Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name spierdalacpotiony
- // @version 1.3.1
- // @author dolphin
- // @match http://*.margonem.pl/
- // ==/UserScript==
- const sklepNode = document.getElementById('shop');
- const configPotki = { attributeFilter: ['style'] };
- let potkiSold = false;
- const tuniaChecker = () => {
- if (!(map.name == 'Dom Tunii')) {
- potkiSold = false;
- }
- }
- const tylonite = () => {
- if (sklepNode.style.cssText.includes("block") && !potkiSold) {
- const toSell = [];
- const zostawPls = [];
- const potkiJebane = [
- "Język maddoka",
- "Źródlana woda Maddoków",
- "Odtrutka maddoków"
- ];
- const zostawJedno = [
- "Latająca miotła"
- ];
- for (const [itemId, {name, own}] of Object.entries(g.item)) {
- for (const pot of potkiJebane) {
- if (name.includes(pot)) {
- if (hero.id == own) {
- toSell.push(itemId);
- break;
- }
- }
- }
- for (const zostaw of zostawJedno) {
- if (name.includes(zostaw)) {
- if (zostawPls.some(item => item[0] == name)) {
- toSell.push(itemId);
- break;
- }
- else {
- zostawPls.push([name, itemId]);
- break;
- }
- }
- }
- }
- while (toSell.length > 0) {
- _g(`shop&sell=${toSell.splice(0, Math.min(20, toSell.length)).toString()}`);
- }
- potkiSold = true;
- };
- };
- const observer = new MutationObserver(tylonite);
- observer.observe(sklepNode, configPotki);
- setInterval(tuniaChecker, 10000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement