From 3396f689cf6efef76cf4420407fe4158c92d073a Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 19 Sep 2024 23:23:19 +0000 Subject: [PATCH] Lua code format - (Stylua) --- data-otservbr-global/npc/mazarius.lua | 18 +- .../actions_ferumbras_lever.lua | 139 ++++++----- .../actions_flower_puzzle_lever.lua | 4 +- .../actions_habitat_corrupted.lua | 19 +- .../actions_habitat_desert.lua | 18 +- .../actions_habitat_dimension.lua | 18 +- .../actions_habitat_grass.lua | 18 +- .../actions_habitat_ice.lua | 18 +- .../actions_habitat_mushroom.lua | 19 +- .../actions_habitat_roshamuul.lua | 18 +- .../actions_habitat_venom.lua | 18 +- .../ferumbras_ascension/actions_mazoran.lua | 164 ++++++------- .../ferumbras_ascension/actions_plagirath.lua | 158 ++++++------- .../ferumbras_ascension/actions_ragiaz.lua | 176 +++++++------- .../ferumbras_ascension/actions_rat_lever.lua | 158 ++++++------- .../ferumbras_ascension/actions_razzagorn.lua | 133 ++++++----- .../ferumbras_ascension/actions_shulgrax.lua | 158 ++++++------- .../ferumbras_ascension/actions_tarbaz.lua | 158 ++++++------- .../actions_the_shatterer_lever.lua | 141 ++++++----- .../ferumbras_ascension/actions_zamulosh.lua | 182 +++++++-------- .../creaturescripts_bosses_kill.lua | 220 +++++++++--------- .../movements_boss_teleport.lua | 122 +++++----- .../movements_desperate_soul.lua | 26 +-- .../movements_entrance.lua | 94 ++++---- .../movements_lovely_monsters.lua | 74 +++--- .../ferumbras_ascension/movements_seal.lua | 152 ++++++------ 26 files changed, 1210 insertions(+), 1213 deletions(-) diff --git a/data-otservbr-global/npc/mazarius.lua b/data-otservbr-global/npc/mazarius.lua index df87ecd3541..2fee7b05b14 100644 --- a/data-otservbr-global/npc/mazarius.lua +++ b/data-otservbr-global/npc/mazarius.lua @@ -80,13 +80,13 @@ local function creatureSayCallback(npc, creature, type, message) "Yet even he deemed this so-called '{godbreaker}' too dangerous, and split it into seven parts. These were at some point entrusted to his powerful minions, known as the Ruthless Seven. ...", "Ancient, forbidden texts hinted at a hellish place where the seven built deadly dungeons, and placed some of their most fearsome and terrible minions as guards, before they sealed the place off. ...", "I'm confident that I can prepare a matching ritual that will breach their protection and allow someone to enter their realm; but I'm in no way suited to handle the horrors to be encountered there. ...", - "Therefore I have to ask you, if you are willing to retrieve the parts of the godbreaker, and face the threat of the ascending Ferumbras?" + "Therefore I have to ask you, if you are willing to retrieve the parts of the godbreaker, and face the threat of the ascending Ferumbras?", }, npc, creature) npcHandler:setTopic(playerId, 0) elseif MsgContains(message, "short") then npcHandler:say({ "My studies indicate that without all doubt Ferumbras the fiendish is in the process of accumulating nearly godlike powers. We have to stop him.", - "Therefore I need you to enter a hellish dimension and acquire the parts of a weapon, the {godbreaker}, powerful enough to stop him once and for all. Are you willing to help me in this dire mission?" + "Therefore I need you to enter a hellish dimension and acquire the parts of a weapon, the {godbreaker}, powerful enough to stop him once and for all. Are you willing to help me in this dire mission?", }, npc, creature) npcHandler:setTopic(playerId, 2) elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 2 and player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Access) < 1 then @@ -115,7 +115,7 @@ local function creatureSayCallback(npc, creature, type, message) "However, it has to be assumed that in the end the sheer power of his creation scared Zathroth, who had to fear the weapon could one day be used against him. So he disassembled it. ...", "He kept the parts hidden and guarded, and if the resources can be trusted and my interpretation is right, moved them again and again, never satisfied with a hiding place. In the end he entrusted the parts to the {Ruthless Seven}. ...", "Knowing that they would never, ever allow one of their own to come in possession of all parts. Since then, the parts have been hidden in a {demi-plane} shared by the Seven.", - "Well, I need 30 {demonic essences} to exchange for a passage so you can access." + "Well, I need 30 {demonic essences} to exchange for a passage so you can access.", }, npc, creature) npcHandler:setTopic(playerId, 0) elseif MsgContains(message, "Ruthless Seven") or MsgContains(message, "ruthless seven") then @@ -124,7 +124,7 @@ local function creatureSayCallback(npc, creature, type, message) elseif MsgContains(message, "demi-plane") then npcHandler:say({ "It is a place, so to say, not completely of this world. It is separate of, yet strongly connected to, our own world. I would imagine it is quite limited in size and its laws of physics and magic should be roughly the same as ours. ...", - "Being home to a host of demons for a while, I expect it to be a hostile and dangerous environment." + "Being home to a host of demons for a while, I expect it to be a hostile and dangerous environment.", }, npc, creature) npcHandler:setTopic(playerId, 0) elseif MsgContains(message, "ascension") then @@ -133,7 +133,7 @@ local function creatureSayCallback(npc, creature, type, message) "Probably born out of desperation, they extensively researched ways to acquire godhood themselves. ...", "Some of them at least even met with moderate success. But the process is complicated at best, and may vary from race to race or even from one individual to another. ...", "The theories differ vastly and waxed and waned in popularity over the centuries if not aeons. Even today and in human society there are a number of obscure ascension cults. ...", - "Some of them claim that humans are most suitable for ascension because they already own a bit of divinity through Banor's godly spark." + "Some of them claim that humans are most suitable for ascension because they already own a bit of divinity through Banor's godly spark.", }, npc, creature) npcHandler:setTopic(playerId, 0) elseif MsgContains(message, "ferumbras") then @@ -142,7 +142,7 @@ local function creatureSayCallback(npc, creature, type, message) "His whole existence seems to be centred on becoming a name that strikes fear into the heart of men and to become a persistent figure in the minds of humanity. ...", "This gives him a hold in reality and a kind of mould to fill with his power and conscience. It's also obvious that this kind of belief of the people alone won't be enough to empower him sufficiently. ...", "Therefore he has to tap into other, probably even more sinister power sources. I can't tell what these sources are, but my scrying revealed that he has reached massive amounts of power. He has probably been infusing himself since years. ...", - "By now he is apparently reaching the end circle of his ascension and could make his final move any day." + "By now he is apparently reaching the end circle of his ascension and could make his final move any day.", }, npc, creature) npcHandler:setTopic(playerId, 0) elseif MsgContains(message, "bozarn") then @@ -160,13 +160,13 @@ local function creatureSayCallback(npc, creature, type, message) elseif MsgContains(message, "kazordoon") then npcHandler:say({ "The dwarves are leftovers from a time long gone by. They have outlived their usefulness to the gods and seem to have come to terms with that. ...", - "They are as unchanging as rock and no greatness awaits them any more. They missed their chance, if they ever had any." + "They are as unchanging as rock and no greatness awaits them any more. They missed their chance, if they ever had any.", }, npc, creature) npcHandler:setTopic(playerId, 0) elseif MsgContains(message, "ab'dendriel") then npcHandler:say({ "The elves are like lost children. Their potential might be great, but they lack focus and dedication to truly improve. If their myths are true, some of the more early elves might have accomplished ascension. ...", - "Yet even if hints strongly suggest those stories are true, the sheer inaction of those assumedly ascended beings is disturbing. Perhaps what those legendary elves achieved was something completely different." + "Yet even if hints strongly suggest those stories are true, the sheer inaction of those assumedly ascended beings is disturbing. Perhaps what those legendary elves achieved was something completely different.", }, npc, creature) npcHandler:setTopic(playerId, 0) elseif MsgContains(message, "edron") then @@ -175,7 +175,7 @@ local function creatureSayCallback(npc, creature, type, message) elseif MsgContains(message, "demons") then npcHandler:say({ "With all their powers and vast magic knowledge they are still more pawns than anything else. Given their resources, ascension might seem within reach. ...", - "The absence of any ascendant demon might prove that they are no true beings at all and literally damned to be stuck in their accursed forms." + "The absence of any ascendant demon might prove that they are no true beings at all and literally damned to be stuck in their accursed forms.", }, npc, creature) npcHandler:setTopic(playerId, 0) elseif MsgContains(message, "venore") then diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ferumbras_lever.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ferumbras_lever.lua index 83c284d8be0..161aaafb3e7 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ferumbras_lever.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ferumbras_lever.lua @@ -1,56 +1,55 @@ local config = { - boss = { - name = "Ferumbras Mortal Shell", - position = Position(33392, 31473, 14), - }, - playerPositions = { - { pos = Position(33269, 31477, 14), teleport = Position(33390, 31483, 14), effect = CONST_ME_TELEPORT }, - - }, - specPos = { - from = Position(33374, 31458, 14), - to = Position(33414, 31498, 14), - }, - exit = Position(33319, 32318, 13), - centerRoom = Position(33392, 31473, 14), - summonName = "Rift Fragment", - maxSummon = 3, + boss = { + name = "Ferumbras Mortal Shell", + position = Position(33392, 31473, 14), + }, + playerPositions = { + { pos = Position(33269, 31477, 14), teleport = Position(33390, 31483, 14), effect = CONST_ME_TELEPORT }, + }, + specPos = { + from = Position(33374, 31458, 14), + to = Position(33414, 31498, 14), + }, + exit = Position(33319, 32318, 13), + centerRoom = Position(33392, 31473, 14), + summonName = "Rift Fragment", + maxSummon = 3, } local leverFerumbras = Action() function leverFerumbras.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) - return true - end - end + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + return true + end + end - if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then - player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) - return true - end + if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then + player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) + return true + end local players = {} - for i = 1, #config.playerPositions do - local pos = config.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() - if not creature or not creature:isPlayer() then - player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") - return true - end - table.insert(players, creature) - end + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + if not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + return true + end + table.insert(players, creature) + end - for i = 1, #players do - local playerToTeleport = players[i] - local teleportPos = config.playerPositions[i].teleport - local effect = config.playerPositions[i].effect - playerToTeleport:teleportTo(teleportPos) - teleportPos:sendMagicEffect(effect) - end + for i = 1, #players do + local playerToTeleport = players[i] + local teleportPos = config.playerPositions[i].teleport + local effect = config.playerPositions[i].effect + playerToTeleport:teleportTo(teleportPos) + teleportPos:sendMagicEffect(effect) + end Game.createMonster(config.boss.name, config.boss.position, true, true) for b = 1, config.maxSummon do @@ -66,39 +65,39 @@ function leverFerumbras.onUse(player, item, fromPosition, target, toPosition, is item:transform(8911) end - return true + return true end function clearBossRoom(fromPos, toPos, exitPos) - local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - spec:teleportTo(exitPos) - exitPos:sendMagicEffect(CONST_ME_TELEPORT) - spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") - else - spec:remove() - end - end + local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + spec:teleportTo(exitPos) + exitPos:sendMagicEffect(CONST_ME_TELEPORT) + spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") + else + spec:remove() + end + end end function isBossInRoom(fromPos, toPos, bossName) - local monstersRemoved = false - for x = fromPos.x, toPos.x do - for y = fromPos.y, toPos.y do - for z = fromPos.z, toPos.z do - local tile = Tile(Position(x, y, z)) - if tile then - local creature = tile:getTopCreature() - if creature and creature:isMonster() then - creature:remove() - monstersRemoved = true - end - end - end - end - end - return monstersRemoved + local monstersRemoved = false + for x = fromPos.x, toPos.x do + for y = fromPos.y, toPos.y do + for z = fromPos.z, toPos.z do + local tile = Tile(Position(x, y, z)) + if tile then + local creature = tile:getTopCreature() + if creature and creature:isMonster() then + creature:remove() + monstersRemoved = true + end + end + end + end + end + return monstersRemoved end leverFerumbras:uid(1021) diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_flower_puzzle_lever.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_flower_puzzle_lever.lua index 748ce24bd66..d09178c1504 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_flower_puzzle_lever.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_flower_puzzle_lever.lua @@ -39,7 +39,9 @@ function ferumbrasAscendantFlowerPuzzle.onUse(player, item, fromPosition, target player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The portal still activated.") else player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FlowerPuzzleTimer, 1) - addEvent(function() player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FlowerPuzzleTimer, 0) end, 30 * 1000) + addEvent(function() + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FlowerPuzzleTimer, 0) + end, 30 * 1000) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A portal forms as two beams of a strange construction dividing this room move towards each other.") for x = 33475, 33479 do local pos = Position(x, 32698, 14) diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_corrupted.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_corrupted.lua index 95d4eac0035..1977a0e8826 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_corrupted.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_corrupted.lua @@ -376,18 +376,17 @@ local function transformArea() end local function resetFerumbrasAscendantHabitats(player) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Roshamuul, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Grass, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Mushroom, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Venom, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Ice, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Corrupted, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Dimension, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats, 0) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Roshamuul, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Grass, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Mushroom, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Venom, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Ice, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Corrupted, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Dimension, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats, 0) end - local ferumbrasAscendantHabitatCorrupted = Action() function ferumbrasAscendantHabitatCorrupted.onUse(player, item, fromPosition, target, toPosition, isHotkey) diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_desert.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_desert.lua index e7bd6134196..d6ebadee7fe 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_desert.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_desert.lua @@ -355,15 +355,15 @@ local function transformArea() end local function resetFerumbrasAscendantHabitats(player) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Roshamuul, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Grass, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Mushroom, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Venom, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Ice, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Corrupted, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Dimension, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats, 0) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Roshamuul, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Grass, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Mushroom, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Venom, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Ice, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Corrupted, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Dimension, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats, 0) end local ferumbrasAscendantHabitatDesert = Action() diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_dimension.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_dimension.lua index 533a435d9d2..94884e25a70 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_dimension.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_dimension.lua @@ -391,15 +391,15 @@ local function transformArea() end local function resetFerumbrasAscendantHabitats(player) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Roshamuul, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Grass, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Mushroom, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Venom, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Ice, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Corrupted, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Dimension, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats, 0) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Roshamuul, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Grass, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Mushroom, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Venom, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Ice, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Corrupted, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Dimension, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats, 0) end local ferumbrasAscendantHabitatDimension = Action() diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_grass.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_grass.lua index 98a22f54450..ce7f6d329ae 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_grass.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_grass.lua @@ -423,15 +423,15 @@ local function transformArea() end local function resetFerumbrasAscendantHabitats(player) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Roshamuul, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Grass, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Mushroom, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Venom, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Ice, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Corrupted, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Dimension, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats, 0) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Roshamuul, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Grass, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Mushroom, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Venom, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Ice, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Corrupted, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Dimension, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats, 0) end local ferumbrasAscendantHabitatGlass = Action() diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_ice.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_ice.lua index 948289a1719..21560098721 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_ice.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_ice.lua @@ -438,15 +438,15 @@ local function transformArea() end local function resetFerumbrasAscendantHabitats(player) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Roshamuul, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Grass, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Mushroom, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Venom, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Ice, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Corrupted, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Dimension, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats, 0) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Roshamuul, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Grass, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Mushroom, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Venom, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Ice, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Corrupted, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Dimension, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats, 0) end local ferumbrasAscendantHabitatIce = Action() diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_mushroom.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_mushroom.lua index 828002e419a..cbcc87dccb5 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_mushroom.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_mushroom.lua @@ -391,18 +391,17 @@ local function transformArea() end local function resetFerumbrasAscendantHabitats(player) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Roshamuul, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Grass, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Mushroom, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Venom, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Ice, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Corrupted, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Dimension, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats, 0) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Roshamuul, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Grass, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Mushroom, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Venom, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Ice, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Corrupted, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Dimension, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats, 0) end - local ferumbrasAscendantHabitatMushroom = Action() function ferumbrasAscendantHabitatMushroom.onUse(player, item, fromPosition, target, toPosition, isHotkey) diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_roshamuul.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_roshamuul.lua index d77c00e6876..a234295469d 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_roshamuul.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_roshamuul.lua @@ -464,15 +464,15 @@ local function transformArea() end local function resetFerumbrasAscendantHabitats(player) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Roshamuul, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Grass, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Mushroom, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Venom, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Ice, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Corrupted, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Dimension, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats, 0) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Roshamuul, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Grass, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Mushroom, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Venom, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Ice, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Corrupted, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Dimension, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats, 0) end local ferumbrasAscendantHabitatRoshamuul = Action() diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_venom.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_venom.lua index fe9960036b9..0b0f6783f96 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_venom.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_habitat_venom.lua @@ -447,15 +447,15 @@ local function transformArea() end local function resetFerumbrasAscendantHabitats(player) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Roshamuul, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Grass, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Mushroom, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Venom, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Ice, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Corrupted, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Dimension, -1) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats, 0) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Roshamuul, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Grass, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Mushroom, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Desert, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Venom, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Ice, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Corrupted, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.Dimension, -1) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Habitats.AllHabitats, 0) end local ferumbrasAscendantHabitatVenom = Action() diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua index 9111dfef175..56cda9fb65b 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua @@ -1,104 +1,104 @@ local config = { - boss = { - name = "Mazoran", - position = Position(33584, 32689, 14), - }, - timeToDefeat = 17 * 60, -- 17 minutes in seconds - playerPositions = { - { pos = Position(33593, 32644, 14), teleport = Position(33585, 32693, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(33593, 32645, 14), teleport = Position(33585, 32693, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(33593, 32646, 14), teleport = Position(33585, 32693, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(33593, 32647, 14), teleport = Position(33585, 32693, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(33593, 32648, 14), teleport = Position(33585, 32693, 14), effect = CONST_ME_TELEPORT }, - }, - specPos = { - from = Position(33570, 32677, 14), - to = Position(33597, 32700, 14), - }, - exit = Position(33319, 32318, 13), + boss = { + name = "Mazoran", + position = Position(33584, 32689, 14), + }, + timeToDefeat = 17 * 60, -- 17 minutes in seconds + playerPositions = { + { pos = Position(33593, 32644, 14), teleport = Position(33585, 32693, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(33593, 32645, 14), teleport = Position(33585, 32693, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(33593, 32646, 14), teleport = Position(33585, 32693, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(33593, 32647, 14), teleport = Position(33585, 32693, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(33593, 32648, 14), teleport = Position(33585, 32693, 14), effect = CONST_ME_TELEPORT }, + }, + specPos = { + from = Position(33570, 32677, 14), + to = Position(33597, 32700, 14), + }, + exit = Position(33319, 32318, 13), } local leverMazoran = Action() function leverMazoran.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) - return true - end - end + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + return true + end + end - if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then - player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) - return true - end + if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then + player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) + return true + end - local players = {} - for i = 1, #config.playerPositions do - local pos = config.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() - if not creature or not creature:isPlayer() then - player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") - return true - end - table.insert(players, creature) - end + local players = {} + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + if not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + return true + end + table.insert(players, creature) + end - for i = 1, #players do - local playerToTeleport = players[i] - local teleportPos = config.playerPositions[i].teleport - local effect = config.playerPositions[i].effect - playerToTeleport:teleportTo(teleportPos) - teleportPos:sendMagicEffect(effect) - end + for i = 1, #players do + local playerToTeleport = players[i] + local teleportPos = config.playerPositions[i].teleport + local effect = config.playerPositions[i].effect + playerToTeleport:teleportTo(teleportPos) + teleportPos:sendMagicEffect(effect) + end - local boss = Game.createMonster(config.boss.name, config.boss.position) - if boss then - boss:setReward(true) - end + local boss = Game.createMonster(config.boss.name, config.boss.position) + if boss then + boss:setReward(true) + end - addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) + addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) - if item.itemid == 8911 then - item:transform(8912) - else - item:transform(8911) - end + if item.itemid == 8911 then + item:transform(8912) + else + item:transform(8911) + end - return true + return true end function clearBossRoom(fromPos, toPos, exitPos) - local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - spec:teleportTo(exitPos) - exitPos:sendMagicEffect(CONST_ME_TELEPORT) - spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") - else - spec:remove() - end - end + local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + spec:teleportTo(exitPos) + exitPos:sendMagicEffect(CONST_ME_TELEPORT) + spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") + else + spec:remove() + end + end end function isBossInRoom(fromPos, toPos, bossName) - local monstersRemoved = false - for x = fromPos.x, toPos.x do - for y = fromPos.y, toPos.y do - for z = fromPos.z, toPos.z do - local tile = Tile(Position(x, y, z)) - if tile then - local creature = tile:getTopCreature() - if creature and creature:isMonster() then - creature:remove() - monstersRemoved = true - end - end - end - end - end - return monstersRemoved + local monstersRemoved = false + for x = fromPos.x, toPos.x do + for y = fromPos.y, toPos.y do + for z = fromPos.z, toPos.z do + local tile = Tile(Position(x, y, z)) + if tile then + local creature = tile:getTopCreature() + if creature and creature:isMonster() then + creature:remove() + monstersRemoved = true + end + end + end + end + end + return monstersRemoved end leverMazoran:uid(1025) diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua index 7a4769e8482..b49a0d58db8 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua @@ -1,101 +1,101 @@ local config = { - boss = { - name = "Plagirath", - position = Position(33172, 31501, 13), - }, - timeToDefeat = 17 * 60, -- 17 minutes in seconds - playerPositions = { - { pos = Position(33229, 31500, 13), teleport = Position(33173, 31504, 13), effect = CONST_ME_TELEPORT }, - { pos = Position(33229, 31501, 13), teleport = Position(33173, 31504, 13), effect = CONST_ME_TELEPORT }, - { pos = Position(33229, 31502, 13), teleport = Position(33173, 31504, 13), effect = CONST_ME_TELEPORT }, - { pos = Position(33229, 31503, 13), teleport = Position(33173, 31504, 13), effect = CONST_ME_TELEPORT }, - { pos = Position(33229, 31504, 13), teleport = Position(33173, 31504, 13), effect = CONST_ME_TELEPORT }, - }, - specPos = { - from = Position(33159, 31488, 13), - to = Position(33190, 31515, 13), - }, - exit = Position(33319, 32318, 13), + boss = { + name = "Plagirath", + position = Position(33172, 31501, 13), + }, + timeToDefeat = 17 * 60, -- 17 minutes in seconds + playerPositions = { + { pos = Position(33229, 31500, 13), teleport = Position(33173, 31504, 13), effect = CONST_ME_TELEPORT }, + { pos = Position(33229, 31501, 13), teleport = Position(33173, 31504, 13), effect = CONST_ME_TELEPORT }, + { pos = Position(33229, 31502, 13), teleport = Position(33173, 31504, 13), effect = CONST_ME_TELEPORT }, + { pos = Position(33229, 31503, 13), teleport = Position(33173, 31504, 13), effect = CONST_ME_TELEPORT }, + { pos = Position(33229, 31504, 13), teleport = Position(33173, 31504, 13), effect = CONST_ME_TELEPORT }, + }, + specPos = { + from = Position(33159, 31488, 13), + to = Position(33190, 31515, 13), + }, + exit = Position(33319, 32318, 13), } local leverPlagirath = Action() function leverPlagirath.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) - return true - end - end + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + return true + end + end - if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then - player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) - return true - end + if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then + player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) + return true + end - local players = {} - for i = 1, #config.playerPositions do - local pos = config.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() - if not creature or not creature:isPlayer() then - player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") - return true - end - table.insert(players, creature) - end + local players = {} + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + if not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + return true + end + table.insert(players, creature) + end - for i = 1, #players do - local playerToTeleport = players[i] - local teleportPos = config.playerPositions[i].teleport - local effect = config.playerPositions[i].effect - playerToTeleport:teleportTo(teleportPos) - teleportPos:sendMagicEffect(effect) - end + for i = 1, #players do + local playerToTeleport = players[i] + local teleportPos = config.playerPositions[i].teleport + local effect = config.playerPositions[i].effect + playerToTeleport:teleportTo(teleportPos) + teleportPos:sendMagicEffect(effect) + end - Game.createMonster(config.boss.name, config.boss.position) + Game.createMonster(config.boss.name, config.boss.position) - addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) + addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) - if item.itemid == 8911 then - item:transform(8912) - else - item:transform(8911) - end + if item.itemid == 8911 then + item:transform(8912) + else + item:transform(8911) + end - return true + return true end function clearBossRoom(fromPos, toPos, exitPos) - local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - spec:teleportTo(exitPos) - exitPos:sendMagicEffect(CONST_ME_TELEPORT) - spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") - else - spec:remove() - end - end + local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + spec:teleportTo(exitPos) + exitPos:sendMagicEffect(CONST_ME_TELEPORT) + spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") + else + spec:remove() + end + end end function isBossInRoom(fromPos, toPos, bossName) - local monstersRemoved = false - for x = fromPos.x, toPos.x do - for y = fromPos.y, toPos.y do - for z = fromPos.z, toPos.z do - local tile = Tile(Position(x, y, z)) - if tile then - local creature = tile:getTopCreature() - if creature and creature:isMonster() then - creature:remove() - monstersRemoved = true - end - end - end - end - end - return monstersRemoved + local monstersRemoved = false + for x = fromPos.x, toPos.x do + for y = fromPos.y, toPos.y do + for z = fromPos.z, toPos.z do + local tile = Tile(Position(x, y, z)) + if tile then + local creature = tile:getTopCreature() + if creature and creature:isMonster() then + creature:remove() + monstersRemoved = true + end + end + end + end + end + return monstersRemoved end leverPlagirath:uid(1022) diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua index 52ad53d1a18..cbe9d13ba35 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua @@ -1,113 +1,113 @@ local config = { - boss = { - name = "Ragiaz", - position = Position(33481, 32334, 13), - }, + boss = { + name = "Ragiaz", + position = Position(33481, 32334, 13), + }, - timeToDefeat = 17 * 60, -- 17 minutes in seconds - playerPositions = { - { pos = Position(33456, 32356, 13), teleport = Position(33482, 32339, 13), effect = CONST_ME_TELEPORT }, - { pos = Position(33457, 32356, 13), teleport = Position(33482, 32339, 13), effect = CONST_ME_TELEPORT }, - { pos = Position(33458, 32356, 13), teleport = Position(33482, 32339, 13), effect = CONST_ME_TELEPORT }, - { pos = Position(33459, 32356, 13), teleport = Position(33482, 32339, 13), effect = CONST_ME_TELEPORT }, - { pos = Position(33460, 32356, 13), teleport = Position(33482, 32339, 13), effect = CONST_ME_TELEPORT }, - }, - monsters = { - { name = "Death Dragon", pos = Position(33476, 32331, 13) }, - { name = "Death Dragon", pos = Position(33476, 32340, 13) }, - { name = "Death Dragon", pos = Position(33487, 32340, 13) }, - { name = "Death Dragon", pos = Position(33488, 32331, 13) }, - }, - specPos = { - from = Position(33468, 32319, 13), - to = Position(33495, 32347, 13), - }, - exit = Position(33319, 32318, 13), + timeToDefeat = 17 * 60, -- 17 minutes in seconds + playerPositions = { + { pos = Position(33456, 32356, 13), teleport = Position(33482, 32339, 13), effect = CONST_ME_TELEPORT }, + { pos = Position(33457, 32356, 13), teleport = Position(33482, 32339, 13), effect = CONST_ME_TELEPORT }, + { pos = Position(33458, 32356, 13), teleport = Position(33482, 32339, 13), effect = CONST_ME_TELEPORT }, + { pos = Position(33459, 32356, 13), teleport = Position(33482, 32339, 13), effect = CONST_ME_TELEPORT }, + { pos = Position(33460, 32356, 13), teleport = Position(33482, 32339, 13), effect = CONST_ME_TELEPORT }, + }, + monsters = { + { name = "Death Dragon", pos = Position(33476, 32331, 13) }, + { name = "Death Dragon", pos = Position(33476, 32340, 13) }, + { name = "Death Dragon", pos = Position(33487, 32340, 13) }, + { name = "Death Dragon", pos = Position(33488, 32331, 13) }, + }, + specPos = { + from = Position(33468, 32319, 13), + to = Position(33495, 32347, 13), + }, + exit = Position(33319, 32318, 13), } local leverRagiaz = Action() function leverRagiaz.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) - return true - end - end + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + return true + end + end - if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then - player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) - return true - end + if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then + player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) + return true + end - local players = {} - for i = 1, #config.playerPositions do - local pos = config.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() - if not creature or not creature:isPlayer() then - player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") - return true - end - table.insert(players, creature) - end + local players = {} + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + if not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + return true + end + table.insert(players, creature) + end - for i = 1, #players do - local playerToTeleport = players[i] - local teleportPos = config.playerPositions[i].teleport - local effect = config.playerPositions[i].effect - playerToTeleport:teleportTo(teleportPos) - teleportPos:sendMagicEffect(effect) - end + for i = 1, #players do + local playerToTeleport = players[i] + local teleportPos = config.playerPositions[i].teleport + local effect = config.playerPositions[i].effect + playerToTeleport:teleportTo(teleportPos) + teleportPos:sendMagicEffect(effect) + end - Game.createMonster(config.boss.name, config.boss.position) + Game.createMonster(config.boss.name, config.boss.position) for i = 1, #config.monsters do - local monsterConfig = config.monsters[i] - Game.createMonster(monsterConfig.name, monsterConfig.pos, true, true) - end + local monsterConfig = config.monsters[i] + Game.createMonster(monsterConfig.name, monsterConfig.pos, true, true) + end - addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) + addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) - if item.itemid == 8911 then - item:transform(8912) - else - item:transform(8911) - end + if item.itemid == 8911 then + item:transform(8912) + else + item:transform(8911) + end - return true + return true end function clearBossRoom(fromPos, toPos, exitPos) - local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - spec:teleportTo(exitPos) - exitPos:sendMagicEffect(CONST_ME_TELEPORT) - spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") - else - spec:remove() - end - end + local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + spec:teleportTo(exitPos) + exitPos:sendMagicEffect(CONST_ME_TELEPORT) + spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") + else + spec:remove() + end + end end function isBossInRoom(fromPos, toPos, bossName) - local monstersRemoved = false - for x = fromPos.x, toPos.x do - for y = fromPos.y, toPos.y do - for z = fromPos.z, toPos.z do - local tile = Tile(Position(x, y, z)) - if tile then - local creature = tile:getTopCreature() - if creature and creature:isMonster() then - creature:remove() - monstersRemoved = true - end - end - end - end - end - return monstersRemoved + local monstersRemoved = false + for x = fromPos.x, toPos.x do + for y = fromPos.y, toPos.y do + for z = fromPos.z, toPos.z do + local tile = Tile(Position(x, y, z)) + if tile then + local creature = tile:getTopCreature() + if creature and creature:isMonster() then + creature:remove() + monstersRemoved = true + end + end + end + end + end + return monstersRemoved end leverRagiaz:uid(1023) diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_rat_lever.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_rat_lever.lua index 0b9c1fdf008..13ef7bb84e2 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_rat_lever.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_rat_lever.lua @@ -1,101 +1,101 @@ local config = { - boss = { - name = "The Lord of The Lice", - position = Position(33220, 31460, 12), - }, - timeToDefeat = 17 * 60, -- 17 minutes in seconds - playerPositions = { - { pos = Position(33197, 31475, 11), teleport = Position(33215, 31470, 12), effect = CONST_ME_TELEPORT }, - { pos = Position(33198, 31475, 11), teleport = Position(33215, 31470, 12), effect = CONST_ME_TELEPORT }, - { pos = Position(33199, 31475, 11), teleport = Position(33215, 31470, 12), effect = CONST_ME_TELEPORT }, - { pos = Position(33200, 31475, 11), teleport = Position(33215, 31470, 12), effect = CONST_ME_TELEPORT }, - { pos = Position(33201, 31475, 11), teleport = Position(33215, 31470, 12), effect = CONST_ME_TELEPORT }, - }, - specPos = { - from = Position(33187, 31429, 12), - to = Position(33242, 31487, 12), - }, - exit = Position(33319, 32318, 13), + boss = { + name = "The Lord of The Lice", + position = Position(33220, 31460, 12), + }, + timeToDefeat = 17 * 60, -- 17 minutes in seconds + playerPositions = { + { pos = Position(33197, 31475, 11), teleport = Position(33215, 31470, 12), effect = CONST_ME_TELEPORT }, + { pos = Position(33198, 31475, 11), teleport = Position(33215, 31470, 12), effect = CONST_ME_TELEPORT }, + { pos = Position(33199, 31475, 11), teleport = Position(33215, 31470, 12), effect = CONST_ME_TELEPORT }, + { pos = Position(33200, 31475, 11), teleport = Position(33215, 31470, 12), effect = CONST_ME_TELEPORT }, + { pos = Position(33201, 31475, 11), teleport = Position(33215, 31470, 12), effect = CONST_ME_TELEPORT }, + }, + specPos = { + from = Position(33187, 31429, 12), + to = Position(33242, 31487, 12), + }, + exit = Position(33319, 32318, 13), } local ferumbrasAscendantRatLever = Action() function ferumbrasAscendantRatLever.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) - return true - end - end + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + return true + end + end - if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then - player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) - return true - end + if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then + player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) + return true + end - local players = {} - for i = 1, #config.playerPositions do - local pos = config.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() - if not creature or not creature:isPlayer() then - player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") - return true - end - table.insert(players, creature) - end + local players = {} + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + if not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + return true + end + table.insert(players, creature) + end - for i = 1, #players do - local playerToTeleport = players[i] - local teleportPos = config.playerPositions[i].teleport - local effect = config.playerPositions[i].effect - playerToTeleport:teleportTo(teleportPos) - teleportPos:sendMagicEffect(effect) - end + for i = 1, #players do + local playerToTeleport = players[i] + local teleportPos = config.playerPositions[i].teleport + local effect = config.playerPositions[i].effect + playerToTeleport:teleportTo(teleportPos) + teleportPos:sendMagicEffect(effect) + end - Game.createMonster(config.boss.name, config.boss.position) + Game.createMonster(config.boss.name, config.boss.position) - addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) + addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) - if item.itemid == 8911 then - item:transform(8912) - else - item:transform(8911) - end + if item.itemid == 8911 then + item:transform(8912) + else + item:transform(8911) + end - return true + return true end function clearBossRoom(fromPos, toPos, exitPos) - local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - spec:teleportTo(exitPos) - exitPos:sendMagicEffect(CONST_ME_TELEPORT) - spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") - else - spec:remove() - end - end + local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + spec:teleportTo(exitPos) + exitPos:sendMagicEffect(CONST_ME_TELEPORT) + spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") + else + spec:remove() + end + end end function isBossInRoom(fromPos, toPos, bossName) - local bossRemoved = false - for x = fromPos.x, toPos.x do - for y = fromPos.y, toPos.y do - for z = fromPos.z, toPos.z do - local tile = Tile(Position(x, y, z)) - if tile then - local creature = tile:getTopCreature() - if creature and creature:isMonster() and creature:getName() == bossName then - creature:remove() - bossRemoved = true - end - end - end - end - end - return bossRemoved + local bossRemoved = false + for x = fromPos.x, toPos.x do + for y = fromPos.y, toPos.y do + for z = fromPos.z, toPos.z do + local tile = Tile(Position(x, y, z)) + if tile then + local creature = tile:getTopCreature() + if creature and creature:isMonster() and creature:getName() == bossName then + creature:remove() + bossRemoved = true + end + end + end + end + end + return bossRemoved end ferumbrasAscendantRatLever:uid(1030) diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua index ee0f2f147d2..c24ec5d2e37 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua @@ -1,10 +1,10 @@ local config = { - boss = { + boss = { name = "Razzagorn", position = Position(33422, 32467, 14), - }, - timeToDefeat = 17 * 60, -- 17 minutes in seconds - playerPositions = { + }, + timeToDefeat = 17 * 60, -- 17 minutes in seconds + playerPositions = { { pos = Position(33386, 32455, 14), teleport = Position(33419, 32467, 14), effect = CONST_ME_TELEPORT }, { pos = Position(33387, 32455, 14), teleport = Position(33419, 32467, 14), effect = CONST_ME_TELEPORT }, { pos = Position(33388, 32455, 14), teleport = Position(33419, 32467, 14), effect = CONST_ME_TELEPORT }, @@ -21,83 +21,82 @@ local config = { local leverRazzagorn = Action() function leverRazzagorn.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) - return true - end - end + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + return true + end + end - if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then - player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) - return true - end + if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then + player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) + return true + end - local players = {} - for i = 1, #config.playerPositions do - local pos = config.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() - if not creature or not creature:isPlayer() then - player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") - return true - end - table.insert(players, creature) - end + local players = {} + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + if not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + return true + end + table.insert(players, creature) + end - for i = 1, #players do - local playerToTeleport = players[i] - local teleportPos = config.playerPositions[i].teleport - local effect = config.playerPositions[i].effect - playerToTeleport:teleportTo(teleportPos) - teleportPos:sendMagicEffect(effect) - end + for i = 1, #players do + local playerToTeleport = players[i] + local teleportPos = config.playerPositions[i].teleport + local effect = config.playerPositions[i].effect + playerToTeleport:teleportTo(teleportPos) + teleportPos:sendMagicEffect(effect) + end - Game.createMonster(config.boss.name, config.boss.position) + Game.createMonster(config.boss.name, config.boss.position) - addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) + addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) - if item.itemid == 8911 then - item:transform(8912) - else - item:transform(8911) - end + if item.itemid == 8911 then + item:transform(8912) + else + item:transform(8911) + end - return true + return true end function clearBossRoom(fromPos, toPos, exitPos) - local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - spec:teleportTo(exitPos) - exitPos:sendMagicEffect(CONST_ME_TELEPORT) - spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") - else - spec:remove() - end - end + local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + spec:teleportTo(exitPos) + exitPos:sendMagicEffect(CONST_ME_TELEPORT) + spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") + else + spec:remove() + end + end end function isBossInRoom(fromPos, toPos, bossName) - local monstersRemoved = false - for x = fromPos.x, toPos.x do - for y = fromPos.y, toPos.y do - for z = fromPos.z, toPos.z do - local tile = Tile(Position(x, y, z)) - if tile then - local creature = tile:getTopCreature() - if creature and creature:isMonster() then - creature:remove() - monstersRemoved = true - end - end - end - end - end - return monstersRemoved + local monstersRemoved = false + for x = fromPos.x, toPos.x do + for y = fromPos.y, toPos.y do + for z = fromPos.z, toPos.z do + local tile = Tile(Position(x, y, z)) + if tile then + local creature = tile:getTopCreature() + if creature and creature:isMonster() then + creature:remove() + monstersRemoved = true + end + end + end + end + end + return monstersRemoved end leverRazzagorn:uid(1024) leverRazzagorn:register() - diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua index 9c27e569113..43f5029a6ac 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua @@ -1,101 +1,101 @@ local config = { - boss = { - name = "Shulgrax", - position = Position(33485, 32786, 13), - }, - timeToDefeat = 17 * 60, -- 17 minutes in seconds - playerPositions = { - { pos = Position(33434, 32785, 13), teleport = Position(33485, 32790, 13), effect = CONST_ME_TELEPORT }, - { pos = Position(33434, 32786, 13), teleport = Position(33485, 32790, 13), effect = CONST_ME_TELEPORT }, - { pos = Position(33434, 32787, 13), teleport = Position(33485, 32790, 13), effect = CONST_ME_TELEPORT }, - { pos = Position(33434, 32788, 13), teleport = Position(33485, 32790, 13), effect = CONST_ME_TELEPORT }, - { pos = Position(33434, 32789, 13), teleport = Position(33485, 32790, 13), effect = CONST_ME_TELEPORT }, - }, - specPos = { - from = Position(33474, 32775, 13), - to = Position(33496, 32798, 13), - }, - exit = Position(33319, 32318, 13), + boss = { + name = "Shulgrax", + position = Position(33485, 32786, 13), + }, + timeToDefeat = 17 * 60, -- 17 minutes in seconds + playerPositions = { + { pos = Position(33434, 32785, 13), teleport = Position(33485, 32790, 13), effect = CONST_ME_TELEPORT }, + { pos = Position(33434, 32786, 13), teleport = Position(33485, 32790, 13), effect = CONST_ME_TELEPORT }, + { pos = Position(33434, 32787, 13), teleport = Position(33485, 32790, 13), effect = CONST_ME_TELEPORT }, + { pos = Position(33434, 32788, 13), teleport = Position(33485, 32790, 13), effect = CONST_ME_TELEPORT }, + { pos = Position(33434, 32789, 13), teleport = Position(33485, 32790, 13), effect = CONST_ME_TELEPORT }, + }, + specPos = { + from = Position(33474, 32775, 13), + to = Position(33496, 32798, 13), + }, + exit = Position(33319, 32318, 13), } local leverShulgrax = Action() function leverShulgrax.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) - return true - end - end + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + return true + end + end - if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then - player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) - return true - end + if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then + player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) + return true + end - local players = {} - for i = 1, #config.playerPositions do - local pos = config.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() - if not creature or not creature:isPlayer() then - player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") - return true - end - table.insert(players, creature) - end + local players = {} + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + if not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + return true + end + table.insert(players, creature) + end - for i = 1, #players do - local playerToTeleport = players[i] - local teleportPos = config.playerPositions[i].teleport - local effect = config.playerPositions[i].effect - playerToTeleport:teleportTo(teleportPos) - teleportPos:sendMagicEffect(effect) - end + for i = 1, #players do + local playerToTeleport = players[i] + local teleportPos = config.playerPositions[i].teleport + local effect = config.playerPositions[i].effect + playerToTeleport:teleportTo(teleportPos) + teleportPos:sendMagicEffect(effect) + end - Game.createMonster(config.boss.name, config.boss.position) + Game.createMonster(config.boss.name, config.boss.position) - addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) + addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) - if item.itemid == 8911 then - item:transform(8912) - else - item:transform(8911) - end + if item.itemid == 8911 then + item:transform(8912) + else + item:transform(8911) + end - return true + return true end function clearBossRoom(fromPos, toPos, exitPos) - local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - spec:teleportTo(exitPos) - exitPos:sendMagicEffect(CONST_ME_TELEPORT) - spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") - else - spec:remove() - end - end + local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + spec:teleportTo(exitPos) + exitPos:sendMagicEffect(CONST_ME_TELEPORT) + spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") + else + spec:remove() + end + end end function isBossInRoom(fromPos, toPos, bossName) - local monstersRemoved = false - for x = fromPos.x, toPos.x do - for y = fromPos.y, toPos.y do - for z = fromPos.z, toPos.z do - local tile = Tile(Position(x, y, z)) - if tile then - local creature = tile:getTopCreature() - if creature and creature:isMonster() then - creature:remove() - monstersRemoved = true - end - end - end - end - end - return monstersRemoved + local monstersRemoved = false + for x = fromPos.x, toPos.x do + for y = fromPos.y, toPos.y do + for z = fromPos.z, toPos.z do + local tile = Tile(Position(x, y, z)) + if tile then + local creature = tile:getTopCreature() + if creature and creature:isMonster() then + creature:remove() + monstersRemoved = true + end + end + end + end + end + return monstersRemoved end leverShulgrax:uid(1028) diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua index 12b39158a57..dfda8c76e8d 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua @@ -1,101 +1,101 @@ local config = { - boss = { - name = "Tarbaz", - position = Position(33459, 32844, 11), - }, - timeToDefeat = 17 * 60, -- 17 minutes in seconds - playerPositions = { - { pos = Position(33418, 32849, 11), teleport = Position(33459, 32848, 11), effect = CONST_ME_TELEPORT }, - { pos = Position(33418, 32850, 11), teleport = Position(33459, 32848, 11), effect = CONST_ME_TELEPORT }, - { pos = Position(33418, 32851, 11), teleport = Position(33459, 32848, 11), effect = CONST_ME_TELEPORT }, - { pos = Position(33418, 32852, 11), teleport = Position(33459, 32848, 11), effect = CONST_ME_TELEPORT }, - { pos = Position(33418, 32853, 11), teleport = Position(33459, 32848, 11), effect = CONST_ME_TELEPORT }, - }, - specPos = { - from = Position(33447, 32832, 11), - to = Position(33473, 32856, 11), - }, - exit = Position(33319, 32318, 13), + boss = { + name = "Tarbaz", + position = Position(33459, 32844, 11), + }, + timeToDefeat = 17 * 60, -- 17 minutes in seconds + playerPositions = { + { pos = Position(33418, 32849, 11), teleport = Position(33459, 32848, 11), effect = CONST_ME_TELEPORT }, + { pos = Position(33418, 32850, 11), teleport = Position(33459, 32848, 11), effect = CONST_ME_TELEPORT }, + { pos = Position(33418, 32851, 11), teleport = Position(33459, 32848, 11), effect = CONST_ME_TELEPORT }, + { pos = Position(33418, 32852, 11), teleport = Position(33459, 32848, 11), effect = CONST_ME_TELEPORT }, + { pos = Position(33418, 32853, 11), teleport = Position(33459, 32848, 11), effect = CONST_ME_TELEPORT }, + }, + specPos = { + from = Position(33447, 32832, 11), + to = Position(33473, 32856, 11), + }, + exit = Position(33319, 32318, 13), } local leverTarbaz = Action() function leverTarbaz.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) - return true - end - end + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + return true + end + end - if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then - player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) - return true - end + if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then + player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) + return true + end - local players = {} - for i = 1, #config.playerPositions do - local pos = config.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() - if not creature or not creature:isPlayer() then - player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") - return true - end - table.insert(players, creature) - end + local players = {} + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + if not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + return true + end + table.insert(players, creature) + end - for i = 1, #players do - local playerToTeleport = players[i] - local teleportPos = config.playerPositions[i].teleport - local effect = config.playerPositions[i].effect - playerToTeleport:teleportTo(teleportPos) - teleportPos:sendMagicEffect(effect) - end + for i = 1, #players do + local playerToTeleport = players[i] + local teleportPos = config.playerPositions[i].teleport + local effect = config.playerPositions[i].effect + playerToTeleport:teleportTo(teleportPos) + teleportPos:sendMagicEffect(effect) + end - Game.createMonster(config.boss.name, config.boss.position) + Game.createMonster(config.boss.name, config.boss.position) - addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) + addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) - if item.itemid == 8911 then - item:transform(8912) - else - item:transform(8911) - end + if item.itemid == 8911 then + item:transform(8912) + else + item:transform(8911) + end - return true + return true end function clearBossRoom(fromPos, toPos, exitPos) - local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - spec:teleportTo(exitPos) - exitPos:sendMagicEffect(CONST_ME_TELEPORT) - spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") - else - spec:remove() - end - end + local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + spec:teleportTo(exitPos) + exitPos:sendMagicEffect(CONST_ME_TELEPORT) + spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") + else + spec:remove() + end + end end function isBossInRoom(fromPos, toPos, bossName) - local monstersRemoved = false - for x = fromPos.x, toPos.x do - for y = fromPos.y, toPos.y do - for z = fromPos.z, toPos.z do - local tile = Tile(Position(x, y, z)) - if tile then - local creature = tile:getTopCreature() - if creature and creature:isMonster() then - creature:remove() - monstersRemoved = true - end - end - end - end - end - return monstersRemoved + local monstersRemoved = false + for x = fromPos.x, toPos.x do + for y = fromPos.y, toPos.y do + for z = fromPos.z, toPos.z do + local tile = Tile(Position(x, y, z)) + if tile then + local creature = tile:getTopCreature() + if creature and creature:isMonster() then + creature:remove() + monstersRemoved = true + end + end + end + end + end + return monstersRemoved end leverTarbaz:uid(1027) diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_the_shatterer_lever.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_the_shatterer_lever.lua index 7b43a2c59f3..221a4bdc850 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_the_shatterer_lever.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_the_shatterer_lever.lua @@ -1,26 +1,26 @@ local config = { - boss = { - name = "The Shatterer", - position = Position(33406, 32418, 14), - }, - timeToDefeat = 17 * 60, -- 17 minutes in seconds - playerPositions = { - { pos = Position(33403, 32465, 13), teleport = Position(33398, 32414, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(33404, 32465, 13), teleport = Position(33398, 32414, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(33405, 32465, 13), teleport = Position(33398, 32414, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(33406, 32465, 13), teleport = Position(33398, 32414, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(33407, 32465, 13), teleport = Position(33398, 32414, 14), effect = CONST_ME_TELEPORT }, - }, - specPos = { - from = Position(33377, 32390, 14), - to = Position(33446, 32447, 14), - }, - exit = Position(33319, 32318, 13), - centerRoom = Position(33406, 32418, 14), - storage = { - lever = Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever, - timer = Storage.Quest.U10_90.FerumbrasAscension.TheShattererTimer, - }, + boss = { + name = "The Shatterer", + position = Position(33406, 32418, 14), + }, + timeToDefeat = 17 * 60, -- 17 minutes in seconds + playerPositions = { + { pos = Position(33403, 32465, 13), teleport = Position(33398, 32414, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(33404, 32465, 13), teleport = Position(33398, 32414, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(33405, 32465, 13), teleport = Position(33398, 32414, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(33406, 32465, 13), teleport = Position(33398, 32414, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(33407, 32465, 13), teleport = Position(33398, 32414, 14), effect = CONST_ME_TELEPORT }, + }, + specPos = { + from = Position(33377, 32390, 14), + to = Position(33446, 32447, 14), + }, + exit = Position(33319, 32318, 13), + centerRoom = Position(33406, 32418, 14), + storage = { + lever = Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever, + timer = Storage.Quest.U10_90.FerumbrasAscension.TheShattererTimer, + }, } local ferumbrasAscendantTheShattererLever = Action() @@ -33,31 +33,30 @@ function ferumbrasAscendantTheShattererLever.onUse(player, item, fromPosition, t return true end end - + if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) return true end - local players = {} - for i = 1, #config.playerPositions do - local pos = config.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() - if not creature or not creature:isPlayer() then - player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") - return true - end - table.insert(players, creature) - end + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + if not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + return true + end + table.insert(players, creature) + end for i = 1, #players do - local playerToTeleport = players[i] - local teleportPos = config.playerPositions[i].teleport - local effect = config.playerPositions[i].effect - playerToTeleport:teleportTo(teleportPos) - teleportPos:sendMagicEffect(effect) - end + local playerToTeleport = players[i] + local teleportPos = config.playerPositions[i].teleport + local effect = config.playerPositions[i].effect + playerToTeleport:teleportTo(teleportPos) + teleportPos:sendMagicEffect(effect) + end Game.createMonster(config.boss.name, config.boss.position, true, true) @@ -69,44 +68,44 @@ function ferumbrasAscendantTheShattererLever.onUse(player, item, fromPosition, t addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit, config.storage.timer) if item.itemid == 8911 then - item:transform(8912) - else - item:transform(8911) - end - - return true + item:transform(8912) + else + item:transform(8911) + end + + return true end function clearBossRoom(fromPos, toPos, exitPos) - local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - spec:teleportTo(exitPos) - exitPos:sendMagicEffect(CONST_ME_TELEPORT) - spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") - else - spec:remove() - end - end + local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + spec:teleportTo(exitPos) + exitPos:sendMagicEffect(CONST_ME_TELEPORT) + spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") + else + spec:remove() + end + end end function isBossInRoom(fromPos, toPos, bossName) - local bossRemoved = false - for x = fromPos.x, toPos.x do - for y = fromPos.y, toPos.y do - for z = fromPos.z, toPos.z do - local tile = Tile(Position(x, y, z)) - if tile then - local creature = tile:getTopCreature() - if creature and creature:isMonster() and creature:getName() == bossName then - creature:remove() - bossRemoved = true - end - end - end - end - end - return bossRemoved + local bossRemoved = false + for x = fromPos.x, toPos.x do + for y = fromPos.y, toPos.y do + for z = fromPos.z, toPos.z do + local tile = Tile(Position(x, y, z)) + if tile then + local creature = tile:getTopCreature() + if creature and creature:isMonster() and creature:getName() == bossName then + creature:remove() + bossRemoved = true + end + end + end + end + end + return bossRemoved end ferumbrasAscendantTheShattererLever:uid(1029) diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua index 142132bb5e7..74e7740bc9f 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua @@ -1,115 +1,115 @@ local config = { - boss = { - name = "Zamulosh", - position = Position(33643, 32756, 11), - }, - timeToDefeat = 17 * 60, -- 17 minutes in seconds - playerPositions = { - { pos = Position(33680, 32741, 11), teleport = Position(33644, 32760, 11), effect = CONST_ME_TELEPORT }, - }, - specPos = { - from = Position(33632, 32747, 11), - to = Position(33654, 32765, 11), - }, - exit = Position(33319, 32318, 13), - summons = { - Position(33642, 32756, 11), - Position(33642, 32756, 11), - Position(33642, 32756, 11), - Position(33644, 32756, 11), - Position(33644, 32756, 11), - Position(33644, 32756, 11), - } + boss = { + name = "Zamulosh", + position = Position(33643, 32756, 11), + }, + timeToDefeat = 17 * 60, -- 17 minutes in seconds + playerPositions = { + { pos = Position(33680, 32741, 11), teleport = Position(33644, 32760, 11), effect = CONST_ME_TELEPORT }, + }, + specPos = { + from = Position(33632, 32747, 11), + to = Position(33654, 32765, 11), + }, + exit = Position(33319, 32318, 13), + summons = { + Position(33642, 32756, 11), + Position(33642, 32756, 11), + Position(33642, 32756, 11), + Position(33644, 32756, 11), + Position(33644, 32756, 11), + Position(33644, 32756, 11), + }, } local leverZamulosh = Action() function leverZamulosh.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) - return true - end - end + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + return true + end + end - if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then - player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) - return true - end + if isBossInRoom(config.specPos.from, config.specPos.to, config.boss.name) then + player:say("The room is being cleared. Please wait a moment.", TALKTYPE_MONSTER_SAY) + return true + end - local players = {} - for i = 1, #config.playerPositions do - local pos = config.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() - if not creature or not creature:isPlayer() then - player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") - return true - end - table.insert(players, creature) - end + local players = {} + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + if not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + return true + end + table.insert(players, creature) + end - for i = 1, #players do - local playerToTeleport = players[i] - local teleportPos = config.playerPositions[i].teleport - local effect = config.playerPositions[i].effect - playerToTeleport:teleportTo(teleportPos) - teleportPos:sendMagicEffect(effect) - end + for i = 1, #players do + local playerToTeleport = players[i] + local teleportPos = config.playerPositions[i].teleport + local effect = config.playerPositions[i].effect + playerToTeleport:teleportTo(teleportPos) + teleportPos:sendMagicEffect(effect) + end - Game.createMonster(config.boss.name, config.boss.position) + Game.createMonster(config.boss.name, config.boss.position) - local zamuloshIndex = math.random(#config.summons) + local zamuloshIndex = math.random(#config.summons) - for i, summonPos in ipairs(config.summons) do - if i == zamuloshIndex then - Game.createMonster(config.boss.name, summonPos) - else - Game.createMonster("Zamulosh3", summonPos) - end - end + for i, summonPos in ipairs(config.summons) do + if i == zamuloshIndex then + Game.createMonster(config.boss.name, summonPos) + else + Game.createMonster("Zamulosh3", summonPos) + end + end - addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) + addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) - if item.itemid == 8911 then - item:transform(8912) - else - item:transform(8911) - end + if item.itemid == 8911 then + item:transform(8912) + else + item:transform(8911) + end - return true + return true end function clearBossRoom(fromPos, toPos, exitPos) - local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - spec:teleportTo(exitPos) - exitPos:sendMagicEffect(CONST_ME_TELEPORT) - spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") - else - spec:remove() - end - end + local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) + for _, spec in pairs(spectators) do + if spec:isPlayer() then + spec:teleportTo(exitPos) + exitPos:sendMagicEffect(CONST_ME_TELEPORT) + spec:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") + else + spec:remove() + end + end end function isBossInRoom(fromPos, toPos, bossName) - local monstersRemoved = false - for x = fromPos.x, toPos.x do - for y = fromPos.y, toPos.y do - for z = fromPos.z, toPos.z do - local tile = Tile(Position(x, y, z)) - if tile then - local creature = tile:getTopCreature() - if creature and creature:isMonster() then - creature:remove() - monstersRemoved = true - end - end - end - end - end - return monstersRemoved + local monstersRemoved = false + for x = fromPos.x, toPos.x do + for y = fromPos.y, toPos.y do + for z = fromPos.z, toPos.z do + local tile = Tile(Position(x, y, z)) + if tile then + local creature = tile:getTopCreature() + if creature and creature:isMonster() then + creature:remove() + monstersRemoved = true + end + end + end + end + end + return monstersRemoved end leverZamulosh:uid(1026) diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/creaturescripts_bosses_kill.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/creaturescripts_bosses_kill.lua index 19d5d116afe..e01e22f1534 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/creaturescripts_bosses_kill.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/creaturescripts_bosses_kill.lua @@ -1,135 +1,135 @@ local bosses = { - ["the lord of the lice"] = { - teleportPos = Position(33226, 31478, 12), - godbreakerPos = Position(33237, 31477, 13), - cooldown = 44, -- hours - storage = Storage.Quest.U10_90.FerumbrasAscension.TheLordOfTheLiceTime - }, - ["tarbaz"] = { - teleportPos = Position(33460, 32853, 11), - godbreakerPos = Position(33427, 32852, 13), - cooldown = 44, -- hours - storage = Storage.Quest.U10_90.FerumbrasAscension.TarbazTime - }, - ["ragiaz"] = { - teleportPos = Position(33482, 32345, 13), - godbreakerPos = Position(33466, 32392, 13), - cooldown = 44, -- hours - storage = Storage.Quest.U10_90.FerumbrasAscension.RagiazTime - }, - ["plagirath"] = { - teleportPos = Position(33174, 31511, 13), - godbreakerPos = Position(33204, 31510, 13), - cooldown = 44, -- hours - storage = Storage.Quest.U10_90.FerumbrasAscension.PlagirathTime - }, - ["razzagorn"] = { - teleportPos = Position(33357, 32434, 12), - godbreakerPos = Position(33357, 32440, 13), - cooldown = 44, -- hours - storage = Storage.Quest.U10_90.FerumbrasAscension.RazzagornTime - }, - ["zamulosh"] = { - teleportPos = Position(33644, 32764, 11), - godbreakerPos = Position(33678, 32758, 13), - cooldown = 44, -- hours - storage = Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTime - }, - ["mazoran"] = { - teleportPos = Position(33585, 32699, 14), - godbreakerPos = Position(33614, 32679, 15), - cooldown = 44, -- hours - storage = Storage.Quest.U10_90.FerumbrasAscension.MazoranTime - }, - ["shulgrax"] = { - teleportPos = Position(33486, 32796, 13), - godbreakerPos = Position(33459, 32820, 14), - cooldown = 44, -- hours - storage = Storage.Quest.U10_90.FerumbrasAscension.ShulgraxTime - }, - ["ferumbras mortal shell"] = { - teleportPos = Position(33392, 31485, 14), - godbreakerPos = Position(33388, 31414, 14), - cooldown = 332, -- hours - 13 days and 20 hours - storage = Storage.Quest.U10_90.FerumbrasAscension.FerumbrasMortalShellTime - }, + ["the lord of the lice"] = { + teleportPos = Position(33226, 31478, 12), + godbreakerPos = Position(33237, 31477, 13), + cooldown = 44, -- hours + storage = Storage.Quest.U10_90.FerumbrasAscension.TheLordOfTheLiceTime, + }, + ["tarbaz"] = { + teleportPos = Position(33460, 32853, 11), + godbreakerPos = Position(33427, 32852, 13), + cooldown = 44, -- hours + storage = Storage.Quest.U10_90.FerumbrasAscension.TarbazTime, + }, + ["ragiaz"] = { + teleportPos = Position(33482, 32345, 13), + godbreakerPos = Position(33466, 32392, 13), + cooldown = 44, -- hours + storage = Storage.Quest.U10_90.FerumbrasAscension.RagiazTime, + }, + ["plagirath"] = { + teleportPos = Position(33174, 31511, 13), + godbreakerPos = Position(33204, 31510, 13), + cooldown = 44, -- hours + storage = Storage.Quest.U10_90.FerumbrasAscension.PlagirathTime, + }, + ["razzagorn"] = { + teleportPos = Position(33357, 32434, 12), + godbreakerPos = Position(33357, 32440, 13), + cooldown = 44, -- hours + storage = Storage.Quest.U10_90.FerumbrasAscension.RazzagornTime, + }, + ["zamulosh"] = { + teleportPos = Position(33644, 32764, 11), + godbreakerPos = Position(33678, 32758, 13), + cooldown = 44, -- hours + storage = Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTime, + }, + ["mazoran"] = { + teleportPos = Position(33585, 32699, 14), + godbreakerPos = Position(33614, 32679, 15), + cooldown = 44, -- hours + storage = Storage.Quest.U10_90.FerumbrasAscension.MazoranTime, + }, + ["shulgrax"] = { + teleportPos = Position(33486, 32796, 13), + godbreakerPos = Position(33459, 32820, 14), + cooldown = 44, -- hours + storage = Storage.Quest.U10_90.FerumbrasAscension.ShulgraxTime, + }, + ["ferumbras mortal shell"] = { + teleportPos = Position(33392, 31485, 14), + godbreakerPos = Position(33388, 31414, 14), + cooldown = 332, -- hours - 13 days and 20 hours + storage = Storage.Quest.U10_90.FerumbrasAscension.FerumbrasMortalShellTime, + }, } local crystals = { - [1] = { crystalPosition = Position(33390, 31468, 14), globalStorage = Storage.Quest.U10_90.FerumbrasAscension.Crystals.Crystal1 }, - [2] = { crystalPosition = Position(33394, 31468, 14), globalStorage = Storage.Quest.U10_90.FerumbrasAscension.Crystals.Crystal2 }, - [3] = { crystalPosition = Position(33397, 31471, 14), globalStorage = Storage.Quest.U10_90.FerumbrasAscension.Crystals.Crystal3 }, - [4] = { crystalPosition = Position(33397, 31475, 14), globalStorage = Storage.Quest.U10_90.FerumbrasAscension.Crystals.Crystal4 }, - [5] = { crystalPosition = Position(33394, 31478, 14), globalStorage = Storage.Quest.U10_90.FerumbrasAscension.Crystals.Crystal5 }, - [6] = { crystalPosition = Position(33390, 31478, 14), globalStorage = Storage.Quest.U10_90.FerumbrasAscension.Crystals.Crystal6 }, - [7] = { crystalPosition = Position(33387, 31475, 14), globalStorage = Storage.Quest.U10_90.FerumbrasAscension.Crystals.Crystal7 }, - [8] = { crystalPosition = Position(33387, 31471, 14), globalStorage = Storage.Quest.U10_90.FerumbrasAscension.Crystals.Crystal8 }, + [1] = { crystalPosition = Position(33390, 31468, 14), globalStorage = Storage.Quest.U10_90.FerumbrasAscension.Crystals.Crystal1 }, + [2] = { crystalPosition = Position(33394, 31468, 14), globalStorage = Storage.Quest.U10_90.FerumbrasAscension.Crystals.Crystal2 }, + [3] = { crystalPosition = Position(33397, 31471, 14), globalStorage = Storage.Quest.U10_90.FerumbrasAscension.Crystals.Crystal3 }, + [4] = { crystalPosition = Position(33397, 31475, 14), globalStorage = Storage.Quest.U10_90.FerumbrasAscension.Crystals.Crystal4 }, + [5] = { crystalPosition = Position(33394, 31478, 14), globalStorage = Storage.Quest.U10_90.FerumbrasAscension.Crystals.Crystal5 }, + [6] = { crystalPosition = Position(33390, 31478, 14), globalStorage = Storage.Quest.U10_90.FerumbrasAscension.Crystals.Crystal6 }, + [7] = { crystalPosition = Position(33387, 31475, 14), globalStorage = Storage.Quest.U10_90.FerumbrasAscension.Crystals.Crystal7 }, + [8] = { crystalPosition = Position(33387, 31471, 14), globalStorage = Storage.Quest.U10_90.FerumbrasAscension.Crystals.Crystal8 }, } local function transformCrystal(player) - for c = 1, #crystals do - local crystal = crystals[c] - player:setStorageValue(crystal.globalStorage, 0) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Crystals.AllCrystals, 0) - local item = Tile(crystal.crystalPosition):getItemById(14961) - if item then - item:transform(14955) - end - end + for c = 1, #crystals do + local crystal = crystals[c] + player:setStorageValue(crystal.globalStorage, 0) + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Crystals.AllCrystals, 0) + local item = Tile(crystal.crystalPosition):getItemById(14961) + if item then + item:transform(14955) + end + end end local function revertTeleport(position, itemId, transformId, destination) - local item = Tile(position):getItemById(itemId) - if item then - item:transform(transformId) - item:setDestination(destination) - end + local item = Tile(position):getItemById(itemId) + if item then + item:transform(transformId) + item:setDestination(destination) + end end local ascendantBossesKill = CreatureEvent("AscendantBossesDeath") local function formatCooldownMessage(cooldownHours) - local days = math.floor(cooldownHours / 24) - local hours = cooldownHours % 24 - if days > 0 then - return string.format("%d days and %d hours", days, hours) - else - return string.format("%d hours", hours) - end + local days = math.floor(cooldownHours / 24) + local hours = cooldownHours % 24 + if days > 0 then + return string.format("%d days and %d hours", days, hours) + else + return string.format("%d hours", hours) + end end function ascendantBossesKill.onDeath(creature) - local bossConfig = bosses[creature:getName():lower()] - if not bossConfig then - return true - end + local bossConfig = bosses[creature:getName():lower()] + if not bossConfig then + return true + end - onDeathForDamagingPlayers(creature, function(creature, player) - local bossName = creature:getName():lower() - if bossConfig.storage then - local cooldownTime = bossConfig.cooldown * 3600 - local nextAvailableTime = os.time() + cooldownTime - player:setStorageValue(bossConfig.storage, nextAvailableTime) - local cooldownMessage = formatCooldownMessage(bossConfig.cooldown) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have defeated " .. bossName .. ". You can challenge this boss again in " .. cooldownMessage .. ".") - end - end) + onDeathForDamagingPlayers(creature, function(creature, player) + local bossName = creature:getName():lower() + if bossConfig.storage then + local cooldownTime = bossConfig.cooldown * 3600 + local nextAvailableTime = os.time() + cooldownTime + player:setStorageValue(bossConfig.storage, nextAvailableTime) + local cooldownMessage = formatCooldownMessage(bossConfig.cooldown) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have defeated " .. bossName .. ". You can challenge this boss again in " .. cooldownMessage .. ".") + end + end) - local teleport = Tile(bossConfig.teleportPos):getItemById(1949) - if teleport then - teleport:transform(22761) - teleport:getPosition():sendMagicEffect(CONST_ME_THUNDER) - teleport:setDestination(bossConfig.godbreakerPos) - addEvent(revertTeleport, 1 * 60 * 1000, bossConfig.teleportPos, 22761, 1949, Position(33319, 32318, 13)) - end + local teleport = Tile(bossConfig.teleportPos):getItemById(1949) + if teleport then + teleport:transform(22761) + teleport:getPosition():sendMagicEffect(CONST_ME_THUNDER) + teleport:setDestination(bossConfig.godbreakerPos) + addEvent(revertTeleport, 1 * 60 * 1000, bossConfig.teleportPos, 22761, 1949, Position(33319, 32318, 13)) + end - if creature:getName():lower() == "ferumbras mortal shell" then - onDeathForDamagingPlayers(creature, function(creature, player) - addEvent(transformCrystal, 2 * 60 * 1000, player) - end) - end + if creature:getName():lower() == "ferumbras mortal shell" then + onDeathForDamagingPlayers(creature, function(creature, player) + addEvent(transformCrystal, 2 * 60 * 1000, player) + end) + end - return true + return true end ascendantBossesKill:register() diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_boss_teleport.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_boss_teleport.lua index 449113b1c06..41bf3809f13 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_boss_teleport.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_boss_teleport.lua @@ -1,79 +1,79 @@ local config = { - [24830] = { - storage = Storage.Quest.U10_90.FerumbrasAscension.Razzagorn, - cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.RazzagornTime, - bossName = "Razzagorn" - }, - [24831] = { - storage = Storage.Quest.U10_90.FerumbrasAscension.Ragiaz, - cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.RagiazTime, - bossName = "Ragiaz" - }, - [24832] = { - storage = Storage.Quest.U10_90.FerumbrasAscension.Zamulosh, - cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTime, - bossName = "Zamulosh" - }, - [24833] = { - storage = Storage.Quest.U10_90.FerumbrasAscension.Mazoran, - cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.MazoranTime, - bossName = "Mazoran" - }, - [24834] = { - storage = Storage.Quest.U10_90.FerumbrasAscension.Tarbaz, - cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.TarbazTime, - bossName = "Tarbaz" - }, - [24835] = { - storage = Storage.Quest.U10_90.FerumbrasAscension.Shulgrax, - cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.ShulgraxTime, - bossName = "Shulgrax" - }, - [24836] = { - storage = Storage.Quest.U10_90.FerumbrasAscension.Plagirath, - cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.PlagirathTime, - bossName = "Plagirath" - }, + [24830] = { + storage = Storage.Quest.U10_90.FerumbrasAscension.Razzagorn, + cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.RazzagornTime, + bossName = "Razzagorn", + }, + [24831] = { + storage = Storage.Quest.U10_90.FerumbrasAscension.Ragiaz, + cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.RagiazTime, + bossName = "Ragiaz", + }, + [24832] = { + storage = Storage.Quest.U10_90.FerumbrasAscension.Zamulosh, + cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTime, + bossName = "Zamulosh", + }, + [24833] = { + storage = Storage.Quest.U10_90.FerumbrasAscension.Mazoran, + cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.MazoranTime, + bossName = "Mazoran", + }, + [24834] = { + storage = Storage.Quest.U10_90.FerumbrasAscension.Tarbaz, + cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.TarbazTime, + bossName = "Tarbaz", + }, + [24835] = { + storage = Storage.Quest.U10_90.FerumbrasAscension.Shulgrax, + cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.ShulgraxTime, + bossName = "Shulgrax", + }, + [24836] = { + storage = Storage.Quest.U10_90.FerumbrasAscension.Plagirath, + cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.PlagirathTime, + bossName = "Plagirath", + }, } local bossTeleport = MoveEvent() function bossTeleport.onStepIn(creature, item, position, fromPosition) - local teleportConfig = config[item.actionid] - if not teleportConfig then - return false - end - local player = creature:getPlayer() - if not player then - return true - end + local teleportConfig = config[item.actionid] + if not teleportConfig then + return false + end + local player = creature:getPlayer() + if not player then + return true + end - local cooldownStorage = teleportConfig.cooldownStorage - local bossName = teleportConfig.bossName - local cooldownTime = player:getStorageValue(cooldownStorage) + local cooldownStorage = teleportConfig.cooldownStorage + local bossName = teleportConfig.bossName + local cooldownTime = player:getStorageValue(cooldownStorage) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:teleportTo(fromPosition) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - return true - end + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:teleportTo(fromPosition) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true + end - if player:getStorageValue(teleportConfig.storage) ~= 1 then - player:teleportTo(fromPosition) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - return true - end + if player:getStorageValue(teleportConfig.storage) ~= 1 then + player:teleportTo(fromPosition) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true + end - return true + return true end bossTeleport:type("stepin") for index, value in pairs(config) do - bossTeleport:aid(index) + bossTeleport:aid(index) end bossTeleport:register() diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_desperate_soul.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_desperate_soul.lua index 85ffe10e204..4d2fc197bc4 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_desperate_soul.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_desperate_soul.lua @@ -1,22 +1,22 @@ local desperateSoul = MoveEvent() function desperateSoul.onStepIn(creature, item, position, fromPosition) - if not creature:isMonster() or creature:getName():lower() ~= "desperate soul" then - return true - end + if not creature:isMonster() or creature:getName():lower() ~= "desperate soul" then + return true + end - creature:remove() - position:sendMagicEffect(CONST_ME_POFF) + creature:remove() + position:sendMagicEffect(CONST_ME_POFF) - local player = Tile(fromPosition):getTopCreature() - if player and player:isPlayer() then - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasEssence, 1) - addEvent(function() - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasEssence, 0) - end, 2 * 60 * 1000) - end + local player = Tile(fromPosition):getTopCreature() + if player and player:isPlayer() then + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasEssence, 1) + addEvent(function() + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasEssence, 0) + end, 2 * 60 * 1000) + end - return true + return true end desperateSoul:type("stepin") diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_entrance.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_entrance.lua index 6522d006ef1..b6e2aa6e4a5 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_entrance.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_entrance.lua @@ -1,59 +1,59 @@ local config = { - [1] = { storage = Storage.Quest.U10_90.FerumbrasAscension.Razzagorn }, - [2] = { storage = Storage.Quest.U10_90.FerumbrasAscension.Ragiaz }, - [3] = { storage = Storage.Quest.U10_90.FerumbrasAscension.Zamulosh }, - [4] = { storage = Storage.Quest.U10_90.FerumbrasAscension.Mazoran }, - [5] = { storage = Storage.Quest.U10_90.FerumbrasAscension.Tarbaz }, - [6] = { storage = Storage.Quest.U10_90.FerumbrasAscension.Shulgrax }, - [7] = { storage = Storage.Quest.U10_90.FerumbrasAscension.Plagirath }, + [1] = { storage = Storage.Quest.U10_90.FerumbrasAscension.Razzagorn }, + [2] = { storage = Storage.Quest.U10_90.FerumbrasAscension.Ragiaz }, + [3] = { storage = Storage.Quest.U10_90.FerumbrasAscension.Zamulosh }, + [4] = { storage = Storage.Quest.U10_90.FerumbrasAscension.Mazoran }, + [5] = { storage = Storage.Quest.U10_90.FerumbrasAscension.Tarbaz }, + [6] = { storage = Storage.Quest.U10_90.FerumbrasAscension.Shulgrax }, + [7] = { storage = Storage.Quest.U10_90.FerumbrasAscension.Plagirath }, } local entrance = MoveEvent() function entrance.onStepIn(creature, item, position, fromPosition) - local player = creature:getPlayer() - if not player then - return true - end + local player = creature:getPlayer() + if not player then + return true + end - if player:getLevel() < 150 then - player:teleportTo(fromPosition) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to be at least level 150 to enter.") - return true - end + if player:getLevel() < 150 then + player:teleportTo(fromPosition) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to be at least level 150 to enter.") + return true + end - local complete = true - for i = 1, #config do - local storage = config[i].storage - if player:getStorageValue(storage) ~= 1 then - complete = false - break - end - end + local complete = true + for i = 1, #config do + local storage = config[i].storage + if player:getStorageValue(storage) ~= 1 then + complete = false + break + end + end - if item:getActionId() == 24837 then - if complete then - player:teleportTo(Position(33275, 32390, 9)) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - return true - else - player:teleportTo(Position(33275, 32390, 8)) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - return true - end - elseif item:getActionId() == 24838 then - if player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Access) < 1 then - player:teleportTo(Position(33275, 32390, 8)) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "This portal is not yet strong enough to breach the destination dimension.") - return true - end - player:teleportTo(Position(33319, 32317, 13)) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - return true - end - return true + if item:getActionId() == 24837 then + if complete then + player:teleportTo(Position(33275, 32390, 9)) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true + else + player:teleportTo(Position(33275, 32390, 8)) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true + end + elseif item:getActionId() == 24838 then + if player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Access) < 1 then + player:teleportTo(Position(33275, 32390, 8)) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "This portal is not yet strong enough to breach the destination dimension.") + return true + end + player:teleportTo(Position(33319, 32317, 13)) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true + end + return true end entrance:type("stepin") diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_lovely_monsters.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_lovely_monsters.lua index 9b9e531fa0e..1a008755b63 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_lovely_monsters.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_lovely_monsters.lua @@ -1,51 +1,51 @@ local config = { - [34315] = { name = "lovely frazzlemaw", centerPos = Position(33618, 32666, 12) }, - [34316] = { name = "lovely deer", centerPos = Position(33641, 32666, 12) }, - [34317] = { name = "lovely rotworm", centerPos = Position(33618, 32684, 12) }, - [34318] = { name = "lovely scorpion", centerPos = Position(33641, 32684, 12) }, - [34319] = { name = "lovely snake", centerPos = Position(33618, 32702, 12) }, - [34320] = { name = "lovely polar bear", centerPos = Position(33641, 32702, 12) }, - [34321] = { name = "lovely souleater", centerPos = Position(33618, 32720, 12) }, - [34322] = { name = "lovely yielothax", centerPos = Position(33641, 32720, 12) }, + [34315] = { name = "lovely frazzlemaw", centerPos = Position(33618, 32666, 12) }, + [34316] = { name = "lovely deer", centerPos = Position(33641, 32666, 12) }, + [34317] = { name = "lovely rotworm", centerPos = Position(33618, 32684, 12) }, + [34318] = { name = "lovely scorpion", centerPos = Position(33641, 32684, 12) }, + [34319] = { name = "lovely snake", centerPos = Position(33618, 32702, 12) }, + [34320] = { name = "lovely polar bear", centerPos = Position(33641, 32702, 12) }, + [34321] = { name = "lovely souleater", centerPos = Position(33618, 32720, 12) }, + [34322] = { name = "lovely yielothax", centerPos = Position(33641, 32720, 12) }, } local lovelyMonsters = MoveEvent() function lovelyMonsters.onStepIn(creature, item, position, fromPosition) - local monsterConfig = config[item.actionid] - if not monsterConfig then - return true - end - - if creature:isPlayer() then - return true - end - - local monster = creature:getMonster() - if monster:getName():lower() == monsterConfig.name then - monster:say("That seemed correct!", TALKTYPE_MONSTER_SAY) - monster:getPosition():sendMagicEffect(CONST_ME_THUNDER) - monster:remove() - - local spectators = Game.getSpectators(monsterConfig.centerPos, false, true, 9, 9, 9, 9) - for _, spectator in pairs(spectators) do - if spectator:isPlayer() then - local player = spectator - if player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTeleports) < 0 then - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTeleports, 0) - end - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTeleports, player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTeleports) + 1) - end - end - return true - end - return true + local monsterConfig = config[item.actionid] + if not monsterConfig then + return true + end + + if creature:isPlayer() then + return true + end + + local monster = creature:getMonster() + if monster:getName():lower() == monsterConfig.name then + monster:say("That seemed correct!", TALKTYPE_MONSTER_SAY) + monster:getPosition():sendMagicEffect(CONST_ME_THUNDER) + monster:remove() + + local spectators = Game.getSpectators(monsterConfig.centerPos, false, true, 9, 9, 9, 9) + for _, spectator in pairs(spectators) do + if spectator:isPlayer() then + local player = spectator + if player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTeleports) < 0 then + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTeleports, 0) + end + player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTeleports, player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTeleports) + 1) + end + end + return true + end + return true end lovelyMonsters:type("stepin") for index, value in pairs(config) do - lovelyMonsters:aid(index) + lovelyMonsters:aid(index) end lovelyMonsters:register() diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_seal.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_seal.lua index 4c381a20264..67b7b8986f2 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_seal.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_seal.lua @@ -1,81 +1,81 @@ local config = { - [24839] = { - toPosition = Position(33419, 32841, 11), - backPosition = Position(33484, 32775, 12), - boss = "Tarbaz", - cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.TarbazTime, - }, - [24840] = { - toPosition = Position(33452, 32356, 13), - backPosition = Position(33432, 32330, 14), - boss = "Ragiaz", - cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.RagiazTime, - }, - [24841] = { - toPosition = Position(33230, 31493, 13), - backPosition = Position(33197, 31438, 13), - boss = "Plagirath", - cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.PlagirathTime, - }, - [24842] = { - toPosition = Position(33380, 32454, 14), - backPosition = Position(33399, 32402, 15), - boss = "Razzagorn", - cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.RazzagornTime, - }, - [24843] = { - toPosition = Position(33680, 32736, 11), - backPosition = Position(33664, 32682, 10), - boss = "Zamulosh", - cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTime, - }, - [24844] = { - toPosition = Position(33593, 32658, 14), - backPosition = Position(33675, 32690, 13), - boss = "Mazoran", - cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.MazoranTime, - }, - [24845] = { - toPosition = Position(33436, 32800, 13), - backPosition = Position(33477, 32701, 14), - boss = "Shulgrax", - cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.ShulgraxTime, - }, - [24846] = { - toPosition = Position(33270, 31474, 14), - backPosition = Position(33324, 31374, 14), - boss = "Ferumbras Mortal Shell", - cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.FerumbrasMortalShellTime, - }, + [24839] = { + toPosition = Position(33419, 32841, 11), + backPosition = Position(33484, 32775, 12), + boss = "Tarbaz", + cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.TarbazTime, + }, + [24840] = { + toPosition = Position(33452, 32356, 13), + backPosition = Position(33432, 32330, 14), + boss = "Ragiaz", + cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.RagiazTime, + }, + [24841] = { + toPosition = Position(33230, 31493, 13), + backPosition = Position(33197, 31438, 13), + boss = "Plagirath", + cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.PlagirathTime, + }, + [24842] = { + toPosition = Position(33380, 32454, 14), + backPosition = Position(33399, 32402, 15), + boss = "Razzagorn", + cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.RazzagornTime, + }, + [24843] = { + toPosition = Position(33680, 32736, 11), + backPosition = Position(33664, 32682, 10), + boss = "Zamulosh", + cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTime, + }, + [24844] = { + toPosition = Position(33593, 32658, 14), + backPosition = Position(33675, 32690, 13), + boss = "Mazoran", + cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.MazoranTime, + }, + [24845] = { + toPosition = Position(33436, 32800, 13), + backPosition = Position(33477, 32701, 14), + boss = "Shulgrax", + cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.ShulgraxTime, + }, + [24846] = { + toPosition = Position(33270, 31474, 14), + backPosition = Position(33324, 31374, 14), + boss = "Ferumbras Mortal Shell", + cooldownStorage = Storage.Quest.U10_90.FerumbrasAscension.FerumbrasMortalShellTime, + }, } local seal = MoveEvent() function seal.onStepIn(creature, item, position, fromPosition) - local player = creature:getPlayer() - if not player then - return true - end + local player = creature:getPlayer() + if not player then + return true + end - local setting = config[item.actionid] - if not setting then - return true - end + local setting = config[item.actionid] + if not setting then + return true + end - local cooldownTime = player:getStorageValue(setting.cooldownStorage) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local days = math.floor(remainingTime / (24 * 3600)) - local hours = math.floor((remainingTime % (24 * 3600)) / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:teleportTo(setting.backPosition) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + local cooldownTime = player:getStorageValue(setting.cooldownStorage) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local days = math.floor(remainingTime / (24 * 3600)) + local hours = math.floor((remainingTime % (24 * 3600)) / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:teleportTo(setting.backPosition) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to wait for time to pass for this boss again.") - return true - end + return true + end - if item.actionid == 24844 then -- Mazoran - if player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Elements.Done) >= 4 then + if item.actionid == 24844 then -- Mazoran + if player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Elements.Done) >= 4 then if player:canFightBoss(setting.boss) then player:teleportTo(setting.toPosition) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) @@ -93,7 +93,7 @@ function seal.onStepIn(creature, item, position, fromPosition) item:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true end - elseif item.actionid == 24845 then + elseif item.actionid == 24845 then if player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FlowerPuzzleTimer) >= 1 then if player:canFightBoss(setting.boss) then player:teleportTo(setting.toPosition) @@ -112,19 +112,19 @@ function seal.onStepIn(creature, item, position, fromPosition) item:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true end - elseif item.actionid == 24846 then -- Ferumbras Mortal Shell - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The portal leads you to the final challenge.") - end + elseif item.actionid == 24846 then -- Ferumbras Mortal Shell + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The portal leads you to the final challenge.") + end - player:teleportTo(setting.toPosition) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - return true + player:teleportTo(setting.toPosition) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true end seal:type("stepin") for index, value in pairs(config) do - seal:aid(index) + seal:aid(index) end seal:register()