Skip to content

Commit

Permalink
support to old quest
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyx14 committed May 31, 2024
1 parent ef54e65 commit ada9762
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions data-otxserver/scripts/actions/other/others/quest_system_old.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
local questSystemOld = Action()

function questSystemOld.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.uid <= 100 or item.uid >= 44613 then
return false
end

local itemType = ItemType(item.uid)
if itemType:getId() == 0 then
return false
end

local itemWeight = itemType:getWeight()
local playerCap = player:getFreeCapacity()
if player:getStorageValue(item.uid) == -1 then
if playerCap >= itemWeight then
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.')
player:addItem(item.uid, 1)
player:setStorageValue(item.uid, 1)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
end
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
end
return true
end

questSystemOld:id(2472, 2478, 2480, 2481, 2482, 4073, 4077, 5674, 5675, 7160, 7161)
questSystemOld:register()

0 comments on commit ada9762

Please sign in to comment.