Untitled

 avatar
unknown
plain_text
a month ago
1.7 kB
6
Indexable
local eq_manager = {
    {   hppcToEquip = 100, -- HP <= 100% (Default)
        eqToEquip = {
            {itemID = 9802, slot = SlotNeck}
        }
    },
    {   hppcToEquip = tonumber(storage.hppercent) or 75, -- HP <= 75%
        eqToEquip = {
            {itemID = 3081, slot = SlotNeck}
        }
    }
}

table.sort(eq_manager, function(a, b) return b.hppcToEquip > a.hppcToEquip end)

addIcon("Zmiana Amuletu", {item=9802, switchable=true, text="Amulet"},
    macro(500, function()
        for k, v in pairs(eq_manager) do
            if manapercent() <= v.hppcToEquip then
                for i = 1, #v.eqToEquip do
                    moveToSlot(v.eqToEquip[i].itemID, v.eqToEquip[i].slot)
                end
                break
            end
        end
    end)
)

local originalRing = 7924
local ringID = 3048
addIcon("Equip Ring", {item=7924, switchable=true, text="Ring"},
    macro(10, function()
        local currentMana = manapercent()
        local currentRing = getFinger()
        
        if currentMana <= 70 then
            if not currentRing or currentRing:getId() ~= ringID then
                local item = findItem(ringID)
                if item then
                    g_game.move(item, {x=65535, y=SlotFinger, z=0}, 1)
                end
            end
        elseif currentMana >= 90 then
            if not currentRing or currentRing:getId() ~= originalRing then
                local item = findItem(originalRing)
                if item then
                    g_game.move(item, {x=65535, y=SlotFinger, z=0}, 1)
                end
            end
        end
    end)
)
Editor is loading...
Leave a Comment