Skip to content

Commit

Permalink
Update rapier_quest.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
majestyotbr committed Jan 14, 2024
1 parent fd3d45e commit 6a55c26
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions data-otservbr-global/scripts/actions/rookgaard/rapier_quest.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
local rapierQuest = Action()

local reward = 3272
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.")
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_EVENT_ADVANCE, "You have found a rapier.")
player:addItem(3272, 1)
player:questKV("rapier"):set("completed", true)
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()

0 comments on commit 6a55c26

Please sign in to comment.