Pokechill

Pokechill panel

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Pokechill
// @namespace    Pokechill
// @version      2026-02-24
// @description  Pokechill panel
// @author       fiammanda
// @license      MIT
// @match        https://play-pokechill.github.io/
// @match        https://g1tyx.github.io/play-pokechill/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=play-pokechill.github.io
// @grant        unsafeWindow
// ==/UserScript==

(function () {
  'use strict';

  const style = document.createElement('style');
  style.textContent = `
    .tm-panel {
      position: fixed;
      top: 20px;
      right: 20px;
      padding: 4px;
      font-size: 15px;
      color: #fff;
      border-radius: 8px;
      box-sizing: border-box;
      z-index: 9;
    }

    .tm-panel div {
      display: flex;
      align-items: center;
      gap: 8px;
      margin: 8px;
    }

    .tm-panel button,
    .tm-panel select {
      flex: 1;
      padding: 4px;
      min-width: max-content;
      border: none;
      border-radius: 4px;
      font-size: 14px;
      cursor: pointer;
    }

    .tm-panel button {
      background: #4caf50;
      color: #fff;
    }

    .tm-panel button:disabled {
      background: #888;
      cursor: not-allowed;
    }

    .tm-panel select {
      padding: 4px 8px;
      background: #fff;
      color: #000;
    }
    #text-data-raw {
      overflow: auto;
      white-space: wrap;
      word-break: break-all;
    }
  `;
  document.head.appendChild(style);

  let interval = null;

  const tickets = [
    '',
    'epochFeather',
    'ancientOrchid',
    'steelKeystone',
    'aetherKeycard',
    'futureDisk',
    'wisdomPetal'
  ];

  const panel = document.createElement('div');
  panel.className = 'tm-panel';

  const div1 = document.createElement('div');
  div1.innerHTML = `<span>游戏速度</span>`;
  const button1 = document.createElement('button');
  button1.textContent = '加速';
  button1.addEventListener('click', () => {
    saved.overrideBattleTimer = 200;
    button1.disabled = true;
    button1.textContent = '已加速';
  });
  div1.append(button1);

  const div2 = document.createElement('div');
  div2.innerHTML = `<span>自动重开</span>`;
  const button2 = document.createElement('button');
  button2.textContent = '已关闭';
  button2.addEventListener('click', () => {
    if (!interval) {
      interval = setInterval(() => {
        document.getElementById('area-rejoin')?.click();
      }, 30000);
      button2.textContent = '已开启';
    } else {
      clearInterval(interval);
      interval = null;
      button2.textContent = '已关闭';
    }
  });
  div2.append(button2);

  const div3 = document.createElement('div');
  div3.innerHTML = `<span>宝蛋掉落</span>`;
  const button3 = document.createElement('button');
  button3.textContent = '+10';
  button3.addEventListener('click', () => {
    item.mysteryEgg.got += 10;
    item.mysteryEgg.newItem += 10;
  });
  const button4 = document.createElement('button');
  button4.textContent = '+100';
  button4.addEventListener('click', () => {
    item.mysteryEgg.got += 100;
    item.mysteryEgg.newItem += 100;
  });
  div3.append(button3, button4);

  const div4 = document.createElement('div');
  div4.innerHTML = `<span>野区轮换</span>`;
  const select1 = document.createElement('select');
  for (let i = 1; i <= 12; i++) {
    const option = document.createElement('option');
    option.value = i;
    option.textContent = i;
    select1.appendChild(option);
  }
  select1.addEventListener('change', () => {
    rotationWildCurrent = Number(select1.value);
  });
  div4.append(select1);

  const div5 = document.createElement('div');
  div5.innerHTML = `<span>副本轮换</span>`;
  const select2 = document.createElement('select');
  for (let i = 1; i <= 3; i++) {
    const option = document.createElement('option');
    option.value = i;
    option.textContent = i;
    select2.appendChild(option);
  }
  select2.addEventListener('change', () => {
    rotationDungeonCurrent = Number(select2.value);
  });
  div5.append(select2);

  const div6 = document.createElement('div');
  div6.innerHTML = `<span>活动轮换</span>`;
  const select3 = document.createElement('select');
  for (let i = 1; i <= 6; i++) {
    const option = document.createElement('option');
    option.value = i;
    option.textContent = i;
    select3.appendChild(option);
  }
  select3.addEventListener('change', () => {
    rotationEventCurrent = Number(select3.value);
  });
  const button5 = document.createElement('button');
  button5.textContent = '票';
  button5.addEventListener('click', () => {
    item[tickets[select3.value]].got += 100;
  });
  div6.append(select3, button5);

  panel.append(div1, div2, div3, div4, div5, div6);

  const timer = setInterval(() => {
    if (saved) {
      clearInterval(timer);

      if (saved.overrideBattleTimer <= 200) {
        button1.disabled = true;
        button1.textContent = '已加速';
      }
      select1.value = rotationWildCurrent;
      select2.value = rotationDungeonCurrent;
      select3.value = rotationEventCurrent;

      document.body.append(panel);

      document.getElementById("tooltipMid").addEventListener('focusin', (e) => {
        const target = e.target;
        if (target.id === "text-data-raw") {
          target.setSelectionRange(0, target.value.length);
        }
      });
    }
  }, 200);

})();