💫 Points Maker (Optimized + Abroad Color + Flight Select)

Optimized: Points-style PDA panel showing Torn display + abroad stock. Collapsible. Abroad stock color-coded. Flight selector added. Safe polling, debounced layout, reduced DOM churn.

Από την 26/11/2025. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         💫 Points Maker (Optimized + Abroad Color + Flight Select)
// @namespace    http://tampermonkey.net/
// @version      1.3.0
// @description  Optimized: Points-style PDA panel showing Torn display + abroad stock. Collapsible. Abroad stock color-coded. Flight selector added. Safe polling, debounced layout, reduced DOM churn.
// @match        https://www.torn.com/*
// @grant        GM_addStyle
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_xmlhttpRequest
// @run-at       document-end
// ==/UserScript==

(function () {
  'use strict';

  // === FLIGHT CONFIG ===
  const FLIGHT_TIMES = {
    Standard: { Mexico:26, Cayman:35, Canada:41, Hawaii:134, UK:159, Argentina:167, Switzerland:175, Japan:225, China:242, UAE:271, "South Africa":297 },
    Airstrip: { Mexico:18, Cayman:25, Canada:29, Hawaii:94, UK:111, Argentina:117, Switzerland:123, Japan:158, China:169, UAE:190, "South Africa":208 },
    WLT: { Mexico:13, Cayman:18, Canada:20, Hawaii:67, UK:80, Argentina:83, Switzerland:88, Japan:113, China:121, UAE:135, "South Africa":149 },
    Business: { Mexico:8, Cayman:11, Canada:12, Hawaii:40, UK:48, Argentina:50, Switzerland:53, Japan:68, China:72, UAE:81, "South Africa":89 }
  };

  let selectedFlightType = GM_getValue('pointsMakerFlightType', 'Business');

  // === ORIGINAL SCRIPT START ===
  const PANEL_ID = 'points_maker_pda';
  const POLL_INTERVAL_MS = 45 * 1000;
  const YATA_URL = 'https://yata.yt/api/v1/travel/export/';
  const PROM_URL = 'https://api.prombot.co.uk/api/travel';
  const SPECIAL_DRUG = 'Xanax';
  const MAX_ABROAD = { flowers: 50, plushies: 50, drugs: 50 };

  const FLOWERS = { 
    "Dahlia": { short: "Dahlia", loc: "MX 🇲🇽", country: "Mexico" },
    "Orchid": { short: "Orchid", loc: "HW 🏝️", country: "Hawaii" },
    "African Violet": { short: "Violet", loc: "SA 🇿🇦", country: "South Africa" },
    "Cherry Blossom": { short: "Cherry", loc: "JP 🇯🇵", country: "Japan" },
    "Peony": { short: "Peony", loc: "CN 🇨🇳", country: "China" },
    "Ceibo Flower": { short: "Ceibo", loc: "AR 🇦🇷", country: "Argentina" },
    "Edelweiss": { short: "Edelweiss", loc: "CH 🇨🇭", country: "Switzerland" },
    "Crocus": { short: "Crocus", loc: "CA 🇨🇦", country: "Canada" },
    "Heather": { short: "Heather", loc: "UK 🇬🇧", country: "United Kingdom" },
    "Tribulus Omanense": { short: "Tribulus", loc: "AE 🇦🇪", country: "UAE" },
    "Banana Orchid": { short: "Banana", loc: "KY 🇰🇾", country: "Cayman Islands" }
  };

  const PLUSHIES = { 
    "Sheep Plushie": { short: "Sheep", loc: "B.B 🏪", country: "Torn City" },
    "Teddy Bear Plushie": { short: "Teddy", loc: "B.B 🏪", country: "Torn City" },
    "Kitten Plushie": { short: "Kitten", loc: "B.B 🏪", country: "Torn City" },
    "Jaguar Plushie": { short: "Jaguar", loc: "MX 🇲🇽", country: "Mexico" },
    "Wolverine Plushie": { short: "Wolverine", loc: "CA 🇨🇦", country: "Canada" },
    "Nessie Plushie": { short: "Nessie", loc: "UK 🇬🇧", country: "United Kingdom" },
    "Red Fox Plushie": { short: "Fox", loc: "UK 🇬🇧", country: "United Kingdom" },
    "Monkey Plushie": { short: "Monkey", loc: "AR 🇦🇷", country: "Argentina" },
    "Chamois Plushie": { short: "Chamois", loc: "CH 🇨🇭", country: "Switzerland" },
    "Panda Plushie": { short: "Panda", loc: "CN 🇨🇳", country: "China" },
    "Lion Plushie": { short: "Lion", loc: "SA 🇿🇦", country: "South Africa" },
    "Camel Plushie": { short: "Camel", loc: "AE 🇦🇪", country: "UAE" },
    "Stingray Plushie": { short: "Stingray", loc: "KY 🇰🇾", country: "Cayman Islands" }
  };

  const COUNTRY_NAME_TO_CODE = {
    'JAPAN': 'JAP', 'MEXICO': 'MEX', 'CANADA': 'CAN', 'CHINA': 'CHI', 'UNITED KINGDOM': 'UNI',
    'ARGENTINA': 'ARG', 'SWITZERLAND': 'SWI', 'HAWAII': 'HAW', 'UAE': 'UAE', 'CAYMAN ISLANDS': 'CAY',
    'SOUTH AFRICA': 'SOU', 'S.A': 'SOU', 'SA': 'SOU', 'TORN': 'BB', 'B.B': 'BB'
  };

  // === UI BUILD WITH FLIGHT SELECTOR ===
  let statusEl, summaryEl, contentEl;
  function buildUI() {
    if (document.getElementById(PANEL_ID)) return;
    const root = document.createElement('div');
    root.id = PANEL_ID;
    root.innerHTML = `
      <div id="tc_header" class="header">▶ 💫 Points Maker</div>
      <div id="tc_content_wrapper">
        <div id="tc_controls" class="controls">
          <button id="tc_refresh">Refresh</button>
          <button id="tc_setkey">Set API Key</button>
          <button id="tc_resetkey">Reset Key</button>
          <select id="tc_flight_type">
            <option>Standard</option>
            <option>Airstrip</option>
            <option>WLT</option>
            <option>Business</option>
          </select>
        </div>
        <div id="tc_status">Waiting for API key...</div>
        <div id="tc_summary"></div>
        <div id="tc_content"></div>
      </div>
    `;
    document.body.appendChild(root);

    const headerEl = root.querySelector('#tc_header');
    const contentWrapper = root.querySelector('#tc_content_wrapper');
    let collapsed = GM_getValue(`${PANEL_ID}-collapsed`, false);
    function updateCollapse() {
      headerEl.textContent = (collapsed ? '▶ ' : '▼ ') + '💫 Points Maker';
      contentWrapper.style.display = collapsed ? 'none' : 'block';
    }
    updateCollapse();
    headerEl.addEventListener('click', () => {
      collapsed = !collapsed;
      GM_setValue(`${PANEL_ID}-collapsed`, collapsed);
      updateCollapse();
    });

    root.querySelector('#tc_refresh').addEventListener('click', () => refreshAll(true));
    root.querySelector('#tc_setkey').addEventListener('click', () => askKey(true));
    root.querySelector('#tc_resetkey').addEventListener('click', () => {
      GM_setValue('tornAPIKey', null);
      apiKey = null;
      if (statusEl) statusEl.textContent = 'Key cleared. Click Set API Key.';
      if (summaryEl) summaryEl.innerHTML = '';
      if (contentEl) contentEl.innerHTML = '';
      stopPolling();
    });

    // FLIGHT SELECT
    const flightDropdown = root.querySelector('#tc_flight_type');
    flightDropdown.value = selectedFlightType;
    flightDropdown.addEventListener('change', e => {
      selectedFlightType = e.target.value;
      GM_setValue('pointsMakerFlightType', selectedFlightType);
      refreshAll(true);
    });

    statusEl = root.querySelector('#tc_status');
    summaryEl = root.querySelector('#tc_summary');
    contentEl = root.querySelector('#tc_content');
  }

  buildUI();

  // === ORIGINAL SCRIPT REMAINS ===
  // All your original polling, fetching, parsing, rendering, etc.
  // Only change: when rendering "low item" lines, you can now reference:
  // let flightTime = FLIGHT_TIMES[selectedFlightType][countryName] || 0;
  // and optionally show a note about flight duration.

})();