From ada97629b41a96e287c86d4f75ddfa6bce7a0dc8 Mon Sep 17 00:00:00 2001 From: Matt Gomez Date: Thu, 30 May 2024 20:00:27 -0600 Subject: [PATCH] support to old quest --- .../actions/other/others/quest_system_old.lua | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 data-otxserver/scripts/actions/other/others/quest_system_old.lua diff --git a/data-otxserver/scripts/actions/other/others/quest_system_old.lua b/data-otxserver/scripts/actions/other/others/quest_system_old.lua new file mode 100644 index 000000000..7c9502fe8 --- /dev/null +++ b/data-otxserver/scripts/actions/other/others/quest_system_old.lua @@ -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()