Skip to content

Commit

Permalink
feat: kv: quests
Browse files Browse the repository at this point in the history
  • Loading branch information
majestyotbr committed Jan 14, 2024
1 parent ea4c6e8 commit 85cffa5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
20 changes: 20 additions & 0 deletions data-otservbr-global/scripts/actions/rookgaard/rapier_quest.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
local rapierQuest = Action()
local reward = 3272
function rapierQuest.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local itemType = ItemType(reward)
local itemWeight = itemType:getWeight()
if player:getFreeCapacity() >= itemType:getWeight() then
if not player:questKV("rapier"):get("completed") then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a rapier.")
player:addItem(reward, 1)
player:questKV("rapier"):set("completed", true)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The box is empty.")
end
else
player:sendTextMessage(MESSAGE_LOOK, "You have found a " .. itemType:getName() .. " weighing " .. (itemWeight/ 100) .. " oz, but it's too heavy.")
end
return true
end
rapierQuest:uid(14042)
rapierQuest:register()
4 changes: 4 additions & 0 deletions data-otservbr-global/startup/tables/chest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1186,4 +1186,8 @@ ChestUnique = {
itemId = 11810,
itemPos = { x = 33195, y = 31765, z = 1 },
},
[14042] = {
itemId = 2473,
itemPos = { x = 32099, y = 32198, z = 9 },
},
}
4 changes: 4 additions & 0 deletions data/libs/functions/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -748,3 +748,7 @@ function Player:canFightBoss(bossNameOrId)
local cooldown = self:getBossCooldown(bossNameOrId)
return cooldown <= os.time()
end

function Player:questKV(questName)
return self:kv():scoped("quests"):scoped(questName)
end

0 comments on commit 85cffa5

Please sign in to comment.