landsandboat/scripts/items/chaosbringer.lua
sruon 64eff5815a Call onItemDrop when passing through the recycle bin
Co-Authored-By: atom0s <atom0s@users.noreply.github.com>
2026-04-12 02:57:17 -06:00

32 lines
1 KiB
Lua

-----------------------------------
-- ID: 16607
-- Chaosbringer
-----------------------------------
---@type TItem
local itemObject = {}
itemObject.onItemDrop = function(target, item, recycleBin)
if not recycleBin then
target:setCharVar('ChaosbringerKills', 0)
end
end
itemObject.onItemEquip = function(target, item)
target:addListener('DEFEATED_MOB', 'CHAOSBRINGER_KILLS', function(mob, player, optParams)
if
(player:getQuestStatus(xi.questLog.BASTOK, xi.quest.id.bastok.BLADE_OF_DARKNESS) == xi.questStatus.QUEST_ACCEPTED or
player:getQuestStatus(xi.questLog.BASTOK, xi.quest.id.bastok.BLADE_OF_DEATH) == xi.questStatus.QUEST_ACCEPTED) and
target:getCharVar('ChaosbringerKills') < 200 and
optParams.isKiller and
not optParams.isWeaponSkillKill
then
player:incrementCharVar('ChaosbringerKills', 1)
end
end)
end
itemObject.onItemUnequip = function(target, item)
target:removeListener('CHAOSBRINGER_KILLS')
end
return itemObject