diff --git a/data-otservbr-global/lib/core/constants.lua b/data-otservbr-global/lib/core/constants.lua index e5cf70cc55f..e69de29bb2d 100644 --- a/data-otservbr-global/lib/core/constants.lua +++ b/data-otservbr-global/lib/core/constants.lua @@ -1,4 +0,0 @@ -ROSHAMUUL_MORTAR_THROWN = 20200 -ROSHAMUUL_KILLED_FRAZZLEMAWS = 20201 -ROSHAMUUL_KILLED_SILENCERS = 20202 -ROSHAMUUL_GOLD_RECORD = 20203 diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index c64ba48991f..d61839e9a20 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -2429,7 +2429,14 @@ Storage = { }, U10_30 = { -- update 10.30 - Reserved Storages 44401 - 44500 DreamWardenOutfits = {}, - Roshamuul = {}, + RoshamuulQuest = { + Constants = { + Roshamuul_Mortar_Thrown = 44401, + Roshamuul_Killed_Frazzlemaws = 44402, + Roshamuul_Killed_Silencers = 44403, + Roshamuul_Gold_Record = 44404, + }, + }, }, U10_37 = { -- update 10.37 - Reserved Storages 44501 - 44550 TinderBox = {}, diff --git a/data-otservbr-global/npc/sandomo.lua b/data-otservbr-global/npc/sandomo.lua index 75d1015233b..0fa8876c5da 100644 --- a/data-otservbr-global/npc/sandomo.lua +++ b/data-otservbr-global/npc/sandomo.lua @@ -52,9 +52,9 @@ end function Player.getInquisitionGold(self) local v = { - math.max(0, self:getStorageValue(ROSHAMUUL_MORTAR_THROWN)) * 100, - math.max(0, self:getStorageValue(ROSHAMUUL_KILLED_FRAZZLEMAWS)), - math.max(0, self:getStorageValue(ROSHAMUUL_KILLED_SILENCERS)), + math.max(0, self:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Mortar_Thrown)) * 100, + math.max(0, self:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Killed_Frazzlemaws)), + math.max(0, self:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Killed_Silencers)), } return v[1] + v[2] + v[3] end @@ -102,9 +102,9 @@ local function creatureSayCallback(npc, creature, type, message) if player:getInquisitionGold() > 0 then npcHandler:setTopic(playerId, 4) npcHandler:say({ - "Alright, so you mixed and delivered " .. math.max(0, player:getStorageValue(ROSHAMUUL_MORTAR_THROWN)) .. " mortar and ...", - "You killed " .. math.max(0, player:getStorageValue(ROSHAMUUL_KILLED_FRAZZLEMAWS)) .. " frazzlemaws and ...", - "You also hunted " .. math.max(0, player:getStorageValue(ROSHAMUUL_KILLED_SILENCERS)) .. " silencers. That would equal " .. player:getInquisitionGold() .. " of inquisition gold - BUT we are currently short of this valuable metal so... do you want me to add this amount to my {books} for now or {trade} it for something else.", + "Alright, so you mixed and delivered " .. math.max(0, player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Mortar_Thrown)) .. " mortar and ...", + "You killed " .. math.max(0, player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Killed_Frazzlemaws)) .. " frazzlemaws and ...", + "You also hunted " .. math.max(0, player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Killed_Silencers)) .. " silencers. That would equal " .. player:getInquisitionGold() .. " of inquisition gold - BUT we are currently short of this valuable metal so... do you want me to add this amount to my {books} for now or {trade} it for something else.", }, npc, creature) else npcHandler:setTopic(playerId, nil) @@ -112,7 +112,7 @@ local function creatureSayCallback(npc, creature, type, message) end end elseif npcHandler:getTopic(playerId) == 4 then - local v = math.max(0, player:getStorageValue(ROSHAMUUL_GOLD_RECORD)) + local v = math.max(0, player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Gold_Record)) if MsgContains(message, "book") or MsgContains(message, "books") then npcHandler:setTopic(playerId, 5) npcHandler:say({ @@ -126,21 +126,21 @@ local function creatureSayCallback(npc, creature, type, message) "Good. Registered as... " .. player:getName() .. "... with... about " .. player:getInquisitionGold() .. " of righteously earned inquisition gold added. There. Thanks for your help! ..", "Good. Ask me any time in case you want to know your current {record}. If you have time, Remember you can also {trade} your earnings into some of these... probably far more valuable, ahem... cluster... things, yes.", }, npc, creature) - player:setStorageValue(ROSHAMUUL_GOLD_RECORD, player:getInquisitionGold()) - player:setStorageValue(ROSHAMUUL_MORTAR_THROWN, 0) - player:setStorageValue(ROSHAMUUL_KILLED_FRAZZLEMAWS, 0) - player:setStorageValue(ROSHAMUUL_KILLED_SILENCERS, 0) + player:setStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Gold_Record, player:getInquisitionGold()) + player:setStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Mortar_Thrown, 0) + player:setStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Killed_Frazzlemaws, 0) + player:setStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Killed_Silencers, 0) npcHandler:setTopic(playerId, nil) end elseif MsgContains(message, "record") then - local v = player:getStorageValue(ROSHAMUUL_GOLD_RECORD) + local v = player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Gold_Record) if v > 0 then npcHandler:say("You have " .. v .. " inquisition gold registered in my book.", npc, creature) else npcHandler:say("I do not see inquisition gold registered in my book from you.", npc, creature) end elseif MsgContains(message, "trade") then - local v = player:getStorageValue(ROSHAMUUL_GOLD_RECORD) + local v = player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Gold_Record) if v >= 100 then npcHandler:setTopic(playerId, 6) npcHandler:say("Ah yes, you currently have " .. v .. " of righteously earned inquisition gold in my book. 100 inquisition gold equals one cluster. How many clusters do you want in exchange?", npc, creature) @@ -154,15 +154,15 @@ local function creatureSayCallback(npc, creature, type, message) return npcHandler:say("You should tell me a real number.", npc, creature) end - local max = math.floor(player:getStorageValue(ROSHAMUUL_GOLD_RECORD) / 100) + local max = math.floor(player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Gold_Record) / 100) if v > max then return npcHandler:say("You do not have enough inquisition gold for that, so far you can ask for up to " .. max .. " clusters.", npc, creature) end player:addItem(20062, v) npcHandler:setTopic(playerId, nil) - player:setStorageValue(ROSHAMUUL_GOLD_RECORD, player:getStorageValue(ROSHAMUUL_GOLD_RECORD) - (v * 100)) - npcHandler:say("There you are. Now I register " .. player:getStorageValue(ROSHAMUUL_GOLD_RECORD) .. " inquisition gold of yours in my book.", npc, creature) + player:setStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Gold_Record, player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Gold_Record) - (v * 100)) + npcHandler:say("There you are. Now I register " .. player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Gold_Record) .. " inquisition gold of yours in my book.", npc, creature) end if MsgContains(message, "bucket") or MsgContains(message, "supplies") then diff --git a/data-otservbr-global/scripts/lib/register_actions.lua b/data-otservbr-global/scripts/lib/register_actions.lua index 7ea2e0ddd4c..a908823f55e 100644 --- a/data-otservbr-global/scripts/lib/register_actions.lua +++ b/data-otservbr-global/scripts/lib/register_actions.lua @@ -773,23 +773,21 @@ function onUsePick(player, item, fromPosition, target, toPosition, isHotkey) addEvent(revertItem, 2 * 60 * 1000, { x = 33277, y = 31754, z = 7 }, 2066, 2071) end end - else - return false - end - if (target ~= nil) and target:isItem() and (target:getId() == 20135) then - --Lower Roshamuul - if math.random(100) > 50 then + elseif target.itemid == 20135 then + local chance = math.random(100) + if chance > 50 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Crushing the stone produces some fine gravel.") target:transform(20133) - target:decay() else Game.createMonster("Frazzlemaw", toPosition) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Crushing the stone yields nothing but slightly finer, yet still unusable rubber.") target:transform(20134) - target:decay() end - return true + target:decay() + else + return false end + return true end diff --git a/data-otservbr-global/scripts/movements/teleport/lower_roshamuul.lua b/data-otservbr-global/scripts/movements/teleport/lower_roshamuul.lua deleted file mode 100644 index 7d4535efbf1..00000000000 --- a/data-otservbr-global/scripts/movements/teleport/lower_roshamuul.lua +++ /dev/null @@ -1,28 +0,0 @@ -local roshamuulCaves = { - Position(33560, 32523, 8), - Position(33554, 32543, 8), - Position(33573, 32545, 8), - Position(33543, 32560, 8), - Position(33579, 32565, 8), - Position(33527, 32597, 8), -} - -local lowerRoshamuul = MoveEvent() - -function lowerRoshamuul.onStepIn(creature, item, position, fromPosition) - if not creature:isPlayer() then - return false - end - - if item:getId() == 20122 then - creature:teleportTo(Position(33551, 32556, 7)) - else - creature:teleportTo(roshamuulCaves[math.random(#roshamuulCaves)]) - end - return true -end - -lowerRoshamuul:type("stepin") -lowerRoshamuul:id(20122) -lowerRoshamuul:aid(1500) -lowerRoshamuul:register() diff --git a/data-otservbr-global/scripts/quests/lower_roshamuul/actions_bone.lua b/data-otservbr-global/scripts/quests/roshamuul_quest/actions_bone.lua similarity index 100% rename from data-otservbr-global/scripts/quests/lower_roshamuul/actions_bone.lua rename to data-otservbr-global/scripts/quests/roshamuul_quest/actions_bone.lua diff --git a/data-otservbr-global/scripts/quests/lower_roshamuul/actions_chalk.lua b/data-otservbr-global/scripts/quests/roshamuul_quest/actions_chalk.lua similarity index 100% rename from data-otservbr-global/scripts/quests/lower_roshamuul/actions_chalk.lua rename to data-otservbr-global/scripts/quests/roshamuul_quest/actions_chalk.lua diff --git a/data-otservbr-global/scripts/quests/lower_roshamuul/actions_gravel.lua b/data-otservbr-global/scripts/quests/roshamuul_quest/actions_gravel.lua similarity index 100% rename from data-otservbr-global/scripts/quests/lower_roshamuul/actions_gravel.lua rename to data-otservbr-global/scripts/quests/roshamuul_quest/actions_gravel.lua diff --git a/data-otservbr-global/scripts/quests/lower_roshamuul/actions_mixture.lua b/data-otservbr-global/scripts/quests/roshamuul_quest/actions_mixture.lua similarity index 100% rename from data-otservbr-global/scripts/quests/lower_roshamuul/actions_mixture.lua rename to data-otservbr-global/scripts/quests/roshamuul_quest/actions_mixture.lua diff --git a/data-otservbr-global/scripts/quests/lower_roshamuul/actions_mortar.lua b/data-otservbr-global/scripts/quests/roshamuul_quest/actions_mortar.lua similarity index 100% rename from data-otservbr-global/scripts/quests/lower_roshamuul/actions_mortar.lua rename to data-otservbr-global/scripts/quests/roshamuul_quest/actions_mortar.lua diff --git a/data-otservbr-global/scripts/quests/lower_roshamuul/actions_resonance_chamber.lua b/data-otservbr-global/scripts/quests/roshamuul_quest/actions_resonance_chamber.lua similarity index 100% rename from data-otservbr-global/scripts/quests/lower_roshamuul/actions_resonance_chamber.lua rename to data-otservbr-global/scripts/quests/roshamuul_quest/actions_resonance_chamber.lua diff --git a/data-otservbr-global/scripts/quests/lower_roshamuul/actions_trough.lua b/data-otservbr-global/scripts/quests/roshamuul_quest/actions_trough.lua similarity index 64% rename from data-otservbr-global/scripts/quests/lower_roshamuul/actions_trough.lua rename to data-otservbr-global/scripts/quests/roshamuul_quest/actions_trough.lua index 35888d262d8..ae8ab9228e0 100644 --- a/data-otservbr-global/scripts/quests/lower_roshamuul/actions_trough.lua +++ b/data-otservbr-global/scripts/quests/roshamuul_quest/actions_trough.lua @@ -1,4 +1,5 @@ local lowerRoshamuulTrough = Action() + function lowerRoshamuulTrough.onUse(player, item, fromPosition, target, toPosition, isHotkey) if (target == nil) or not target:isItem() then return false @@ -7,7 +8,7 @@ function lowerRoshamuulTrough.onUse(player, item, fromPosition, target, toPositi if target:getId() == 20216 then item:transform(2873, 0) toPosition:sendMagicEffect(10) - player:setStorageValue(ROSHAMUUL_MORTAR_THROWN, math.max(0, player:getStorageValue(ROSHAMUUL_MORTAR_THROWN)) + 1) + player:setStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Mortar_Thrown, math.max(0, player:getStorageValue(Storage.Quest.U10_30.RoshamuulQuest.Constants.Roshamuul_Mortar_Thrown)) + 1) end return true end diff --git a/data-otservbr-global/scripts/creaturescripts/monster/lower_roshamuul.lua b/data-otservbr-global/scripts/quests/roshamuul_quest/creaturescripts_lower_roshamuul.lua similarity index 100% rename from data-otservbr-global/scripts/creaturescripts/monster/lower_roshamuul.lua rename to data-otservbr-global/scripts/quests/roshamuul_quest/creaturescripts_lower_roshamuul.lua diff --git a/data-otservbr-global/scripts/quests/roshamuul_quest/movements_lower_roshamuul.lua b/data-otservbr-global/scripts/quests/roshamuul_quest/movements_lower_roshamuul.lua new file mode 100644 index 00000000000..3f112843642 --- /dev/null +++ b/data-otservbr-global/scripts/quests/roshamuul_quest/movements_lower_roshamuul.lua @@ -0,0 +1,50 @@ +local lowerRoshamuul20122 = MoveEvent() + +function lowerRoshamuul20122.onStepIn(creature, item, position, fromPosition) + local player = creature:getPlayer() + if not player then + return false + end + + if item:getId() == 20122 then + player:teleportTo(Position(33554, 32546, 7)) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true + end + + return false +end + +lowerRoshamuul20122:type("stepin") +lowerRoshamuul20122:id(20122) +lowerRoshamuul20122:register() + +local roshamuulCaves = { + Position(33560, 32523, 8), + Position(33554, 32543, 8), + Position(33573, 32545, 8), + Position(33543, 32560, 8), + Position(33579, 32565, 8), + Position(33527, 32597, 8), +} + +local lowerRoshamuul1500 = MoveEvent() + +function lowerRoshamuul1500.onStepIn(creature, item, position, fromPosition) + local player = creature:getPlayer() + if not player then + return false + end + + if item:getActionId() == 55000 then + player:teleportTo(roshamuulCaves[math.random(#roshamuulCaves)]) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true + end + + return false +end + +lowerRoshamuul1500:type("stepin") +lowerRoshamuul1500:aid(55000) +lowerRoshamuul1500:register() diff --git a/data-otservbr-global/startup/tables/item.lua b/data-otservbr-global/startup/tables/item.lua index 6efdc1e3965..882a5cb9286 100644 --- a/data-otservbr-global/startup/tables/item.lua +++ b/data-otservbr-global/startup/tables/item.lua @@ -1425,6 +1425,17 @@ ItemAction = { { x = 32788, y = 32227, z = 14 }, }, }, + -- Roshamuul Quest + [55000] = { + itemId = false, + itemPos = { + { x = 33560, y = 32525, z = 7 }, + { x = 33554, y = 32545, z = 7 }, + { x = 33573, y = 32547, z = 7 }, + { x = 33543, y = 32562, z = 7 }, + { x = 33579, y = 32567, z = 7 }, + }, + }, -- Spike Tasks [56421] = { itemId = 1949,