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

chore: vortex tamer achievement logic #4832

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion data/lib/core/storages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ PlayerStorageKeys = {
nailCaseUseCount = 30031,
swampDigging = 30032,
insectoidCell = 30033,
vortexTamer = 30034,
-- empty: 30034
mutatedPumpkin = 30035,

-- Achievements:
Expand Down
29 changes: 16 additions & 13 deletions data/scripts/actions/others/usable_mount_items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@ local config = {
[26194] = { -- vibrant egg
name = "vortexion",
mountId = 94,
tameMessage = "You receive the permission to ride a sparkion."
tameMessage = "You receive the permission to ride a sparkion.",
achievementProgress = { name = "Vortex Tamer", progress = 3 }
},
[26340] = { -- crackling egg
name = "neon sparkid",
mountId = 98,
tameMessage = "You receive the permission to ride a neon sparkid."
tameMessage = "You receive the permission to ride a neon sparkid.",
achievementProgress = { name = "Vortex Tamer", progress = 3 }
},
[26341] = { -- menacing egg
name = "vortexion",
mountId = 99,
tameMessage = "You receive the permission to ride a vortexion."
tameMessage = "You receive the permission to ride a vortexion.",
achievementProgress = { name = "Vortex Tamer", progress = 3 }
},
[25521] = { -- mysterious scroll
name = "rift runner",
Expand All @@ -31,22 +34,22 @@ local config = {
local usableItemMounts = Action()

function usableItemMounts.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local useItem = config[item.itemid]
if not useItem then
return true
end

if not player:isPremium() then
player:sendCancelMessage(RETURNVALUE_YOUNEEDPREMIUMACCOUNT)
return true
end

local useItem = config[item.itemid]
if player:hasMount(useItem.mountId) then
return false
return true
end

if table.contains({26194, 26340, 26341}, item.itemid) then
local storage = player:getStorageValue(PlayerStorageKeys.vortexTamer)
player:setStorageValue(PlayerStorageKeys.vortexTamer, storage + 1)
if storage == 1 then
player:addAchievement("Vortex Tamer")
end
if useItem.achievementProgress then
player:addAchievementProgress(useItem.achievementProgress.name, useItem.achievementProgress.progress)
end

if useItem.achievement then
Expand All @@ -60,8 +63,8 @@ function usableItemMounts.onUse(player, item, fromPosition, target, toPosition,
return true
end

for k, v in pairs(config) do
usableItemMounts:id(k)
for itemId in pairs(config) do
usableItemMounts:id(itemId)
end

usableItemMounts:register()
Loading