diff --git a/data-otservbr-global/scripts/actions/rookgaard/rapier_quest.lua b/data-otservbr-global/scripts/actions/rookgaard/rapier_quest.lua index a60563ec1a5..726279dd274 100644 --- a/data-otservbr-global/scripts/actions/rookgaard/rapier_quest.lua +++ b/data-otservbr-global/scripts/actions/rookgaard/rapier_quest.lua @@ -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()