Advertisement
Czogista

Wpłacanie złota do klanu NI SI

Oct 16th, 2021
1,520
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Wpłacanie złota do klanu
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  Dodatek automatycznie wpłaca złoto do klanu postaci NI SI
  6. // @author       Czogi
  7. // @match        https://*.margonem.pl/
  8. // @icon         https://www.google.com/s2/favicons?domain=margonem.pl
  9. // @grant        none
  10. // ==/UserScript==
  11.  
  12. "use strict";
  13. {
  14.   const config = {
  15.     doNotSend: 5_000_000 /* Tyle ma zostawić */,
  16.     minAmount: 1_000_000 /* Minimum wysyłaj tyle złota */
  17.   };
  18.   (async (sleep) => {
  19.     if (typeof unsafeWindow !== "undefined") {
  20.       window = unsafeWindow;
  21.     }
  22.     const isSi = window.getCookie("interface") === "si";
  23.     do {
  24.       await sleep(1e3);
  25.     } while (
  26.       !Object.keys(isSi ? window?.hero || {} : window?.Engine?.hero || {})
  27.         .length
  28.     );
  29.     {
  30.     }
  31.  
  32.     if (isSi ? !("clan" in window.hero) : !("clan" in window.Engine.hero.d)) {
  33.       return;
  34.     }
  35.  
  36.     while (true) {
  37.       await sleep(1e3);
  38.       const currGold = isSi ? window.hero.gold : window.Engine.hero.d.gold;
  39.       const toSend = currGold - config.doNotSend;
  40.  
  41.       if (toSend < config.minAmount) {
  42.         continue;
  43.       }
  44.       window._g(`clan&a=save&f=gold&v=${toSend}`);
  45.     }
  46.   })((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
  47. }
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement