Lootfilter

...

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Lootfilter
// @version      1.0
// @author       Bancewald, edit: Arh
// @match        *.margonem.pl/
// @grant        none
// @description  ...
// @namespace https://greasyfork.org/users/935016
// ==/UserScript==

function run(){
    if(!Engine){
        setTimeout(run, 100);
        return;
    }
    const timer = ms => new Promise(res => setTimeout(res, ms))
    async function newItemLooted(item){
        if(!Engine.loots){
            return;
        }
        var itemId = item.id
        var logicResult = USERLOGIC(item)
        if(logicResult == 'want'){
            Engine.loots.itemsDecision[itemId] = Engine.party ? "must" : "want"
        }
        else if(logicResult == 'not'){
            Engine.loots.itemsDecision[itemId] = "not"
        }
        else{
            Engine.loots.itemsDecision[itemId] = Engine.party ? "must" : "want"
        }
        const iloscItemkow = Object.entries(Engine.loots.statesOfLoot).length

        for (let i = 0; i < iloscItemkow; i++) {
            Engine.loots.setLootItems()
        }
        if(!Engine.party && !MaddonzAPI.Item.isLegendary(item)){
            await timer(100)
            // TUTAJ ODKOMENTOWAĆ JAK PRZETESTUJESZ, ŻE NA PEWNO DOBRZE CI DZIAŁA :)
            //Engine.loots.acceptLoot()
        }
    }

    Engine.items.fetch(Engine.itemsFetchData.FETCH_NEW_LOOT, newItemLooted)

}
run()


function USERLOGIC(item){
    if(item._cachedStats.hasOwnProperty("teleport") || item._cachedStats.hasOwnProperty("runes") || item._cachedStats.hasOwnProperty("fullheal") || item._cachedStats.hasOwnProperty("canpreview") || item.name == "Serce pajęczego ołtarza" || item.name == "Pazur młodego smoka" || item.name == "Tytoń" || item.name == "Kolec pajęczej matki" || MaddonzAPI.Item.isStone(item) || item.name == "Głowa zbira") return 'want'
    else if(item.cl===16 || item.cl===21 || item.cl===22 || (item.cl===15 && item.parseStats().opis != 'Jeden ze składników legendarnej zbroi wykuwanej przez krasnoludy.') || (item.cl == 26 && (item._cachedStats.target_rarity == "common" || item._cachedStats.target_rarity == "unique"))) return 'not'
    else return null
}