Skip to content

Commit 1943015

Browse files
authored
fix: spirit of purity mount (#3661)
1 parent acdeb16 commit 1943015

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
local config = {
2+
requiredItems = {
3+
[44048] = { key = "spiritual-horseshoe", count = 4 },
4+
},
5+
mountId = 217,
6+
}
7+
8+
local spiritualHorseshoe = Action()
9+
10+
function spiritualHorseshoe.onUse(player, item, fromPosition, target, toPosition, isHotkey)
11+
local itemInfo = config.requiredItems[item:getId()]
12+
if not itemInfo then
13+
return true
14+
end
15+
16+
if player:hasMount(config.mountId) then
17+
return true
18+
end
19+
20+
local currentCount = (player:kv():get(itemInfo.key) or 0) + 1
21+
player:kv():set(itemInfo.key, currentCount)
22+
player:getPosition():sendMagicEffect(CONST_ME_HOLYDAMAGE)
23+
item:remove(1)
24+
25+
for _, info in pairs(config.requiredItems) do
26+
if (player:kv():get(info.key) or 0) < info.count then
27+
return true
28+
end
29+
end
30+
31+
player:addMount(config.mountId)
32+
player:addAchievement("The Spirit of Purity")
33+
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Spirit of Purity is now yours!")
34+
return true
35+
end
36+
37+
for itemId, _ in pairs(config.requiredItems) do
38+
spiritualHorseshoe:id(itemId)
39+
end
40+
41+
spiritualHorseshoe:register()

0 commit comments

Comments
 (0)