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 11, 2024
1 parent ea4c6e8 commit 4f03598
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 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,15 @@
local rapierQuest = Action()

function rapierQuest.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:questKV('rapier'):get('completed') then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The box is empty.")
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a rapier.")
player:addItem(3272, 1)
player:kv():scoped('quests'):scoped('rapier'):set('completed', true)
end
return true
end

rapierQuest:position{x = 32099, y = 32198, z = 9}
rapierQuest:register()
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 4f03598

Please sign in to comment.