Lootfilter

...

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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
}