Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve: anniversary reward boxes to core #2356

Merged
merged 1 commit into from
Mar 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,24 @@ local config = {
}

local rewardBox = Action()

function rewardBox.onUse(player, item, fromPosition, itemEx, toPosition)
local box = config[item:getId()]
if not box or not player then
if not box then
return false
end
for i = 1, #box do
if box[i] then
player:addItem(box[i].id, box[i].count)
player:getPosition():sendMagicEffect(CONST_ME_PRISMATIC_SPARK)
end

for _, reward in ipairs(box) do
player:addItem(reward.id, reward.count)
player:getPosition():sendMagicEffect(CONST_ME_PRISMATIC_SPARK)
end

item:remove()
return true
end

for index, value in pairs(config) do
for index, _ in pairs(config) do
rewardBox:id(index)
end

rewardBox:register()
Loading