Advertisement
Czogista

clanBless SI

Feb 3rd, 2022
1,911
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         clanBless SI
  3. // @namespace    https://czogi.usermd.net
  4. // @version      0.1
  5. // @description  Applies clan blessing if there is no blessing affecting hero
  6. // @author       Czogi
  7. // @include      /https://[a-z]{4,15}.margonem.pl/
  8. // @run-at       document-itle
  9. // @noframes
  10. // @icon         https://czogi.usermd.net/cBot/icon.png
  11. // @grant        unsafeWindow
  12. // ==/UserScript==
  13. "use strict";
  14. {
  15.   const blessingName = "Czarcie spojrzenie";
  16.   //Nazwa błogosławieństwa
  17.   const blessings = {
  18.     "upiorne wzmocnienie": 1,
  19.     "krwawe widmo": 2,
  20.     "czarcie spojrzenie": 3,
  21.     "krwawa aura": 4,
  22.     "demoniczne zniszczenie": 5,
  23.     "moc z zaświatów": 6,
  24.     "śmiertelne westchnienie": 7
  25.   };
  26.   let blockApplyingBless = false;
  27.   if (typeof unsafeWindow !== "undefined") {
  28.     window = unsafeWindow;
  29.   }
  30.   ((oldPi) => {
  31.     const main = (data) => {
  32.       if (window.g.init < 5) {
  33.         return;
  34.       }
  35.       if (typeof window.hero?.clan !== "object") {
  36.         return;
  37.       }
  38.       if (window.hero.is_blessed !== 0) {
  39.         return;
  40.       }
  41.       if (
  42.         data.hasOwnProperty("alert") &&
  43.         data.alert.includes("Kolejne błogosławieństwo będzie można użyć") &&
  44.         !blockApplyingBless
  45.       ) {
  46.         blockApplyingBless = setTimeout(() => {
  47.           blockApplyingBless = false;
  48.         }, 60e3);
  49.         delete data.alert;
  50.       }
  51.       if (blockApplyingBless) {
  52.         return;
  53.       }
  54.       window._g(
  55.         `clan&a=skills_use&name=blessing&opt=${
  56.           blessings[blessingName.toLowerCase()]
  57.         }&ans=1`
  58.       );
  59.     };
  60.     window.parseInput = function (data) {
  61.       main(data);
  62.       oldPi(...arguments);
  63.     };
  64.   })(window.parseInput);
  65. }
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement