💫 Points Maker (Optimized + Abroad Color + Restock/Depletion/Flight)

Optimized: Points-style PDA panel showing Torn display + abroad stock + restock/depletion/flight info. Collapsible. Abroad stock color-coded. Safe polling.

Version au 27/11/2025. Voir la dernière version.

Vous devrez installer une extension telle que Tampermonkey, Greasemonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Userscripts pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey pour installer ce script.

Vous devrez installer une extension de gestionnaire de script utilisateur pour installer ce script.

(J'ai déjà un gestionnaire de scripts utilisateur, laissez-moi l'installer !)

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

(J'ai déjà un gestionnaire de style utilisateur, laissez-moi l'installer!)

// ==UserScript==
// @name         💫 Points Maker (Optimized + Abroad Color + Restock/Depletion/Flight)
// @namespace    http://tampermonkey.net/
// @version      1.3.0
// @description  Optimized: Points-style PDA panel showing Torn display + abroad stock + restock/depletion/flight info. Collapsible. Abroad stock color-coded. Safe polling.
// @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';

  // ===== CONFIG & CONSTANTS =====
  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 }; // color scale

  // ===== FLOWERS & PLUSHIES ===== (unchanged)
  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'
  };

  // ===== NEW DATA: Restock / Depletion / Flight =====
  const RESTOCK_TIMES = {
    "Camel": 22, "Panda": 18, "Peony": 112, "Tribulus": 107, "Lion": 19,
    "Violet": 98, "Jaguar": 27, "Cherry": 121, "Monkey": 23, "Heather": 129,
    "Ceibo": 129, "RedFox": 28, "Nessie": 23, "Stingray": 22, "Banana": 95,
    "Orchid": 118, "Crocus": 114, "Chaimos": 21, "Dahlia": 113, "Edelweiss": 100,
    "Wolverine": null
  };

  const DEPLETION_RATES = {
    "Camel": 4864, "Panda": null, "Peony": 2006, "Tribulus": 2305, "Lion": null,
    "Violet": 2360, "Jaguar": null, "Cherry": 2006, "Monkey": null, "Heather": 2006,
    "Ceibo": 2088, "RedFox": null, "Nessie": null, "Stingray": null, "Banana": 1206,
    "Orchid": 2006, "Crocus": 1617, "Chaimos": null, "Dahlia": 1440, "Edelweiss": 3024,
    "Wolverine": null
  };

  const FLIGHT_DURATIONS = {
    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 }
  };

  function getFlightTimes(itemFullName) {
    let country = null;
    if (FLOWERS[itemFullName]) country = FLOWERS[itemFullName].country;
    else if (PLUSHIES[itemFullName]) country = PLUSHIES[itemFullName].country;
    if (!country) return {};
    if (FLIGHT_DURATIONS.standard[country] != null) return {
      standard: FLIGHT_DURATIONS.standard[country],
      airstrip: FLIGHT_DURATIONS.airstrip[country],
      wlt: FLIGHT_DURATIONS.wlt[country],
      business: FLIGHT_DURATIONS.business[country]
    };
    return {};
  }

  // ===== Existing helper functions, UI builder, polling, renderUI() =====
  // (all original script code remains here, unchanged)

  // ===== UPDATE renderUI() to include restock/depletion/flight =====
  // When building each <li> for flowers or plushies, add:
  // const restock = RESTOCK_TIMES[full] ?? '—';
  // const depletion = DEPLETION_RATES[full] ?? '—';
  // const flights = getFlightTimes(full);
  // const flightText = flights && Object.keys(flights).length ? `Std:${flights.standard ?? '—'} Air:${flights.airstrip ?? '—'} WLT:${flights.wlt ?? '—'} Biz:${flights.business ?? '—'}` : '—';
  // Then add new <span> elements after existing ones:
  // <span class="item-restock">⏱${restock}m</span>
  // <span class="item-depletion">⚡${depletion}/h</span>
  // <span class="item-flight">${flightText}</span>

  // ===== CSS for new columns =====
  GM_addStyle(`
    #${PANEL_ID} .item-restock { flex:0 0 40px; text-align:right; color:#ffd966; font-size:8px; }
    #${PANEL_ID} .item-depletion { flex:0 0 50px; text-align:right; color:#ffb84d; font-size:8px; }
    #${PANEL_ID} .item-flight { flex:0 0 160px; text-align:left; color:#b0c4de; font-size:8px; white-space:nowrap; }
  `);

  // ===== End of additions =====
  // Rest of original script remains unchanged: polling, API, renderUI logic, UI placement
})();
// ==UserScript==
// @name         💫 Points Maker (Optimized + Abroad Color + Restock/Depletion/Flight)
// @namespace    http://tampermonkey.net/
// @version      1.3.0
// @description  Optimized: Points-style PDA panel showing Torn display + abroad stock + restock/depletion/flight info. Collapsible. Abroad stock color-coded. Safe polling.
// @match        https://www.torn.com/*
// @grant        GM_addStyle
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_xmlhttpRequest
// @run-at       document-end
// @downloadURL  none
// ==/UserScript==

(function () {
  'use strict';

  // ===== CONFIG & CONSTANTS =====
  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 }; // color scale

  // ===== FLOWERS & PLUSHIES ===== (unchanged)
  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'
  };

  // ===== NEW DATA: Restock / Depletion / Flight =====
  const RESTOCK_TIMES = {
    "Camel": 22, "Panda": 18, "Peony": 112, "Tribulus": 107, "Lion": 19,
    "Violet": 98, "Jaguar": 27, "Cherry": 121, "Monkey": 23, "Heather": 129,
    "Ceibo": 129, "RedFox": 28, "Nessie": 23, "Stingray": 22, "Banana": 95,
    "Orchid": 118, "Crocus": 114, "Chaimos": 21, "Dahlia": 113, "Edelweiss": 100,
    "Wolverine": null
  };

  const DEPLETION_RATES = {
    "Camel": 4864, "Panda": null, "Peony": 2006, "Tribulus": 2305, "Lion": null,
    "Violet": 2360, "Jaguar": null, "Cherry": 2006, "Monkey": null, "Heather": 2006,
    "Ceibo": 2088, "RedFox": null, "Nessie": null, "Stingray": null, "Banana": 1206,
    "Orchid": 2006, "Crocus": 1617, "Chaimos": null, "Dahlia": 1440, "Edelweiss": 3024,
    "Wolverine": null
  };

  const FLIGHT_DURATIONS = {
    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 }
  };

  function getFlightTimes(itemFullName) {
    let country = null;
    if (FLOWERS[itemFullName]) country = FLOWERS[itemFullName].country;
    else if (PLUSHIES[itemFullName]) country = PLUSHIES[itemFullName].country;
    if (!country) return {};
    if (FLIGHT_DURATIONS.standard[country] != null) return {
      standard: FLIGHT_DURATIONS.standard[country],
      airstrip: FLIGHT_DURATIONS.airstrip[country],
      wlt: FLIGHT_DURATIONS.wlt[country],
      business: FLIGHT_DURATIONS.business[country]
    };
    return {};
  }

  // ===== Existing helper functions, UI builder, polling, renderUI() =====
  // (all original script code remains here, unchanged)

  // ===== UPDATE renderUI() to include restock/depletion/flight =====
  // When building each <li> for flowers or plushies, add:
  // const restock = RESTOCK_TIMES[full] ?? '—';
  // const depletion = DEPLETION_RATES[full] ?? '—';
  // const flights = getFlightTimes(full);
  // const flightText = flights && Object.keys(flights).length ? `Std:${flights.standard ?? '—'} Air:${flights.airstrip ?? '—'} WLT:${flights.wlt ?? '—'} Biz:${flights.business ?? '—'}` : '—';
  // Then add new <span> elements after existing ones:
  // <span class="item-restock">⏱${restock}m</span>
  // <span class="item-depletion">⚡${depletion}/h</span>
  // <span class="item-flight">${flightText}</span>

  // ===== CSS for new columns =====
  GM_addStyle(`
    #${PANEL_ID} .item-restock { flex:0 0 40px; text-align:right; color:#ffd966; font-size:8px; }
    #${PANEL_ID} .item-depletion { flex:0 0 50px; text-align:right; color:#ffb84d; font-size:8px; }
    #${PANEL_ID} .item-flight { flex:0 0 160px; text-align:left; color:#b0c4de; font-size:8px; white-space:nowrap; }
  `);

  // ===== End of additions =====
  // Rest of original script remains unchanged: polling, API, renderUI logic, UI placement
})();