From f05de75abcea3b25b5500246a652dadc14f437f2 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Thu, 3 Oct 2024 13:20:44 -0300 Subject: [PATCH 01/70] Fix: ferumbras Ascendant Quest - review 10 --- .../scripts/quests/ferumbras_ascension/actions_zamulosh.lua | 4 ++++ 1 file changed, 4 insertions(+) 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 74e7740bc9f..0f89a0af6ea 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua @@ -6,6 +6,10 @@ local config = { timeToDefeat = 17 * 60, -- 17 minutes in seconds playerPositions = { { pos = Position(33680, 32741, 11), teleport = Position(33644, 32760, 11), effect = CONST_ME_TELEPORT }, + { pos = Position(33680, 32742, 11), teleport = Position(33644, 32760, 11), effect = CONST_ME_TELEPORT }, + { pos = Position(33680, 32743, 11), teleport = Position(33644, 32760, 11), effect = CONST_ME_TELEPORT }, + { pos = Position(33680, 32744, 11), teleport = Position(33644, 32760, 11), effect = CONST_ME_TELEPORT }, + { pos = Position(33680, 32745, 11), teleport = Position(33644, 32760, 11), effect = CONST_ME_TELEPORT }, }, specPos = { from = Position(33632, 32747, 11), From e001b9a8a9f122ee7d8c4bae6a503bc8e256a1a7 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Thu, 3 Oct 2024 13:45:13 -0300 Subject: [PATCH 02/70] More Fix: ferumbras Ascendant Quest - review 10 --- .../ferumbras_ascension/actions_ferumbras_lever.lua | 12 ++++++++++++ .../quests/ferumbras_ascension/actions_mazoran.lua | 12 ++++++++++++ .../quests/ferumbras_ascension/actions_plagirath.lua | 12 ++++++++++++ .../quests/ferumbras_ascension/actions_ragiaz.lua | 12 ++++++++++++ .../quests/ferumbras_ascension/actions_razzagorn.lua | 12 ++++++++++++ .../quests/ferumbras_ascension/actions_shulgrax.lua | 12 ++++++++++++ .../quests/ferumbras_ascension/actions_tarbaz.lua | 12 ++++++++++++ .../quests/ferumbras_ascension/actions_zamulosh.lua | 12 ++++++++++++ 8 files changed, 96 insertions(+) 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 161aaafb3e7..d471d327ad2 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 @@ -19,6 +19,18 @@ local config = { local leverFerumbras = Action() function leverFerumbras.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local cooldownTime = player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasMortalShellTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + + player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + player:teleportTo(fromPosition) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true + 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 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 56cda9fb65b..374c1a552b8 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua @@ -21,6 +21,18 @@ local config = { local leverMazoran = Action() function leverMazoran.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local cooldownTime = player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.MazoranTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + + player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + player:teleportTo(fromPosition) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true + 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 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 b49a0d58db8..0c3ee57fd09 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua @@ -21,6 +21,18 @@ local config = { local leverPlagirath = Action() function leverPlagirath.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local cooldownTime = player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.PlagirathTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + + player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + player:teleportTo(fromPosition) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true + 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 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 cbe9d13ba35..4f6f9169c26 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua @@ -28,6 +28,18 @@ local config = { local leverRagiaz = Action() function leverRagiaz.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local cooldownTime = player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.RagiazTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + + player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + player:teleportTo(fromPosition) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true + 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 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 c24ec5d2e37..c33f393d8a7 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua @@ -21,6 +21,18 @@ local config = { local leverRazzagorn = Action() function leverRazzagorn.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local cooldownTime = player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.RazzagornTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + + player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + player:teleportTo(fromPosition) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true + 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 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 43f5029a6ac..e06741eca74 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua @@ -21,6 +21,18 @@ local config = { local leverShulgrax = Action() function leverShulgrax.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local cooldownTime = player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ShulgraxTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + + player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + player:teleportTo(fromPosition) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true + 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 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 dfda8c76e8d..7bd0a99d264 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua @@ -21,6 +21,18 @@ local config = { local leverTarbaz = Action() function leverTarbaz.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local cooldownTime = player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TarbazTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + + player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + player:teleportTo(fromPosition) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true + 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 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 0f89a0af6ea..0b16ec9a17e 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua @@ -29,6 +29,18 @@ local config = { local leverZamulosh = Action() function leverZamulosh.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local cooldownTime = player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + + player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + player:teleportTo(fromPosition) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true + 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 From 616b1bb46341022bd1fd4fd7b1429a951fdbfa18 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:09:01 -0300 Subject: [PATCH 03/70] Fix: mission 02 of The Djinn War Quest, Efreet Faction (Green Djinns) - review 7 --- .../quests/the_djinn_war_quest/action_water_fountain.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-otservbr-global/scripts/quests/the_djinn_war_quest/action_water_fountain.lua b/data-otservbr-global/scripts/quests/the_djinn_war_quest/action_water_fountain.lua index 0f8ae9f8ac5..9586aae2d80 100644 --- a/data-otservbr-global/scripts/quests/the_djinn_war_quest/action_water_fountain.lua +++ b/data-otservbr-global/scripts/quests/the_djinn_war_quest/action_water_fountain.lua @@ -11,5 +11,5 @@ function action_water_fountain.onUse(player, item, fromPosition, target, toPosit return true end -action_water_fountain:aid(5390) +action_water_fountain:aid(12105) action_water_fountain:register() From a07880a5b90f56def17b7f5a4be460c20837166d Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:15:22 -0300 Subject: [PATCH 04/70] Fix: Barbarian Test - review 8 --- data-otservbr-global/npc/buddel_helheim.lua | 8 ++++---- data-otservbr-global/npc/buddel_okolnir.lua | 8 ++++---- data-otservbr-global/npc/buddel_raider_camp.lua | 8 ++++---- data-otservbr-global/npc/buddel_tyrsung.lua | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/data-otservbr-global/npc/buddel_helheim.lua b/data-otservbr-global/npc/buddel_helheim.lua index 88f94ccfa27..c1b526270f5 100644 --- a/data-otservbr-global/npc/buddel_helheim.lua +++ b/data-otservbr-global/npc/buddel_helheim.lua @@ -79,7 +79,7 @@ addTravelKeyword("svargrond", "You know a town nicer than this? NICER DICER! Apr end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -90,7 +90,7 @@ addTravelKeyword("okolnir", "It's nice there. Except of the ice dragons which ar end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -101,7 +101,7 @@ addTravelKeyword("tyrsung", "*HICKS* Big, big island east of here. Venorian hunt end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -112,7 +112,7 @@ addTravelKeyword("camp", "Both of you look like you could defend yourself! If yo end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) diff --git a/data-otservbr-global/npc/buddel_okolnir.lua b/data-otservbr-global/npc/buddel_okolnir.lua index f21ff049f4b..e4c9ea84f4a 100644 --- a/data-otservbr-global/npc/buddel_okolnir.lua +++ b/data-otservbr-global/npc/buddel_okolnir.lua @@ -82,7 +82,7 @@ addTravelKeyword("svargrond", "You know a town nicer than this? NICER DICER! Apr end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -93,7 +93,7 @@ addTravelKeyword("camp", "Both of you look like you could defend yourself! If yo end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -104,7 +104,7 @@ addTravelKeyword("helheim", "T'at is a small island to the east.", Position(3246 end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -117,7 +117,7 @@ addTravelKeyword("tyrsung", "*HICKS* Big, big island east of here. Venorian hunt end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) diff --git a/data-otservbr-global/npc/buddel_raider_camp.lua b/data-otservbr-global/npc/buddel_raider_camp.lua index 06b69175967..11cc062a2b6 100644 --- a/data-otservbr-global/npc/buddel_raider_camp.lua +++ b/data-otservbr-global/npc/buddel_raider_camp.lua @@ -82,7 +82,7 @@ addTravelKeyword("svargrond", "You know a town nicer than this? NICER DICER! Apr end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -93,7 +93,7 @@ addTravelKeyword("okolnir", "It's nice there. Except of the ice dragons which ar end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -104,7 +104,7 @@ addTravelKeyword("helheim", "T'at is a small island to the east.", Position(3246 end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -117,7 +117,7 @@ addTravelKeyword("tyrsung", "*HICKS* Big, big island east of here. Venorian hunt end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) diff --git a/data-otservbr-global/npc/buddel_tyrsung.lua b/data-otservbr-global/npc/buddel_tyrsung.lua index cb9025b1a91..65cbaf73066 100644 --- a/data-otservbr-global/npc/buddel_tyrsung.lua +++ b/data-otservbr-global/npc/buddel_tyrsung.lua @@ -82,7 +82,7 @@ addTravelKeyword("svargrond", "You know a town nicer than this? NICER DICER! Apr end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -93,7 +93,7 @@ addTravelKeyword("okolnir", "It's nice there. Except of the ice dragons which ar end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -104,7 +104,7 @@ addTravelKeyword("helheim", "T'at is a small island to the east.", Position(3246 end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) @@ -117,7 +117,7 @@ addTravelKeyword("camp", "Both of you look like you could defend yourself! If yo end, function() return math.random(5) > 1 end, function(player) - return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) < 8 + return player:getStorageValue(Storage.Quest.U8_0.BarbarianTest.Questline) == 8 end, function(player) return player:getItemCount(3097) > 0 end, function(player) From e07171b88a3584f93f9f905772e8ba0d23531e7b Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Thu, 3 Oct 2024 19:00:44 -0300 Subject: [PATCH 05/70] Festive Outfits Quest and The First Dragon Quest --- data-otservbr-global/lib/core/quests.lua | 12 ++-- data-otservbr-global/lib/core/storages.lua | 48 ++++++++-------- .../quests/the_first_dragon/angry_plant.lua | 4 ++ .../bosses/fallen_challenger.lua | 4 ++ .../the_first_dragon/dragon_essence.lua | 4 ++ .../the_first_dragon/somewhat_beatable.lua | 2 +- .../npc/gelidrazahs_thirst.lua | 2 +- data-otservbr-global/npc/kizar.lua | 56 +++++++++++++++++++ data-otservbr-global/npc/muriel.lua | 55 +++++++++++++++++- data-otservbr-global/npc/tamoril.lua | 40 +++++++++---- data-otservbr-global/npc/the_first_dragon.lua | 37 ++++++------ .../actions_lair_entrance.lua | 2 +- .../quests/the_first_dragon/actions_lever.lua | 53 ++++++++++++++++-- .../the_first_dragon/actions_rewards.lua | 33 +++++++---- .../actions_sacrifice_items.lua | 16 +++--- .../actions_treasure_chest.lua | 15 +++-- .../creaturescripts_death_first_dragon.lua | 4 +- ...reaturescripts_death_somewhat_beatable.lua | 8 +-- .../creaturescripts_kill_dragon.lua | 4 +- .../movements_entrance_teleport.lua | 12 ++-- .../movements_last_teleport.lua | 28 ++++++++-- .../movements_zorvorax_secrets.lua | 17 +++--- data-otservbr-global/startup/tables/item.lua | 5 ++ .../startup/tables/teleport.lua | 5 ++ data-otservbr-global/startup/tables/tile.lua | 1 + data-otservbr-global/world/otservbr-npc.xml | 3 + 26 files changed, 351 insertions(+), 119 deletions(-) create mode 100644 data-otservbr-global/npc/kizar.lua diff --git a/data-otservbr-global/lib/core/quests.lua b/data-otservbr-global/lib/core/quests.lua index 8d7d9ede37c..741702b68b5 100644 --- a/data-otservbr-global/lib/core/quests.lua +++ b/data-otservbr-global/lib/core/quests.lua @@ -5250,22 +5250,22 @@ if not Quests then }, [37] = { name = "The First Dragon", - startStorageId = Storage.FirstDragon.Questline, + startStorageId = Storage.Quest.U11_02.TheFirstDragon.Questline, startStorageValue = 1, missions = { [1] = { name = "Power", - storageId = Storage.FirstDragon.DragonCounter, + storageId = Storage.Quest.U11_02.TheFirstDragon.DragonCounter, missionId = 10368, startValue = 0, endValue = 200, description = function(player) - return ("You already hunted %d/200 dragons."):format(player:getStorageValue(Storage.FirstDragon.DragonCounter)) + return ("You already hunted %d/200 dragons."):format(player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.DragonCounter)) end, }, [2] = { name = "Treasure", - storageId = Storage.FirstDragon.ChestCounter, + storageId = Storage.Quest.U11_02.TheFirstDragon.ChestCounter, missionId = 10369, startValue = 0, endValue = 20, @@ -5274,7 +5274,7 @@ if not Quests then }, [3] = { name = "Knowledge", - storageId = Storage.FirstDragon.GelidrazahAccess, + storageId = Storage.Quest.U11_02.TheFirstDragon.GelidrazahAccess, missionId = 10370, startValue = 0, endValue = 1, @@ -5283,7 +5283,7 @@ if not Quests then }, [4] = { name = "Life", - storageId = Storage.FirstDragon.SecretsCounter, + storageId = Storage.Quest.U11_02.TheFirstDragon.SecretsCounter, missionId = 10371, startValue = 0, endValue = 3, diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index 1c4033b09bc..f4b3fccb11d 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -393,27 +393,6 @@ Storage = { AccessDoor = 50263, }, }, - FirstDragon = { - -- Reserved storage from 50350 - 50379 - Questline = 50350, - DragonCounter = 50351, - ChestCounter = 50352, - SecretsCounter = 50355, - GelidrazahAccess = 50356, - DesertTile = 50358, - StoneSculptureTile = 50359, - SuntowerTile = 50360, - Horn = 50362, - Scale = 50363, - Bones = 50364, - Tooth = 50365, - AccessCave = 50366, - SomewhatBeatable = 50367, - FirstDragonTimer = 50368, - RewardFeather = 50369, - RewardMask = 50370, - RewardBackpack = 50371, - }, HeroRathleton = { -- Reserved storage from 50400 - 50419 QuestLine = 50400, @@ -2522,8 +2501,31 @@ Storage = { HeartOfDestruction = {}, }, U11_02 = { -- update 11.02 - Reserved Storages 45451 - 45650 - FestiveOutfits = {}, - FirstDragon = {}, + FestiveOutfits = { + Addon1 = 45451, + Addon2 = 45452, + }, + TheFirstDragon = { + Questline = 45453, + DragonCounter = 45454, + ChestCounter = 45455, + SecretsCounter = 45456, + GelidrazahAccess = 45457, + DesertTile = 45458, + StoneSculptureTile = 45459, + SuntowerTile = 45460, + Horn = 45461, + Scale = 45462, + Bones = 45463, + Tooth = 45464, + AccessCave = 45465, + SomewhatBeatable = 45466, + FirstDragonTimer = 45467, + RewardFeather = 45468, + RewardMask = 45469, + RewardBackpack = 45470, + Feathers = 45471, + }, ForgottenKnowledge = {}, }, U11_40 = { -- update 11.40 - Reserved Storages 45651 - 45850 diff --git a/data-otservbr-global/monster/quests/the_first_dragon/angry_plant.lua b/data-otservbr-global/monster/quests/the_first_dragon/angry_plant.lua index 7ecc32947fb..97f702b6639 100644 --- a/data-otservbr-global/monster/quests/the_first_dragon/angry_plant.lua +++ b/data-otservbr-global/monster/quests/the_first_dragon/angry_plant.lua @@ -20,6 +20,10 @@ monster.corpse = 2983 monster.speed = 55 monster.manaCost = 0 +monster.events = { + "AngryPlantDeath", +} + monster.changeTarget = { interval = 2000, chance = 5, diff --git a/data-otservbr-global/monster/quests/the_first_dragon/bosses/fallen_challenger.lua b/data-otservbr-global/monster/quests/the_first_dragon/bosses/fallen_challenger.lua index 1e050fdfd65..3ac0bb8f18f 100644 --- a/data-otservbr-global/monster/quests/the_first_dragon/bosses/fallen_challenger.lua +++ b/data-otservbr-global/monster/quests/the_first_dragon/bosses/fallen_challenger.lua @@ -20,6 +20,10 @@ monster.corpse = 775 monster.speed = 150 monster.manaCost = 0 +monster.events = { + "FallenDeath", +} + monster.changeTarget = { interval = 5000, chance = 8, diff --git a/data-otservbr-global/monster/quests/the_first_dragon/dragon_essence.lua b/data-otservbr-global/monster/quests/the_first_dragon/dragon_essence.lua index 629b187cf93..a91ecae04c5 100644 --- a/data-otservbr-global/monster/quests/the_first_dragon/dragon_essence.lua +++ b/data-otservbr-global/monster/quests/the_first_dragon/dragon_essence.lua @@ -20,6 +20,10 @@ monster.corpse = 0 monster.speed = 125 monster.manaCost = 0 +monster.events = { + "DragonEssenceDeath", +} + monster.changeTarget = { interval = 2000, chance = 5, diff --git a/data-otservbr-global/monster/quests/the_first_dragon/somewhat_beatable.lua b/data-otservbr-global/monster/quests/the_first_dragon/somewhat_beatable.lua index 8829b1415d9..9c0ace92c1f 100644 --- a/data-otservbr-global/monster/quests/the_first_dragon/somewhat_beatable.lua +++ b/data-otservbr-global/monster/quests/the_first_dragon/somewhat_beatable.lua @@ -53,7 +53,7 @@ monster.flags = { } monster.events = { - "Somewhat Beatable Death", + "SomewhatBeatableDeath", } monster.light = { diff --git a/data-otservbr-global/npc/gelidrazahs_thirst.lua b/data-otservbr-global/npc/gelidrazahs_thirst.lua index a051dfb791e..beff8d7c6b9 100644 --- a/data-otservbr-global/npc/gelidrazahs_thirst.lua +++ b/data-otservbr-global/npc/gelidrazahs_thirst.lua @@ -72,7 +72,7 @@ local function creatureSayCallback(npc, creature, type, message) elseif MsgContains(message, "Svir") and npcHandler:getTopic(playerId) == 4 then npcHandler:say("That is correct. You satisfactorily answered all questions. You may pass and enter Gelidrazah's lair.", npc, creature) npcHandler:setTopic(playerId, 0) - player:setStorageValue(Storage.FirstDragon.GelidrazahAccess, 1) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.GelidrazahAccess, 1) else npcHandler:say("I don't know what you are talking about.", npc, creature) end diff --git a/data-otservbr-global/npc/kizar.lua b/data-otservbr-global/npc/kizar.lua new file mode 100644 index 00000000000..df58dd82d3a --- /dev/null +++ b/data-otservbr-global/npc/kizar.lua @@ -0,0 +1,56 @@ +local internalNpcName = "Kizar" +local npcType = Game.createNpcType(internalNpcName) +local npcConfig = {} + +npcConfig.name = internalNpcName +npcConfig.description = internalNpcName + +npcConfig.health = 100 +npcConfig.maxHealth = npcConfig.health +npcConfig.walkInterval = 2000 +npcConfig.walkRadius = 2 + +npcConfig.outfit = { + lookType = 132, + lookHead = 114, + lookBody = 68, + lookLegs = 19, + lookFeet = 115, + lookAddons = 0, +} + +npcConfig.flags = { + floorchange = false, +} + +local keywordHandler = KeywordHandler:new() +local npcHandler = NpcHandler:new(keywordHandler) + +npcType.onThink = function(npc, interval) + npcHandler:onThink(npc, interval) +end + +npcType.onAppear = function(npc, creature) + npcHandler:onAppear(npc, creature) +end + +npcType.onDisappear = function(npc, creature) + npcHandler:onDisappear(npc, creature) +end + +npcType.onMove = function(npc, creature, fromPosition, toPosition) + npcHandler:onMove(npc, creature, fromPosition, toPosition) +end + +npcType.onSay = function(npc, creature, type, message) + npcHandler:onSay(npc, creature, type, message) +end + +npcType.onCloseChannel = function(npc, creature) + npcHandler:onCloseChannel(npc, creature) +end + +npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true) + +-- npcType registering the npcConfig table +npcType:register(npcConfig) diff --git a/data-otservbr-global/npc/muriel.lua b/data-otservbr-global/npc/muriel.lua index 8017528a681..8aece06cd9a 100644 --- a/data-otservbr-global/npc/muriel.lua +++ b/data-otservbr-global/npc/muriel.lua @@ -76,19 +76,58 @@ local function creatureSayCallback(npc, creature, type, message) "The rotworms dug deep into the soil north of Thais. Rumours say that you can access a place of endless moaning from there. ...", "No one knows how old that common grave is but the people who died there are cursed and never come to rest. A bone from that pit would be perfect for my studies.", }, npc, creature) + npcHandler:setTopic(playerId, 0) elseif player:getStorageValue(Storage.Quest.U8_1.TibiaTales.IntoTheBonePit) == 2 then player:setStorageValue(Storage.Quest.U8_1.TibiaTales.IntoTheBonePit, 3) if player:removeItem(131, 1) then player:addItem(6299, 1) npcHandler:say("Excellent! Now I can try to put my theoretical thoughts into practice and find a cure for the symptoms of undead. Here, take this for your efforts.", npc, creature) + npcHandler:setTopic(playerId, 0) else npcHandler:say({ "I am so glad you are still alive. Benjamin found the container with the bone sample inside. Fortunately, I inscribe everything with my name, so he knew it was mine. ...", "I thought you have been haunted and killed by the undead. I'm glad that this is not the case. Thank you for your help.", }, npc, creature) + npcHandler:setTopic(playerId, 0) end else npcHandler:say("I am very glad you helped me, but I am very busy at the moment.", npc, creature) + npcHandler:setTopic(playerId, 0) + end + elseif MsgContains(message, "addons") then + local hasMasks = player:getItemCount(25088) >= 3 + local hasFeathers = player:getItemCount(25089) >= 50 + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.Feathers) == 2 and player:getStorageValue(Storage.Quest.U11_02.FestiveOutfits.Addon1) == 1 and hasMasks then + npcHandler:say("I see you have the porcelain masks. Are you ready to exchange them for the first addon?", npc, creature) + npcHandler:setTopic(playerId, 2) + elseif player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.Feathers) == 2 and player:getStorageValue(Storage.Quest.U11_02.FestiveOutfits.Addon2) == 1 and hasFeathers then + npcHandler:say("I see you have the colourful feathers. Are you ready to exchange them for the second addon?", npc, creature) + npcHandler:setTopic(playerId, 4) + else + npcHandler:say("You need the outfit and 3 porcelain masks or 50 colored feathers to get the festive costume accessories.", npc, creature) + npcHandler:setTopic(playerId, 0) + end + elseif MsgContains(message, "mask") and player:getStorageValue(Storage.Quest.U11_02.FestiveOutfits.Addon1) == 1 then + if player:removeItem(25088, 3) then + player:addOutfit(929, 1) + player:addOutfit(931, 1) + npcHandler:say("Very good! You gained the first addon to the festive outfit.", npc, creature) + player:setStorageValue(Storage.Quest.U11_02.FestiveOutfits.Addon1, 2) + npcHandler:setTopic(playerId, 0) + else + npcHandler:say("Oh, sorry but you don't have enough porcelain masks!", npc, creature) + npcHandler:setTopic(playerId, 0) + end + elseif MsgContains(message, "feather") and player:getStorageValue(Storage.Quest.U11_02.FestiveOutfits.Addon2) == 1 then + if player:removeItem(25089, 50) then + player:addOutfit(929, 2) + player:addOutfit(931, 2) + npcHandler:say("Very good! You gained the second addon to the festive outfit.", npc, creature) + player:setStorageValue(Storage.Quest.U11_02.FestiveOutfits.Addon2, 2) + npcHandler:setTopic(playerId, 0) + else + npcHandler:say("Oh, sorry but you don't have enough colourful feathers!", npc, creature) + npcHandler:setTopic(playerId, 0) end elseif MsgContains(message, "yes") then if npcHandler:getTopic(playerId) == 1 then @@ -98,12 +137,22 @@ local function creatureSayCallback(npc, creature, type, message) }, npc, creature) player:addItem(4852, 1) player:setStorageValue(Storage.Quest.U8_1.TibiaTales.IntoTheBonePit, 1) + npcHandler:setTopic(playerId, 0) + elseif npcHandler:getTopic(playerId) == 2 then + npcHandler:say("I provide two addons. For the first one I need you to bring me three porcelain masks. For the second addon you need fifty colourful ostrich feathers. Do you want one of these addons?", npc, creature) + npcHandler:setTopic(playerId, 3) + elseif npcHandler:getTopic(playerId) == 3 then + npcHandler:say("What do you have for me: the porcelain masks or the colourful feathers?", npc, creature) + player:setStorageValue(Storage.Quest.U11_02.FestiveOutfits.Addon1, 1) + elseif npcHandler:getTopic(playerId) == 4 then + npcHandler:say("I provide two addons. For the first one I need you to bring me three porcelain masks. For the second addon you need fifty colourful ostrich feathers. Do you want one of these addons?", npc, creature) + player:setStorageValue(Storage.Quest.U11_02.FestiveOutfits.Addon2, 1) end elseif MsgContains(message, "no") then - if npcHandler:getTopic(playerId) == 1 then - npcHandler:say("Ohh, then I need to find another adventurer who wants to earn a great reward. Bye!", npc, creature) - end + npcHandler:say("Ohh, then I need to find another adventurer who wants to earn a great reward. Bye!", npc, creature) + npcHandler:setTopic(playerId, 0) end + return true end diff --git a/data-otservbr-global/npc/tamoril.lua b/data-otservbr-global/npc/tamoril.lua index 654355d9be5..166b4b01b50 100644 --- a/data-otservbr-global/npc/tamoril.lua +++ b/data-otservbr-global/npc/tamoril.lua @@ -42,16 +42,28 @@ npcType.onThink = function(npc, interval) npcHandler:onThink(npc, interval) end -local function greetCallback(npc, creature) - local playerId = creature:getId() - npcHandler:setMessage(MESSAGE_GREET, "Another pesky mortal who believes his gold outweighs his nutrition value.") - return true +local function isDateWithinEvent() + local currentDate = os.date("*t") + local startDate = { day = 14, month = 1 } + local endDate = { day = 12, month = 2 } + + if (currentDate.month == startDate.month and currentDate.day >= startDate.day) or + (currentDate.month == endDate.month and currentDate.day <= endDate.day) or + (currentDate.month > startDate.month and currentDate.month < endDate.month) then + return true + end + return false end local function creatureSayCallback(npc, creature, type, message) local player = Player(creature) local playerId = player:getId() + if not isDateWithinEvent() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only discuss the First Dragon between January 14 and February 12.") + return true + end + if MsgContains(message, "first dragon") then npcHandler:say("The First Dragon? The first of all of us? The Son of Garsharak? I'm surprised you heard about him. It is such a long time that he wandered Tibia. Yet, there are some {rumours}.", npc, creature) npcHandler:setTopic(playerId, 1) @@ -86,15 +98,22 @@ local function creatureSayCallback(npc, creature, type, message) "And finally an amethyst teleporter in undead-infested caverns underneath Edron allows you to enter the lair of Zorvorax.", }, npc, creature) npcHandler:setTopic(playerId, 0) - player:setStorageValue(Storage.FirstDragon.Questline, 1) - player:setStorageValue(Storage.FirstDragon.DragonCounter, 0) - player:setStorageValue(Storage.FirstDragon.ChestCounter, 0) - player:setStorageValue(Storage.FirstDragon.GelidrazahAccess, 0) - player:setStorageValue(Storage.FirstDragon.SecretsCounter, 0) + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.Questline) < 1 then + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.Questline, 1) + end + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.ChestCounter) < 0 then + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.ChestCounter, 0) + end + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.DragonCounter, 0) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.GelidrazahAccess, 0) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.SecretsCounter, 0) end + return true end -npcHandler:setCallback(CALLBACK_GREET, greetCallback) + +npcHandler:setMessage(MESSAGE_GREET, "Another pesky mortal who believes his gold outweighs his nutrition value.") + npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true) @@ -107,6 +126,7 @@ npcConfig.shop = { { itemName = "white gem", clientId = 32769, sell = 12000 }, { itemName = "yellow gem", clientId = 3037, sell = 1000 }, } + -- On buy npc shop message npcType.onBuyItem = function(npc, player, itemId, subType, amount, ignore, inBackpacks, totalCost) npc:sellItem(player, itemId, amount, subType, 0, ignore, inBackpacks) diff --git a/data-otservbr-global/npc/the_first_dragon.lua b/data-otservbr-global/npc/the_first_dragon.lua index 64b10bc4cf5..4892f5800bf 100644 --- a/data-otservbr-global/npc/the_first_dragon.lua +++ b/data-otservbr-global/npc/the_first_dragon.lua @@ -54,28 +54,30 @@ local function creatureSayCallback(npc, creature, type, message) local player = Player(creature) local playerId = player:getId() - if MsgContains(message, "reward") and npcHandler:getTopic(playerId) == 0 and player:getStorageValue(34013) < 1 then + if MsgContains(message, "reward") and player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.Feathers) == 1 then npcHandler:say({ "Have a look at the chests over there. Feel free to take the things you find within. You know, gold, gems and the like. There's also a garment I'm storing here for a while. As it doesn't fit me I have no need for it. ...", "But it might be a nice outfit for a little human. You also can take the porcelain mask and the feathers. There's a wizard named Muriel in Thais who reportedly embellishes outfits with stuff like this.", }, npc, creature) - player:addOutfit(929, 1) - player:addOutfit(931, 1) + player:addOutfit(929, 0) + player:addOutfit(931, 0) player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) - player:setStorageValue(34013, 1) + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.Feathers) < 2 then + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.Feathers, 2) + end npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "fight") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "fight") then npcHandler:say({ "Even in {retirement} I sometimes succumb to the temptation of sweet battle. Fighting was so different back in the old {times}. You can read about it in my {memoirs}. There should be a copy lying here somewhere.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "retirement") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "retirement") then npcHandler:say({ "When you are young, you are much more tolerant towards the burden of life. At a certain age even a {dragon} will start to think about if things will go on forever. ...", "Eventually there comes a time when you decide all the {hassle} isn't worth it anymore and you decide to concentrate on the {finer} things life has to offer.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "memoirs") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "memoirs") then npcHandler:say({ "I dictated my memoirs to a human servant. I like the idea to share my thoughts and memories with humanity with the help of a {book}. ...", "You are my greatest fans after all. ...", @@ -83,37 +85,37 @@ local function creatureSayCallback(npc, creature, type, message) "By the way, it's a funny story how I learnt the bonelord language. However, I saved it for a possible part two of my memoirs.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "hassle") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "hassle") then npcHandler:say({ "I really enjoy a good fight now and then. ...", "A real pain, however, is the constant annoyance caused by tedious fights against adventurers with more healing pots than brain.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "worthy") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "worthy") then npcHandler:say({ "To be honest, the first dragon hunters weren't {worthy}. ...", "They used {weaknesses} to their advantage. It took some time before a dragon could be killed in a fair fight.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "weaknesses") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "weaknesses") then npcHandler:say({ "The first awoken dragons were quite disoriented when leaving the {mists} and re-entering reality. ...", "This led to certain vulnerabilities. However, the dragons overcame such shortcomings quickly and soon took their rightful place in the food chain, so to say.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "mists") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "mists") then npcHandler:say({ "There was a time before the gods cast the mists of healing over the world. At that time the dragons ruled and burnt the {world}. ...", "In hindsight I'm not too proud of this. This was some kind of juvenile bullying.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "world") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "world") then npcHandler:say({ "The world has changed so much; I'm beginning to feel really old. People have changed, the face of the world has changed, even the laws of nature are no longer the same. ...", "I think it is the greatest advantage of you {humans} to be more flexible and adaptable.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "books") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "books") then npcHandler:say({ "Your books are an amazing thing. Draconic glyphs are so different. ...", "They are not only more complicated but also more specific. A single word which always keeps the same meaning is astonishingly effective in its primitive way. ...", @@ -121,19 +123,19 @@ local function creatureSayCallback(npc, creature, type, message) "Books are a wonderful {invention}. If you are ever tired of your heroic exploits, take the time to read one.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "invention") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "invention") then npcHandler:say({ "Being powerful creatures themselves, dragons had no need for inventions. ...", "However, now that times have changed and the pressure increases, even my kin might slowly start to change in order to {adapt}.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "adapt") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "adapt") then npcHandler:say({ "Well, surely some of my kin might whine and complain as they always do. ...", "You have no idea how backwards thinking some dragons can be. A few are even still idealising the times before the {mists}.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "finer") and npcHandler:getTopic(playerId) == 0 then + elseif MsgContains(message, "finer") then npcHandler:say({ "The definition of finer things is different for a dragon than for a human. ...", "A young dragon appreciates diving into a lava pool, while an old dragon just can't stand to get rid of the {lava} afterwards and prefers bathing in boiling water.", @@ -144,6 +146,9 @@ local function creatureSayCallback(npc, creature, type, message) return true end + +npcHandler:setMessage(MESSAGE_GREET, "Hello, my sparring buddy. We should have another fight sometimes. I think you may have earned a little reward.") + keywordHandler:addKeyword({ "times" }, StdModule.say, { npcHandler = npcHandler, text = "Times have changed . In the past dragons were feared and respected. Only the {demons} rivalled our notoriety." }) keywordHandler:addKeyword({ "demons" }, StdModule.say, { npcHandler = npcHandler, text = "Those upstarts! I wonder why would anyone care about them. They lack our style. For them it is all about brute force and showing-off." }) keywordHandler:addKeyword({ "style" }, StdModule.say, { npcHandler = npcHandler, text = "Breathing fire is an art! Instead of setting everything on fire, you exhale a cone of fire to give a worthy opponent a chance to avoid it." }) diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/actions_lair_entrance.lua b/data-otservbr-global/scripts/quests/the_first_dragon/actions_lair_entrance.lua index 2c03f4d86e3..c2666382616 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/actions_lair_entrance.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/actions_lair_entrance.lua @@ -1,7 +1,7 @@ local lairEntrance = Action() function lairEntrance.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.FirstDragon.AccessCave) <= 3 then + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.AccessCave) <= 3 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are not worthy to enter in The First Dragon's Lair yet.") return true end diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua b/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua index 2e794aa7fa8..ca975b2433c 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua @@ -3,7 +3,7 @@ local lever = Action() local config = { centerRoom = { x = 33616, y = 31022, z = 14 }, range = 10, - storage = Storage.FirstDragon.FirstDragonTimer, + storage = Storage.Quest.U11_02.TheFirstDragon.FirstDragonTimer, monsterPosition = { { position = Position(33574, 31013, 14) }, { position = Position(33592, 31013, 14) }, @@ -58,23 +58,63 @@ local config = { { fromPosition = Position(33583, 30997, 14) }, { fromPosition = Position(33584, 30997, 14) }, }, + clearArea = { + from = Position(33566, 31006, 14), + to = Position(33626, 31032, 14), + } } +local function clearMonstersInArea(fromPos, toPos) + for z = fromPos.z, toPos.z do + for y = fromPos.y, toPos.y do + for x = fromPos.x, toPos.x do + local tile = Tile(Position(x, y, z)) + if tile then + local creature = tile:getTopCreature() + if creature and creature:isMonster() then + creature:remove() + end + end + end + end + end +end + +local function isRoomOccupied(fromPos, toPos) + for z = fromPos.z, toPos.z do + for y = fromPos.y, toPos.y do + for x = fromPos.x, toPos.x do + local tile = Tile(Position(x, y, z)) + if tile then + local creature = tile:getTopCreature() + if creature and creature:isPlayer() then + return true + end + end + end + end + end + return false +end + function lever.onUse(player, item, fromPosition, target, toPosition, isHotkey) if item.itemid == 8911 then for i = 1, #config.playerPositions do local creature = Tile(config.playerPositions[i]):getTopCreature() if not creature then item:transform(8912) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need 5 players to fight with this boss.") + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need 15 players to fight with this boss.") return true end end end + if item.itemid == 8911 then - if roomIsOccupied(config.centerRoom, false, config.range, config.range) then - player:say("Someone is fighting against the boss! You need wait awhile.", TALKTYPE_MONSTER_SAY) + if isRoomOccupied(config.clearArea.from, config.clearArea.to) then + player:say("Someone is fighting against the boss! You need to wait awhile.", TALKTYPE_MONSTER_SAY) return true + else + clearMonstersInArea(config.clearArea.from, config.clearArea.to) end for d = 1, 5 do @@ -83,6 +123,7 @@ function lever.onUse(player, item, fromPosition, target, toPosition, isHotkey) for b = 1, #config.monsterPosition do Game.createMonster("fallen challenger", config.monsterPosition[b].position, true, true) end + for i = 1, #config.playerPositions do local creature = Tile(config.playerPositions[i]):getTopCreature() if creature then @@ -110,10 +151,10 @@ function lever.onUse(player, item, fromPosition, target, toPosition, isHotkey) end creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) creature:setStorageValue(config.storage, os.time() + 20 * 3600) - creature:setStorageValue(Storage.FirstDragon.SomewhatBeatable, 0) + creature:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.SomewhatBeatable, 0) end end - -- One hour for clean the room + addEvent(clearRoom, 60 * 60 * 1000, Position(33583, 31022, 14), 50, 50, config.storage) Game.createMonster("spirit of fertility", Position(33625, 31021, 14), true, true) item:transform(8912) diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/actions_rewards.lua b/data-otservbr-global/scripts/quests/the_first_dragon/actions_rewards.lua index 2d1c8ac2a90..5b58b23dd13 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/actions_rewards.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/actions_rewards.lua @@ -6,13 +6,13 @@ local bpItems = { { name = "gold token", count = 3 }, { name = "blue gem", count = 1 }, { name = "yellow gem", count = 1 }, - { id = 3039, count = 1 }, -- red gem + { name = "red gem", count = 1 }, { name = "demon horn", count = 2 }, { name = "slime heart", count = 2 }, { name = "energy vein", count = 2 }, { name = "petrified scream", count = 2 }, { name = "brimstone shell", count = 2 }, - { name = "deepling wart", count = 2 }, + { name = "deepling warts", count = 2 }, { name = "wyrm scale", count = 2 }, { name = "hellspawn tail", count = 2 }, } @@ -33,36 +33,47 @@ local chests = { } local finalReward = Action() + function finalReward.onUse(player, item, fromPosition, target, toPosition, isHotkey) local setting = chests[item.uid] if not setting then return true end - if item.uid == 14021 and player:getStorageValue(Storage.FirstDragon.RewardFeather) < os.time() then + + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.Feathers) ~= 2 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are not eligible to claim these rewards yet.") + return true + end + + if item.uid == 14021 and player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.RewardMask) < os.time() then player:addItem(setting.name, setting.count, true) - player:setStorageValue(Storage.FirstDragon.RewardFeather, os.time() + 24 * 3600) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.RewardMask, os.time() + 60 * 60 * 24 * 5) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You found " .. setting.count .. " " .. setting.name .. ".") - elseif item.uid == 14022 and player:getStorageValue(Storage.FirstDragon.RewardBackpack) < os.time() then + + elseif item.uid == 14022 and player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.RewardBackpack) < os.time() then local bp = Game.createItem("Backpack", 1) if bp then for i = 1, #bpItems do if bpItems[i].id then - bp:addItem(bpItems[i].id, count) + bp:addItem(bpItems[i].id, bpItems[i].count) else - bp:addItem(bpItems[i].name, count) + bp:addItem(bpItems[i].name, bpItems[i].count) end end bp:moveTo(player) end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You found a backpack.") - player:setStorageValue(Storage.FirstDragon.RewardBackpack, os.time() + 60 * 60 * 365 * 24) - elseif item.uid == 14023 and player:getStorageValue(Storage.FirstDragon.RewardMask) < os.time() then + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.RewardBackpack, os.time() + 60 * 60 * 24 * 365) + + elseif item.uid == 14023 and player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.RewardFeather) < os.time() then player:addItem(setting.name, setting.count, true) - player:setStorageValue(Storage.FirstDragon.RewardMask, os.time() + 60 * 60 * 5 * 24) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.RewardFeather, os.time() + 24 * 3600) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You found " .. setting.count .. " " .. setting.name .. ".") + else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The " .. getItemName(setting.itemId) .. " is empty.") + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The chest is empty.") end + return true end diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/actions_sacrifice_items.lua b/data-otservbr-global/scripts/quests/the_first_dragon/actions_sacrifice_items.lua index 19144117c54..0a9cd03ccaf 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/actions_sacrifice_items.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/actions_sacrifice_items.lua @@ -1,8 +1,8 @@ local config = { - [24939] = { storage = Storage.FirstDragon.Scale }, - [24940] = { storage = Storage.FirstDragon.Tooth }, - [24941] = { storage = Storage.FirstDragon.Horn }, - [24942] = { storage = Storage.FirstDragon.Bones }, + [24939] = { storage = Storage.Quest.U11_02.TheFirstDragon.Scale }, + [24940] = { storage = Storage.Quest.U11_02.TheFirstDragon.Tooth }, + [24941] = { storage = Storage.Quest.U11_02.TheFirstDragon.Horn }, + [24942] = { storage = Storage.Quest.U11_02.TheFirstDragon.Bones }, } local sacrificeItems = Action() @@ -18,20 +18,20 @@ function sacrificeItems.onUse(player, item, fromPosition, target, toPosition, is return true end - if player:getStorageValue(Storage.FirstDragon.AccessCave) >= 4 then + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.AccessCave) >= 4 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You're plunging " .. item:getName() .. " into the lava. You are now worthy to enter The First Dragon's Lair. Touch the lava pool again.") return true end - if player:getStorageValue(Storage.FirstDragon.AccessCave) < 0 then - player:setStorageValue(Storage.FirstDragon.AccessCave, 0) + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.AccessCave) < 0 then + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.AccessCave, 0) end local targetPosition = Position(33047, 32712, 3) if toPosition == targetPosition then local targetId = Tile(targetPosition):getItemById(25160) if targetId then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You're plunging " .. item:getName() .. " into the lava.") - player:setStorageValue(Storage.FirstDragon.AccessCave, player:getStorageValue(Storage.FirstDragon.AccessCave) + 1) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.AccessCave, player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.AccessCave) + 1) player:setStorageValue(setting.storage, 1) item:remove(1) return true diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/actions_treasure_chest.lua b/data-otservbr-global/scripts/quests/the_first_dragon/actions_treasure_chest.lua index d40aec690d2..913cb03e7f5 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/actions_treasure_chest.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/actions_treasure_chest.lua @@ -84,26 +84,30 @@ local UniqueTable = { } local treasureChest = Action() + function treasureChest.onUse(player, item, fromPosition, target, toPosition, isHotkey) local setting = UniqueTable[item.uid] if not setting then return false end - if player:getStorageValue(item.uid) >= 1 then - player:sendTextMessage(string.format(MESSAGE_EVENT_ADVANCE, "The %s is empty.", item:getName())) + local storageValue = player:getStorageValue(item.uid) + if storageValue > 0 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The " .. item:getName() .. " is empty.") return true end - if player:getStorageValue(Storage.FirstDragon.ChestCounter) >= 19 then + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.ChestCounter) >= 19 then player:addAchievement("Treasure Hunter") player:addItem(setting.name or setting.itemId, setting.count, true) player:setStorageValue(item.uid, 1) - player:setStorageValue(Storage.FirstDragon.ChestCounter, player:getStorageValue(Storage.FirstDragon.ChestCounter) + 1) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.ChestCounter, player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.ChestCounter) + 1) return true end + player:setStorageValue(item.uid, 1) - player:setStorageValue(Storage.FirstDragon.ChestCounter, player:getStorageValue(Storage.FirstDragon.ChestCounter) + 1) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.ChestCounter, player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.ChestCounter) + 1) + if setting.name then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You found " .. setting.count .. " " .. setting.name .. ".") player:addItem(setting.name, setting.count, true) @@ -119,3 +123,4 @@ for index, value in pairs(UniqueTable) do end treasureChest:register() + diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_death_first_dragon.lua b/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_death_first_dragon.lua index 90a2451066c..c347f907e09 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_death_first_dragon.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_death_first_dragon.lua @@ -25,7 +25,9 @@ function deathFirstDragon.onDeath(creature, corpse, lasthitkiller, mostdamagekil if spec:isPlayer() then spec:teleportTo(Position(33617, 31020, 13)) spec:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - spec:setStorageValue(Storage.FirstDragon.Feathers, 1) + if spec:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.Feathers) < 1 then + spec:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.Feathers, 1) + end end end return true diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_death_somewhat_beatable.lua b/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_death_somewhat_beatable.lua index be0cab0cd7b..13308f03d97 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_death_somewhat_beatable.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_death_somewhat_beatable.lua @@ -6,15 +6,15 @@ function deathSomewhatBeatable.onDeath(creature, target) local spec = spectators[i] if spec:isPlayer() then if creature:getName():lower() == "somewhat beatable" then - if spec:getStorageValue(Storage.FirstDragon.SomewhatBeatable) < 5 then - spec:setStorageValue(Storage.FirstDragon.SomewhatBeatable, spec:getStorageValue(Storage.FirstDragon.SomewhatBeatable) + 1) + if spec:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.SomewhatBeatable) < 5 then + spec:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.SomewhatBeatable, spec:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.SomewhatBeatable) + 1) end end - if spec:getStorageValue(Storage.FirstDragon.SomewhatBeatable) == 5 then + if spec:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.SomewhatBeatable) == 5 then for b = 1, 6 do Game.createMonster("dragon essence", Position(math.random(33609, 33624), math.random(31017, 31028), 14), true, true) end - spec:setStorageValue(Storage.FirstDragon.SomewhatBeatable, 0) + spec:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.SomewhatBeatable, 0) end end end diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_kill_dragon.lua b/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_kill_dragon.lua index 55045c65e9d..af6bef08e29 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_kill_dragon.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/creaturescripts_kill_dragon.lua @@ -2,9 +2,9 @@ local killDragon = CreatureEvent("TheFirstDragonDragonTaskDeath") function killDragon.onDeath(creature, _corpse, _lastHitKiller, mostDamageKiller) onDeathForParty(creature, mostDamageKiller, function(creature, player) - local storage = player:getStorageValue(Storage.FirstDragon.DragonCounter) + local storage = player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.DragonCounter) if storage >= 0 and storage < 200 then - player:setStorageValue(Storage.FirstDragon.DragonCounter, player:getStorageValue(Storage.FirstDragon.DragonCounter) + 1) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.DragonCounter, player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.DragonCounter) + 1) end end) return true diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/movements_entrance_teleport.lua b/data-otservbr-global/scripts/quests/the_first_dragon/movements_entrance_teleport.lua index 9eb046b74f7..8543eff38c5 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/movements_entrance_teleport.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/movements_entrance_teleport.lua @@ -1,7 +1,7 @@ local UniqueTable = { -- Tazhadur entrance [35001] = { - storage = Storage.FirstDragon.DragonCounter, + storage = Storage.Quest.U11_02.TheFirstDragon.DragonCounter, value = 200, range = 10, newPos = { x = 32015, y = 32466, z = 8 }, @@ -10,8 +10,8 @@ local UniqueTable = { }, -- Kalyassa entrance [35002] = { - storage = Storage.FirstDragon.ChestCounter, - value = 5, + storage = Storage.Quest.U11_02.TheFirstDragon.ChestCounter, + value = 4, range = 10, newPos = { x = 32078, y = 32456, z = 8 }, bossName = "Kalyassa", @@ -19,7 +19,7 @@ local UniqueTable = { }, -- Zorvorax entrance [35003] = { - storage = Storage.FirstDragon.SecretsCounter, + storage = Storage.Quest.U11_02.TheFirstDragon.SecretsCounter, value = 3, range = 10, newPos = { x = 32008, y = 32396, z = 8 }, @@ -28,7 +28,7 @@ local UniqueTable = { }, -- Gelidrazah entrance [35004] = { - storage = Storage.FirstDragon.GelidrazahAccess, + storage = Storage.Quest.U11_02.TheFirstDragon.GelidrazahAccess, value = 1, range = 10, newPos = { x = 32076, y = 32402, z = 8 }, @@ -65,7 +65,7 @@ function entranceTeleport.onStepIn(creature, item, position, fromPosition) return true end - if player:getStorageValue(Storage.FirstDragon.Questline) < 1 or player:getStorageValue(setting.storage) < setting.value then + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.Questline) < 1 or player:getStorageValue(setting.storage) < setting.value then player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) player:teleportTo(fromPosition) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/movements_last_teleport.lua b/data-otservbr-global/scripts/quests/the_first_dragon/movements_last_teleport.lua index 310fabe8cd7..11e7b5151b0 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/movements_last_teleport.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/movements_last_teleport.lua @@ -1,27 +1,45 @@ local lastTeleport = MoveEvent() +local function isDateWithinEvent() + local currentDate = os.date("*t") + local startDate = { day = 14, month = 1 } + local endDate = { day = 12, month = 2 } + + if (currentDate.month == startDate.month and currentDate.day >= startDate.day) or + (currentDate.month == endDate.month and currentDate.day <= endDate.day) or + (currentDate.month > startDate.month and currentDate.month < endDate.month) then + return true + end + return false +end + function lastTeleport.onStepIn(creature, item, position, fromPosition) local player = creature:getPlayer() if not player then return end - local setting = UniqueTable[item.uid] - if not setting then + local destination = {x = 33585, y = 30990, z = 14} + + if not isDateWithinEvent() then + player:teleportTo(fromPosition, true) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "This teleport is only available between January 14 and February 12.") + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true end - if player:getStorageValue(Storage.FirstDragon.FirstDragonTimer) < os.time() then + if player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.FirstDragonTimer) < os.time() then position:sendMagicEffect(CONST_ME_TELEPORT) - player:teleportTo(setting.destination) + player:teleportTo(destination) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) else player:teleportTo(fromPosition, true) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have to wait to challenge The First Dragon again!") player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) end + return true end -lastTeleport:uid(24894) +lastTeleport:uid(24889) lastTeleport:register() diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/movements_zorvorax_secrets.lua b/data-otservbr-global/scripts/quests/the_first_dragon/movements_zorvorax_secrets.lua index 16ea14e9fcd..36772967418 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/movements_zorvorax_secrets.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/movements_zorvorax_secrets.lua @@ -1,18 +1,15 @@ local UniqueTable = { [25002] = { - storage = Storage.FirstDragon.DesertTile, - msg = "You enter the beautiful oasis. \ - By visiting this sacred site you're infused with the power of water bringing life to the desert.", + storage = Storage.Quest.U11_02.TheFirstDragon.DesertTile, + msg = "You enter the beautiful oasis. By visiting this sacred site you're infused with the power of water bringing life to the desert.", }, [25003] = { - storage = Storage.FirstDragon.StoneSculptureTile, - msg = "You enter the circle of trees and flowers. \ - By visiting this sacred site you're infused with the power of nature and plants.", + storage = Storage.Quest.U11_02.TheFirstDragon.StoneSculptureTile, + msg = "You enter the circle of trees and flowers. By visiting this sacred site you're infused with the power of nature and plants.", }, [25004] = { - storage = Storage.FirstDragon.SuntowerTile, - msg = "You entered the suntower of Ab'dendriel. \ - By visiting this sacred site you're infused with the power of the life-giving sun.", + storage = Storage.Quest.U11_02.TheFirstDragon.SuntowerTile, + msg = "You entered the suntower of Ab'dendriel. By visiting this sacred site you're infused with the power of the life-giving sun.", }, } @@ -31,7 +28,7 @@ function zorvoraxSecrets.onStepIn(creature, item, position, fromPosition) if player:getStorageValue(setting.storage) < 1 then player:setStorageValue(setting.storage, 1) - player:setStorageValue(Storage.FirstDragon.SecretsCounter, player:getStorageValue(Storage.FirstDragon.SecretsCounter) + 1) + player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.SecretsCounter, player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.SecretsCounter) + 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, setting.msg) return true end diff --git a/data-otservbr-global/startup/tables/item.lua b/data-otservbr-global/startup/tables/item.lua index ed01d30aeed..6fa23fb8bd9 100644 --- a/data-otservbr-global/startup/tables/item.lua +++ b/data-otservbr-global/startup/tables/item.lua @@ -1623,6 +1623,11 @@ ItemUnique = { itemId = 2576, itemPos = { x = 32455, y = 31166, z = 12 }, }, + -- The First Dragon + [1066] = { + itemId = 3657, + itemPos = { x = 33608, y = 31022, z = 14 }, + }, -- The Pits of Inferno Quest [2000] = { itemId = 599, diff --git a/data-otservbr-global/startup/tables/teleport.lua b/data-otservbr-global/startup/tables/teleport.lua index 367dc51ba4e..b32575f117d 100644 --- a/data-otservbr-global/startup/tables/teleport.lua +++ b/data-otservbr-global/startup/tables/teleport.lua @@ -34,6 +34,11 @@ TeleportUnique = { }, -- The first dragon quest -- Path: data\scripts\movements\quests\first_dragon\entrance_teleport.lua + -- Boss First Dragon + [24889] = { + itemId = 1949, + itemPos = { x = 33597, y = 30996, z = 14 }, + }, -- Tazhadur entrance [35001] = { itemId = 8649, diff --git a/data-otservbr-global/startup/tables/tile.lua b/data-otservbr-global/startup/tables/tile.lua index 546bc66ef65..59d9d3be69f 100644 --- a/data-otservbr-global/startup/tables/tile.lua +++ b/data-otservbr-global/startup/tables/tile.lua @@ -54,6 +54,7 @@ TileAction = { { x = 32696, y = 31720, z = 7 }, { x = 32697, y = 31720, z = 7 }, { x = 32698, y = 31720, z = 7 }, + { x = 32691, y = 31724, z = 7 }, }, }, --Dawnport diff --git a/data-otservbr-global/world/otservbr-npc.xml b/data-otservbr-global/world/otservbr-npc.xml index 5a475b8999d..5c53601aa9c 100644 --- a/data-otservbr-global/world/otservbr-npc.xml +++ b/data-otservbr-global/world/otservbr-npc.xml @@ -2818,6 +2818,9 @@ + + + From 1681bbf0c234b60f3fa715de40646ca930b53235 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 3 Oct 2024 22:01:35 +0000 Subject: [PATCH 06/70] Lua code format - (Stylua) --- data-otservbr-global/npc/tamoril.lua | 4 +--- data-otservbr-global/npc/the_first_dragon.lua | 1 - .../scripts/quests/the_first_dragon/actions_lever.lua | 2 +- .../scripts/quests/the_first_dragon/actions_rewards.lua | 3 --- .../quests/the_first_dragon/actions_treasure_chest.lua | 1 - .../quests/the_first_dragon/movements_last_teleport.lua | 6 ++---- 6 files changed, 4 insertions(+), 13 deletions(-) diff --git a/data-otservbr-global/npc/tamoril.lua b/data-otservbr-global/npc/tamoril.lua index 166b4b01b50..e6ed393420f 100644 --- a/data-otservbr-global/npc/tamoril.lua +++ b/data-otservbr-global/npc/tamoril.lua @@ -47,9 +47,7 @@ local function isDateWithinEvent() local startDate = { day = 14, month = 1 } local endDate = { day = 12, month = 2 } - if (currentDate.month == startDate.month and currentDate.day >= startDate.day) or - (currentDate.month == endDate.month and currentDate.day <= endDate.day) or - (currentDate.month > startDate.month and currentDate.month < endDate.month) then + if (currentDate.month == startDate.month and currentDate.day >= startDate.day) or (currentDate.month == endDate.month and currentDate.day <= endDate.day) or (currentDate.month > startDate.month and currentDate.month < endDate.month) then return true end return false diff --git a/data-otservbr-global/npc/the_first_dragon.lua b/data-otservbr-global/npc/the_first_dragon.lua index 4892f5800bf..ec3ba95d004 100644 --- a/data-otservbr-global/npc/the_first_dragon.lua +++ b/data-otservbr-global/npc/the_first_dragon.lua @@ -146,7 +146,6 @@ local function creatureSayCallback(npc, creature, type, message) return true end - npcHandler:setMessage(MESSAGE_GREET, "Hello, my sparring buddy. We should have another fight sometimes. I think you may have earned a little reward.") keywordHandler:addKeyword({ "times" }, StdModule.say, { npcHandler = npcHandler, text = "Times have changed . In the past dragons were feared and respected. Only the {demons} rivalled our notoriety." }) diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua b/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua index ca975b2433c..698ada382b2 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua @@ -61,7 +61,7 @@ local config = { clearArea = { from = Position(33566, 31006, 14), to = Position(33626, 31032, 14), - } + }, } local function clearMonstersInArea(fromPos, toPos) diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/actions_rewards.lua b/data-otservbr-global/scripts/quests/the_first_dragon/actions_rewards.lua index 5b58b23dd13..bbef9b99c1b 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/actions_rewards.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/actions_rewards.lua @@ -49,7 +49,6 @@ function finalReward.onUse(player, item, fromPosition, target, toPosition, isHot player:addItem(setting.name, setting.count, true) player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.RewardMask, os.time() + 60 * 60 * 24 * 5) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You found " .. setting.count .. " " .. setting.name .. ".") - elseif item.uid == 14022 and player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.RewardBackpack) < os.time() then local bp = Game.createItem("Backpack", 1) if bp then @@ -64,12 +63,10 @@ function finalReward.onUse(player, item, fromPosition, target, toPosition, isHot end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You found a backpack.") player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.RewardBackpack, os.time() + 60 * 60 * 24 * 365) - elseif item.uid == 14023 and player:getStorageValue(Storage.Quest.U11_02.TheFirstDragon.RewardFeather) < os.time() then player:addItem(setting.name, setting.count, true) player:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.RewardFeather, os.time() + 24 * 3600) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You found " .. setting.count .. " " .. setting.name .. ".") - else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The chest is empty.") end diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/actions_treasure_chest.lua b/data-otservbr-global/scripts/quests/the_first_dragon/actions_treasure_chest.lua index 913cb03e7f5..edbcba3184f 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/actions_treasure_chest.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/actions_treasure_chest.lua @@ -123,4 +123,3 @@ for index, value in pairs(UniqueTable) do end treasureChest:register() - diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/movements_last_teleport.lua b/data-otservbr-global/scripts/quests/the_first_dragon/movements_last_teleport.lua index 11e7b5151b0..80509399d64 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/movements_last_teleport.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/movements_last_teleport.lua @@ -5,9 +5,7 @@ local function isDateWithinEvent() local startDate = { day = 14, month = 1 } local endDate = { day = 12, month = 2 } - if (currentDate.month == startDate.month and currentDate.day >= startDate.day) or - (currentDate.month == endDate.month and currentDate.day <= endDate.day) or - (currentDate.month > startDate.month and currentDate.month < endDate.month) then + if (currentDate.month == startDate.month and currentDate.day >= startDate.day) or (currentDate.month == endDate.month and currentDate.day <= endDate.day) or (currentDate.month > startDate.month and currentDate.month < endDate.month) then return true end return false @@ -19,7 +17,7 @@ function lastTeleport.onStepIn(creature, item, position, fromPosition) return end - local destination = {x = 33585, y = 30990, z = 14} + local destination = { x = 33585, y = 30990, z = 14 } if not isDateWithinEvent() then player:teleportTo(fromPosition, true) From 0460de4fa561cdcb9e60a6e880aa868892dd1048 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Fri, 4 Oct 2024 16:58:25 -0300 Subject: [PATCH 07/70] More Fix: ferumbras Ascendant Quest - review 10 --- .../quests/ferumbras_ascension/actions_ferumbras_lever.lua | 3 --- .../scripts/quests/ferumbras_ascension/actions_mazoran.lua | 3 --- .../scripts/quests/ferumbras_ascension/actions_plagirath.lua | 3 --- .../scripts/quests/ferumbras_ascension/actions_ragiaz.lua | 3 --- .../scripts/quests/ferumbras_ascension/actions_razzagorn.lua | 3 --- .../scripts/quests/ferumbras_ascension/actions_shulgrax.lua | 3 --- .../scripts/quests/ferumbras_ascension/actions_tarbaz.lua | 3 --- .../scripts/quests/ferumbras_ascension/actions_zamulosh.lua | 3 --- 8 files changed, 24 deletions(-) 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 d471d327ad2..80c82795673 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 @@ -24,10 +24,7 @@ function leverFerumbras.onUse(player, item, fromPosition, target, toPosition, is local remainingTime = cooldownTime - os.time() local hours = math.floor(remainingTime / 3600) local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - player:teleportTo(fromPosition) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true end 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 374c1a552b8..eb5af2bf600 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua @@ -26,10 +26,7 @@ function leverMazoran.onUse(player, item, fromPosition, target, toPosition, isHo local remainingTime = cooldownTime - os.time() local hours = math.floor(remainingTime / 3600) local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - player:teleportTo(fromPosition) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true end 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 0c3ee57fd09..464456789bf 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua @@ -26,10 +26,7 @@ function leverPlagirath.onUse(player, item, fromPosition, target, toPosition, is local remainingTime = cooldownTime - os.time() local hours = math.floor(remainingTime / 3600) local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - player:teleportTo(fromPosition) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true end 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 4f6f9169c26..43090f60872 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua @@ -33,10 +33,7 @@ function leverRagiaz.onUse(player, item, fromPosition, target, toPosition, isHot local remainingTime = cooldownTime - os.time() local hours = math.floor(remainingTime / 3600) local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - player:teleportTo(fromPosition) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true end 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 c33f393d8a7..0c4e05c00d4 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua @@ -26,10 +26,7 @@ function leverRazzagorn.onUse(player, item, fromPosition, target, toPosition, is local remainingTime = cooldownTime - os.time() local hours = math.floor(remainingTime / 3600) local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - player:teleportTo(fromPosition) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true end 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 e06741eca74..4cacf93bfd5 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua @@ -26,10 +26,7 @@ function leverShulgrax.onUse(player, item, fromPosition, target, toPosition, isH local remainingTime = cooldownTime - os.time() local hours = math.floor(remainingTime / 3600) local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - player:teleportTo(fromPosition) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true end 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 7bd0a99d264..a06c47b70e9 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua @@ -26,10 +26,7 @@ function leverTarbaz.onUse(player, item, fromPosition, target, toPosition, isHot local remainingTime = cooldownTime - os.time() local hours = math.floor(remainingTime / 3600) local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - player:teleportTo(fromPosition) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true end 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 0b16ec9a17e..3e1f0c7d16b 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua @@ -34,10 +34,7 @@ function leverZamulosh.onUse(player, item, fromPosition, target, toPosition, isH local remainingTime = cooldownTime - os.time() local hours = math.floor(remainingTime / 3600) local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - player:teleportTo(fromPosition) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true end From 977f8b513ebf7c61f026847688352a7a82817ca4 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Sat, 5 Oct 2024 06:56:59 -0300 Subject: [PATCH 08/70] Fix Bosslever system Before only a normal player could pull a lever and go to the boss room even though that wasn't the minimum requirement. --- data/libs/functions/boss_lever.lua | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/data/libs/functions/boss_lever.lua b/data/libs/functions/boss_lever.lua index 9cd577ee911..496fc211802 100644 --- a/data/libs/functions/boss_lever.lua +++ b/data/libs/functions/boss_lever.lua @@ -146,11 +146,23 @@ end function BossLever:onUse(player) local monsterName = MonsterType(self.name):getName() local isParticipant = false - for _, v in ipairs(self.playerPositions) do - if Position(v.pos) == player:getPosition() then + local players = {} + + for i = 1, #self.playerPositions do + local pos = self.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() + + if not creature or not creature:isPlayer() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need " .. #self.playerPositions .. " players to challenge " .. self.name .. ".") + return true + end + + if pos == player:getPosition() then isParticipant = true end - end + + table.insert(players, creature) + end if not isParticipant then return false end From a1be8af0e35e7003006b55acb408f8ce5cd843c3 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Sat, 5 Oct 2024 09:57:38 +0000 Subject: [PATCH 09/70] Lua code format - (Stylua) --- data/libs/functions/boss_lever.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/data/libs/functions/boss_lever.lua b/data/libs/functions/boss_lever.lua index 496fc211802..821587a59d5 100644 --- a/data/libs/functions/boss_lever.lua +++ b/data/libs/functions/boss_lever.lua @@ -146,23 +146,23 @@ end function BossLever:onUse(player) local monsterName = MonsterType(self.name):getName() local isParticipant = false - local players = {} + local players = {} - for i = 1, #self.playerPositions do - local pos = self.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() + for i = 1, #self.playerPositions do + local pos = self.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() - if not creature or not creature:isPlayer() then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need " .. #self.playerPositions .. " players to challenge " .. self.name .. ".") - return true - end + if not creature or not creature:isPlayer() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need " .. #self.playerPositions .. " players to challenge " .. self.name .. ".") + return true + end - if pos == player:getPosition() then + if pos == player:getPosition() then isParticipant = true end - table.insert(players, creature) - end + table.insert(players, creature) + end if not isParticipant then return false end From 77eec06f40691a88a7db65d035bf676773372dbd Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Sat, 5 Oct 2024 07:40:57 -0300 Subject: [PATCH 10/70] More Fix: ferumbras Ascendant Quest - review 10 I'm testing more possibilities. --- .../ferumbras_ascension/actions_mazoran.lua | 83 ++++++++++--------- .../ferumbras_ascension/actions_plagirath.lua | 80 ++++++++++-------- .../ferumbras_ascension/actions_ragiaz.lua | 80 ++++++++++-------- .../ferumbras_ascension/actions_razzagorn.lua | 80 ++++++++++-------- .../ferumbras_ascension/actions_shulgrax.lua | 80 ++++++++++-------- .../ferumbras_ascension/actions_tarbaz.lua | 80 ++++++++++-------- .../ferumbras_ascension/actions_zamulosh.lua | 80 ++++++++++-------- 7 files changed, 308 insertions(+), 255 deletions(-) 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 eb5af2bf600..187f8aad7de 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua @@ -21,51 +21,56 @@ local config = { local leverMazoran = Action() function leverMazoran.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local cooldownTime = player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.MazoranTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - 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 + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() - 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 not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + 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 cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.MazoranTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + 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 + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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 addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) 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 464456789bf..fa4ea143b55 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua @@ -21,46 +21,54 @@ local config = { local leverPlagirath = Action() function leverPlagirath.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local cooldownTime = player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.PlagirathTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - 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 + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() - 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 not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + 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 cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.PlagirathTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + 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 + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) 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 43090f60872..fbcc2e8a681 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua @@ -28,46 +28,54 @@ local config = { local leverRagiaz = Action() function leverRagiaz.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local cooldownTime = player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.RagiazTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - 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 + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() - 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 not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + 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 cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.RagiazTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + 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 + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) 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 0c4e05c00d4..1af68f32d63 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua @@ -21,46 +21,54 @@ local config = { local leverRazzagorn = Action() function leverRazzagorn.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local cooldownTime = player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.RazzagornTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - 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 + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() - 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 not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + 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 cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.RazzagornTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + 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 + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) 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 4cacf93bfd5..7e77e016fdf 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua @@ -21,46 +21,54 @@ local config = { local leverShulgrax = Action() function leverShulgrax.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local cooldownTime = player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ShulgraxTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - 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 + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() - 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 not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + 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 cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ShulgraxTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + 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 + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) 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 a06c47b70e9..99cbb30f6eb 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua @@ -21,46 +21,54 @@ local config = { local leverTarbaz = Action() function leverTarbaz.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local cooldownTime = player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TarbazTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - 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 + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() - 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 not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + 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 cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TarbazTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + 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 + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) 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 3e1f0c7d16b..86ef0384906 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua @@ -29,46 +29,54 @@ local config = { local leverZamulosh = Action() function leverZamulosh.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local cooldownTime = player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - 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 + for i = 1, #config.playerPositions do + local pos = config.playerPositions[i].pos + local creature = Tile(pos):getTopCreature() - 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 not creature or not creature:isPlayer() then + player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") + 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 cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + 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 + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) From 57b250dc0b5ad8641fcf1dca26668a0007e8d555 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Sat, 5 Oct 2024 10:41:38 +0000 Subject: [PATCH 11/70] Lua code format - (Stylua) --- .../ferumbras_ascension/actions_mazoran.lua | 96 +++++++++---------- .../ferumbras_ascension/actions_plagirath.lua | 96 +++++++++---------- .../ferumbras_ascension/actions_ragiaz.lua | 96 +++++++++---------- .../ferumbras_ascension/actions_razzagorn.lua | 96 +++++++++---------- .../ferumbras_ascension/actions_shulgrax.lua | 96 +++++++++---------- .../ferumbras_ascension/actions_tarbaz.lua | 96 +++++++++---------- .../ferumbras_ascension/actions_zamulosh.lua | 96 +++++++++---------- 7 files changed, 336 insertions(+), 336 deletions(-) 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 187f8aad7de..7edf91121fd 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua @@ -21,54 +21,54 @@ local config = { local leverMazoran = Action() function leverMazoran.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.MazoranTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - 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 - - 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 players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.MazoranTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) 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 fa4ea143b55..a3ed6fd05d3 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua @@ -21,54 +21,54 @@ local config = { local leverPlagirath = Action() function leverPlagirath.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.PlagirathTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - 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 - - 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 players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.PlagirathTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) 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 fbcc2e8a681..e23cf2889f2 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua @@ -28,54 +28,54 @@ local config = { local leverRagiaz = Action() function leverRagiaz.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.RagiazTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - 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 - - 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 players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.RagiazTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) 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 1af68f32d63..6083111c026 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua @@ -21,54 +21,54 @@ local config = { local leverRazzagorn = Action() function leverRazzagorn.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.RazzagornTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - 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 - - 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 players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.RazzagornTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) 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 7e77e016fdf..61f7bc205ec 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua @@ -21,54 +21,54 @@ local config = { local leverShulgrax = Action() function leverShulgrax.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ShulgraxTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - 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 - - 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 players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ShulgraxTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) 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 99cbb30f6eb..fbfc4574903 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua @@ -21,54 +21,54 @@ local config = { local leverTarbaz = Action() function leverTarbaz.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TarbazTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - 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 - - 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 players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TarbazTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) 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 86ef0384906..8ba9fe077b0 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua @@ -29,54 +29,54 @@ local config = { local leverZamulosh = Action() function leverZamulosh.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - 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 - - 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 players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTime) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) From 7e83fd9ebd199485f15a131909073e4bd963aeb4 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Mon, 7 Oct 2024 10:06:15 -0300 Subject: [PATCH 12/70] Forgotten Knowledge Quest --- data-otservbr-global/lib/core/quests.lua | 16 +- data-otservbr-global/lib/core/storages.lua | 88 +++++------ data-otservbr-global/npc/a_dragon_mother.lua | 12 +- .../npc/a_strange_chalice.lua | 10 +- .../npc/a_weakened_forest_fury.lua | 58 ++++--- data-otservbr-global/npc/albinius.lua | 77 ++++------ data-otservbr-global/npc/ivalisse.lua | 123 +++++++-------- .../bosses_levers/dragonking_zyrtarch.lua | 30 ---- .../actions/bosses_levers/lady_tenebris.lua | 28 ---- .../scripts/actions/bosses_levers/lloyd.lua | 29 ---- .../bosses_levers/melting_frozen_horror.lua | 34 ---- .../bosses_levers/the_last_lore_keeper.lua | 44 ------ .../bosses_levers/the_thorn_knight.lua | 30 ---- .../bosses_levers/the_time_guardian.lua | 27 ---- .../actions/object/imbuement_shrine.lua | 2 +- .../creaturescripts/customs/freequests.lua | 32 ++-- .../forgotten_knowledge/actions_bird_cage.lua | 6 +- .../actions_dragonking_zyrtarch.lua | 130 ++++++++++++++++ .../forgotten_knowledge/actions_fount.lua | 4 +- .../actions_frozen_horror.lua | 145 ++++++++++++++++++ .../actions_girl_picture.lua | 4 +- .../actions_lady_tenebris.lua | 129 ++++++++++++++++ .../forgotten_knowledge/actions_lloyd.lua | 129 ++++++++++++++++ .../forgotten_knowledge/actions_old_desk.lua | 10 +- .../forgotten_knowledge/actions_plant.lua | 14 +- .../actions_secret_wall.lua | 2 +- .../actions_servants_mechanism.lua | 8 +- .../actions_the_last_lore_keeper.lua | 143 +++++++++++++++++ .../actions_the_thorn_knight.lua | 129 ++++++++++++++++ .../actions_the_time_guardian.lua | 128 ++++++++++++++++ .../actions_time_machine.lua | 1 + .../creaturescripts_astral_source.lua | 4 +- .../creaturescripts_bosses_kill.lua | 29 ++-- .../creaturescripts_bound_astral_power.lua | 10 +- .../creaturescripts_distorted_source.lua | 4 +- .../creaturescripts_energy_prism_death.lua | 2 +- .../creaturescripts_lloyd_preparedeath.lua | 2 +- .../creaturescripts_replica_servants.lua | 10 +- .../movements_challenger.lua | 2 +- .../movements_entrance_teleport.lua | 45 +++--- .../forgotten_knowledge/movements_fount.lua | 2 +- .../movements_ice_teleport.lua | 2 +- .../movements_lava_teleport.lua | 2 +- .../movements_servant_teleport.lua | 2 +- .../movements_teleport_tree.lua | 2 +- .../iron_servant_transformation.lua | 6 +- data-otservbr-global/startup/tables/chest.lua | 25 +++ data-otservbr-global/startup/tables/item.lua | 13 ++ data-otservbr-global/startup/tables/lever.lua | 13 ++ .../startup/tables/teleport.lua | 21 +++ .../startup/tables/teleport_item.lua | 82 +++++++++- 51 files changed, 1369 insertions(+), 531 deletions(-) delete mode 100644 data-otservbr-global/scripts/actions/bosses_levers/dragonking_zyrtarch.lua delete mode 100644 data-otservbr-global/scripts/actions/bosses_levers/lady_tenebris.lua delete mode 100644 data-otservbr-global/scripts/actions/bosses_levers/lloyd.lua delete mode 100644 data-otservbr-global/scripts/actions/bosses_levers/melting_frozen_horror.lua delete mode 100644 data-otservbr-global/scripts/actions/bosses_levers/the_last_lore_keeper.lua delete mode 100644 data-otservbr-global/scripts/actions/bosses_levers/the_thorn_knight.lua delete mode 100644 data-otservbr-global/scripts/actions/bosses_levers/the_time_guardian.lua create mode 100644 data-otservbr-global/scripts/quests/forgotten_knowledge/actions_dragonking_zyrtarch.lua create mode 100644 data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua create mode 100644 data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lady_tenebris.lua create mode 100644 data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lloyd.lua create mode 100644 data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_last_lore_keeper.lua create mode 100644 data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_thorn_knight.lua create mode 100644 data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua diff --git a/data-otservbr-global/lib/core/quests.lua b/data-otservbr-global/lib/core/quests.lua index 741702b68b5..711b3f19eb1 100644 --- a/data-otservbr-global/lib/core/quests.lua +++ b/data-otservbr-global/lib/core/quests.lua @@ -5169,12 +5169,12 @@ if not Quests then }, [36] = { name = "Forgotten Knowledge", - startStorageId = Storage.ForgottenKnowledge.Tomes, + startStorageId = Storage.Quest.U11_02.ForgottenKnowledge.Tomes, startStorageValue = 1, missions = { [1] = { name = "Circle of the Black Sphinx", - storageId = Storage.ForgottenKnowledge.LadyTenebrisKilled, + storageId = Storage.Quest.U11_02.ForgottenKnowledge.LadyTenebrisKilled, missionId = 10361, startValue = 0, endValue = 1522018605, @@ -5184,7 +5184,7 @@ if not Quests then }, [2] = { name = "Bane of the Cosmic Force", - storageId = Storage.ForgottenKnowledge.LloydKilled, + storageId = Storage.Quest.U11_02.ForgottenKnowledge.LloydKilled, missionId = 10362, startValue = 0, endValue = 1522018605, @@ -5195,7 +5195,7 @@ if not Quests then }, [3] = { name = "The Desecrated Glade", - storageId = Storage.ForgottenKnowledge.ThornKnightKilled, + storageId = Storage.Quest.U11_02.ForgottenKnowledge.ThornKnightKilled, missionId = 10363, startValue = 0, endValue = 1522018605, @@ -5206,7 +5206,7 @@ if not Quests then }, [4] = { name = "The Unwary Mage", - storageId = Storage.ForgottenKnowledge.DragonkingKilled, + storageId = Storage.Quest.U11_02.ForgottenKnowledge.DragonkingKilled, missionId = 10364, startValue = 0, endValue = 1522018605, @@ -5217,7 +5217,7 @@ if not Quests then }, [5] = { name = "Dragon in Distress", - storageId = Storage.ForgottenKnowledge.HorrorKilled, + storageId = Storage.Quest.U11_02.ForgottenKnowledge.HorrorKilled, missionId = 10365, startValue = 0, endValue = 1522018605, @@ -5227,7 +5227,7 @@ if not Quests then }, [6] = { name = "Time is a Window", - storageId = Storage.ForgottenKnowledge.TimeGuardianKilled, + storageId = Storage.Quest.U11_02.ForgottenKnowledge.TimeGuardianKilled, missionId = 10366, startValue = 0, endValue = 1522018605, @@ -5238,7 +5238,7 @@ if not Quests then }, [7] = { name = "Final Fight", - storageId = Storage.ForgottenKnowledge.LastLoreKilled, + storageId = Storage.Quest.U11_02.ForgottenKnowledge.LastLoreKilled, missionId = 10367, startValue = 0, endValue = 1522018605, diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index f4b3fccb11d..75ec195c7b7 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -403,41 +403,6 @@ Storage = { AccessTeleport2 = 50405, AccessTeleport3 = 50406, }, - ForgottenKnowledge = { - -- Reserved storage from 50470 - 50519 - AccessDeath = 50470, - AccessViolet = 50471, - AccessEarth = 50472, - AccessFire = 50473, - AccessIce = 50474, - AccessGolden = 50475, - AccessLast = 50476, - OldDesk = 50477, - GirlPicture = 50478, - SilverKey = 50479, - Phial = 50480, - BirdCounter = 50481, - PlantCounter = 50482, - GoldenServantCounter = 50483, - DiamondServantCounter = 50484, - AccessPortals = 50485, - AccessMachine = 50486, - LadyTenebrisKilled = 50488, - LloydKilled = 50490, - ThornKnightKilled = 50492, - DragonkingKilled = 50494, - HorrorKilled = 50496, - TimeGuardianKilled = 50498, - LastLoreKilled = 50501, - BirdCage = 50502, - AccessLavaTeleport = 50503, - Ivalisse = 50504, - Chalice = 50505, - Tomes = 50506, - BabyDragon = 50507, - SpiderWeb = 50508, - LloydEvent = 50509, - }, SweetyCyclops = { -- Reserved storage from 50520 - 50529 AmuletTimer = 50520, @@ -2526,7 +2491,47 @@ Storage = { RewardBackpack = 45470, Feathers = 45471, }, - ForgottenKnowledge = {}, + ForgottenKnowledge = { + AccessDeath = 45472, + AccessViolet = 45473, + AccessEarth = 45474, + AccessFire = 45475, + AccessIce = 45476, + AccessGolden = 45477, + AccessLast = 45478, + OldDesk = 45479, + GirlPicture = 45480, + SilverKey = 45481, + Phial = 45482, + BirdCounter = 45483, + PlantCounter = 45484, + GoldenServantCounter = 45485, + DiamondServantCounter = 45486, + AccessPortals = 45487, + AccessMachine = 45488, + LadyTenebrisKilled = 45489, + LloydKilled = 45490, + ThornKnightKilled = 45491, + DragonkingKilled = 45492, + HorrorKilled = 45493, + TimeGuardianKilled = 45494, + LastLoreKilled = 45495, + BirdCage = 45496, + AccessLavaTeleport = 45497, + Ivalisse = 45498, + Chalice = 45499, + Tomes = 45500, + BabyDragon = 45501, + SpiderWeb = 45502, + LloydEvent = 45503, + ActiveTree = 45504, + MechanismGolden = 45505, + MechanismDiamond = 45506, + GoldenServant = 45507, + DiamondServant = 45508, + AstralPowerCounter = 45509, + AstralGlyph = 45510, + }, }, U11_40 = { -- update 11.40 - Reserved Storages 45651 - 45850 CultsOfTibia = {}, -- 45651 - 45750 @@ -2826,7 +2831,6 @@ GlobalStorage = { Chance = 60020, Active = 60021, }, - HeroRathleton = { -- Reserved storage from 60070 - 60089 FirstMachines = 60070, @@ -2844,16 +2848,6 @@ GlobalStorage = { LavaChange = 60082, FastWay = 24867, }, - ForgottenKnowledge = { - -- Reserved storage from 60090 - 60099 - ActiveTree = 60090, - MechanismGolden = 60091, - MechanismDiamond = 60092, - GoldenServant = 60093, - DiamondServant = 60094, - AstralPowerCounter = 60095, - AstralGlyph = 60096, - }, TheOrderOfTheLion = { -- Reserved storage from 60170 - 60171 Drume = { diff --git a/data-otservbr-global/npc/a_dragon_mother.lua b/data-otservbr-global/npc/a_dragon_mother.lua index ec4653828c6..cfb788c6902 100644 --- a/data-otservbr-global/npc/a_dragon_mother.lua +++ b/data-otservbr-global/npc/a_dragon_mother.lua @@ -54,16 +54,16 @@ local function greetCallback(npc, creature) local player = Player(creature) local playerId = player:getId() - if player:getStorageValue(Storage.ForgottenKnowledge.BabyDragon) < 1 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.BabyDragon) < 1 then npcHandler:setMessage(MESSAGE_GREET, "Greetings humans! Consider yourselfs lucky, I'm in need of {help}.") npcHandler:setTopic(playerId, 1) return true - elseif player:getStorageValue(Storage.ForgottenKnowledge.AccessMachine) == 1 then + elseif player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessMachine) == 1 then npcHandler:setMessage(MESSAGE_GREET, "Grrr.") return true - elseif player:getStorageValue(Storage.ForgottenKnowledge.HorrorKilled) >= 1 then + elseif player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.HorrorKilled) >= 1 then npcHandler:setMessage(MESSAGE_GREET, "You have done me a favour and the knowledge you are seeking shall be yours. I melted the ice for you, you can pass now.") - player:setStorageValue(Storage.ForgottenKnowledge.AccessMachine, 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessMachine, 1) end return true end @@ -95,7 +95,7 @@ local function creatureSayCallback(npc, creature, type, message) "So return to the upper tunnels where cultists and ice golems dwell. Somewhere in these tunnels you will find a small prison haunted by a ghost. South of this prison cell there is a tunnel that will lead you eastwards. ...", "Follow the tunnel until you reach a small cave. Step down and down until you see a blue energy field. It will lead you to my egg. It is sealed so that not everyone may enter the room. But you have the permission now.", }, npc, creature) - player:setStorageValue(Storage.ForgottenKnowledge.BabyDragon, 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.BabyDragon, 1) npcHandler:setTopic(playerId, 4) end elseif MsgContains(message, "no") then @@ -113,7 +113,7 @@ local function creatureSayCallback(npc, creature, type, message) "As I told you, fiendish ice creatures dragged my egg into the lower caves. ...", " Without enough heat the egg will die soon. Venture there and save my hatchling and the knowledge you seeek shall be yours!", }, npc, creature) - player:setStorageValue(Storage.ForgottenKnowledge.BabyDragon, 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.BabyDragon, 1) end end return true diff --git a/data-otservbr-global/npc/a_strange_chalice.lua b/data-otservbr-global/npc/a_strange_chalice.lua index 4b1c8f1d701..c0523cb09e3 100644 --- a/data-otservbr-global/npc/a_strange_chalice.lua +++ b/data-otservbr-global/npc/a_strange_chalice.lua @@ -57,10 +57,8 @@ local function creatureSayCallback(npc, creature, type, message) return false end - if MsgContains(message, "chalice") and player:getStorageValue(Storage.ForgottenKnowledge.Chalice) == 1 then - npcHandler:say({ - "Finally. That's what I... oh wait, you're still talking to me - you will blow my cover! What do you want? Oh wait, did my {daughter} send you? It has been some time now, indeed.", - }, npc, creature) + if MsgContains(message, "chalice") and player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Chalice) == 1 then + npcHandler:say("Finally. That's what I... oh wait, you're still talking to me - you will blow my cover! What do you want? Oh wait, did my {daughter} send you? It has been some time now, indeed.", npc, creature) npcHandler:setTopic(playerId, 1) end @@ -111,11 +109,13 @@ local function creatureSayCallback(npc, creature, type, message) " I already know how to enter it, you need to step in and yell 'zzubaran'. Unfortunately they never took me with them. ...", " I heard them say it once, when a seemingly drunk guard yelled it in front of a wall mounted torch, hitting his head against it afterwards. He spilt all my contents on the floor, hmpf.", }, npc, creature) - player:setStorageValue(Storage.ForgottenKnowledge.AccessLavaTeleport, 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessLavaTeleport, 1) end return true end +npcHandler:setMessage(MESSAGE_GREET, "Hi? What do you mean 'hi' - can't you see I am a... I have to lower my voice. Did it occur to you, that this 'chalice' does not want to be disturbed?! Leave me alone!") + npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true) diff --git a/data-otservbr-global/npc/a_weakened_forest_fury.lua b/data-otservbr-global/npc/a_weakened_forest_fury.lua index 1d9a8a4ccdc..3bd1cdc49f2 100644 --- a/data-otservbr-global/npc/a_weakened_forest_fury.lua +++ b/data-otservbr-global/npc/a_weakened_forest_fury.lua @@ -50,13 +50,6 @@ npcType.onCloseChannel = function(npc, creature) npcHandler:onCloseChannel(npc, creature) end --- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions! -keywordHandler:addKeyword({ "name" }, StdModule.say, { npcHandler = npcHandler, text = " My name is now known only to the wind and it shall remain like this until I will return to my kin." }) -keywordHandler:addKeyword({ "job" }, StdModule.say, { npcHandler = npcHandler, text = "I was a guardian of this glade. I am the last one... everyone had to leave." }) -keywordHandler:addKeyword({ "time" }, StdModule.say, { npcHandler = npcHandler, text = "This glade's time is growing short if nothing will be done soon." }) -keywordHandler:addKeyword({ "forest fury" }, StdModule.say, { npcHandler = npcHandler, text = "Take care, guardian." }) -keywordHandler:addKeyword({ "orclops" }, StdModule.say, { npcHandler = npcHandler, text = "Cruel beings. Large and monstrous, with a single eye, staring at their prey. " }) - local function creatureSayCallback(npc, creature, type, message) local player = Player(creature) local playerId = player:getId() @@ -81,59 +74,62 @@ local function creatureSayCallback(npc, creature, type, message) "Indeed, you will. Take one of these cages, which have been crafted generations ago to rob a creature of its freedom for that it may earn it again truthfully. Return the birds back to their home in the glade. ...", "You will find {phials} for water near this sacred well which will take you safely to the glade. No seeds are left, they are in the hands of the intruders now. Have faith in yourself, guardian.", }, npc, creature) - player:setStorageValue(Storage.ForgottenKnowledge.BirdCage, 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.BirdCage, 1) player:addItem(23812, 1) + npcHandler:setTopic(playerId, 0) end elseif MsgContains(message, "seeds") then if npcHandler:getTopic(playerId) == 1 then - npcHandler:say({ - "Seeds to give life to strong trees, blooming and proud. The {intruders} robbed us from them.", - }, npc, creature) + npcHandler:say("Seeds to give life to strong trees, blooming and proud. The {intruders} robbed us from them.", npc, creature) + npcHandler:setTopic(playerId, 0) end elseif MsgContains(message, "intruders") then if npcHandler:getTopic(playerId) == 1 then - npcHandler:say({ - "The intruders appeared in the blink of an eye. Out of thin air, as if they came from nowhere. They overrun the glade within ours and drove away what was remaining from us within the day.", - }, npc, creature) + npcHandler:say("The intruders appeared in the blink of an eye. Out of thin air, as if they came from nowhere. They overrun the glade within ours and drove away what was remaining from us within the day.", npc, creature) + npcHandler:setTopic(playerId, 0) end elseif MsgContains(message, "water") then if npcHandler:getTopic(playerId) == 1 then - npcHandler:say({ - "The purest water flows through this well. For centuries we concealed it, for other beings to not lay their eyes on it.", - }, npc, creature) + npcHandler:say("The purest water flows through this well. For centuries we concealed it, for other beings to not lay their eyes on it.", npc, creature) + npcHandler:setTopic(playerId, 0) end elseif MsgContains(message, "birds") then if npcHandler:getTopic(playerId) == 1 then - npcHandler:say({ - "Take care, guardian.", - }, npc, creature) + npcHandler:say("Take care, guardian.", npc, creature) + npcHandler:setTopic(playerId, 0) end elseif MsgContains(message, "phials") then if npcHandler:getTopic(playerId) == 1 then - npcHandler:say({ - "Phials for the purest water from our sacred well. They are finely crafted and very fragile. We keep a small supply up here around the well. Probably the only thing the intruders did not care for.", - }, npc, creature) + npcHandler:say("Phials for the purest water from our sacred well. They are finely crafted and very fragile. We keep a small supply up here around the well. Probably the only thing the intruders did not care for.", npc, creature) + npcHandler:setTopic(playerId, 0) end - end - if MsgContains(message, "cages") and player:getStorageValue(Storage.ForgottenKnowledge.BirdCage) == 1 then + elseif MsgContains(message, "cages") and player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.BirdCage) == 1 then npcHandler:say({ "Crafted generations ago to rob a creature of its freedom for that it may earn it again truthfully. You will need them if you plan on returning the birds to their rightful home in the glade. ... ", "Are you in need of another one? ", }, npc, creature) npcHandler:setTopic(playerId, 2) - end - if MsgContains(message, "yes") then + elseif MsgContains(message, "yes") then if npcHandler:getTopic(playerId) == 2 then - npcHandler:say({ - "I already handed a cage to you. If you are in need of another one, you will have to return to me later.", - }, npc, creature) + npcHandler:say("I already handed a cage to you. If you are in need of another one, you will have to return to me later.", npc, creature) + npcHandler:setTopic(playerId, 0) end end + return true end -npcHandler:setCallback(CALLBACK_GREET, greetCallback) +npcHandler:setMessage(MESSAGE_GREET, "I greet you, human. This is a time of distress, more than ever are we in need of guardians to protect us and our world.") + npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) + +-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions! +keywordHandler:addKeyword({ "name" }, StdModule.say, { npcHandler = npcHandler, text = "My name is now known only to the wind and it shall remain like this until I will return to my kin." }) +keywordHandler:addKeyword({ "job" }, StdModule.say, { npcHandler = npcHandler, text = "I was a guardian of this glade. I am the last one... everyone had to leave." }) +keywordHandler:addKeyword({ "time" }, StdModule.say, { npcHandler = npcHandler, text = "This glade's time is growing short if nothing will be done soon." }) +keywordHandler:addKeyword({ "forest fury" }, StdModule.say, { npcHandler = npcHandler, text = "Take care, guardian." }) +keywordHandler:addKeyword({ "orclops" }, StdModule.say, { npcHandler = npcHandler, text = "Cruel beings. Large and monstrous, with a single eye, staring at their prey. " }) + npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true) -- npcType registering the npcConfig table diff --git a/data-otservbr-global/npc/albinius.lua b/data-otservbr-global/npc/albinius.lua index ca04c785848..57106ef9df0 100644 --- a/data-otservbr-global/npc/albinius.lua +++ b/data-otservbr-global/npc/albinius.lua @@ -61,10 +61,6 @@ npcType.onThink = function(npc, interval) npcHandler:onThink(npc, interval) end -keywordHandler:addKeyword({ "name" }, StdModule.say, { npcHandler = npcHandler, text = "I am Albinius, a worshipper of the {Astral Shapers}." }) -keywordHandler:addKeyword({ "time" }, StdModule.say, { npcHandler = npcHandler, text = "Precisely time." }) -keywordHandler:addKeyword({ "job" }, StdModule.say, { npcHandler = npcHandler, text = "I find ways to unveil the secrets of the stars. Judging by this question, I doubt you follow my weekly publications concerning this research." }) - local runes = { { runeid = 24954 }, { runeid = 24955 }, @@ -97,20 +93,18 @@ local function creatureSayCallback(npc, creature, type, message) end if MsgContains(message, "temple") then - npcHandler:say({ - "The temple has been restored to its former glory, yet we strife to live and praise in the {Shaper} ways. Do you still need me to take some old {tomes} from you my child?", - }, npc, creature) + npcHandler:say("The temple has been restored to its former glory, yet we strife to live and praise in the {Shaper} ways. Do you still need me to take some old {tomes} from you my child?", npc, creature) npcHandler:setTopic(playerId, 1) end if MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 1 then - if player:getStorageValue(Storage.ForgottenKnowledge.Tomes) == 1 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Tomes) == 1 then npcHandler:say("You already offered enough tomes for us to study and rebuild this temple. Thank you, my child.", npc, creature) npcHandler:setTopic(playerId, 0) else if player:getItemCount(23986) >= 5 then player:removeItem(23986, 5) npcHandler:say("Thank you very much for your contribution, child. Your first step in the ways of the {Shapers} has been taken.", npc, creature) - player:setStorageValue(Storage.ForgottenKnowledge.Tomes, 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Tomes, 1) else npcHandler:say("You need 5 heavy old tome.", npc, creature) end @@ -120,10 +114,8 @@ local function creatureSayCallback(npc, creature, type, message) npcHandler:removeInteraction(npc, creature) end - if MsgContains(message, "tomes") and player:getStorageValue(Storage.ForgottenKnowledge.Tomes) < 1 then - npcHandler:say({ - "If you have some old shaper tomes I would {buy} them.", - }, npc, creature) + if MsgContains(message, "tomes") and player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Tomes) < 1 then + npcHandler:say("If you have some old shaper tomes I would {buy} them.", npc, creature) npcHandler:setTopic(playerId, 7) end @@ -134,7 +126,7 @@ local function creatureSayCallback(npc, creature, type, message) --- ##Astral Shaper Rune## if MsgContains(message, "astral shaper rune") then - if player:getStorageValue(Storage.ForgottenKnowledge.LastLoreKilled) >= 1 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LastLoreKilled) >= 1 then npcHandler:say("Do you wish to merge your rune parts into an astral shaper rune?", npc, creature) npcHandler:setTopic(playerId, 8) else @@ -162,21 +154,19 @@ local function creatureSayCallback(npc, creature, type, message) --- ####PORTALS### -- Ice Portal if MsgContains(message, "ice portal") then - if player:getStorageValue(Storage.ForgottenKnowledge.Tomes) == 1 then - npcHandler:say({ - "You may pass this portal if you have 50 fish as offering. Do you have the fish with you?", - }, npc, creature) + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Tomes) == 1 and player:getStorageValue(Storage.Quest.U8_0.TheIceIslands.FormorgarMinesDoor) == 1 then + npcHandler:say("You may pass this portal if you have 50 fish as offering. Do you have the fish with you?", npc, creature) npcHandler:setTopic(playerId, 2) else - npcHandler:say("Sorry, first you need to bring my Heavy Old Tomes.", npc, creature) + npcHandler:say("Sorry, you first need to bring my Heavy Old Tomes or do the quest before continuing.", npc, creature) end end if MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 2 then - if player:getStorageValue(Storage.ForgottenKnowledge.AccessIce) < 1 and player:getItemCount(3578) >= 50 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessIce) < 1 and player:getItemCount(3578) >= 50 then player:removeItem(3578, 50) npcHandler:say("Thank you for your offering. You may pass the Portal to the Powers of Ice now.", npc, creature) - player:setStorageValue(Storage.ForgottenKnowledge.AccessIce, 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessIce, 1) else npcHandler:say("I'm sorry, you don't have enough fish. Return if you can offer fifty of them.", npc, creature) end @@ -186,10 +176,8 @@ local function creatureSayCallback(npc, creature, type, message) -- Holy Portal if MsgContains(message, "holy portal") then - if player:getStorageValue(Storage.ForgottenKnowledge.Tomes) == 1 then - npcHandler:say({ - "You may pass this portal if you have 50 incantation notes as offering. Do you have the incantation notes with you?", - }, npc, creature) + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Tomes) == 1 then + npcHandler:say("You may pass this portal if you have 50 incantation notes as offering. Do you have the incantation notes with you?", npc, creature) npcHandler:setTopic(playerId, 3) else npcHandler:say("Sorry, first you need to bring my Heavy Old Tomes.", npc, creature) @@ -197,10 +185,10 @@ local function creatureSayCallback(npc, creature, type, message) end if MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 3 then - if player:getStorageValue(Storage.ForgottenKnowledge.AccessGolden) < 1 and player:getItemCount(18929) >= 50 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessGolden) < 1 and player:getItemCount(18929) >= 50 then player:removeItem(18929, 50) npcHandler:say("Thank you for your offering. You may pass the Portal to the Powers of Holy now.", npc, creature) - player:setStorageValue(Storage.ForgottenKnowledge.AccessGolden, 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessGolden, 1) else npcHandler:say("I'm sorry, you don't have enough incantation notes. Return if you can offer fifty of them.", npc, creature) end @@ -210,10 +198,8 @@ local function creatureSayCallback(npc, creature, type, message) -- Energy Portal if MsgContains(message, "energy portal") then - if player:getStorageValue(Storage.ForgottenKnowledge.Tomes) == 1 then - npcHandler:say({ - "You may pass this portal if you have 50 marsh stalker feathers as offering. Do you have the marsh stalker feathers with you?", - }, npc, creature) + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Tomes) == 1 then + npcHandler:say("You may pass this portal if you have 50 marsh stalker feathers as offering. Do you have the marsh stalker feathers with you?", npc, creature) npcHandler:setTopic(playerId, 4) else npcHandler:say("Sorry, first you need to bring my Heavy Old Tomes.", npc, creature) @@ -221,10 +207,10 @@ local function creatureSayCallback(npc, creature, type, message) end if MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 4 then - if player:getStorageValue(Storage.ForgottenKnowledge.AccessViolet) < 1 and player:getItemCount(17462) >= 50 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessViolet) < 1 and player:getItemCount(17462) >= 50 then player:removeItem(17462, 50) npcHandler:say("Thank you for your offering. You may pass the Portal to the Powers of Energy now.", npc, creature) - player:setStorageValue(Storage.ForgottenKnowledge.AccessViolet, 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessViolet, 1) else npcHandler:say("I'm sorry, you don't have enough marsh stalker feathers. Return if you can offer fifty of them.", npc, creature) end @@ -234,10 +220,8 @@ local function creatureSayCallback(npc, creature, type, message) -- Earth Portal if MsgContains(message, "earth portal") then - if player:getStorageValue(Storage.ForgottenKnowledge.Tomes) == 1 then - npcHandler:say({ - "You may pass this portal if you have 50 acorns as offering. Do you have the acorns with you?", - }, npc, creature) + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Tomes) == 1 then + npcHandler:say("You may pass this portal if you have 50 acorns as offering. Do you have the acorns with you?", npc, creature) npcHandler:setTopic(playerId, 5) else npcHandler:say("Sorry, first you need to bring my Heavy Old Tomes.", npc, creature) @@ -245,10 +229,10 @@ local function creatureSayCallback(npc, creature, type, message) end if MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 5 then - if player:getStorageValue(Storage.ForgottenKnowledge.AccessEarth) < 1 and player:getItemCount(10296) >= 50 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessEarth) < 1 and player:getItemCount(10296) >= 50 then player:removeItem(10296, 50) npcHandler:say("Thank you for your offering. You may pass the Portal to the Powers of Earth now.", npc, creature) - player:setStorageValue(Storage.ForgottenKnowledge.AccessEarth, 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessEarth, 1) else npcHandler:say("I'm sorry, you don't have enough acorns. Return if you can offer fifty of them.", npc, creature) end @@ -258,10 +242,8 @@ local function creatureSayCallback(npc, creature, type, message) -- Death Portal if MsgContains(message, "death portal") then - if player:getStorageValue(Storage.ForgottenKnowledge.Tomes) == 1 then - npcHandler:say({ - "You may pass this portal if you have 50 pelvis bones as offering. Do you have the pelvis bones with you?", - }, npc, creature) + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Tomes) == 1 then + npcHandler:say("You may pass this portal if you have 50 pelvis bones as offering. Do you have the pelvis bones with you?", npc, creature) npcHandler:setTopic(playerId, 6) else npcHandler:say("Sorry, first you need to bring my Heavy Old Tomes.", npc, creature) @@ -269,10 +251,10 @@ local function creatureSayCallback(npc, creature, type, message) end if MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 6 then - if player:getStorageValue(Storage.ForgottenKnowledge.AccessDeath) < 1 and player:getItemCount(11481) >= 50 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessDeath) < 1 and player:getItemCount(11481) >= 50 then player:removeItem(11481, 50) npcHandler:say("Thank you for your offering. You may pass the Portal to the Powers of Death now.", npc, creature) - player:setStorageValue(Storage.ForgottenKnowledge.AccessDeath, 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessDeath, 1) else npcHandler:say("I'm sorry, you don't have enough pelvis bones. Return if you can offer fifty of them.", npc, creature) end @@ -286,6 +268,11 @@ npcHandler:setMessage(MESSAGE_GREET, "Greetings, pilgrim. Welcome to the halls o npcHandler:setMessage(MESSAGE_WALKAWAY, "Oh... farewell, child.") npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) + +keywordHandler:addKeyword({ "name" }, StdModule.say, { npcHandler = npcHandler, text = "I am Albinius, a worshipper of the {Astral Shapers}." }) +keywordHandler:addKeyword({ "time" }, StdModule.say, { npcHandler = npcHandler, text = "Precisely time." }) +keywordHandler:addKeyword({ "job" }, StdModule.say, { npcHandler = npcHandler, text = "I find ways to unveil the secrets of the stars. Judging by this question, I doubt you follow my weekly publications concerning this research." }) + npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true) npcType:register(npcConfig) diff --git a/data-otservbr-global/npc/ivalisse.lua b/data-otservbr-global/npc/ivalisse.lua index 71948ca4bb2..bd909ebf636 100644 --- a/data-otservbr-global/npc/ivalisse.lua +++ b/data-otservbr-global/npc/ivalisse.lua @@ -50,16 +50,6 @@ npcType.onCloseChannel = function(npc, creature) npcHandler:onCloseChannel(npc, creature) end --- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions! -keywordHandler:addKeyword({ "silus" }, StdModule.say, { npcHandler = npcHandler, text = "My {father}, can you tell me if he's alright?" }) -keywordHandler:addKeyword({ "thais" }, StdModule.say, { npcHandler = npcHandler, text = "Alright then, you are very welcome to explore the temple!" }) -keywordHandler:addKeyword({ "name" }, StdModule.say, { npcHandler = npcHandler, text = "My name is Ivalisse." }) -keywordHandler:addKeyword({ "time" }, StdModule.say, { npcHandler = npcHandler, text = "There is always time to make a change." }) -keywordHandler:addKeyword({ "job" }, StdModule.say, { npcHandler = npcHandler, text = "Besides my various {duties} in the temple, I also take care of visitors. Well, I would but right now I can't get my mind of how my {father}'s doing. I am sorry." }) -keywordHandler:addKeyword({ "duties" }, StdModule.say, { npcHandler = npcHandler, text = " I help linking the portals of this temple to other ancient sites of the {Astral Shapers}." }) -keywordHandler:addKeyword({ "duties" }, StdModule.say, { npcHandler = npcHandler, text = " I help linking the portals of this temple to other ancient sites of the {Astral Shapers}." }) -keywordHandler:addKeyword({ "mission" }, StdModule.say, { npcHandler = npcHandler, text = "Besides my various {duties} in the temple, I also take care of visitors. Well, I would but right now I can't get my mind of how my {father}'s doing. I am sorry." }) - local function creatureSayCallback(npc, creature, type, message) local player = Player(creature) local playerId = player:getId() @@ -69,13 +59,12 @@ local function creatureSayCallback(npc, creature, type, message) end if MsgContains(message, "temple") then - npcHandler:say({ - "Well, I hope you like it here. We tried to rebuild in the {Shaper}'s will. I am a bit preoccupied at the moment because of the absence of my {father}. I may not be the best of help currently, sorry.", - }, npc, creature) + npcHandler:say("Well, I hope you like it here. We tried to rebuild in the {Shaper}'s will. I am a bit preoccupied at the moment because of the absence of my {father}. I may not be the best of help currently, sorry.", npc, creature) npcHandler:setTopic(playerId, 1) - end - - if MsgContains(message, "imbuing") or MsgContains(message, "imbuements") then + elseif MsgContains(message, "mission") then + npcHandler:say("Besides my various {duties} in the temple, I also take care of visitors. Well, I would but right now I can't get my mind of how my {father}'s doing. I am sorry.", npc, creature) + npcHandler:setTopic(playerId, 1) + elseif MsgContains(message, "imbuing") or MsgContains(message, "imbuements") then npcHandler:say({ "The astral Shapers had many ways to shape and refine weapons and equipment. They built shrines dedicated to this world's energies, focussing it and utilising it like a tool to enhance objects. ...", "They called this process imbuing and perfected it throughout time. Remains of these shrines are scattered all over Tibia. ...", @@ -85,62 +74,68 @@ local function creatureSayCallback(npc, creature, type, message) "We see the gates as an invitation, use them to your advantage and follow the ways of the Shapers. Access to one of these ancient shrines is the only way to learn additional imbuements. ...", "But beware, as far as we know, some of them have been claimed by other ancient beings and there is now way for us to prepare you what lies beyond any of those gates.", }, npc, creature) + npcHandler:setTopic(playerId, 0) + elseif MsgContains(message, "father") and npcHandler:getTopic(playerId) == 1 then + if player:getStorageValue(Storage.Quest.U8_54.TheNewFrontier.Questline) == 29 then + npcHandler:say({ + "Papa- my father has recently started an adventure on his own. His name is Silus; he is a member of the Edron academy. ...", + "Ever since he joined what he called a 'special research division', he went on and on about Zao and how venturing there would help him get ahead. ...", + "You must know he lives for science, especially concerning faraway lands and cultures. He talked about the importance of practical field studies but, frankly, he isn't particularly cut out for that. ...", + "I know he has to focus to get his research done right now, and I simply cannot leave my duties in the temple. You seem like a person who travels a lot; would you be willing to help me?", + }, npc, creature) + npcHandler:setTopic(playerId, 2) + elseif player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Ivalisse) == 1 or + player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Chalice) == 1 then + npcHandler:say("Well, I hope you like it here. We tried to rebuild in the Shaper's will. I am a bit preoccupied at the moment because of the absence of my father. I may not be the best of help currently, sorry.", npc, creature) + npcHandler:setTopic(playerId, 0) + elseif player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.DragonkingKilled) >= 1 and player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Ivalisse) < 1 then + npcHandler:say({ + "What? You're telling me you found father? How is he? What did papa say? A chalice? As a disguise? The whole time? ...", + "Well, I am not as much surprised as I am happy to hear that he's alright. You know, after the incident with the duck and the umbrella—it doesn't get to me that easily anymore. ...", + "Thank you very much for doing all this for me; I will be forever grateful. I have nothing to repay you with, but you are already blessed to have been able to lay eyes on the sacred Shaper ruins.", + }, npc, creature) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Ivalisse, 1) + npcHandler:setTopic(playerId, 0) + end + elseif MsgContains(message, "yes") then + if npcHandler:getTopic(playerId) == 2 then + npcHandler:say({ + "Thank you! He told me the other researchers in his team discovered a bridge leading to a cave with a dragon sculpture somewhere in a muggy, grassy area. ...", + "The cave is said to lead to a temple complex underground which is ued as a gathering place for a race called 'draken'. He left right away and tried to enter Zao on his own. ...", + "I was even more worried when he explained the route he chose. he wanted to head straight through a giant steppe and through a massive mountainous ridge to reach the grassy plains of lower Zao. ...", + "If you're interested: I know that the Shapers where active in all corners of Tibia. If you happen to find Shaper ruins there, you may even be able to gather some of their lost knowledge. ...", + "I may have been a bit stubborn and angry the day he left, I even refused to say farewell. And now I worry if he is safe. ...", + "I can not do much to help you but I can open a portal to get you quite close to his last known location in Zao. What do you say, will you help me find my father?", + }, npc, creature) + npcHandler:setTopic(playerId, 3) + elseif npcHandler:getTopic(playerId) == 3 then + npcHandler:say("You would? That's great! Thank you! If you can find my father, tell him I understand and that I really miss him!", npc, creature) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessFire, 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Chalice, 1) + npcHandler:setTopic(playerId, 0) + end + elseif MsgContains(message, "no") then + npcHandler:say("Oh nevermind, I am sorry I asked you for this.", npc, creature) + npcHandler:setTopic(playerId, 0) end - if MsgContains(message, "father") and npcHandler:getTopic(playerId) == 1 then - npcHandler:say({ - "Papa- my father has recently started an adventure on his own. His name is Silus, he is a member of the Edron academy. ...", - "Ever since he has joined what he called a 'special research division', he went on and on about Zao and how venturing there would help him get ahead. ...", - "You must know he lives for science, especially concerning far-away lands and cultures. He talked about the importance of practical field studies but, frankly, he isn't particularly cut out for that. ...", - "I know he has to focus to get his research done right now and I simply cannot leave my duties in the temple. You seem like a person who travels a lot, would you be willing to help me?", - }, npc, creature) - npcHandler:setTopic(playerId, 2) - elseif MsgContains(message, "father") and npcHandler:getTopic(playerId) == 1 and player:getStorageValue(Storage.ForgottenKnowledge.Ivalisse) == 1 or player:getStorageValue(Storage.ForgottenKnowledge.Chalice) == 1 then - npcHandler:say({ - "Well, I hope you like it here. We tried to rebuild in the Shaper's will. I am a bit preoccupied at the moment because of the absence of my father. I may not be the best of help currently, sorry.", - }, npc, creature) - elseif MsgContains(message, "father") and npcHandler:getTopic(playerId) == 1 and player:getStorageValue(Storage.ForgottenKnowledge.DragonkingKilled) == 1 then - npcHandler:say({ - "What? You're telling me you found father? How is he, what did papa say? A chalice? As a disguise? The whole time? ...", - "Well, I am not as much surprised as I am happy to hear that he's alright. You know, after the incident with the duck and the umbrella - it doesn't get to me that easily anymore. ...", - "Thank you very much for doing all this for me, I will be forever grateful. I have nothing to repay you with but you are already blessed to have been able to lay eyes on the sacred shaper ruins.", - }, npc, creature) - player:setStorageValue(Storage.ForgottenKnowledge.Ivalisse, 1) - end - - if MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 2 then - npcHandler:say({ - "Thank you! He told me the other researchers in his team discovered a bridge leading to a cave with a dragon sculpture somewhere in a muggy, grassy area. ...", - "The cave is said to lead to a temple complex underground which is ued as a gathering place for a race called 'draken'. He left right away and tried to enter Zao on his own. ...", - "I was even more worried when he explained the route he chose. he wanted to head straight through a giant steppe and through a massive mountainous ridge to reach the grassy plains of lower Zao. ...", - "If you're interested: I know that the Shapers where active in all corners of Tibia. If you happen to find Shaper ruins there, you may even be able to gather some of their lost knowledge. ...", - "I may have been a bit stubborn and angry the day he left, I even refused to say farewell. And now I worry if he is safe. ...", - "I can not do much to help you but I can open a portal to get you quite close to his last known location in Zao. What do you say, will you help me find my father?", - }, npc, creature) - npcHandler:setTopic(playerId, 3) - elseif MsgContains(message, "no") and npcHandler:getTopic(playerId) == 2 then - npcHandler:say({ - "Oh nevermind, I am sorry I asked you for this.", - }, npc, creature) - end - - if MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 3 then - npcHandler:say({ - "You would? That's great! Thank you! If you can find my father, tell him I understand and that I really miss him!", - }, npc, creature) - player:setStorageValue(Storage.ForgottenKnowledge.AccessFire, 1) - player:setStorageValue(Storage.ForgottenKnowledge.Chalice, 1) - elseif MsgContains(message, "no") and npcHandler:getTopic(playerId) == 3 then - npcHandler:say({ - "Oh nevermind, I am sorry I asked you for this.", - }, npc, creature) - end return true end +npcHandler:setMessage(MESSAGE_GREET, "Hello, worshiper of the Astral Shapers! Welcome to the temple! While you are here to pay tribute, you can also learn something about the ancient art of imbuing.") npcHandler:setMessage(MESSAGE_WALKAWAY, "Oh... farewell, child.") npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) + +-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions! +keywordHandler:addKeyword({ "silus" }, StdModule.say, { npcHandler = npcHandler, text = "My {father}, can you tell me if he's alright?" }) +keywordHandler:addKeyword({ "thais" }, StdModule.say, { npcHandler = npcHandler, text = "Alright then, you are very welcome to explore the temple!" }) +keywordHandler:addKeyword({ "name" }, StdModule.say, { npcHandler = npcHandler, text = "My name is Ivalisse." }) +keywordHandler:addKeyword({ "time" }, StdModule.say, { npcHandler = npcHandler, text = "There is always time to make a change." }) +keywordHandler:addKeyword({ "job" }, StdModule.say, { npcHandler = npcHandler, text = "Besides my various {duties} in the temple, I also take care of visitors. Well, I would but right now I can't get my mind of how my {father}'s doing. I am sorry." }) +keywordHandler:addKeyword({ "duties" }, StdModule.say, { npcHandler = npcHandler, text = " I help linking the portals of this temple to other ancient sites of the {Astral Shapers}." }) +keywordHandler:addKeyword({ "duties" }, StdModule.say, { npcHandler = npcHandler, text = " I help linking the portals of this temple to other ancient sites of the {Astral Shapers}." }) + npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true) -- npcType registering the npcConfig table diff --git a/data-otservbr-global/scripts/actions/bosses_levers/dragonking_zyrtarch.lua b/data-otservbr-global/scripts/actions/bosses_levers/dragonking_zyrtarch.lua deleted file mode 100644 index 99585188b91..00000000000 --- a/data-otservbr-global/scripts/actions/bosses_levers/dragonking_zyrtarch.lua +++ /dev/null @@ -1,30 +0,0 @@ -local config = { - boss = { - name = "soul of dragonking zyrtarch", - position = Position(33359, 31182, 12), - }, - requiredLevel = 250, - playerPositions = { - { pos = Position(33391, 31178, 10), teleport = Position(33359, 31186, 10) }, - { pos = Position(33391, 31179, 10), teleport = Position(33359, 31186, 10) }, - { pos = Position(33391, 31180, 10), teleport = Position(33359, 31186, 10) }, - { pos = Position(33391, 31181, 10), teleport = Position(33359, 31186, 10) }, - { pos = Position(33391, 31182, 10), teleport = Position(33359, 31186, 10) }, - }, - monsters = { - { name = "soulcatcher", pos = Position(33352, 31187, 10) }, - { name = "soulcatcher", pos = Position(33363, 31187, 10) }, - { name = "soulcatcher", pos = Position(33353, 31176, 10) }, - { name = "soulcatcher", pos = Position(33363, 31176, 10) }, - { name = "dragonking zyrtarch", pos = Position(33357, 31182, 10) }, - }, - specPos = { - from = Position(33348, 31172, 10), - to = Position(33368, 31190, 12), - }, - exit = Position(33407, 31172, 10), -} - -local lever = BossLever(config) -lever:position(Position(33391, 31177, 10)) -lever:register() diff --git a/data-otservbr-global/scripts/actions/bosses_levers/lady_tenebris.lua b/data-otservbr-global/scripts/actions/bosses_levers/lady_tenebris.lua deleted file mode 100644 index 795b3cf2234..00000000000 --- a/data-otservbr-global/scripts/actions/bosses_levers/lady_tenebris.lua +++ /dev/null @@ -1,28 +0,0 @@ -local config = { - boss = { - name = "Lady Tenebris", - position = Position(32912, 31599, 14), - }, - requiredLevel = 250, - playerPositions = { - { pos = Position(32902, 31623, 14), teleport = Position(32911, 31603, 14) }, - { pos = Position(32902, 31624, 14), teleport = Position(32911, 31603, 14) }, - { pos = Position(32902, 31625, 14), teleport = Position(32911, 31603, 14) }, - { pos = Position(32902, 31626, 14), teleport = Position(32911, 31603, 14) }, - { pos = Position(32902, 31627, 14), teleport = Position(32911, 31603, 14) }, - }, - monsters = { - { name = "shadow tentacle", pos = Position(32910, 31599, 14) }, - { name = "shadow tentacle", pos = Position(32912, 31597, 14) }, - { name = "shadow tentacle", pos = Position(32914, 31599, 14) }, - }, - specPos = { - from = Position(32899, 31587, 14), - to = Position(32923, 31612, 14), - }, - exit = Position(32902, 31629, 14), -} - -local lever = BossLever(config) -lever:position(Position(32902, 31622, 14)) -lever:register() diff --git a/data-otservbr-global/scripts/actions/bosses_levers/lloyd.lua b/data-otservbr-global/scripts/actions/bosses_levers/lloyd.lua deleted file mode 100644 index 7a2fa1d0a86..00000000000 --- a/data-otservbr-global/scripts/actions/bosses_levers/lloyd.lua +++ /dev/null @@ -1,29 +0,0 @@ -local config = { - boss = { - name = "Lloyd", - position = Position(32799, 32827, 14), - }, - requiredLevel = 250, - playerPositions = { - { pos = Position(32759, 32868, 14), teleport = Position(32800, 32831, 14) }, - { pos = Position(32759, 32869, 14), teleport = Position(32800, 32831, 14) }, - { pos = Position(32759, 32870, 14), teleport = Position(32800, 32831, 14) }, - { pos = Position(32759, 32871, 14), teleport = Position(32800, 32831, 14) }, - { pos = Position(32759, 32872, 14), teleport = Position(32800, 32831, 14) }, - }, - monsters = { - { name = "cosmic energy prism a invu", pos = Position(32801, 32827, 14) }, - { name = "cosmic energy prism b invu", pos = Position(32798, 32827, 14) }, - { name = "cosmic energy prism c invu", pos = Position(32803, 32826, 14) }, - { name = "cosmic energy prism d invu", pos = Position(32796, 32826, 14) }, - }, - specPos = { - from = Position(32785, 32813, 14), - to = Position(32812, 32838, 14), - }, - exit = Position(32815, 32873, 13), -} - -local lever = BossLever(config) -lever:position(Position(32759, 32867, 14)) -lever:register() diff --git a/data-otservbr-global/scripts/actions/bosses_levers/melting_frozen_horror.lua b/data-otservbr-global/scripts/actions/bosses_levers/melting_frozen_horror.lua deleted file mode 100644 index fbb60e8fec2..00000000000 --- a/data-otservbr-global/scripts/actions/bosses_levers/melting_frozen_horror.lua +++ /dev/null @@ -1,34 +0,0 @@ -local eggPos = Position(32269, 31084, 14) -local config = { - boss = { - name = "Melting Frozen Horror", - createFunction = function() - Tile(eggPos):getTopCreature():setHealth(1) - return Game.createMonster("solid frozen horror", Position(32269, 31091, 14), true, true) - end, - }, - timeToDefeat = 15 * 60, -- In seconds - requiredLevel = 250, - playerPositions = { - { pos = Position(32302, 31088, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32302, 31089, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32302, 31090, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32302, 31091, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32302, 31092, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, - }, - monsters = { - { name = "icicle", pos = Position(32266, 31084, 14) }, - { name = "icicle", pos = Position(32272, 31084, 14) }, - { name = "dragon egg", pos = eggPos }, - { name = "melting frozen horror", pos = Position(32267, 31071, 14) }, - }, - specPos = { - from = Position(32257, 31080, 14), - to = Position(32280, 31102, 14), - }, - exit = Position(32271, 31097, 14), -} - -local lever = BossLever(config) -lever:position(Position(32302, 31087, 14)) -lever:register() diff --git a/data-otservbr-global/scripts/actions/bosses_levers/the_last_lore_keeper.lua b/data-otservbr-global/scripts/actions/bosses_levers/the_last_lore_keeper.lua deleted file mode 100644 index d14d9b88d73..00000000000 --- a/data-otservbr-global/scripts/actions/bosses_levers/the_last_lore_keeper.lua +++ /dev/null @@ -1,44 +0,0 @@ -local config = { - boss = { - name = "The Last Lore Keeper", - position = Position(31987, 32839, 14), - }, - timeToFightAgain = ParseDuration("14d") / 1000, - timeToDefeat = ParseDuration("17m") / 1000, - requiredLevel = 250, - playerPositions = { - { pos = Position(32018, 32844, 14), teleport = Position(31984, 32851, 14) }, - { pos = Position(32019, 32844, 14), teleport = Position(31984, 32851, 14) }, - { pos = Position(32020, 32844, 14), teleport = Position(31984, 32851, 14) }, - { pos = Position(32018, 32845, 14), teleport = Position(31984, 32851, 14) }, - { pos = Position(32019, 32845, 14), teleport = Position(31984, 32851, 14) }, - { pos = Position(32020, 32845, 14), teleport = Position(31984, 32851, 14) }, - { pos = Position(32018, 32846, 14), teleport = Position(31984, 32851, 14) }, - { pos = Position(32019, 32846, 14), teleport = Position(31984, 32851, 14) }, - { pos = Position(32020, 32846, 14), teleport = Position(31984, 32851, 14) }, - { pos = Position(32018, 32847, 14), teleport = Position(31984, 32851, 14) }, - { pos = Position(32019, 32847, 14), teleport = Position(31984, 32851, 14) }, - { pos = Position(32020, 32847, 14), teleport = Position(31984, 32851, 14) }, - { pos = Position(32018, 32848, 14), teleport = Position(31984, 32851, 14) }, - { pos = Position(32019, 32848, 14), teleport = Position(31984, 32851, 14) }, - { pos = Position(32020, 32848, 14), teleport = Position(31984, 32851, 14) }, - }, - monsters = { - { name = "bound astral power", pos = Position(31973, 32840, 15) }, - { name = "bound astral power", pos = Position(31973, 32856, 15) }, - { name = "bound astral power", pos = Position(31989, 32856, 15) }, - { name = "bound astral power", pos = Position(31989, 32840, 15) }, - { name = "a shielded astral glyph", pos = Position(31986, 32840, 14) }, - { name = "the distorted astral source", pos = Position(31986, 32823, 15) }, - { name = "an astral glyph", pos = Position(31989, 32823, 15) }, - }, - specPos = { - from = Position(31968, 32821, 14), - to = Position(32004, 32865, 15), - }, - exit = Position(32035, 32859, 14), -} - -local lever = BossLever(config) -lever:position(Position(32019, 32843, 14)) -lever:register() diff --git a/data-otservbr-global/scripts/actions/bosses_levers/the_thorn_knight.lua b/data-otservbr-global/scripts/actions/bosses_levers/the_thorn_knight.lua deleted file mode 100644 index b48a07e44e1..00000000000 --- a/data-otservbr-global/scripts/actions/bosses_levers/the_thorn_knight.lua +++ /dev/null @@ -1,30 +0,0 @@ -local config = { - boss = { - name = "The Enraged Thorn Knight", - createFunction = function() - return Game.createMonster("Mounted Thorn Knight", Position(32624, 32880, 14), true, true) - end, - }, - requiredLevel = 250, - playerPositions = { - { pos = Position(32657, 32877, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32657, 32878, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32657, 32879, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32657, 32880, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32657, 32881, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, - }, - onUseExtra = function(player) - for d = 1, 6 do - Game.createMonster("possessed tree", Position(math.random(32619, 32629), math.random(32877, 32884), 14), true, true) - end - end, - specPos = { - from = Position(32613, 32869, 14), - to = Position(32636, 32892, 14), - }, - exit = Position(32678, 32888, 14), -} - -local lever = BossLever(config) -lever:position(Position(32657, 32876, 14)) -lever:register() diff --git a/data-otservbr-global/scripts/actions/bosses_levers/the_time_guardian.lua b/data-otservbr-global/scripts/actions/bosses_levers/the_time_guardian.lua deleted file mode 100644 index 386bce7d94d..00000000000 --- a/data-otservbr-global/scripts/actions/bosses_levers/the_time_guardian.lua +++ /dev/null @@ -1,27 +0,0 @@ -local config = { - boss = { - name = "The Time Guardian", - position = Position(32977, 31662, 14), - }, - requiredLevel = 250, - playerPositions = { - { pos = Position(33010, 31660, 14), teleport = Position(32977, 31667, 14) }, - { pos = Position(33010, 31661, 14), teleport = Position(32977, 31667, 14) }, - { pos = Position(33010, 31662, 14), teleport = Position(32977, 31667, 14) }, - { pos = Position(33010, 31663, 14), teleport = Position(32977, 31667, 14) }, - { pos = Position(33010, 31664, 14), teleport = Position(32977, 31667, 14) }, - }, - monsters = { - { name = "The Freezing Time Guardian", pos = Position(32975, 31664, 13) }, - { name = "The Blazing Time Guardian", pos = Position(32980, 31664, 13) }, - }, - specPos = { - from = Position(32967, 31654, 14), - to = Position(32989, 31677, 14), - }, - exit = Position(32870, 32724, 14), -} - -local lever = BossLever(config) -lever:position(Position(33010, 31659, 14)) -lever:register() diff --git a/data-otservbr-global/scripts/actions/object/imbuement_shrine.lua b/data-otservbr-global/scripts/actions/object/imbuement_shrine.lua index 0fb998a9756..f5d878df284 100644 --- a/data-otservbr-global/scripts/actions/object/imbuement_shrine.lua +++ b/data-otservbr-global/scripts/actions/object/imbuement_shrine.lua @@ -1,7 +1,7 @@ local imbuement = Action() function imbuement.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if configManager.getBoolean(configKeys.TOGGLE_IMBUEMENT_SHRINE_STORAGE) and player:getStorageValue(Storage.ForgottenKnowledge.Tomes) ~= 1 then + if configManager.getBoolean(configKeys.TOGGLE_IMBUEMENT_SHRINE_STORAGE) and player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Tomes) ~= 1 then return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You did not collect enough knowledge from the ancient Shapers. Visit the Shaper temple in Thais for help.") end diff --git a/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua b/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua index bf0e1430635..9d0f5eab3b7 100644 --- a/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua +++ b/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua @@ -110,16 +110,16 @@ local questTable = { { storage = Storage.Quest.U7_6.ExplorerSociety.QuestLine, storageValue = 58 }, { storage = Storage.Quest.U7_6.ExplorerSociety.QuestLine, storageValue = 61 }, { storage = Storage.Quest.U7_6.ExplorerSociety.CalassaQuest, storageValue = 2 }, - { storage = Storage.ForgottenKnowledge.Tomes, storageValue = 1 }, - { storage = Storage.ForgottenKnowledge.LastLoreKilled, storageValue = 1 }, - { storage = Storage.ForgottenKnowledge.TimeGuardianKilled, storageValue = 1 }, - { storage = Storage.ForgottenKnowledge.HorrorKilled, storageValue = 1 }, - { storage = Storage.ForgottenKnowledge.DragonkingKilled, storageValue = 1 }, - { storage = Storage.ForgottenKnowledge.ThornKnightKilled, storageValue = 1 }, - { storage = Storage.ForgottenKnowledge.LloydKilled, storageValue = 1 }, - { storage = Storage.ForgottenKnowledge.LadyTenebrisKilled, storageValue = 1 }, - { storage = Storage.ForgottenKnowledge.AccessMachine, storageValue = 1 }, - { storage = Storage.ForgottenKnowledge.AccessLavaTeleport, storageValue = 1 }, + { storage = Storage.Quest.U11_02.ForgottenKnowledge.Tomes, storageValue = 1 }, + { storage = Storage.Quest.U11_02.ForgottenKnowledge.LastLoreKilled, storageValue = 1 }, + { storage = Storage.Quest.U11_02.ForgottenKnowledge.TimeGuardianKilled, storageValue = 1 }, + { storage = Storage.Quest.U11_02.ForgottenKnowledge.HorrorKilled, storageValue = 1 }, + { storage = Storage.Quest.U11_02.ForgottenKnowledge.DragonkingKilled, storageValue = 1 }, + { storage = Storage.Quest.U11_02.ForgottenKnowledge.ThornKnightKilled, storageValue = 1 }, + { storage = Storage.Quest.U11_02.ForgottenKnowledge.LloydKilled, storageValue = 1 }, + { storage = Storage.Quest.U11_02.ForgottenKnowledge.LadyTenebrisKilled, storageValue = 1 }, + { storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessMachine, storageValue = 1 }, + { storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessLavaTeleport, storageValue = 1 }, { storage = Storage.Quest.U8_0.BarbarianTest.Questline, storageValue = 8 }, { storage = Storage.Quest.U8_0.BarbarianTest.Mission01, storageValue = 3 }, { storage = Storage.Quest.U8_0.BarbarianTest.Mission02, storageValue = 3 }, @@ -282,12 +282,12 @@ local questTable = { { storage = Storage.Quest.U10_80.TheLostBrotherQuest, storageValue = 3 }, { storage = Storage.Quest.U10_55.Dawnport.Questline, storageValue = 1 }, { storage = Storage.Quest.U10_55.Dawnport.GoMain, storageValue = 1 }, - { storage = Storage.ForgottenKnowledge.AccessDeath, storageValue = 1 }, - { storage = Storage.ForgottenKnowledge.AccessViolet, storageValue = 1 }, - { storage = Storage.ForgottenKnowledge.AccessEarth, storageValue = 1 }, - { storage = Storage.ForgottenKnowledge.AccessFire, storageValue = 1 }, - { storage = Storage.ForgottenKnowledge.AccessIce, storageValue = 1 }, - { storage = Storage.ForgottenKnowledge.AccessGolden, storageValue = 1 }, + { storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessDeath, storageValue = 1 }, + { storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessViolet, storageValue = 1 }, + { storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessEarth, storageValue = 1 }, + { storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessFire, storageValue = 1 }, + { storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessIce, storageValue = 1 }, + { storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessGolden, storageValue = 1 }, { storage = Storage.Quest.U10_80.GrimvaleQuest.AncientFeudDoors, storageValue = 1 }, { storage = Storage.Quest.U10_80.GrimvaleQuest.AncientFeudShortcut, storageValue = 1 }, { storage = Storage.Kilmaresh.AccessDoor, storageValue = 1 }, diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_bird_cage.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_bird_cage.lua index 36206829675..53d507e6b73 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_bird_cage.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_bird_cage.lua @@ -15,10 +15,10 @@ function forgottenKnowledgeBird.onUse(player, item, fromPosition, target, toPosi end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You open the cage and let the cave parrot roam free!") item:transform(23812) - if player:getStorageValue(Storage.ForgottenKnowledge.BirdCounter) < 0 then - player:setStorageValue(Storage.ForgottenKnowledge.BirdCounter, 0) + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.BirdCounter) < 0 then + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.BirdCounter, 0) end - player:setStorageValue(Storage.ForgottenKnowledge.BirdCounter, player:getStorageValue(Storage.ForgottenKnowledge.BirdCounter) + 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.BirdCounter, player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.BirdCounter) + 1) end player:getPosition():sendMagicEffect(CONST_ME_HEARTS) return true diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_dragonking_zyrtarch.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_dragonking_zyrtarch.lua new file mode 100644 index 00000000000..266c0ea489a --- /dev/null +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_dragonking_zyrtarch.lua @@ -0,0 +1,130 @@ +local config = { + boss = { + name = "soul of dragonking zyrtarch", + position = Position(33359, 31182, 12), + }, + requiredLevel = 250, + timeToDefeat = 15 * 60, + playerPositions = { + { pos = Position(33391, 31178, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, + { pos = Position(33391, 31179, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, + { pos = Position(33391, 31180, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, + { pos = Position(33391, 31181, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, + { pos = Position(33391, 31182, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, + }, + monsters = { + { name = "soulcatcher", pos = Position(33352, 31187, 10) }, + { name = "soulcatcher", pos = Position(33363, 31187, 10) }, + { name = "soulcatcher", pos = Position(33353, 31176, 10) }, + { name = "soulcatcher", pos = Position(33363, 31176, 10) }, + { name = "dragonking zyrtarch", pos = Position(33357, 31182, 10) }, + }, + specPos = { + from = Position(33348, 31172, 10), + to = Position(33368, 31190, 12), + }, + exit = Position(33407, 31172, 10), +} + +local leverZyrtarch = Action() + +function leverZyrtarch.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.DragonkingKilled) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) + for _, monster in pairs(config.monsters) do + Game.createMonster(monster.name, monster.pos) + end + + 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 + + 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 +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 +end + +leverZyrtarch:position(Position(33391, 31177, 10)) +leverZyrtarch:register() diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_fount.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_fount.lua index 09501839c9e..1b7b0a4a3e9 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_fount.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_fount.lua @@ -1,11 +1,11 @@ local forgottenKnowledgeFount = Action() function forgottenKnowledgeFount.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.ForgottenKnowledge.Phial) >= 1 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Phial) >= 1 then return false end player:addItem(23810) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A phial of fresh pond water. It looks crystal clear and sparkles a little.") - player:setStorageValue(Storage.ForgottenKnowledge.Phial, 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Phial, 1) return true end diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua new file mode 100644 index 00000000000..8f4978b2453 --- /dev/null +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua @@ -0,0 +1,145 @@ +local eggPos = Position(32269, 31084, 14) +local config = { + boss = { + name = "Melting Frozen Horror", + createFunction = function() + Game.createMonster("dragon egg", eggPos, true, true) + + local eggCreature = Tile(eggPos):getTopCreature() + if eggCreature then + eggCreature:setHealth(1) + else + print("Error: No dragon egg found at eggPos.") + end + + return Game.createMonster("solid frozen horror", Position(32269, 31091, 14), true, true) + end, + }, + requiredLevel = 250, + timeToDefeat = 15 * 60, + playerPositions = { + { pos = Position(32302, 31088, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32302, 31089, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32302, 31090, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32302, 31091, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32302, 31092, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, + }, + monsters = { + { name = "icicle", pos = Position(32266, 31084, 14) }, + { name = "icicle", pos = Position(32272, 31084, 14) }, + { name = "melting frozen horror", pos = Position(32267, 31071, 14) }, + }, + specPos = { + from = Position(32257, 31080, 14), + to = Position(32280, 31102, 14), + }, + exit = Position(32271, 31097, 14), +} + +local leverMeltingFrozenHorror = Action() + +function leverMeltingFrozenHorror.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.HorrorKilled) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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 + + if config.boss.createFunction then + config.boss.createFunction() + else + Game.createMonster(config.boss.name, config.boss.position) + end + + for _, monster in pairs(config.monsters) do + Game.createMonster(monster.name, monster.pos) + end + + 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 + + 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 +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 +end + +leverMeltingFrozenHorror:position(Position(32302, 31087, 14)) +leverMeltingFrozenHorror:register() diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_girl_picture.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_girl_picture.lua index b065f3e3de2..c7995ab4a94 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_girl_picture.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_girl_picture.lua @@ -1,9 +1,9 @@ local forgottenKnowledgeGirl = Action() function forgottenKnowledgeGirl.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.ForgottenKnowledge.GirlPicture) >= 1 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.GirlPicture) >= 1 then return false end - player:setStorageValue(Storage.ForgottenKnowledge.GirlPicture, 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.GirlPicture, 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seems that an old silver key appears in the drower.") item:remove() return true diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lady_tenebris.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lady_tenebris.lua new file mode 100644 index 00000000000..40c2fc774f7 --- /dev/null +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lady_tenebris.lua @@ -0,0 +1,129 @@ +local config = { + boss = { + name = "Lady Tenebris", + position = Position(32912, 31599, 14), + }, + requiredLevel = 250, + timeToDefeat = 15 * 60, + playerPositions = { + { pos = Position(32902, 31623, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32902, 31624, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32902, 31625, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32902, 31626, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32902, 31627, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, + }, + monsters = { + { name = "shadow tentacle", pos = Position(32910, 31599, 14) }, + { name = "shadow tentacle", pos = Position(32912, 31597, 14) }, + { name = "shadow tentacle", pos = Position(32914, 31599, 14) }, + }, + specPos = { + from = Position(32899, 31587, 14), + to = Position(32923, 31612, 14), + }, + exit = Position(32902, 31629, 14), +} + +local leverLadyTenebris = Action() + +function leverLadyTenebris.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LadyTenebrisKilled) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) + for _, monster in pairs(config.monsters) do + Game.createMonster(monster.name, monster.pos) + end + + 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 + + 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 +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 +end + +leverLadyTenebris:position(Position(32902, 31622, 14)) +leverLadyTenebris:register() + diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lloyd.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lloyd.lua new file mode 100644 index 00000000000..3b2d7ba2a7d --- /dev/null +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lloyd.lua @@ -0,0 +1,129 @@ +local config = { + boss = { + name = "Lloyd", + position = Position(32799, 32827, 14), + }, + requiredLevel = 250, + timeToDefeat = 10 * 60, + playerPositions = { + { pos = Position(32759, 32868, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32759, 32869, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32759, 32870, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32759, 32871, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32759, 32872, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, + }, + monsters = { + { name = "cosmic energy prism a invu", pos = Position(32801, 32827, 14) }, + { name = "cosmic energy prism b invu", pos = Position(32798, 32827, 14) }, + { name = "cosmic energy prism c invu", pos = Position(32803, 32826, 14) }, + { name = "cosmic energy prism d invu", pos = Position(32796, 32826, 14) }, + }, + specPos = { + from = Position(32785, 32813, 14), + to = Position(32812, 32838, 14), + }, + exit = Position(32815, 32873, 13), +} + +local leverLloyd = Action() + +function leverLloyd.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LloydKilled) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) + for _, monster in pairs(config.monsters) do + Game.createMonster(monster.name, monster.pos) + end + + 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 + + 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 +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 +end + +leverLloyd:position(Position(32759, 32867, 14)) +leverLloyd:register() diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_old_desk.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_old_desk.lua index 3bbc0175e5d..a33e1aa4cfd 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_old_desk.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_old_desk.lua @@ -1,22 +1,22 @@ local forgottenKnowledgeOldDesk = Action() function forgottenKnowledgeOldDesk.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.ForgottenKnowledge.SilverKey) >= 1 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.SilverKey) >= 1 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You already get an old silver key.") return true end - if player:getStorageValue(Storage.ForgottenKnowledge.GirlPicture) >= 1 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.GirlPicture) >= 1 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You find an old silver key inside of the drower.") player:addItem(23733, true, true) - player:setStorageValue(Storage.ForgottenKnowledge.SilverKey, 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.SilverKey, 1) return true end - if player:getStorageValue(Storage.ForgottenKnowledge.OldDesk) >= 1 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.OldDesk) >= 1 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You already get an old note.") return true end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "As you open the drower a ghostly apparition shortly appears hovering over the desk. You find an old note inside of the drower.") player:addItem(23731, true, true) - player:setStorageValue(Storage.ForgottenKnowledge.OldDesk, 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.OldDesk, 1) return true end diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_plant.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_plant.lua index d0306018ce5..65715560a67 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_plant.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_plant.lua @@ -403,7 +403,7 @@ local function revertTree() tree:getPosition():sendMagicEffect(CONST_ME_POFF) tree:transform(6189) end - Game.setStorageValue(GlobalStorage.ForgottenKnowledge.ActiveTree, 0) + Game.setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.ActiveTree, 0) for v = 1, #dry do Game.createItem(dry[v].itemid, 1, dry[v].position) local pos = Position(dry[v].position) @@ -429,16 +429,16 @@ function forgottenKnowledgePlant.onUse(player, item, fromPosition, target, toPos target:getPosition():sendMagicEffect(CONST_ME_SMALLPLANTS) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The birch grows as you pour the sparkling water from the phial over it.") addEvent(revertItem, 10 * 60 * 1000, target:getPosition(), 26483, 26482) - if player:getStorageValue(Storage.ForgottenKnowledge.PlantCounter) < 0 then - player:setStorageValue(Storage.ForgottenKnowledge.PlantCounter, 0) + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.PlantCounter) < 0 then + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.PlantCounter, 0) end - player:setStorageValue(Storage.ForgottenKnowledge.PlantCounter, player:getStorageValue(Storage.ForgottenKnowledge.PlantCounter) + 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.PlantCounter, player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.PlantCounter) + 1) elseif target.itemid == 6180 and target:getPosition() == Position(32737, 32116, 10) then - if Game.getStorageValue(GlobalStorage.ForgottenKnowledge.ActiveTree) >= 1 then + if Game.getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.ActiveTree) >= 1 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You cannot use the phial while the trees still have life and colour.") return true end - if player:getStorageValue(Storage.ForgottenKnowledge.PlantCounter) < 5 or player:getStorageValue(Storage.ForgottenKnowledge.BirdCounter) < 3 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.PlantCounter) < 5 or player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.BirdCounter) < 3 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seems that you don't make grow enough trees or not free the parrots.") return true end @@ -477,7 +477,7 @@ function forgottenKnowledgePlant.onUse(player, item, fromPosition, target, toPos end end end - Game.setStorageValue(GlobalStorage.ForgottenKnowledge.ActiveTree, 1) + Game.setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.ActiveTree, 1) addEvent(revertTree, 1 * 60 * 1000) Game.createItem(11108, 1, Position(32736, 32117, 10)) local teleport = Game.createItem(775, 1, Position(32736, 32117, 10)) diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_secret_wall.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_secret_wall.lua index 674e9fd5b42..0d9e3a3acff 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_secret_wall.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_secret_wall.lua @@ -7,7 +7,7 @@ function forgottenKnowledgeSecret.onUse(player, item, fromPosition, target, toPo if not player:getItemById(23738, true) then return false end - if player:getStorageValue(Storage.ForgottenKnowledge.SilverKey) < 1 or not player:getItemById(23733, true) then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.SilverKey) < 1 or not player:getItemById(23733, true) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You don't have the fitting key.") return true end diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_servants_mechanism.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_servants_mechanism.lua index eb2d9588662..8c2ca9f5bf1 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_servants_mechanism.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_servants_mechanism.lua @@ -1,19 +1,19 @@ local config = { - [26663] = { storage = GlobalStorage.ForgottenKnowledge.MechanismDiamond, counter = GlobalStorage.ForgottenKnowledge.DiamondServant, msg = "5 diamond entities are consuming too much raw energy for the cosmic chamber to awaken, it will be put to rest again in 10 minutes." }, - [26664] = { storage = GlobalStorage.ForgottenKnowledge.MechanismGolden, counter = GlobalStorage.ForgottenKnowledge.GoldenServant, msg = "5 golden entities are consuming too much raw energy for the cosmic chamber to awaken, it will be put to rest again in 10 minutes." }, + [26663] = { storage = Storage.Quest.U11_02.ForgottenKnowledge.MechanismDiamond, counter = Storage.Quest.U11_02.ForgottenKnowledge.DiamondServant, msg = "5 diamond entities are consuming too much raw energy for the cosmic chamber to awaken, it will be put to rest again in 10 minutes." }, + [26664] = { storage = Storage.Quest.U11_02.ForgottenKnowledge.MechanismGolden, counter = Storage.Quest.U11_02.ForgottenKnowledge.GoldenServant, msg = "5 golden entities are consuming too much raw energy for the cosmic chamber to awaken, it will be put to rest again in 10 minutes." }, } local function clearGolems() local specs, spec = Game.getSpectators(Position(32815, 32874, 13), false, false, 63, 63, 63, 63) for i = 1, #specs do spec = specs[i] - if Game.getStorageValue(GlobalStorage.ForgottenKnowledge.MechanismDiamond) < 1 then + if Game.getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.MechanismDiamond) < 1 then if spec:isMonster() and spec:getName():lower() == "diamond servant replica" then spec:getPosition():sendMagicEffect(CONST_ME_POFF) spec:remove() end end - if Game.getStorageValue(GlobalStorage.ForgottenKnowledge.MechanismGolden) < 1 then + if Game.getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.MechanismGolden) < 1 then if spec:isMonster() and spec:getName():lower() == "golden servant replica" then spec:getPosition():sendMagicEffect(CONST_ME_POFF) spec:remove() diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_last_lore_keeper.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_last_lore_keeper.lua new file mode 100644 index 00000000000..7b86711d158 --- /dev/null +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_last_lore_keeper.lua @@ -0,0 +1,143 @@ +local config = { + boss = { + name = "The Last Lore Keeper", + position = Position(31987, 32839, 14), + }, + requiredLevel = 250, + timeToDefeat = 17 * 60, + playerPositions = { + { pos = Position(32018, 32844, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32019, 32844, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32020, 32844, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32018, 32845, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32019, 32845, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32020, 32845, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32018, 32846, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32019, 32846, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32020, 32846, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32018, 32847, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32019, 32847, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32020, 32847, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32018, 32848, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32019, 32848, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32020, 32848, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + }, + monsters = { + { name = "bound astral power", pos = Position(31973, 32840, 15) }, + { name = "bound astral power", pos = Position(31973, 32856, 15) }, + { name = "bound astral power", pos = Position(31989, 32856, 15) }, + { name = "bound astral power", pos = Position(31989, 32840, 15) }, + { name = "a shielded astral glyph", pos = Position(31986, 32840, 14) }, + { name = "the distorted astral source", pos = Position(31986, 32823, 15) }, + { name = "an astral glyph", pos = Position(31989, 32823, 15) }, + }, + specPos = { + from = Position(31968, 32821, 14), + to = Position(32004, 32865, 15), + }, + exit = Position(32035, 32859, 14), +} + +local leverLoreKeeper = Action() + +function leverLoreKeeper.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LastLoreKilled) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) + + for _, monster in pairs(config.monsters) do + Game.createMonster(monster.name, monster.pos) + end + + 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 + + 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 +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 +end + +leverLoreKeeper:position(Position(32019, 32843, 14)) +leverLoreKeeper:register() diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_thorn_knight.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_thorn_knight.lua new file mode 100644 index 00000000000..356bd3d2a4a --- /dev/null +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_thorn_knight.lua @@ -0,0 +1,129 @@ +local config = { + boss = { + name = "The Enraged Thorn Knight", + createFunction = function() + return Game.createMonster("Mounted Thorn Knight", Position(32624, 32880, 14), true, true) + end, + }, + requiredLevel = 250, + timeToDefeat = 15 * 60, + playerPositions = { + { pos = Position(32657, 32877, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32657, 32878, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32657, 32879, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32657, 32880, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32657, 32881, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, + }, + specPos = { + from = Position(32613, 32869, 14), + to = Position(32636, 32892, 14), + }, + exit = Position(32678, 32888, 14), + onUseExtra = function(player) + for d = 1, 6 do + Game.createMonster("possessed tree", Position(math.random(32619, 32629), math.random(32877, 32884), 14), true, true) + end + end +} + +local leverThornKnight = Action() + +function leverThornKnight.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.ThornKnightKilled) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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 + + config.boss.createFunction() + + config.onUseExtra(player) + + 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 + + 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 +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 +end + +leverThornKnight:position(Position(32657, 32876, 14)) +leverThornKnight:register() diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua new file mode 100644 index 00000000000..b9570ef82e1 --- /dev/null +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua @@ -0,0 +1,128 @@ +local config = { + boss = { + name = "The Time Guardian", + position = Position(32977, 31662, 14), + }, + requiredLevel = 250, + timeToDefeat = 15 * 60, + playerPositions = { + { pos = Position(33010, 31660, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(33010, 31661, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(33010, 31662, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(33010, 31663, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(33010, 31664, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, + }, + monsters = { + { name = "The Freezing Time Guardian", pos = Position(32975, 31664, 13) }, + { name = "The Blazing Time Guardian", pos = Position(32980, 31664, 13) }, + }, + specPos = { + from = Position(32967, 31654, 14), + to = Position(32989, 31677, 14), + }, + exit = Position(32870, 32724, 14), +} + +local leverTimeGuardian = Action() + +function leverTimeGuardian.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.TimeGuardianKilled) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) + + for _, monster in pairs(config.monsters) do + Game.createMonster(monster.name, monster.pos) + end + + 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 + + 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 +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 +end + +leverTimeGuardian:position(Position(33010, 31659, 14)) +leverTimeGuardian:register() diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_time_machine.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_time_machine.lua index bc92b403adf..52188508827 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_time_machine.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_time_machine.lua @@ -1,4 +1,5 @@ local timeMachine = Action() + function timeMachine.onUse(player, item, fromPosition, target, toPosition, isHotkey) if player:getPosition() == Position(32870, 32723, 15) then player:teleportTo(Position(32870, 32724, 14)) diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_astral_source.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_astral_source.lua index 9d243f4be65..d7d0d869513 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_astral_source.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_astral_source.lua @@ -2,7 +2,7 @@ local astralSource = CreatureEvent("AstralSource") function astralSource.onThink(creature) local hp = (creature:getHealth() / creature:getMaxHealth()) * 100 local health, difference, glyph, pos = 0, 0, Tile(Position(31989, 32823, 15)):getTopCreature(), creature:getPosition() - if hp < 5.5 and Game.getStorageValue(GlobalStorage.ForgottenKnowledge.AstralGlyph) >= 1 then + if hp < 5.5 and Game.getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AstralGlyph) >= 1 then sourcePos = creature:getPosition() creature:say("Your damage distorted the source and prevents the Glyph to draw on its power.", TALKTYPE_MONSTER_SAY) creature:remove() @@ -23,7 +23,7 @@ function astralSource.onThink(creature) glyph:say("Without the power of the source the Glyph loses its protection!", TALKTYPE_MONSTER_SAY) end end - elseif Game.getStorageValue(GlobalStorage.ForgottenKnowledge.AstralGlyph) < 1 then + elseif Game.getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AstralGlyph) < 1 then creature:addHealth(10000, false) end end diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_bosses_kill.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_bosses_kill.lua index 6bd27821be6..00ced55f16d 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_bosses_kill.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_bosses_kill.lua @@ -1,19 +1,20 @@ local bosses = { -- bosses - ["lady tenebris"] = { storage = Storage.ForgottenKnowledge.LadyTenebrisKilled }, - ["the enraged thorn knight"] = { storage = Storage.ForgottenKnowledge.ThornKnightKilled }, - ["lloyd"] = { storage = Storage.ForgottenKnowledge.LloydKilled }, - ["soul of dragonking zyrtarch"] = { storage = Storage.ForgottenKnowledge.DragonkingKilled }, - ["melting frozen horror"] = { storage = Storage.ForgottenKnowledge.HorrorKilled }, - ["the time guardian"] = { storage = Storage.ForgottenKnowledge.TimeGuardianKilled }, - ["the blazing time guardian"] = { storage = Storage.ForgottenKnowledge.TimeGuardianKilled }, - ["the freezing time guardian"] = { storage = Storage.ForgottenKnowledge.TimeGuardianKilled }, - ["the last lore keeper"] = { storage = Storage.ForgottenKnowledge.LastLoreKilled }, + ["lady tenebris"] = { storage = Storage.Quest.U11_02.ForgottenKnowledge.LadyTenebrisKilled }, + ["the enraged thorn knight"] = { storage = Storage.Quest.U11_02.ForgottenKnowledge.ThornKnightKilled }, + ["lloyd"] = { storage = Storage.Quest.U11_02.ForgottenKnowledge.LloydKilled }, + ["soul of dragonking zyrtarch"] = { storage = Storage.Quest.U11_02.ForgottenKnowledge.DragonkingKilled }, + ["melting frozen horror"] = { storage = Storage.Quest.U11_02.ForgottenKnowledge.HorrorKilled }, + ["the time guardian"] = { storage = Storage.Quest.U11_02.ForgottenKnowledge.TimeGuardianKilled }, + ["the blazing time guardian"] = { storage = Storage.Quest.U11_02.ForgottenKnowledge.TimeGuardianKilled }, + ["the freezing time guardian"] = { storage = Storage.Quest.U11_02.ForgottenKnowledge.TimeGuardianKilled }, + ["the last lore keeper"] = { storage = Storage.Quest.U11_02.ForgottenKnowledge.LastLoreKilled }, -- IA interactions ["an astral glyph"] = {}, } local bossesForgottenKill = CreatureEvent("ForgottenKnowledgeBossDeath") + function bossesForgottenKill.onDeath(creature) local bossConfig = bosses[creature:getName():lower()] if not bossConfig then @@ -22,10 +23,14 @@ function bossesForgottenKill.onDeath(creature) onDeathForDamagingPlayers(creature, function(creature, player) if bossConfig.storage then - player:setStorageValue(bossConfig.storage, os.time() + 20 * 3600) + if creature:getName():lower() == "the last lore keeper" then + player:setStorageValue(bossConfig.storage, os.time() + (13 * 24 * 3600) + (20 * 3600)) + else + player:setStorageValue(bossConfig.storage, os.time() + 20 * 3600) + end elseif creature:getName():lower() == "the enraged thorn knight" then - player:setStorageValue(Storage.ForgottenKnowledge.PlantCounter, 0) - player:setStorageValue(Storage.ForgottenKnowledge.BirdCounter, 0) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.PlantCounter, 0) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.BirdCounter, 0) end end) diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_bound_astral_power.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_bound_astral_power.lua index 3709d5c559a..be6286b7e88 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_bound_astral_power.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_bound_astral_power.lua @@ -7,9 +7,9 @@ local positions = { local astralPower = CreatureEvent("BoundAstralPowerDeath") function astralPower.onDeath(creature, _corpse, _lastHitKiller, mostDamageKiller) - Game.setStorageValue(GlobalStorage.ForgottenKnowledge.AstralPowerCounter, Game.getStorageValue(GlobalStorage.ForgottenKnowledge.AstralPowerCounter) + 1) - if Game.getStorageValue(GlobalStorage.ForgottenKnowledge.AstralPowerCounter) >= 4 then - Game.setStorageValue(GlobalStorage.ForgottenKnowledge.AstralPowerCounter, 1) + Game.setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AstralPowerCounter, Game.getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AstralPowerCounter) + 1) + if Game.getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AstralPowerCounter) >= 4 then + Game.setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AstralPowerCounter, 1) end local msg = "The destruction of the power source gained you more time until the glyph is powered up!" @@ -21,8 +21,8 @@ function astralPower.onDeath(creature, _corpse, _lastHitKiller, mostDamageKiller if player:getPosition():getDistance(positions[i].pos) < 7 then creature:say(msg, TALKTYPE_MONSTER_SAY, false, nil, positions[i].pos) Game.createMonster("bound astral power", positions[i].nextPos, true, true) - Game.setStorageValue(GlobalStorage.ForgottenKnowledge.AstralGlyph, 1) - addEvent(Game.setStorageValue, 1 * 60 * 1000, GlobalStorage.ForgottenKnowledge.AstralGlyph, 0) + Game.setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AstralGlyph, 1) + addEvent(Game.setStorageValue, 1 * 60 * 1000, Storage.Quest.U11_02.ForgottenKnowledge.AstralGlyph, 0) end end return true diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_distorted_source.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_distorted_source.lua index 334c7bc8cf6..e8f7c799dbb 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_distorted_source.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_distorted_source.lua @@ -3,7 +3,7 @@ function distortedSource.onThink(creature) local health, difference, glyph, pos = 0, 0, Tile(Position(31989, 32823, 15)):getTopCreature(), creature:getPosition() if creature:getHealth() <= 40000 then creature:addHealth(10000, false) - elseif creature:getHealth() >= 55000 or Game.getStorageValue(GlobalStorage.ForgottenKnowledge.AstralGlyph) < 1 then + elseif creature:getHealth() >= 55000 or Game.getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AstralGlyph) < 1 then local spectators = Game.getSpectators(Position(31986, 32847, 14), false, false, 12, 12, 12, 12) for i = 1, #spectators do local spec = spectators[i] @@ -20,7 +20,7 @@ function distortedSource.onThink(creature) end end - if Game.getStorageValue(GlobalStorage.ForgottenKnowledge.AstralGlyph) >= 1 then + if Game.getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AstralGlyph) >= 1 then local spectators = Game.getSpectators(Position(31986, 32847, 14), false, false, 12, 12, 12, 12) for i = 1, #spectators do local spec2 = spectators[i] diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_energy_prism_death.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_energy_prism_death.lua index 140362d92b3..5b4213feaed 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_energy_prism_death.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_energy_prism_death.lua @@ -1,6 +1,6 @@ local energyPrismDeath = CreatureEvent("EnergyPrismDeath") function energyPrismDeath.onDeath(creature) - stopEvent(Storage.ForgottenKnowledge.LloydEvent) + stopEvent(Storage.Quest.U11_02.ForgottenKnowledge.LloydEvent) local tile = Tile(Position(32799, 32826, 14)) if not tile then return false diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_lloyd_preparedeath.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_lloyd_preparedeath.lua index e00624aa53d..5804a21283c 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_lloyd_preparedeath.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_lloyd_preparedeath.lua @@ -49,7 +49,7 @@ function lloydPrepareDeath.onPrepareDeath(creature, lastHitKiller, mostDamageKil creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) creature:addHealth(300000, true) creature:say("The cosmic energies in the chamber refocus on Lloyd.", TALKTYPE_MONSTER_SAY) - Storage.ForgottenKnowledge.LloydEvent = addEvent(revertLloyd, 10 * 1000, prismCount) + Storage.Quest.U11_02.ForgottenKnowledge.LloydEvent = addEvent(revertLloyd, 10 * 1000, prismCount) end return true end diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_replica_servants.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_replica_servants.lua index acb25740216..d2dbe4a1b4e 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_replica_servants.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/creaturescripts_replica_servants.lua @@ -1,11 +1,11 @@ local servants = { ["golden servant replica"] = { - storage = GlobalStorage.ForgottenKnowledge.GoldenServant, - playerStorage = Storage.ForgottenKnowledge.GoldenServantCounter, + storage = Storage.Quest.U11_02.ForgottenKnowledge.GoldenServant, + playerStorage = Storage.Quest.U11_02.ForgottenKnowledge.GoldenServantCounter, }, ["diamond servant replica"] = { - storage = GlobalStorage.ForgottenKnowledge.DiamondServant, - playerStorage = Storage.ForgottenKnowledge.DiamondServantCounter, + storage = Storage.Quest.U11_02.ForgottenKnowledge.DiamondServant, + playerStorage = Storage.Quest.U11_02.ForgottenKnowledge.DiamondServantCounter, }, } local replicaServant = CreatureEvent("ReplicaServantDeath") @@ -18,7 +18,7 @@ function replicaServant.onDeath(creature, _corpse, _lastHitKiller, mostDamageKil Game.setStorageValue(bossConfig.storage, 0) end Game.setStorageValue(bossConfig.storage, Game.getStorageValue(bossConfig.storage) + 1) - if Game.getStorageValue(GlobalStorage.ForgottenKnowledge.GoldenServant) >= 5 and Game.getStorageValue(GlobalStorage.ForgottenKnowledge.DiamondServant) >= 5 then + if Game.getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.GoldenServant) >= 5 and Game.getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.DiamondServant) >= 5 then if not Tile(Position(32815, 32870, 13)):getItemById(10840) then local teleport = Game.createItem(10840, 1, Position(32815, 32870, 13)) if teleport then diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_challenger.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_challenger.lua index d204cd119a9..edc8ffbc61e 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_challenger.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_challenger.lua @@ -45,7 +45,7 @@ function challenger.onStepIn(creature, item, position, fromPosition) end if player:canFightBoss(teleport.boss) then if item.uid == 24882 then - if player:getStorageValue(Storage.ForgottenKnowledge.BabyDragon) < 1 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.BabyDragon) < 1 then player:teleportTo(teleport.backPos) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You not have permission to use this teleport!") player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_entrance_teleport.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_entrance_teleport.lua index 5b327430c4b..2ead03f8c80 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_entrance_teleport.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_entrance_teleport.lua @@ -1,72 +1,72 @@ local destination = { [25047] = { newPos = Position(32807, 31657, 8), - storage = Storage.ForgottenKnowledge.AccessDeath, + storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessDeath, effect = CONST_ME_MORTAREA, }, [25048] = { newPos = Position(32325, 32089, 7), - storage = Storage.ForgottenKnowledge.AccessDeath, + storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessDeath, effect = CONST_ME_MORTAREA, }, [25051] = { newPos = Position(32786, 32820, 13), - storage = Storage.ForgottenKnowledge.AccessViolet, + storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessViolet, effect = CONST_ME_PURPLEENERGY, }, [25052] = { newPos = Position(32328, 32089, 7), - storage = Storage.ForgottenKnowledge.AccessViolet, + storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessViolet, effect = CONST_ME_PURPLEENERGY, }, [25049] = { newPos = Position(32637, 32256, 7), - storage = Storage.ForgottenKnowledge.AccessEarth, + storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessEarth, effect = CONST_ME_SMALLPLANTS, }, [25050] = { newPos = Position(32331, 32089, 7), - storage = Storage.ForgottenKnowledge.AccessEarth, + storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessEarth, effect = CONST_ME_SMALLPLANTS, }, [25053] = { newPos = Position(33341, 31168, 7), - storage = Storage.ForgottenKnowledge.AccessFire, + storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessFire, effect = CONST_ME_FIREAREA, }, [25054] = { newPos = Position(32334, 32089, 7), - storage = Storage.ForgottenKnowledge.AccessFire, + storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessFire, effect = CONST_ME_FIREAREA, }, [25057] = { newPos = Position(32207, 31036, 10), - storage = Storage.ForgottenKnowledge.AccessIce, + storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessIce, effect = CONST_ME_ICEATTACK, }, [25058] = { newPos = Position(32337, 32089, 7), - storage = Storage.ForgottenKnowledge.AccessIce, + storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessIce, effect = CONST_ME_ICEATTACK, }, [25055] = { newPos = Position(32780, 32686, 14), - storage = Storage.ForgottenKnowledge.AccessGolden, + storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessGolden, effect = CONST_ME_YELLOWENERGY, }, [25056] = { newPos = Position(32340, 32089, 7), - storage = Storage.ForgottenKnowledge.AccessGolden, + storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessGolden, effect = CONST_ME_YELLOWENERGY, }, [10840] = { newPos = Position(32907, 32848, 13), - storage = Storage.ForgottenKnowledge.AccessLast, + storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessLast, effect = CONST_ME_ENERGYHIT, }, [10842] = { newPos = Position(32332, 32092, 7), - storage = Storage.ForgottenKnowledge.AccessLast, + storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessLast, effect = CONST_ME_ENERGYHIT, }, } @@ -84,16 +84,15 @@ function entranceTeleport.onStepIn(creature, item, position, fromPosition) return end if item.itemid == 10840 then - if player:getStorageValue(Storage.ForgottenKnowledge.AccessLast) < 1 then - if - player:getStorageValue(Storage.ForgottenKnowledge.LadyTenebrisKilled) >= 1 - and player:getStorageValue(Storage.ForgottenKnowledge.LloydKilled) >= 1 - and player:getStorageValue(Storage.ForgottenKnowledge.ThornKnightKilled) >= 1 - and player:getStorageValue(Storage.ForgottenKnowledge.DragonkingKilled) >= 1 - and player:getStorageValue(Storage.ForgottenKnowledge.HorrorKilled) >= 1 - and player:getStorageValue(Storage.ForgottenKnowledge.TimeGuardianKilled) >= 1 + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessLast) < 1 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LadyTenebrisKilled) >= 1 + and player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LloydKilled) >= 1 + and player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.ThornKnightKilled) >= 1 + and player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.DragonkingKilled) >= 1 + and player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.HorrorKilled) >= 1 + and player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.TimeGuardianKilled) >= 1 then - player:setStorageValue(Storage.ForgottenKnowledge.AccessLast, 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessLast, 1) end end end diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_fount.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_fount.lua index e1a11083da7..c38b3b56cc7 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_fount.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_fount.lua @@ -5,7 +5,7 @@ function fount.onStepIn(creature, item, position, fromPosition) if not player then return end - if player:getStorageValue(Storage.ForgottenKnowledge.Phial) >= 1 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Phial) >= 1 then player:teleportTo(Position(32722, 32242, 8)) player:getPosition():sendMagicEffect(CONST_ME_WATERSPLASH) return true diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_ice_teleport.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_ice_teleport.lua index b855169c234..7854fa63f4f 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_ice_teleport.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_ice_teleport.lua @@ -1,7 +1,7 @@ local destination = { [26667] = { position = Position(32273, 31053, 13), - storage = Storage.ForgottenKnowledge.AccessMachine, + storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessMachine, }, } diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_lava_teleport.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_lava_teleport.lua index 1e352d3d7ea..005b6546644 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_lava_teleport.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_lava_teleport.lua @@ -1,7 +1,7 @@ local destination = { [26668] = { position = Position(33411, 31082, 10), - storage = Storage.ForgottenKnowledge.AccessLavaTeleport, + storage = Storage.Quest.U11_02.ForgottenKnowledge.AccessLavaTeleport, }, } diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_servant_teleport.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_servant_teleport.lua index 42921e1712f..bba0c98bfa8 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_servant_teleport.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_servant_teleport.lua @@ -13,7 +13,7 @@ function servantTeleport.onStepIn(creature, item, position, fromPosition) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have to wait to challenge this enemy again!") return true end - if player:getStorageValue(Storage.ForgottenKnowledge.GoldenServantCounter) >= 5 and player:getStorageValue(Storage.ForgottenKnowledge.DiamondServantCounter) >= 5 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.GoldenServantCounter) >= 5 and player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.DiamondServantCounter) >= 5 then player:teleportTo(Position(32760, 32876, 14)) player:getPosition():sendMagicEffect(CONST_ME_ENERGYHIT) return true diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_teleport_tree.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_teleport_tree.lua index ea3bf54a854..d1135f65fa0 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_teleport_tree.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_teleport_tree.lua @@ -6,7 +6,7 @@ function teleportTree.onStepIn(creature, item, position, fromPosition) return end - if player:getStorageValue(Storage.ForgottenKnowledge.PlantCounter) < 5 or player:getStorageValue(Storage.ForgottenKnowledge.BirdCounter) < 3 then + if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.PlantCounter) < 5 or player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.BirdCounter) < 3 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You don't help in anything to enter here") player:teleportTo(Position(32737, 32117, 10)) position:sendMagicEffect(CONST_ME_TELEPORT) diff --git a/data-otservbr-global/scripts/world_changes/iron_servant_transformation.lua b/data-otservbr-global/scripts/world_changes/iron_servant_transformation.lua index 7da5f5d1b99..e62cd23c876 100644 --- a/data-otservbr-global/scripts/world_changes/iron_servant_transformation.lua +++ b/data-otservbr-global/scripts/world_changes/iron_servant_transformation.lua @@ -6,7 +6,7 @@ ironServantTransformation.monsterOnSpawn = function(monster, position) end local chance = math.random(100) - if Game.getStorageValue(GlobalStorage.ForgottenKnowledge.MechanismDiamond) >= 1 and Game.getStorageValue(GlobalStorage.ForgottenKnowledge.MechanismGolden) >= 1 then + if Game.getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.MechanismDiamond) >= 1 and Game.getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.MechanismGolden) >= 1 then if chance > 30 then local monsterType = math.random(2) == 1 and "diamond servant replica" or "golden servant replica" Game.createMonster(monsterType, monster:getPosition(), false, true) @@ -15,13 +15,13 @@ ironServantTransformation.monsterOnSpawn = function(monster, position) return end - if Game.getStorageValue(GlobalStorage.ForgottenKnowledge.MechanismDiamond) >= 1 and chance > 30 then + if Game.getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.MechanismDiamond) >= 1 and chance > 30 then Game.createMonster("diamond servant replica", monster:getPosition(), false, true) monster:remove() return end - if Game.getStorageValue(GlobalStorage.ForgottenKnowledge.MechanismGolden) >= 1 and chance > 30 then + if Game.getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.MechanismGolden) >= 1 and chance > 30 then Game.createMonster("golden servant replica", monster:getPosition(), false, true) monster:remove() end diff --git a/data-otservbr-global/startup/tables/chest.lua b/data-otservbr-global/startup/tables/chest.lua index d5b28c633ed..09edd338516 100644 --- a/data-otservbr-global/startup/tables/chest.lua +++ b/data-otservbr-global/startup/tables/chest.lua @@ -2621,6 +2621,31 @@ ChestUnique = { weight = 1.00, storage = Storage.Quest.U10_90.FerumbrasAscension.VampireTeeth, }, + -- Forgotten Knowledge Quest + [6310] = { + useKV = true, + itemId = 23736, + itemPos = { x = 32825, y = 31664, z = 9 }, + reward = { { 23734, 1 } }, + weight = 6.00, + questName = "GhostsilverLanternQuest", + }, + [6311] = { + useKV = true, + itemId = 21858, + itemPos = { x = 32883, y = 31686, z = 10 }, + reward = { { 23732, 1 } }, + weight = 4.00, + questName = "PaintingOfAGirlQuest", + }, + [6311] = { + useKV = true, + itemId = 9253, + itemPos = { x = 33026, y = 31662, z = 14 }, + reward = { { 24964, 1 } }, + weight = 3.00, + questName = "ImbuingCrystalQuest", + }, -- Reward of others scrips files (varied rewards) -- The First dragon Quest -- Treasure chests (data\scripts\actions\quests\first_dragon\treasure_chests.lua) diff --git a/data-otservbr-global/startup/tables/item.lua b/data-otservbr-global/startup/tables/item.lua index 6fa23fb8bd9..080095b1cf6 100644 --- a/data-otservbr-global/startup/tables/item.lua +++ b/data-otservbr-global/startup/tables/item.lua @@ -885,6 +885,19 @@ ItemAction = { { x = 33324, y = 31372, z = 14 }, }, }, + -- Forgotten Knowledge Quest + [24875] = { + itemId = 23730, + itemPos = { x = 32860, y = 31644, z = 10 }, + }, + [24876] = { + itemId = 1503, + itemPos = { x = 32891, y = 31619, z = 10 }, + }, + [24877] = { + itemId = 1503, + itemPos = { x = 32924, y = 31636, z = 14 }, + }, -- The Cursed Crystal [25018] = { itemId = false, diff --git a/data-otservbr-global/startup/tables/lever.lua b/data-otservbr-global/startup/tables/lever.lua index 86798188a0a..56ab01b63b7 100644 --- a/data-otservbr-global/startup/tables/lever.lua +++ b/data-otservbr-global/startup/tables/lever.lua @@ -102,6 +102,19 @@ LeverAction = { { x = 32576, y = 31862, z = 14 }, }, }, + -- Forgotten Knowledge Quest + [26663] = { + itemId = 9125, + itemPos = { + { x = 32792, y = 32820, z = 13 }, + }, + }, + [26664] = { + itemId = 9125, + itemPos = { + { x = 32840, y = 32820, z = 13 }, + }, + }, -- Dawnport bridge lever -- Path: data\scripts\actions\dawnport\lever.lua [30001] = { diff --git a/data-otservbr-global/startup/tables/teleport.lua b/data-otservbr-global/startup/tables/teleport.lua index b32575f117d..b7147fbbbd5 100644 --- a/data-otservbr-global/startup/tables/teleport.lua +++ b/data-otservbr-global/startup/tables/teleport.lua @@ -27,6 +27,27 @@ TeleportAction = { } TeleportUnique = { + -- Forgotten Knowledge Quest + [1067] = { + itemId = 1949, + itemPos = { x = 32915, y = 31637, z = 14 }, + }, + [1068] = { + itemId = 1949, + itemPos = { x = 32676, y = 32888, z = 14 }, + }, + [1070] = { + itemId = 1949, + itemPos = { x = 32316, y = 31093, z = 14 }, + }, + [1071] = { + itemId = 1949, + itemPos = { x = 32849, y = 32689, z = 15 }, + }, + [1072] = { + itemId = 1949, + itemPos = { x = 32033, y = 32859, z = 14 }, + }, -- Issavi town teleport [9515] = { itemId = 1949, diff --git a/data-otservbr-global/startup/tables/teleport_item.lua b/data-otservbr-global/startup/tables/teleport_item.lua index c9595228a49..c09dd9e22fa 100644 --- a/data-otservbr-global/startup/tables/teleport_item.lua +++ b/data-otservbr-global/startup/tables/teleport_item.lua @@ -49,19 +49,97 @@ TeleportItemAction = { { x = 32172, y = 32439, z = 7 }, }, }, - -- Teleports Thais + -- Forgotten Knowledge Quest - Teleports Thais [24873] = { - itemId = false, + itemId = 25047, itemPos = { { x = 32325, y = 32087, z = 7 }, + }, + }, + [24873] = { + itemId = 25051, + itemPos = { { x = 32328, y = 32087, z = 7 }, + }, + }, + [24873] = { + itemId = 25049, + itemPos = { { x = 32331, y = 32087, z = 7 }, + }, + }, + [24873] = { + itemId = 25053, + itemPos = { { x = 32334, y = 32087, z = 7 }, + }, + }, + [24873] = { + itemId = 25057, + itemPos = { { x = 32337, y = 32087, z = 7 }, + }, + }, + [24873] = { + itemId = 25055, + itemPos = { { x = 32340, y = 32087, z = 7 }, + }, + }, + [24873] = { + itemId = 10840, + itemPos = { { x = 32332, y = 32094, z = 7 }, }, }, + [24873] = { + itemId = 25048, + itemPos = { + { x = 32805, y = 31657, z = 8 }, + }, + }, + [24873] = { + itemId = 25052, + itemPos = { + { x = 32786, y = 32818, z = 13 }, + }, + }, + [24873] = { + itemId = 25050, + itemPos = { + { x = 32637, y = 32255, z = 7 }, + }, + }, + [24873] = { + itemId = 25054, + itemPos = { + { x = 33341, y = 31167, z = 7 }, + }, + }, + [24873] = { + itemId = 25058, + itemPos = { + { x = 32205, y = 31036, z = 10 }, + }, + }, + [24873] = { + itemId = 25056, + itemPos = { + { x = 32780, y = 32684, z = 14 }, + }, + }, + [24873] = { + itemId = 10842, + itemPos = { + { x = 32906, y = 32846, z = 13 }, + }, + }, + [26668] = { + itemId = 1949, + itemPos = { + { x = 33396, y = 31129, z = 9 }, + }, + }, } TeleportItemUnique = { From 773e2928f3713ed137a3e307b61f0930055f024d Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 7 Oct 2024 13:07:06 +0000 Subject: [PATCH 13/70] Lua code format - (Stylua) --- data-otservbr-global/npc/ivalisse.lua | 51 ++-- .../actions_dragonking_zyrtarch.lua | 228 ++++++++-------- .../actions_frozen_horror.lua | 256 +++++++++--------- .../actions_lady_tenebris.lua | 225 ++++++++------- .../forgotten_knowledge/actions_lloyd.lua | 226 ++++++++-------- .../actions_the_last_lore_keeper.lua | 254 ++++++++--------- .../actions_the_thorn_knight.lua | 214 +++++++-------- .../actions_the_time_guardian.lua | 224 +++++++-------- .../movements_entrance_teleport.lua | 3 +- 9 files changed, 840 insertions(+), 841 deletions(-) diff --git a/data-otservbr-global/npc/ivalisse.lua b/data-otservbr-global/npc/ivalisse.lua index bd909ebf636..5b3e5a96140 100644 --- a/data-otservbr-global/npc/ivalisse.lua +++ b/data-otservbr-global/npc/ivalisse.lua @@ -75,28 +75,27 @@ local function creatureSayCallback(npc, creature, type, message) "But beware, as far as we know, some of them have been claimed by other ancient beings and there is now way for us to prepare you what lies beyond any of those gates.", }, npc, creature) npcHandler:setTopic(playerId, 0) - elseif MsgContains(message, "father") and npcHandler:getTopic(playerId) == 1 then - if player:getStorageValue(Storage.Quest.U8_54.TheNewFrontier.Questline) == 29 then - npcHandler:say({ - "Papa- my father has recently started an adventure on his own. His name is Silus; he is a member of the Edron academy. ...", - "Ever since he joined what he called a 'special research division', he went on and on about Zao and how venturing there would help him get ahead. ...", - "You must know he lives for science, especially concerning faraway lands and cultures. He talked about the importance of practical field studies but, frankly, he isn't particularly cut out for that. ...", - "I know he has to focus to get his research done right now, and I simply cannot leave my duties in the temple. You seem like a person who travels a lot; would you be willing to help me?", - }, npc, creature) - npcHandler:setTopic(playerId, 2) - elseif player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Ivalisse) == 1 or - player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Chalice) == 1 then - npcHandler:say("Well, I hope you like it here. We tried to rebuild in the Shaper's will. I am a bit preoccupied at the moment because of the absence of my father. I may not be the best of help currently, sorry.", npc, creature) - npcHandler:setTopic(playerId, 0) - elseif player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.DragonkingKilled) >= 1 and player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Ivalisse) < 1 then - npcHandler:say({ - "What? You're telling me you found father? How is he? What did papa say? A chalice? As a disguise? The whole time? ...", - "Well, I am not as much surprised as I am happy to hear that he's alright. You know, after the incident with the duck and the umbrella—it doesn't get to me that easily anymore. ...", - "Thank you very much for doing all this for me; I will be forever grateful. I have nothing to repay you with, but you are already blessed to have been able to lay eyes on the sacred Shaper ruins.", - }, npc, creature) - player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Ivalisse, 1) - npcHandler:setTopic(playerId, 0) - end + elseif MsgContains(message, "father") and npcHandler:getTopic(playerId) == 1 then + if player:getStorageValue(Storage.Quest.U8_54.TheNewFrontier.Questline) == 29 then + npcHandler:say({ + "Papa- my father has recently started an adventure on his own. His name is Silus; he is a member of the Edron academy. ...", + "Ever since he joined what he called a 'special research division', he went on and on about Zao and how venturing there would help him get ahead. ...", + "You must know he lives for science, especially concerning faraway lands and cultures. He talked about the importance of practical field studies but, frankly, he isn't particularly cut out for that. ...", + "I know he has to focus to get his research done right now, and I simply cannot leave my duties in the temple. You seem like a person who travels a lot; would you be willing to help me?", + }, npc, creature) + npcHandler:setTopic(playerId, 2) + elseif player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Ivalisse) == 1 or player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Chalice) == 1 then + npcHandler:say("Well, I hope you like it here. We tried to rebuild in the Shaper's will. I am a bit preoccupied at the moment because of the absence of my father. I may not be the best of help currently, sorry.", npc, creature) + npcHandler:setTopic(playerId, 0) + elseif player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.DragonkingKilled) >= 1 and player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Ivalisse) < 1 then + npcHandler:say({ + "What? You're telling me you found father? How is he? What did papa say? A chalice? As a disguise? The whole time? ...", + "Well, I am not as much surprised as I am happy to hear that he's alright. You know, after the incident with the duck and the umbrella—it doesn't get to me that easily anymore. ...", + "Thank you very much for doing all this for me; I will be forever grateful. I have nothing to repay you with, but you are already blessed to have been able to lay eyes on the sacred Shaper ruins.", + }, npc, creature) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Ivalisse, 1) + npcHandler:setTopic(playerId, 0) + end elseif MsgContains(message, "yes") then if npcHandler:getTopic(playerId) == 2 then npcHandler:say({ @@ -109,10 +108,10 @@ local function creatureSayCallback(npc, creature, type, message) }, npc, creature) npcHandler:setTopic(playerId, 3) elseif npcHandler:getTopic(playerId) == 3 then - npcHandler:say("You would? That's great! Thank you! If you can find my father, tell him I understand and that I really miss him!", npc, creature) - player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessFire, 1) - player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Chalice, 1) - npcHandler:setTopic(playerId, 0) + npcHandler:say("You would? That's great! Thank you! If you can find my father, tell him I understand and that I really miss him!", npc, creature) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessFire, 1) + player:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.Chalice, 1) + npcHandler:setTopic(playerId, 0) end elseif MsgContains(message, "no") then npcHandler:say("Oh nevermind, I am sorry I asked you for this.", npc, creature) diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_dragonking_zyrtarch.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_dragonking_zyrtarch.lua index 266c0ea489a..88bca44d699 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_dragonking_zyrtarch.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_dragonking_zyrtarch.lua @@ -1,129 +1,129 @@ local config = { - boss = { - name = "soul of dragonking zyrtarch", - position = Position(33359, 31182, 12), - }, - requiredLevel = 250, - timeToDefeat = 15 * 60, - playerPositions = { - { pos = Position(33391, 31178, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, - { pos = Position(33391, 31179, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, - { pos = Position(33391, 31180, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, - { pos = Position(33391, 31181, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, - { pos = Position(33391, 31182, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, - }, - monsters = { - { name = "soulcatcher", pos = Position(33352, 31187, 10) }, - { name = "soulcatcher", pos = Position(33363, 31187, 10) }, - { name = "soulcatcher", pos = Position(33353, 31176, 10) }, - { name = "soulcatcher", pos = Position(33363, 31176, 10) }, - { name = "dragonking zyrtarch", pos = Position(33357, 31182, 10) }, - }, - specPos = { - from = Position(33348, 31172, 10), - to = Position(33368, 31190, 12), - }, - exit = Position(33407, 31172, 10), + boss = { + name = "soul of dragonking zyrtarch", + position = Position(33359, 31182, 12), + }, + requiredLevel = 250, + timeToDefeat = 15 * 60, + playerPositions = { + { pos = Position(33391, 31178, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, + { pos = Position(33391, 31179, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, + { pos = Position(33391, 31180, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, + { pos = Position(33391, 31181, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, + { pos = Position(33391, 31182, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, + }, + monsters = { + { name = "soulcatcher", pos = Position(33352, 31187, 10) }, + { name = "soulcatcher", pos = Position(33363, 31187, 10) }, + { name = "soulcatcher", pos = Position(33353, 31176, 10) }, + { name = "soulcatcher", pos = Position(33363, 31176, 10) }, + { name = "dragonking zyrtarch", pos = Position(33357, 31182, 10) }, + }, + specPos = { + from = Position(33348, 31172, 10), + to = Position(33368, 31190, 12), + }, + exit = Position(33407, 31172, 10), } local leverZyrtarch = Action() function leverZyrtarch.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.DragonkingKilled) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - 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 - - 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) - for _, monster in pairs(config.monsters) do - Game.createMonster(monster.name, monster.pos) - end - - 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 - - return true + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.DragonkingKilled) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) + for _, monster in pairs(config.monsters) do + Game.createMonster(monster.name, monster.pos) + end + + 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 + + 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 leverZyrtarch:position(Position(33391, 31177, 10)) diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua index 8f4978b2453..b6db83cb8bb 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua @@ -1,144 +1,144 @@ local eggPos = Position(32269, 31084, 14) local config = { - boss = { - name = "Melting Frozen Horror", - createFunction = function() - Game.createMonster("dragon egg", eggPos, true, true) - - local eggCreature = Tile(eggPos):getTopCreature() - if eggCreature then - eggCreature:setHealth(1) - else - print("Error: No dragon egg found at eggPos.") - end - - return Game.createMonster("solid frozen horror", Position(32269, 31091, 14), true, true) - end, - }, - requiredLevel = 250, - timeToDefeat = 15 * 60, - playerPositions = { - { pos = Position(32302, 31088, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32302, 31089, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32302, 31090, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32302, 31091, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32302, 31092, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, - }, - monsters = { - { name = "icicle", pos = Position(32266, 31084, 14) }, - { name = "icicle", pos = Position(32272, 31084, 14) }, - { name = "melting frozen horror", pos = Position(32267, 31071, 14) }, - }, - specPos = { - from = Position(32257, 31080, 14), - to = Position(32280, 31102, 14), - }, - exit = Position(32271, 31097, 14), + boss = { + name = "Melting Frozen Horror", + createFunction = function() + Game.createMonster("dragon egg", eggPos, true, true) + + local eggCreature = Tile(eggPos):getTopCreature() + if eggCreature then + eggCreature:setHealth(1) + else + print("Error: No dragon egg found at eggPos.") + end + + return Game.createMonster("solid frozen horror", Position(32269, 31091, 14), true, true) + end, + }, + requiredLevel = 250, + timeToDefeat = 15 * 60, + playerPositions = { + { pos = Position(32302, 31088, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32302, 31089, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32302, 31090, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32302, 31091, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32302, 31092, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, + }, + monsters = { + { name = "icicle", pos = Position(32266, 31084, 14) }, + { name = "icicle", pos = Position(32272, 31084, 14) }, + { name = "melting frozen horror", pos = Position(32267, 31071, 14) }, + }, + specPos = { + from = Position(32257, 31080, 14), + to = Position(32280, 31102, 14), + }, + exit = Position(32271, 31097, 14), } local leverMeltingFrozenHorror = Action() function leverMeltingFrozenHorror.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.HorrorKilled) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - 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 - - 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 - - if config.boss.createFunction then - config.boss.createFunction() - else - Game.createMonster(config.boss.name, config.boss.position) - end - - for _, monster in pairs(config.monsters) do - Game.createMonster(monster.name, monster.pos) - end - - 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 - - return true + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.HorrorKilled) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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 + + if config.boss.createFunction then + config.boss.createFunction() + else + Game.createMonster(config.boss.name, config.boss.position) + end + + for _, monster in pairs(config.monsters) do + Game.createMonster(monster.name, monster.pos) + end + + 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 + + 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 leverMeltingFrozenHorror:position(Position(32302, 31087, 14)) diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lady_tenebris.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lady_tenebris.lua index 40c2fc774f7..67348e45803 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lady_tenebris.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lady_tenebris.lua @@ -1,129 +1,128 @@ local config = { - boss = { - name = "Lady Tenebris", - position = Position(32912, 31599, 14), - }, - requiredLevel = 250, - timeToDefeat = 15 * 60, - playerPositions = { - { pos = Position(32902, 31623, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32902, 31624, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32902, 31625, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32902, 31626, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32902, 31627, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, - }, - monsters = { - { name = "shadow tentacle", pos = Position(32910, 31599, 14) }, - { name = "shadow tentacle", pos = Position(32912, 31597, 14) }, - { name = "shadow tentacle", pos = Position(32914, 31599, 14) }, - }, - specPos = { - from = Position(32899, 31587, 14), - to = Position(32923, 31612, 14), - }, - exit = Position(32902, 31629, 14), + boss = { + name = "Lady Tenebris", + position = Position(32912, 31599, 14), + }, + requiredLevel = 250, + timeToDefeat = 15 * 60, + playerPositions = { + { pos = Position(32902, 31623, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32902, 31624, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32902, 31625, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32902, 31626, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32902, 31627, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, + }, + monsters = { + { name = "shadow tentacle", pos = Position(32910, 31599, 14) }, + { name = "shadow tentacle", pos = Position(32912, 31597, 14) }, + { name = "shadow tentacle", pos = Position(32914, 31599, 14) }, + }, + specPos = { + from = Position(32899, 31587, 14), + to = Position(32923, 31612, 14), + }, + exit = Position(32902, 31629, 14), } local leverLadyTenebris = Action() function leverLadyTenebris.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LadyTenebrisKilled) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - 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 - - 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) - for _, monster in pairs(config.monsters) do - Game.createMonster(monster.name, monster.pos) - end - - 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 - - return true + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LadyTenebrisKilled) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) + for _, monster in pairs(config.monsters) do + Game.createMonster(monster.name, monster.pos) + end + + 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 + + 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 leverLadyTenebris:position(Position(32902, 31622, 14)) leverLadyTenebris:register() - diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lloyd.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lloyd.lua index 3b2d7ba2a7d..70e849261b5 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lloyd.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lloyd.lua @@ -1,128 +1,128 @@ local config = { - boss = { - name = "Lloyd", - position = Position(32799, 32827, 14), - }, - requiredLevel = 250, - timeToDefeat = 10 * 60, - playerPositions = { - { pos = Position(32759, 32868, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32759, 32869, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32759, 32870, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32759, 32871, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32759, 32872, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, - }, - monsters = { - { name = "cosmic energy prism a invu", pos = Position(32801, 32827, 14) }, - { name = "cosmic energy prism b invu", pos = Position(32798, 32827, 14) }, - { name = "cosmic energy prism c invu", pos = Position(32803, 32826, 14) }, - { name = "cosmic energy prism d invu", pos = Position(32796, 32826, 14) }, - }, - specPos = { - from = Position(32785, 32813, 14), - to = Position(32812, 32838, 14), - }, - exit = Position(32815, 32873, 13), + boss = { + name = "Lloyd", + position = Position(32799, 32827, 14), + }, + requiredLevel = 250, + timeToDefeat = 10 * 60, + playerPositions = { + { pos = Position(32759, 32868, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32759, 32869, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32759, 32870, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32759, 32871, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32759, 32872, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, + }, + monsters = { + { name = "cosmic energy prism a invu", pos = Position(32801, 32827, 14) }, + { name = "cosmic energy prism b invu", pos = Position(32798, 32827, 14) }, + { name = "cosmic energy prism c invu", pos = Position(32803, 32826, 14) }, + { name = "cosmic energy prism d invu", pos = Position(32796, 32826, 14) }, + }, + specPos = { + from = Position(32785, 32813, 14), + to = Position(32812, 32838, 14), + }, + exit = Position(32815, 32873, 13), } local leverLloyd = Action() function leverLloyd.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LloydKilled) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - 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 - - 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) - for _, monster in pairs(config.monsters) do - Game.createMonster(monster.name, monster.pos) - end - - 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 - - return true + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LloydKilled) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) + for _, monster in pairs(config.monsters) do + Game.createMonster(monster.name, monster.pos) + end + + 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 + + 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 leverLloyd:position(Position(32759, 32867, 14)) diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_last_lore_keeper.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_last_lore_keeper.lua index 7b86711d158..4c8eff54ca3 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_last_lore_keeper.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_last_lore_keeper.lua @@ -1,142 +1,142 @@ local config = { - boss = { - name = "The Last Lore Keeper", - position = Position(31987, 32839, 14), - }, - requiredLevel = 250, - timeToDefeat = 17 * 60, - playerPositions = { - { pos = Position(32018, 32844, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32019, 32844, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32020, 32844, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32018, 32845, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32019, 32845, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32020, 32845, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32018, 32846, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32019, 32846, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32020, 32846, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32018, 32847, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32019, 32847, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32020, 32847, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32018, 32848, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32019, 32848, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32020, 32848, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - }, - monsters = { - { name = "bound astral power", pos = Position(31973, 32840, 15) }, - { name = "bound astral power", pos = Position(31973, 32856, 15) }, - { name = "bound astral power", pos = Position(31989, 32856, 15) }, - { name = "bound astral power", pos = Position(31989, 32840, 15) }, - { name = "a shielded astral glyph", pos = Position(31986, 32840, 14) }, - { name = "the distorted astral source", pos = Position(31986, 32823, 15) }, - { name = "an astral glyph", pos = Position(31989, 32823, 15) }, - }, - specPos = { - from = Position(31968, 32821, 14), - to = Position(32004, 32865, 15), - }, - exit = Position(32035, 32859, 14), + boss = { + name = "The Last Lore Keeper", + position = Position(31987, 32839, 14), + }, + requiredLevel = 250, + timeToDefeat = 17 * 60, + playerPositions = { + { pos = Position(32018, 32844, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32019, 32844, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32020, 32844, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32018, 32845, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32019, 32845, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32020, 32845, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32018, 32846, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32019, 32846, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32020, 32846, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32018, 32847, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32019, 32847, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32020, 32847, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32018, 32848, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32019, 32848, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(32020, 32848, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, + }, + monsters = { + { name = "bound astral power", pos = Position(31973, 32840, 15) }, + { name = "bound astral power", pos = Position(31973, 32856, 15) }, + { name = "bound astral power", pos = Position(31989, 32856, 15) }, + { name = "bound astral power", pos = Position(31989, 32840, 15) }, + { name = "a shielded astral glyph", pos = Position(31986, 32840, 14) }, + { name = "the distorted astral source", pos = Position(31986, 32823, 15) }, + { name = "an astral glyph", pos = Position(31989, 32823, 15) }, + }, + specPos = { + from = Position(31968, 32821, 14), + to = Position(32004, 32865, 15), + }, + exit = Position(32035, 32859, 14), } local leverLoreKeeper = Action() function leverLoreKeeper.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LastLoreKilled) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - 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 - - 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) - - for _, monster in pairs(config.monsters) do - Game.createMonster(monster.name, monster.pos) - end - - 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 - - return true + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LastLoreKilled) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) + + for _, monster in pairs(config.monsters) do + Game.createMonster(monster.name, monster.pos) + end + + 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 + + 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 leverLoreKeeper:position(Position(32019, 32843, 14)) diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_thorn_knight.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_thorn_knight.lua index 356bd3d2a4a..b0a1a95e9e2 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_thorn_knight.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_thorn_knight.lua @@ -1,128 +1,128 @@ local config = { - boss = { - name = "The Enraged Thorn Knight", - createFunction = function() - return Game.createMonster("Mounted Thorn Knight", Position(32624, 32880, 14), true, true) - end, - }, - requiredLevel = 250, - timeToDefeat = 15 * 60, - playerPositions = { + boss = { + name = "The Enraged Thorn Knight", + createFunction = function() + return Game.createMonster("Mounted Thorn Knight", Position(32624, 32880, 14), true, true) + end, + }, + requiredLevel = 250, + timeToDefeat = 15 * 60, + playerPositions = { { pos = Position(32657, 32877, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, { pos = Position(32657, 32878, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, { pos = Position(32657, 32879, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, { pos = Position(32657, 32880, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, { pos = Position(32657, 32881, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, }, - specPos = { - from = Position(32613, 32869, 14), - to = Position(32636, 32892, 14), - }, - exit = Position(32678, 32888, 14), - onUseExtra = function(player) - for d = 1, 6 do - Game.createMonster("possessed tree", Position(math.random(32619, 32629), math.random(32877, 32884), 14), true, true) - end - end + specPos = { + from = Position(32613, 32869, 14), + to = Position(32636, 32892, 14), + }, + exit = Position(32678, 32888, 14), + onUseExtra = function(player) + for d = 1, 6 do + Game.createMonster("possessed tree", Position(math.random(32619, 32629), math.random(32877, 32884), 14), true, true) + end + end, } local leverThornKnight = Action() function leverThornKnight.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.ThornKnightKilled) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - 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 - - 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 - - config.boss.createFunction() - - config.onUseExtra(player) - - 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 - - return true + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.ThornKnightKilled) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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 + + config.boss.createFunction() + + config.onUseExtra(player) + + 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 + + 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 leverThornKnight:position(Position(32657, 32876, 14)) diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua index b9570ef82e1..c25f1ccf1b9 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua @@ -1,127 +1,127 @@ local config = { - boss = { - name = "The Time Guardian", - position = Position(32977, 31662, 14), - }, - requiredLevel = 250, - timeToDefeat = 15 * 60, - playerPositions = { - { pos = Position(33010, 31660, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(33010, 31661, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(33010, 31662, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(33010, 31663, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(33010, 31664, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, - }, - monsters = { - { name = "The Freezing Time Guardian", pos = Position(32975, 31664, 13) }, - { name = "The Blazing Time Guardian", pos = Position(32980, 31664, 13) }, - }, - specPos = { - from = Position(32967, 31654, 14), - to = Position(32989, 31677, 14), - }, - exit = Position(32870, 32724, 14), + boss = { + name = "The Time Guardian", + position = Position(32977, 31662, 14), + }, + requiredLevel = 250, + timeToDefeat = 15 * 60, + playerPositions = { + { pos = Position(33010, 31660, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(33010, 31661, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(33010, 31662, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(33010, 31663, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, + { pos = Position(33010, 31664, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, + }, + monsters = { + { name = "The Freezing Time Guardian", pos = Position(32975, 31664, 13) }, + { name = "The Blazing Time Guardian", pos = Position(32980, 31664, 13) }, + }, + specPos = { + from = Position(32967, 31654, 14), + to = Position(32989, 31677, 14), + }, + exit = Position(32870, 32724, 14), } local leverTimeGuardian = Action() function leverTimeGuardian.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.TimeGuardianKilled) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - 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 - - 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) - - for _, monster in pairs(config.monsters) do - Game.createMonster(monster.name, monster.pos) - end - - 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 - - return true + local players = {} + local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) + + 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 + + local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.TimeGuardianKilled) + if cooldownTime > os.time() then + local remainingTime = cooldownTime - os.time() + local hours = math.floor(remainingTime / 3600) + local minutes = math.floor((remainingTime % 3600) / 60) + player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + return true + end + + if creature:getLevel() < config.requiredLevel then + player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") + return true + end + + table.insert(players, creature) + end + + 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 + + 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) + + for _, monster in pairs(config.monsters) do + Game.createMonster(monster.name, monster.pos) + end + + 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 + + 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 leverTimeGuardian:position(Position(33010, 31659, 14)) diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_entrance_teleport.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_entrance_teleport.lua index 2ead03f8c80..64847b1560a 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_entrance_teleport.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/movements_entrance_teleport.lua @@ -85,7 +85,8 @@ function entranceTeleport.onStepIn(creature, item, position, fromPosition) end if item.itemid == 10840 then if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AccessLast) < 1 then - if player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LadyTenebrisKilled) >= 1 + if + player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LadyTenebrisKilled) >= 1 and player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LloydKilled) >= 1 and player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.ThornKnightKilled) >= 1 and player:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.DragonkingKilled) >= 1 From 9b9685eb92600e90c2c7a401913a56b29589ae85 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:26:06 -0300 Subject: [PATCH 14/70] Cults of Tibia Quest --- data-otservbr-global/lib/core/quests.lua | 24 +- data-otservbr-global/lib/core/storages.lua | 132 +- .../quests/cults_of_tibia/misguided_bully.lua | 8 +- .../cults_of_tibia/misguided_shadow.lua | 8 +- .../quests/cults_of_tibia/misguided_thief.lua | 4 + data-otservbr-global/npc/angelo.lua | 111 +- data-otservbr-global/npc/denominator.lua | 102 +- data-otservbr-global/npc/gareth.lua | 102 +- data-otservbr-global/npc/gerimor.lua | 357 +++--- data-otservbr-global/npc/iwar.lua | 25 +- data-otservbr-global/npc/jamesfrancis.lua | 78 +- data-otservbr-global/npc/noozer.lua | 40 +- data-otservbr-global/npc/tigo.lua | 25 +- .../actions/valuables/random_items.lua | 7 + .../creaturescripts/customs/freequests.lua | 78 +- .../cults_of_tibia/actions_analyser.lua | 4 +- .../cults_of_tibia/actions_bosses_levers.lua | 1066 +++++++++-------- .../cults_of_tibia/actions_counter_agent.lua | 4 +- .../quests/cults_of_tibia/actions_crate.lua | 6 +- .../cults_of_tibia/actions_cult_symbol.lua | 19 +- .../cults_of_tibia/actions_document.lua | 7 +- .../cults_of_tibia/actions_last_object.lua | 7 +- .../cults_of_tibia/actions_lever_mota.lua | 71 +- .../cults_of_tibia/actions_magnifier.lua | 4 +- .../cults_of_tibia/actions_misguided.lua | 24 +- .../quests/cults_of_tibia/actions_torch.lua | 7 +- .../creaturescripts_bosses_mission_cults.lua | 14 +- ...creaturescripts_glowing_rubbish_amulet.lua | 60 +- .../creaturescripts_minotaur_task_count.lua | 4 +- .../cults_of_tibia/creaturescripts_splash.lua | 1 + .../cults_of_tibia/movements_begin_task.lua | 21 +- .../cults_of_tibia/movements_check_oasis.lua | 4 +- .../cults_of_tibia/movements_energy_fence.lua | 24 +- .../quests/cults_of_tibia/movements_ice.lua | 167 +-- .../cults_of_tibia/movements_ice_death.lua | 29 +- .../cults_of_tibia/movements_looktype.lua | 12 +- .../movements_river_teleport.lua | 4 +- .../movements_sand_entrance.lua | 2 +- .../quests/cults_of_tibia/movements_tar.lua | 264 ++-- .../movements_task_teleport.lua | 12 +- data-otservbr-global/startup/tables/chest.lua | 11 +- .../startup/tables/door_quest.lua | 40 +- data-otservbr-global/startup/tables/item.lua | 107 ++ data-otservbr-global/startup/tables/lever.lua | 19 + .../startup/tables/teleport.lua | 13 + data/modules/scripts/cults_of_tibia/death.lua | 4 +- 46 files changed, 1613 insertions(+), 1519 deletions(-) diff --git a/data-otservbr-global/lib/core/quests.lua b/data-otservbr-global/lib/core/quests.lua index 711b3f19eb1..bd5cc91bb4f 100644 --- a/data-otservbr-global/lib/core/quests.lua +++ b/data-otservbr-global/lib/core/quests.lua @@ -5294,23 +5294,23 @@ if not Quests then }, [38] = { name = "Cults of Tibia", - startStorageId = Storage.CultsOfTibia.Questline, + startStorageId = Storage.Quest.U11_40.CultsOfTibia.Questline, startStorageValue = 1, missions = { [1] = { name = "The Strengthtening of the Minotaurs", - storageId = Storage.CultsOfTibia.Minotaurs.JamesfrancisTask, + storageId = Storage.Quest.U11_40.CultsOfTibia.Minotaurs.JamesfrancisTask, missionId = 10372, startValue = 0, endValue = 50, description = function(player) return ("James asked you to enter the cave for hunting 50 empowered minotaurs. \z - Then he will be able to continue his research.\nMinotaurs killed: %d/50"):format(player:getStorageValue(Storage.CultsOfTibia.Minotaurs.JamesfrancisTask)) + Then he will be able to continue his research.\nMinotaurs killed: %d/50"):format(player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Minotaurs.JamesfrancisTask)) end, }, [2] = { name = "The Strengthtening of the Minotaurs", - storageId = Storage.CultsOfTibia.Minotaurs.Mission, + storageId = Storage.Quest.U11_40.CultsOfTibia.Minotaurs.Mission, missionId = 10373, startValue = 1, endValue = 5, @@ -5326,7 +5326,7 @@ if not Quests then }, [3] = { name = "Patron of Arts", - storageId = Storage.CultsOfTibia.MotA.Mission, + storageId = Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, missionId = 10374, startValue = 1, endValue = 15, @@ -5359,7 +5359,7 @@ if not Quests then }, [4] = { name = "Barkless", - storageId = Storage.CultsOfTibia.Barkless.Mission, + storageId = Storage.Quest.U11_40.CultsOfTibia.Barkless.Mission, missionId = 10375, startValue = 1, endValue = 7, @@ -5371,7 +5371,7 @@ if not Quests then The hardest part, however, is yet to come. Give your life to the ice... to become true and purified.", [3] = function(player) return ("You survived the Trial. Barkless now have the right to see the cult leader but a \z - powerful relic is sealing the path. Barkless markings broken to reverse the power of the cult object: \z %d of 10"):format(math.max(player:getStorageValue(Storage.CultsOfTibia.Barkless.Objects), 0)) + powerful relic is sealing the path. Barkless markings broken to reverse the power of the cult object: \z %d of 10"):format(math.max(player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Objects), 0)) end, [4] = "You broke enough Barkless markings to now reverse the seal \z held up by the cult object in the ritual chamber. \z @@ -5387,7 +5387,7 @@ if not Quests then }, [5] = { name = "Misguided", - storageId = Storage.CultsOfTibia.Misguided.Mission, + storageId = Storage.Quest.U11_40.CultsOfTibia.Misguided.Mission, missionId = 10376, startValue = 1, endValue = 5, @@ -5397,7 +5397,7 @@ if not Quests then hinted at something weird going on in a cave. He seemed too confused to decide whether to stop you.", [3] = function(player) return ("While rubbish, the amulet you equipe emits a strange aura of splendour. \z - You feel an urge to fulfill the amulets hunger for especific deaths... Exorcisms: %d/5 "):format(math.max(player:getStorageValue(Storage.CultsOfTibia.Misguided.Exorcisms), 0)) + You feel an urge to fulfill the amulets hunger for especific deaths... Exorcisms: %d/5 "):format(math.max(player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Exorcisms), 0)) end, [4] = "You defeated the cult leader of Misguided by uncovering the true master to pull his strings \z and freeing this world from its malicious existance. Return to Gerimor to tell him about the victory.", @@ -5406,7 +5406,7 @@ if not Quests then }, [6] = { name = "The Orc Idol", - storageId = Storage.CultsOfTibia.Orcs.Mission, + storageId = Storage.Quest.U11_40.CultsOfTibia.Orcs.Mission, missionId = 10377, startValue = 1, endValue = 3, @@ -5420,7 +5420,7 @@ if not Quests then }, [7] = { name = "The Secret of the Sandy Cave", - storageId = Storage.CultsOfTibia.Life.Mission, + storageId = Storage.Quest.U11_40.CultsOfTibia.Life.Mission, missionId = 10378, startValue = 1, endValue = 10, @@ -5445,7 +5445,7 @@ if not Quests then }, [8] = { name = "Zathroth Remmants", - storageId = Storage.CultsOfTibia.Humans.Mission, + storageId = Storage.Quest.U11_40.CultsOfTibia.Humans.Mission, missionId = 10379, startValue = 1, endValue = 3, diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index 75ec195c7b7..6d5873bcdb8 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -328,71 +328,6 @@ Storage = { LastAchievement = 50191, }, }, - CultsOfTibia = { - -- Reserved storage from 50200 - 50269 - Questline = 50200, - Minotaurs = { - EntranceAccessDoor = 50201, - JamesfrancisTask = 50202, - Mission = 50203, - BossTimer = 50204, - AccessDoor = 50205, - }, - MotA = { - Mission = 50210, - Stone1 = 50211, - Stone2 = 50212, - Stone3 = 50213, - Answer = 50214, - QuestionId = 50215, - AccessDoorInvestigation = 50216, - AccessDoorGareth = 50217, - AccessDoorDenominator = 50218, - }, - Barkless = { - Mission = 50225, - sulphur = 50226, - Tar = 50227, - Ice = 50228, - Death = 50229, - Objects = 50230, - Temp = 50231, - BossTimer = 50232, - TrialAccessDoor = 50243, -- 50233 is used by an ore wagon - TarAccessDoor = 50234, - AccessDoor = 50235, - BossAccessDoor = 50236, - }, - Orcs = { - Mission = 50240, - LookType = 50241, - BossTimer = 50242, - }, - Life = { - Mission = 50245, - BossTimer = 50246, - AccessDoor = 50264, - }, - Humans = { - Mission = 50250, - Vaporized = 50251, - Decaying = 50252, - BossTimer = 50253, - }, - Misguided = { - Mission = 50255, - Monsters = 50256, - Exorcisms = 50257, - Time = 50258, - BossTimer = 50259, - AccessDoor = 50260, - }, - FinalBoss = { - Mission = 50261, - BossTimer = 50262, - AccessDoor = 50263, - }, - }, HeroRathleton = { -- Reserved storage from 50400 - 50419 QuestLine = 50400, @@ -2534,7 +2469,72 @@ Storage = { }, }, U11_40 = { -- update 11.40 - Reserved Storages 45651 - 45850 - CultsOfTibia = {}, -- 45651 - 45750 + CultsOfTibia = { -- 45651 - 45750 + Questline = 45651, + Minotaurs = { + BossAccessDoor = 45652, + JamesfrancisTask = 45653, + Mission = 45654, + BossTimer = 45655, + AccessDoor = 45656, + }, + MotA = { + Mission = 45657, + Stone1 = 45658, + Stone2 = 45659, + Stone3 = 45660, + Answer = 45661, + QuestionId = 45662, + AccessDoorInvestigation = 45663, + AccessDoorGareth = 45664, + AccessDoorDenominator = 45665, + }, + Barkless = { + Mission = 45666, + Sulphur = 45667, + Tar = 45668, + Ice = 45669, + Death = 45670, + Objects = 45671, + Temp = 45672, + BossTimer = 45673, + TrialAccessDoor = 45674, + TarAccessDoor = 45675, + AccessDoor = 45676, + BossAccessDoor = 45677, + SulphurAccessDoor = 45678, + }, + Orcs = { + Mission = 45678, + LookType = 45679, + BossTimer = 45680, + }, + Life = { + Mission = 45681, + BossTimer = 45682, + AccessDoor = 45683, + }, + Humans = { + Mission = 45684, + Vaporized = 45685, + Decaying = 45686, + BossTimer = 45687, + WallDecaying = 45688, + }, + Misguided = { + Mission = 45688, + Monsters = 45689, + Exorcisms = 45690, + Time = 45691, + BossTimer = 45692, + AccessDoor = 45693, + }, + FinalBoss = { + Mission = 45694, + BossTimer = 45695, + AccessDoor = 45696, + }, + }, ThreatenedDreams = { -- 45751 - 45850 QuestLine = 45751, Mission01 = { diff --git a/data-otservbr-global/monster/quests/cults_of_tibia/misguided_bully.lua b/data-otservbr-global/monster/quests/cults_of_tibia/misguided_bully.lua index 5cf1c3b8582..0798c14fe70 100644 --- a/data-otservbr-global/monster/quests/cults_of_tibia/misguided_bully.lua +++ b/data-otservbr-global/monster/quests/cults_of_tibia/misguided_bully.lua @@ -13,10 +13,6 @@ monster.outfit = { lookMount = 0, } -monster.events = { - "GlowingRubbishAmuletDeath", -} - monster.raceId = 1412 monster.Bestiary = { class = "Humanoid", @@ -49,6 +45,10 @@ monster.strategiesTarget = { random = 10, } +monster.events = { + "GlowingRubbishAmuletDeath", +} + monster.flags = { summonable = false, attackable = true, diff --git a/data-otservbr-global/monster/quests/cults_of_tibia/misguided_shadow.lua b/data-otservbr-global/monster/quests/cults_of_tibia/misguided_shadow.lua index 547c67f7cf1..b854cf01fe6 100644 --- a/data-otservbr-global/monster/quests/cults_of_tibia/misguided_shadow.lua +++ b/data-otservbr-global/monster/quests/cults_of_tibia/misguided_shadow.lua @@ -13,10 +13,6 @@ monster.outfit = { lookMount = 0, } -monster.events = { - "GlowingRubbishAmuletDeath", -} - monster.health = 3000 monster.maxHealth = 3000 monster.race = "blood" @@ -36,6 +32,10 @@ monster.strategiesTarget = { random = 10, } +monster.events = { + "GlowingRubbishAmuletDeath", +} + monster.flags = { summonable = false, attackable = true, diff --git a/data-otservbr-global/monster/quests/cults_of_tibia/misguided_thief.lua b/data-otservbr-global/monster/quests/cults_of_tibia/misguided_thief.lua index 68ed4699b15..a753fcaaab0 100644 --- a/data-otservbr-global/monster/quests/cults_of_tibia/misguided_thief.lua +++ b/data-otservbr-global/monster/quests/cults_of_tibia/misguided_thief.lua @@ -45,6 +45,10 @@ monster.strategiesTarget = { random = 10, } +monster.events = { + "GlowingRubbishAmuletDeath", +} + monster.flags = { summonable = false, attackable = true, diff --git a/data-otservbr-global/npc/angelo.lua b/data-otservbr-global/npc/angelo.lua index ca73a5a6544..e770704a75a 100644 --- a/data-otservbr-global/npc/angelo.lua +++ b/data-otservbr-global/npc/angelo.lua @@ -52,18 +52,18 @@ end local function greetCallback(npc, creature) local playerId = creature:getId() - local player = Player(creature) - -- Se estiver na 1º missão - if player:getStorageValue(Storage.CultsOfTibia.Life.Mission) == 1 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission) == 1 then npcHandler:setMessage(MESSAGE_GREET, "The Druid of Crunor? He told you that a new cave appeared here? That's right. I'm the head of a {project} that tries to find out more about this new {area}.") - elseif player:getStorageValue(Storage.CultsOfTibia.Life.Mission) == 9 then + elseif player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission) == 9 then npcHandler:setMessage(MESSAGE_GREET, "Just get out of my way! You killed this beautiful creature. I have nothing more to say. Damn druid of Crunor!") - -- Se já tiver após a 1º missão - elseif player:getStorageValue(Storage.CultsOfTibia.Life.Mission) > 1 then + elseif player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission) > 1 then npcHandler:setMessage(MESSAGE_GREET, "How is your {mission} going?") + elseif player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission) < 1 then + npcHandler:setMessage(MESSAGE_GREET, "The Druid of Crunor? He told you that a new cave appeared here? That's right. I'm the head of a project that tries to find out more about this new area.") end + return true end local function creatureSayCallback(npc, creature, type, message) @@ -74,88 +74,79 @@ local function creatureSayCallback(npc, creature, type, message) return false end - -- Sequência para pegar a quest - if MsgContains(message, "project") then - npcHandler:say({ "The project is called 'Sandy {Cave} Project' and is funded by the {MoTA}. Its goal is the investigation of this {cave}." }, npc, creature) - npcHandler:setTopic(playerId, 2) - elseif npcHandler:getTopic(playerId) == 2 and MsgContains(message, "mota") then - npcHandler:say({ "MoTA is short for the recently founded Museum of Tibian Arts. We work together in close collaboration. New {results} are communicated to the museum instantly." }, npc, creature) - npcHandler:setTopic(playerId, 3) - elseif npcHandler:getTopic(playerId) == 3 and MsgContains(message, "results") then - npcHandler:say({ "We have no scientific results so far to reach our {goal}, because my workers aren't back yet. Should I be {worried}?" }, npc, creature) - npcHandler:setTopic(playerId, 4) - elseif npcHandler:getTopic(playerId) == 4 and MsgContains(message, "yes") then - npcHandler:say({ "Alright. I have to find out why they don't return. But I'm old and my back aches. Would you like to go there and look for my workers?" }, npc, creature) - npcHandler:setTopic(playerId, 5) - elseif npcHandler:getTopic(playerId) == 5 and MsgContains(message, "yes") then - npcHandler:say({ "Fantastic! Go there and then tell me what you've seen. I've oppened the door for you. Take care of yourself!" }, npc, creature) - player:setStorageValue(Storage.CultsOfTibia.Life.Mission, 2) - player:setStorageValue(Storage.CultsOfTibia.Life.AccessDoor, 1) - npcHandler:setTopic(playerId, 0) - - -- Inútil - elseif npcHandler:getTopic(playerId) == 2 and MsgContains(message, "cave") then - npcHandler:say({ "We don't know exactly why this cave has now exposed an entry via the {dark pyramid}. It seems that the cave already existed for a long time, however, without a connection to our world. Maybe some smaller earth movements have changed the situation." }, npc, creature) - npcHandler:setTopic(playerId, 11) - elseif npcHandler:getTopic(playerId) == 11 and MsgContains(message, "dark pyramid") then - npcHandler:say({ "We don't know yet to wich extent the cave and the dark pyramid belong together. Thisi s what we try to find out. Maybe the history of this place has to be rewritten." }, npc, creature) - npcHandler:setTopic(playerId, 0) - end - - -- Depois de encontrar o Oasis - if player:getStorageValue(Storage.CultsOfTibia.Life.Mission) == 3 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission) == 3 then if MsgContains(message, "mission") then - npcHandler:say({ "The scientists are still missing? You just found some strange green shining mummies and a big oasis? I give you this analysis tool for the water of the oasis. Maybe that's the key. Could you bring me a sample of this water?" }, npc, creature) + npcHandler:say("The scientists are still missing? You just found some strange green shining mummies and a big oasis? I give you this analysis tool for the water of the oasis. Maybe that's the key. Could you bring me a sample of this water?", npc, creature) npcHandler:setTopic(playerId, 15) elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 15 then - npcHandler:say({ "Very good. Hopefully analysing this sample will get us closer to the solution of this mistery." }, npc, creature) + npcHandler:say("Very good. Hopefully analysing this sample will get us closer to the solution of this mistery.", npc, creature) player:addItem(25305, 1) - player:setStorageValue(Storage.CultsOfTibia.Life.Mission, 4) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission, 4) end end - -- Depois de usar o analyzing tool - if player:getStorageValue(Storage.CultsOfTibia.Life.Mission) == 5 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission) == 5 then if MsgContains(message, "mission") then - npcHandler:say({ "Do you have the sample I asked you for?" }, npc, creature) + npcHandler:say("Do you have the sample I asked you for?", npc, creature) npcHandler:setTopic(playerId, 16) elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 16 then - npcHandler:say({ "Thanks a lot. Let me check the result. Well, I think you need the counteragent. Please apply it to the oasis!" }, npc, creature) + npcHandler:say("Thanks a lot. Let me check the result. Well, I think you need the counteragent. Please apply it to the oasis!", npc, creature) player:addItem(25304, 1) - player:setStorageValue(Storage.CultsOfTibia.Life.Mission, 6) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission, 6) end end - -- Depois de usar o conteragent - if player:getStorageValue(Storage.CultsOfTibia.Life.Mission) == 7 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission) == 7 then if MsgContains(message, "mission") then - npcHandler:say({ "What has happened? You applied the counteragent to the oasis and then it was destroyed by a sandstorm? Keep on investigating the place." }, npc, creature) + npcHandler:say("What has happened? You applied the counteragent to the oasis and then it was destroyed by a sandstorm? Keep on investigating the place.", npc, creature) npcHandler:setTopic(playerId, 17) end end - -- after killing the boss the sandking - if player:getStorageValue(Storage.CultsOfTibia.Life.Mission) == 8 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission) == 8 then npcHandler:say("Just get out of my way! You killed this beautiful creature. I have nothing more to say. Damn druid of Crunor!", npc, creature) - player:setStorageValue(Storage.CultsOfTibia.Life.Mission, 9) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission, 9) end - ----------------------------------------- MOTA ------------------------------- - -- Pedindo o Magnifier de Gareth - if player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) == 6 then + + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 6 then if MsgContains(message, "magnifier") then - npcHandler:say({ "{Gareth} told you that there are rumours about fake artefacts in the MoTA? And it is your task to check that with a magnifier? I see. I don't need one right now, so you can have one of mine. You find one in the crate over there." }, npc, creature) - player:setStorageValue(Storage.CultsOfTibia.MotA.Mission, 7) + npcHandler:say("{Gareth} told you that there are rumours about fake artefacts in the MoTA? And it is your task to check that with a magnifier? I see. I don't need one right now, so you can have one of mine. You find one in the crate over there.", npc, creature) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, 7) end end - -- Pedindo a pintura de Gareth para Angelo - if player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) == 10 then - if MsgContains(message, "picture") then - npcHandler:say({ "So you found out that one artefact in the MoTA is fake? And {Gareth} sent you to me to get a new artefact as a replacement? Sorry, I hardly know you so I don't trust you. I won't help you with that!" }, npc, creature) - player:setStorageValue(Storage.CultsOfTibia.MotA.Mission, 11) + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 10 then + if MsgContains(message, "artefact") then + npcHandler:say("So you found out that one artefact in the MoTA is fake? And {Gareth} sent you to me to get a new artefact as a replacement? Sorry, I hardly know you so I don't trust you. I won't help you with that!", npc, creature) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, 11) end end + if MsgContains(message, "project") then + npcHandler:say("The project is called 'Sandy {Cave} Project' and is funded by the {MoTA}. Its goal is the investigation of this {cave}.", npc, creature) + npcHandler:setTopic(playerId, 2) + elseif npcHandler:getTopic(playerId) == 2 and MsgContains(message, "mota") then + npcHandler:say("MoTA is short for the recently founded Museum of Tibian Arts. We work together in close collaboration. New {results} are communicated to the museum instantly.", npc, creature) + npcHandler:setTopic(playerId, 3) + elseif npcHandler:getTopic(playerId) == 3 and MsgContains(message, "results") then + npcHandler:say("We have no scientific results so far to reach our {goal}, because my workers aren't back yet. Should I be {worried}?", npc, creature) + npcHandler:setTopic(playerId, 4) + elseif npcHandler:getTopic(playerId) == 4 and MsgContains(message, "worried") then + npcHandler:say("Then I have to find out why they don't return. But I'm old and my back aches. Would you like to go there and look for my workers?", npc, creature) + npcHandler:setTopic(playerId, 5) + elseif npcHandler:getTopic(playerId) == 5 and MsgContains(message, "yes") then + npcHandler:say("Fantastic! Go there and then tell me what you've seen. I've opened the door for you. Take care of yourself!", npc, creature) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission, 2) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.AccessDoor, 1) + npcHandler:setTopic(playerId, 0) + elseif npcHandler:getTopic(playerId) == 2 and MsgContains(message, "cave") then + npcHandler:say("We don't know exactly why this cave has now exposed an entry via the {dark pyramid}. It seems that the cave already existed for a long time, however, without a connection to our world. Maybe some smaller earth movements have changed the situation.", npc, creature) + npcHandler:setTopic(playerId, 11) + elseif npcHandler:getTopic(playerId) == 11 and MsgContains(message, "dark pyramid") then + npcHandler:say("We don't know yet to wich extent the cave and the dark pyramid belong together. Thisi s what we try to find out. Maybe the history of this place has to be rewritten.", npc, creature) + npcHandler:setTopic(playerId, 0) + end + return true end diff --git a/data-otservbr-global/npc/denominator.lua b/data-otservbr-global/npc/denominator.lua index e41ed2c051c..ab1e1c79667 100644 --- a/data-otservbr-global/npc/denominator.lua +++ b/data-otservbr-global/npc/denominator.lua @@ -46,15 +46,15 @@ npcType.onCloseChannel = function(npc, creature) end local playerLastResp = {} + local function greetCallback(npc, creature) local playerId = creature:getId() local player = Player(creature) local playerId = player:getId() - if player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) == 13 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 13 then npcHandler:setMessage(MESSAGE_GREET, "Enter answers for the following {questions}:") - npcHandler:setTopic(playerId, 1) else npcHandler:setMessage(MESSAGE_GREET, "Greetings.") end @@ -63,31 +63,31 @@ end local quiz1 = { [1] = { - p = "The sum of first and second digit?", + p = "The sum of the first and second digit?", r = function(player) - player:setStorageValue(Storage.CultsOfTibia.MotA.Answer, player:getStorageValue(Storage.CultsOfTibia.MotA.Stone1) + player:getStorageValue(Storage.CultsOfTibia.MotA.Stone2)) - return player:getStorageValue(Storage.CultsOfTibia.MotA.Answer) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Answer, player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Stone1) + player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Stone2)) + return player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Answer) end, }, [2] = { - p = "The sum of second and third digit?", + p = "The sum of the second and third digit?", r = function(player) - player:setStorageValue(Storage.CultsOfTibia.MotA.Answer, player:getStorageValue(Storage.CultsOfTibia.MotA.Stone2) + player:getStorageValue(Storage.CultsOfTibia.MotA.Stone3)) - return player:getStorageValue(Storage.CultsOfTibia.MotA.Answer) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Answer, player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Stone2) + player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Stone3)) + return player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Answer) end, }, [3] = { - p = "The sum of first and third digit?", + p = "The sum of the first and third digit?", r = function(player) - player:setStorageValue(Storage.CultsOfTibia.MotA.Answer, player:getStorageValue(Storage.CultsOfTibia.MotA.Stone1) + player:getStorageValue(Storage.CultsOfTibia.MotA.Stone3)) - return player:getStorageValue(Storage.CultsOfTibia.MotA.Answer) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Answer, player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Stone1) + player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Stone3)) + return player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Answer) end, }, [4] = { - p = "The digit sum?", + p = "The total digit sum?", r = function(player) - player:setStorageValue(Storage.CultsOfTibia.MotA.Answer, player:getStorageValue(Storage.CultsOfTibia.MotA.Stone1) + player:getStorageValue(Storage.CultsOfTibia.MotA.Stone2) + player:getStorageValue(Storage.CultsOfTibia.MotA.Stone3)) - return player:getStorageValue(Storage.CultsOfTibia.MotA.Answer) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Answer, player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Stone1) + player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Stone2) + player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Stone3)) + return player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Answer) end, }, } @@ -96,7 +96,7 @@ local quiz2 = { [1] = { p = "Is the number prime?", r = function(player) - local stg = player:getStorageValue(Storage.CultsOfTibia.MotA.Answer) + local stg = player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Answer) if stg < 1 then return 0 end @@ -113,9 +113,9 @@ local quiz2 = { end, }, [2] = { - p = "Does the number belong to a prime twing?", + p = "Does the number belong to a twin prime?", r = function(player) - local stg = player:getStorageValue(Storage.CultsOfTibia.MotA.Answer) + local stg = player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Answer) if stg < 2 then return 0 end @@ -131,23 +131,23 @@ local quiz2 = { return (incr == 2 and 1 or 0) end, }, - -- [2] = {p = "", r = ""} } local quiz3 = { [1] = { p = "Is the number divisible by 3?", r = function(player) - return (player:getStorageValue(Storage.CultsOfTibia.MotA.Answer) % 3 == 0 and 1 or 0) + return (player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Answer) % 3 == 0 and 1 or 0) end, }, [2] = { p = "Is the number divisible by 2?", r = function(player) - return (player:getStorageValue(Storage.CultsOfTibia.MotA.Answer) % 2 == 0 and 1 or 0) + return (player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Answer) % 2 == 0 and 1 or 0) end, }, } + local function creatureSayCallback(npc, creature, type, message) local player = Player(creature) local playerId = player:getId() @@ -156,26 +156,23 @@ local function creatureSayCallback(npc, creature, type, message) return false end - -- Começou a quest - if MsgContains(message, "questions") and npcHandler:getTopic(playerId) == 1 then + -- Quest started + if MsgContains(message, "questions") and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 13 then npcHandler:say("Ready to {start}?", npc, creature) npcHandler:setTopic(playerId, 2) - npcHandler:setTopic(playerId, 2) elseif MsgContains(message, "start") and npcHandler:getTopic(playerId) == 2 then - local perguntaid = math.random(#quiz1) - player:setStorageValue(Storage.CultsOfTibia.MotA.QuestionId, perguntaid) - npcHandler:say(quiz1[perguntaid].p, npc, creature) - npcHandler:setTopic(playerId, 3) + local questionId = math.random(#quiz1) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.QuestionId, questionId) + npcHandler:say(quiz1[questionId].p, npc, creature) npcHandler:setTopic(playerId, 3) elseif npcHandler:getTopic(playerId) == 3 then npcHandler:say(string.format("Your answer is %s, do you want to continue?", message), npc, creature) playerLastResp[playerId] = tonumber(message) npcHandler:setTopic(playerId, 4) - npcHandler:setTopic(playerId, 4) elseif npcHandler:getTopic(playerId) == 4 then if MsgContains(message, "yes") then - local resposta = quiz1[player:getStorageValue(Storage.CultsOfTibia.MotA.QuestionId)].r - if playerLastResp[playerId] ~= (tonumber(resposta(player))) then + local answer = quiz1[player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.QuestionId)].r + if playerLastResp[playerId] ~= (tonumber(answer(player))) then npcHandler:say("Wrong. SHUT DOWN.", npc, creature) npcHandler:resetNpc(creature) npcHandler:removeInteraction(npc, creature) @@ -183,7 +180,6 @@ local function creatureSayCallback(npc, creature, type, message) else npcHandler:say("Correct. {Next} question?", npc, creature) npcHandler:setTopic(playerId, 5) - npcHandler:setTopic(playerId, 5) end elseif MsgContains(message, "no") then npcHandler:say("SHUT DOWN.", npc, creature) @@ -192,23 +188,21 @@ local function creatureSayCallback(npc, creature, type, message) return false end elseif MsgContains(message, "next") and npcHandler:getTopic(playerId) == 5 then - local perguntaid = math.random(#quiz2) - player:setStorageValue(Storage.CultsOfTibia.MotA.QuestionId, perguntaid) - npcHandler:say(quiz2[perguntaid].p, npc, creature) - npcHandler:setTopic(playerId, 6) + local questionId = math.random(#quiz2) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.QuestionId, questionId) + npcHandler:say(quiz2[questionId].p, npc, creature) npcHandler:setTopic(playerId, 6) elseif npcHandler:getTopic(playerId) == 6 then - local resp = 0 + local response = 0 if MsgContains(message, "no") then - resp = 0 + response = 0 elseif MsgContains(message, "yes") then - resp = 1 + response = 1 end - local resposta = quiz2[player:getStorageValue(Storage.CultsOfTibia.MotA.QuestionId)].r - if resp == resposta(player) then + local answer = quiz2[player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.QuestionId)].r + if response == answer(player) then npcHandler:say("Correct. {Next} question?", npc, creature) npcHandler:setTopic(playerId, 7) - npcHandler:setTopic(playerId, 7) else npcHandler:say("Wrong. SHUT DOWN.", npc, creature) npcHandler:resetNpc(creature) @@ -216,23 +210,21 @@ local function creatureSayCallback(npc, creature, type, message) return false end elseif npcHandler:getTopic(playerId) == 7 and MsgContains(message, "next") then - local perguntaid = math.random(#quiz3) - player:setStorageValue(Storage.CultsOfTibia.MotA.QuestionId, perguntaid) - npcHandler:say(quiz3[perguntaid].p, npc, creature) - npcHandler:setTopic(playerId, 8) + local questionId = math.random(#quiz3) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.QuestionId, questionId) + npcHandler:say(quiz3[questionId].p, npc, creature) npcHandler:setTopic(playerId, 8) elseif npcHandler:getTopic(playerId) == 8 then - local resp = 0 + local response = 0 if MsgContains(message, "no") then - resp = 0 + response = 0 elseif MsgContains(message, "yes") then - resp = 1 + response = 1 end - local resposta = quiz3[player:getStorageValue(Storage.CultsOfTibia.MotA.QuestionId)].r - if resp == resposta(player) then + local answer = quiz3[player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.QuestionId)].r + if response == answer(player) then npcHandler:say("Correct. {Last} question?", npc, creature) npcHandler:setTopic(playerId, 9) - npcHandler:setTopic(playerId, 9) else npcHandler:say("Wrong. SHUT DOWN.", npc, creature) npcHandler:resetNpc(creature) @@ -242,15 +234,13 @@ local function creatureSayCallback(npc, creature, type, message) elseif npcHandler:getTopic(playerId) == 9 and MsgContains(message, "last") then npcHandler:say("Tell me the correct number?", npc, creature) npcHandler:setTopic(playerId, 10) - npcHandler:setTopic(playerId, 10) elseif npcHandler:getTopic(playerId) == 10 then npcHandler:say(string.format("Your answer is %s, do you want to continue?", message), npc, creature) playerLastResp[playerId] = tonumber(message) npcHandler:setTopic(playerId, 11) - npcHandler:setTopic(playerId, 11) elseif npcHandler:getTopic(playerId) == 11 then if MsgContains(message, "yes") then - local correct = string.format("%d%d%d", player:getStorageValue(Storage.CultsOfTibia.MotA.Stone1), player:getStorageValue(Storage.CultsOfTibia.MotA.Stone2), player:getStorageValue(Storage.CultsOfTibia.MotA.Stone3)) + local correct = string.format("%d%d%d", player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Stone1), player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Stone2), player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Stone3)) if tonumber(playerLastResp[playerId]) ~= (tonumber(correct)) then npcHandler:say("Wrong. SHUT DOWN.", npc, creature) npcHandler:resetNpc(creature) @@ -258,8 +248,8 @@ local function creatureSayCallback(npc, creature, type, message) return false else npcHandler:say("Correct. The lower door is now open. The druid of Crunor lies.", npc, creature) - player:setStorageValue(Storage.CultsOfTibia.MotA.Mission, player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) + 1) - player:setStorageValue(Storage.CultsOfTibia.MotA.AccessDoorDenominator) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) + 1) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.AccessDoorDenominator) end elseif MsgContains(message, "no") then npcHandler:say("SHUT DOWN.", npc, creature) diff --git a/data-otservbr-global/npc/gareth.lua b/data-otservbr-global/npc/gareth.lua index d50f86f11ae..6be3b8a579f 100644 --- a/data-otservbr-global/npc/gareth.lua +++ b/data-otservbr-global/npc/gareth.lua @@ -55,14 +55,16 @@ local function greetCallback(npc, creature) local player = Player(creature) - if player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) == 1 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) < 1 or player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) > 14 then + npcHandler:setMessage(MESSAGE_GREET, "Welcome to the wonderful and only recently opened Museum of Tibian Arts! Free entrance for everybody, but patrons of the arts are wanted and favoured.") + elseif player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 1 then npcHandler:setMessage(MESSAGE_GREET, "The Druid of Crunor has sent you? He seems to know that this new museum shines like a diamond. Enjoy your stay! If you like to {support} this place, talk to me.") - elseif player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) > 1 and player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) < 14 then + elseif player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) > 1 and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) < 14 then npcHandler:setMessage(MESSAGE_GREET, "How is your {mission} going?") - elseif player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) == 14 then + elseif player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 14 then npcHandler:setMessage(MESSAGE_GREET, "You again? How could you flee from the last floor. The cultists should have 'dealt' with you! That beats me. You have to leave this place right now. There's nothing more to say.") - npcHandler:setTopic(playerId, 0) end + return true end @@ -74,64 +76,60 @@ local function creatureSayCallback(npc, creature, type, message) return false end - local valor = 10000 + local value = 10000 - -- Começou a quest - if player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) < 2 then - if MsgContains(message, "support") and npcHandler:getTopic(playerId) == 1 then - npcHandler:say({ "If you like to, you can pay some gold to become a patron of the arts for this wonderful museum. The price is 10,000 gold. Your personal gain will be priceless. Do you want to pay?" }, npc, creature) + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) < 2 then + if MsgContains(message, "patrons") then + npcHandler:say("If you like to, you can pay some gold to become a patron of the arts for this wonderful museum. The price is 10,000 gold. Your personal gain will be priceless. Do you want to {pay}?", npc, creature) npcHandler:setTopic(playerId, 2) - elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 2 then - if (player:getMoney() + player:getBankBalance()) >= valor then - npcHandler:say({ "This is a very wise decision. You won't regret it. Congratulations! As your first task I like you to investigate the crime scene of a theft wich occurred last night. ...", "A very varuable artefact has been stolen. I open the door for you. You can find the room on the same floor as we are right now." }, npc, creature) - npcHandler:setTopic(playerId, 3) - player:removeMoneyBank(valor) + elseif MsgContains(message, "pay") and npcHandler:getTopic(playerId) == 2 then + if (player:getMoney() + player:getBankBalance()) >= value then + npcHandler:say({ + "This is a very wise decision. You won't regret it. Congratulations! As your first task I like you to investigate the crime scene of a theft wich occurred last night. ...", + "A very varuable artefact has been stolen. I open the door for you. You can find the room on the same floor as we are right now." + }, npc, creature) + player:removeMoneyBank(value) player:addItem(25689, 1) - player:setStorageValue(Storage.CultsOfTibia.MotA.Mission, 2) - player:setStorageValue(Storage.CultsOfTibia.MotA.AccessDoorInvestigation, 1) - if player:getStorageValue(Storage.CultsOfTibia.Questline) < 1 then - player:setStorageValue(Storage.CultsOfTibia.Questline, 1) - end + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, 2) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.AccessDoorInvestigation, 1) + npcHandler:setTopic(playerId, 3) else - npcHandler:say({ "You don't have enough money." }, npc, creature) + npcHandler:say("You don't have enough money.", npc, creature) npcHandler:setTopic(playerId, 1) end end - - -- Reportando sobre o document - elseif MsgContains(message, "mission") and player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) == 3 then - npcHandler:say({ "They want us to buy the picture back. Unfortunately this artefact is so important that I don't see an alternative. Please got to Iwar in Kazordoon and pay the money." }, npc, creature) - player:setStorageValue(Storage.CultsOfTibia.MotA.Mission, 4) + elseif MsgContains(message, "mission") and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 3 then + npcHandler:say("They want us to buy the picture back. Unfortunately this artefact is so important that I don't see an alternative. Please got to Iwar in Kazordoon and pay the money.", npc, creature) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, 4) npcHandler:setTopic(playerId, 1) - - -- Depois de ter pago o Iwar - elseif MsgContains(message, "mission") and player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) == 5 then + elseif MsgContains(message, "mission") and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 5 then npcHandler:say({ "Nice! I'm really happy to have the picture back. First of all I have to check if everything's fine. Then I'll put it back on its place. For now, I'd like you to find out if some rumours about fake pictures in the MOTA are true. ...", "Some say one of the small pictures in the entrance hall here is fake. For this reason you have to go to my friend {Angelo} and ask him to get a {magnifier} for the investigation.", "Then do your job here in the museum and come back.", }, npc, creature) - player:setStorageValue(Storage.CultsOfTibia.MotA.Mission, 6) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, 6) npcHandler:setTopic(playerId, 1) - - -- Depois de ter visto a pintura falsa - elseif MsgContains(message, "mission") and player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) == 9 then - npcHandler:say({ "So the rumours are true. How could this happen? I'll keep the picture at its place until we've got a replacement. Please fo to {Angelo} and ask him if he has a new artefact for our museum." }, npc, creature) - player:setStorageValue(Storage.CultsOfTibia.MotA.Mission, 10) - elseif MsgContains(message, "mission") and player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) == 11 then - npcHandler:say({ "You're back, nice. Angelo's team hasn't found an artefact yet? I thought the progress would be faster. Anyway thanks for you efforts. ...", "I have no work for you right now. If you like to, you can have a look at the last floor. I open the door for you." }, npc, creature) - player:setStorageValue(Storage.CultsOfTibia.MotA.Mission, 12) - player:setStorageValue(Storage.CultsOfTibia.MotA.AccessDoorGareth, 1) - - --------------------------------------- FALHAS ---------------------------------------------------------- - -- Se ainda não tiver visto a pintura falsa - elseif MsgContains(message, "mission") and player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) == 8 then - npcHandler:say({ "You didn't investigate the pictures yet. Do your job and then come back." }, npc, creature) + elseif MsgContains(message, "mission") and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 9 then + npcHandler:say("So the rumours are true. How could this happen? I'll keep the picture at its place until we've got a replacement. Please fo to {Angelo} and ask him if he has a new artefact for our museum.", npc, creature) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, 10) + npcHandler:setTopic(playerId, 0) + elseif MsgContains(message, "mission") and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 11 then + npcHandler:say({ + "You're back, nice. Angelo's team hasn't found an artefact yet? I thought the progress would be faster. Anyway thanks for you efforts. ...", + "I have no work for you right now. If you like to, you can have a look at the last floor. I open the door for you." + }, npc, creature) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, 12) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.AccessDoorGareth, 1) + npcHandler:setTopic(playerId, 0) + elseif MsgContains(message, "mission") and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 8 then + npcHandler:say("You didn't investigate the pictures yet. Do your job and then come back.", npc, creature) + npcHandler:setTopic(playerId, 0) end if MsgContains(message, "extension") and player:getStorageValue(Storage.TheSecretLibrary.LiquidDeath) == 11 then if player:getStorageValue(Storage.TheSecretLibrary.LiquidDeath) == 11 then - npcHandler:say({ "It is planned to extend the MOTA. But this will take time, because our workers have faced a little problem." }, npc, creature) + npcHandler:say("It is planned to extend the MOTA. But this will take time, because our workers have faced a little problem.", npc, creature) npcHandler:setTopic(playerId, 11) end elseif MsgContains(message, "problem") and npcHandler:getTopic(playerId) == 11 then @@ -144,7 +142,7 @@ local function creatureSayCallback(npc, creature, type, message) end elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 12 then if npcHandler:getTopic(playerId) == 12 then - npcHandler:say({ "You are a true patron of the arts! I have opened the construction site for you. Start your work right now!" }, npc, creature) + npcHandler:say("You are a true patron of the arts! I have opened the construction site for you. Start your work right now!", npc, creature) player:setStorageValue(Storage.TheSecretLibrary.Mota, 1) player:setStorageValue(Storage.TheSecretLibrary.LiquidDeath, 12) npcHandler:setTopic(playerId, 13) @@ -152,17 +150,19 @@ local function creatureSayCallback(npc, creature, type, message) end if MsgContains(message, "bone") and player:getStorageValue(Storage.TheSecretLibrary.Mota) == 2 then - npcHandler:say({ "Hmm, interesting. Several years ago I have read some books dealing with strange locking mechanisms. I think what you have found here is a bone lever of category 3. ...", "Normally this is not used because it is not secure. The production failed and the lever can always be activated as follows: back, back, up, right, left. Just have a try, it should work." }, npc, creature) + npcHandler:say({ + "Hmm, interesting. Several years ago I have read some books dealing with strange locking mechanisms. I think what you have found here is a bone lever of category 3. ...", + "Normally this is not used because it is not secure. The production failed and the lever can always be activated as follows: back, back, up, right, left. Just have a try, it should work." + }, npc, creature) player:setStorageValue(Storage.TheSecretLibrary.Mota, 3) npcHandler:setTopic(playerId, 14) end if MsgContains(message, "extension") and player:getStorageValue(Storage.TheSecretLibrary.Mota) == 11 then - npcHandler:say( - { "You have found an inscription I would like to translate for you. The tibianus cipher was used: ...", "Those who are accorded the honour to visit this exclusive place will smash their blindness and face the truth. ...", "Astonishingly, Dedoras from Cormaya has recently asked me for these kinds of inscriptions. For sure he is able to bring light into the darkness. You should visit him. " }, - npc, - creature - ) + npcHandler:say({ + "You have found an inscription I would like to translate for you. The tibianus cipher was used: ...", + "Those who are accorded the honour to visit this exclusive place will smash their blindness and face the truth. ...", "Astonishingly, Dedoras from Cormaya has recently asked me for these kinds of inscriptions. For sure he is able to bring light into the darkness. You should visit him. " + }, npc, creature) player:setStorageValue(Storage.TheSecretLibrary.Mota, 12) player:setStorageValue(Storage.TheSecretLibrary.TheLament, 1) npcHandler:setTopic(playerId, 15) diff --git a/data-otservbr-global/npc/gerimor.lua b/data-otservbr-global/npc/gerimor.lua index 1c7d4c8443e..495ef3d84bf 100644 --- a/data-otservbr-global/npc/gerimor.lua +++ b/data-otservbr-global/npc/gerimor.lua @@ -55,12 +55,9 @@ local function greetCallback(npc, creature) local playerId = player:getId() if player then - npcHandler:setMessage( - MESSAGE_GREET, - "Greeting, |PLAYERNAME|! I welcome you to this sacred {place}. \z - If you are interested in {missions} just ask." - ) + npcHandler:setMessage(MESSAGE_GREET, "Greeting, |PLAYERNAME|! I welcome you to this sacred {place}. If you are interested in {missions} just ask.") end + return true end @@ -73,10 +70,8 @@ keywordHandler:addKeyword({ "place" }, StdModule.say, { keywordHandler:addKeyword({ "me" }, StdModule.say, { npcHandler = npcHandler, text = { - "I'm a member of a circle of persons, that joined wisdom and resources for a common purpose. \z - Let's say, we have an eye on the greater picture in the matters of our world. ...", - "We are watching and evaluating what is happening in our world. \z - Trying to avert the worst and offering a helping hand where we deem it needed. ...", + "I'm a member of a circle of persons, that joined wisdom and resources for a common purpose. Let's say, we have an eye on the greater picture in the matters of our world. ...", + "We are watching and evaluating what is happening in our world. Trying to avert the worst and offering a helping hand where we deem it needed. ...", "We usually avoid to interfere directly in the affairs of the world and vain politics are not our concern at all.", }, }) @@ -89,36 +84,30 @@ keywordHandler:addKeyword({ "circle" }, StdModule.say, { keywordHandler:addKeyword({ "persons" }, StdModule.say, { npcHandler = npcHandler, text = { - "Well, while I focus more on the matters of life, some of my peers have different approaches \z - and emphasize other aspects of the world more in their observations. ...", + "Well, while I focus more on the matters of life, some of my peers have different approaches and emphasize other aspects of the world more in their observations. ...", "Regardless we share a common goal of balance and harmony.", }, }) keywordHandler:addKeyword({ "approaches" }, StdModule.say, { npcHandler = npcHandler, - text = "We might not be many but we are diverse. \z - Our rather informal order came together in the dawn of time, when the wars of the gods ravaged the world.", + text = "We might not be many but we are diverse. Our rather informal order came together in the dawn of time, when the wars of the gods ravaged the world.", }) keywordHandler:addKeyword({ "dawn" }, StdModule.say, { npcHandler = npcHandler, text = { "Even we know the individual that was somewhat of our funder, only as the wise man. ...", - "He was the first to bring bright and dedicated minds together, \z - to bring at least a little order and guidance into troubled and chaotic times. ...", - "The order predates mankind and never bothered to give itself a name. \z - Such assumptions of pretence and vanity have no place in our mindset.", + "He was the first to bring bright and dedicated minds together, to bring at least a little order and guidance into troubled and chaotic times. ...", + "The order predates mankind and never bothered to give itself a name. Such assumptions of pretence and vanity have no place in our mindset.", }, }) keywordHandler:addKeyword({ "guidance" }, StdModule.say, { npcHandler = npcHandler, text = { - "Most times we are silent watchers and keeper of knowledge that share what they have learned with each other. \z - We are more concerned about knowledge and wisdom and power means little to us. ...", - "To solve problems we usually try to convince the right people to do the right thing. \z - We usually even lack the means for a more direct interference.", + "Most times we are silent watchers and keeper of knowledge that share what they have learned with each other. We are more concerned about knowledge and wisdom and power means little to us. ...", + "To solve problems we usually try to convince the right people to do the right thing. We usually even lack the means for a more direct interference.", }, }) @@ -126,113 +115,84 @@ keywordHandler:addKeyword({ "direct" }, StdModule.say, { npcHandler = npcHandler, text = { "Sometimes it's necessary to do something about a situation that became threatening to the world itself. ...", - "It is gladly a rare occurrence and usually it is sufficient to somewhat offer a guiding hand to \z - avert a course that would lead to more dire consequences. Nonetheless sometimes we have to interfere.", + "It is gladly a rare occurrence and usually it is sufficient to somewhat offer a guiding hand to avert a course that would lead to more dire consequences. Nonetheless sometimes we have to interfere.", }, }) keywordHandler:addKeyword({ "interfere" }, StdModule.say, { npcHandler = npcHandler, - text = "Interference comes in different forms. \z - In this particular case there is sadly little time for subtlety and a more direct approach is necessary.", + text = "Interference comes in different forms. In this particular case there is sadly little time for subtlety and a more direct approach is necessary.", }) keywordHandler:addKeyword({ "feyrist" }, StdModule.say, { npcHandler = npcHandler, - text = "The fae granted me permission to enter their hidden realm. \z - As a druid I'm in close touch with nature so I could gain their trust. \z - The nature spirits are inhabiting this peninsula for ages.", + text = "The fae granted me permission to enter their hidden realm. As a druid I'm in close touch with nature so I could gain their trust. The nature spirits are inhabiting this peninsula for ages.", }) keywordHandler:addKeyword({ "fae" }, StdModule.say, { npcHandler = npcHandler, text = { - "The fae vary greatly in size and appearance. \z - There are different kinds of fae like fauns, pixies, pookas, swan maidens, nymphs and boogies. \z - Those mystical creatures are wielding power in magic and elementals. ...", - "Most of them are rather reclusive and live peaceful lives in their secret realm. \z - Sometimes they are called the 'children of dreams' or 'the dream born' \z - because the fae are born from the mortals' dreams.", + "The fae vary greatly in size and appearance. There are different kinds of fae like fauns, pixies, pookas, swan maidens, nymphs and boogies. Those mystical creatures are wielding power in magic and elementals. ...", + "Most of them are rather reclusive and live peaceful lives in their secret realm. Sometimes they are called the 'children of dreams' or 'the dream born' because the fae are born from the mortals' dreams.", }, }) keywordHandler:addKeyword({ "fauns" }, StdModule.say, { npcHandler = npcHandler, text = { - "Fauns are half-human, half-beast nature spirits inhabiting the woods and mountains of Feyrist. \z - They are a slightly roguish but cheerful folk, lovers of wine and dancing. ...", - "Fauns show a youthful and graceful aspect but they are also brave and fearless \z - when it comes to defend themselves. As Maelyrra told me, they emerge from mortals' \z - dreams about celebrations, music and dancing. ...", - "Lately, some fauns on Feyrist are tainted by the mysterious, sinister force that is \z - threatening Feyrist as well as the rest of Tibia.", + "Fauns are half-human, half-beast nature spirits inhabiting the woods and mountains of Feyrist. They are a slightly roguish but cheerful folk, lovers of wine and dancing. ...", + "Fauns show a youthful and graceful aspect but they are also brave and fearless when it comes to defend themselves. As Maelyrra told me, they emerge from mortals' dreams about celebrations, music and dancing. ...", + "Lately, some fauns on Feyrist are tainted by the mysterious, sinister force that is threatening Feyrist as well as the rest of Tibia.", }, }) keywordHandler:addKeyword({ "pixies" }, StdModule.say, { npcHandler = npcHandler, text = { - "Pixies are small nature spirits and mythical creatures inhabiting the forests and plains of Feyrist. \z - They are generally benign, but at times, they may also display mischievous traits. ...", - "Like most of the fae, pixies love dancing and are often gathering in larger groups \z - to dance on secluded glades. Pixies love flowers, butterflies, shimmering beetles, \z - gems and other colourful things. ...", - "They also love the taste of honey, sweetened oat and ripe grapes. \z - As Maelyrra told me, pixies emerge from mortals' dreams about friends and family.", + "Pixies are small nature spirits and mythical creatures inhabiting the forests and plains of Feyrist. They are generally benign, but at times, they may also display mischievous traits. ...", + "Like most of the fae, pixies love dancing and are often gathering in larger groups to dance on secluded glades. Pixies love flowers, butterflies, shimmering beetles, gems and other colourful things. ...", + "They also love the taste of honey, sweetened oat and ripe grapes. As Maelyrra told me, pixies emerge from mortals' dreams about friends and family.", }, }) keywordHandler:addKeyword({ "pookas" }, StdModule.say, { npcHandler = npcHandler, text = { - "Pookas are nature spirits in animal form, looking like big hares with a faintly glittering fur. \z - They are benign but mischievous, for sure with good reason regarded as the tricksters among the fae. ...", - "Pookas love to play pranks on others, snitching and hiding things or telling made-up stories. \z - They are capricious and fickle creatures. \z - Pookas emerge from mortals' dreams about gems, treasures and gold. ...", - "Lately, some pookas on Feyrist are tainted by a mysterious, sinister force that is \z - threatening Feyrist as well as the rest of Tibia.", + "Pookas are nature spirits in animal form, looking like big hares with a faintly glittering fur. They are benign but mischievous, for sure with good reason regarded as the tricksters among the fae. ...", + "Pookas love to play pranks on others, snitching and hiding things or telling made-up stories. They are capricious and fickle creatures. Pookas emerge from mortals' dreams about gems, treasures and gold. ...", + "Lately, some pookas on Feyrist are tainted by a mysterious, sinister force that is threatening Feyrist as well as the rest of Tibia.", }, }) keywordHandler:addKeyword({ "swan maidens" }, StdModule.say, { npcHandler = npcHandler, text = { - "Swan maidens are fae who can shapeshift from human form to swan form. \z - The magical item allowing this transformation is a swan feather cloak, a garment with swan feathers attached. ...", - "Here on Feyrist it is always hard to tell whether a swan swimming on a lake \z - is an ordinary animal or a swan maiden in her bird shape. ...", - "They protect the wilds of their secret realm from every intruder and live in small \z - flocks along secluded lakeshores. As Maelyrra told me, swan maidens emerge from mortals' dreams about flying.", + "Swan maidens are fae who can shapeshift from human form to swan form. The magical item allowing this transformation is a swan feather cloak, a garment with swan feathers attached. ...", + "Here on Feyrist it is always hard to tell whether a swan swimming on a lake is an ordinary animal or a swan maiden in her bird shape. ...", + "They protect the wilds of their secret realm from every intruder and live in small flocks along secluded lakeshores. As Maelyrra told me, swan maidens emerge from mortals' dreams about flying.", }, }) keywordHandler:addKeyword({ "nymphs" }, StdModule.say, { npcHandler = npcHandler, text = { - "Nymphs are female nature spirits and usually take the form of beautiful, \z - young maidens who love to dance and sing. They dwell in the hills and forests of Feyrist, \z - often near lakes and streams and they can't die of old age nor illness. ...", - "They have a special, strong bond to the plants and animals of their domain and are very \z - protective of Feyrist's flora and fauna. As Maelyrra told me, nymphs emerge from mortals' dreams about love.", + "Nymphs are female nature spirits and usually take the form of beautiful, young maidens who love to dance and sing. They dwell in the hills and forests of Feyrist, often near lakes and streams and they can't die of old age nor illness. ...", + "They have a special, strong bond to the plants and animals of their domain and are very protective of Feyrist's flora and fauna. As Maelyrra told me, nymphs emerge from mortals' dreams about love.", }, }) keywordHandler:addKeyword({ "boogies" }, StdModule.say, { npcHandler = npcHandler, text = { - "Boogies are a rather twisted kind of fae. Other than pixies, nymphs or fauns they favour \z - underground caves and tunnels over forests or lush meadows. ...", - "Only at night, they are roaming the surface, chasing other fae and visitors to Feyrist alike. \z - They were once clumsy yet peaceful fae, but they are now twisted and tainted by a mysterious, sinister force.", + "Boogies are a rather twisted kind of fae. Other than pixies, nymphs or fauns they favour underground caves and tunnels over forests or lush meadows. ...", + "Only at night, they are roaming the surface, chasing other fae and visitors to Feyrist alike. They were once clumsy yet peaceful fae, but they are now twisted and tainted by a mysterious, sinister force.", }, }) keywordHandler:addKeyword({ "maelyrra" }, StdModule.say, { npcHandler = npcHandler, text = { - "She's the queen of a fae court. You can find her on a glade in the deep forest. \z - It was queen Maelyrra who granted me permission to stay here in Feyrist. ...", + "She's the queen of a fae court. You can find her on a glade in the deep forest. It was queen Maelyrra who granted me permission to stay here in Feyrist. ...", "I promised to inform her about anything I find out about the abominable force that threatens this world.", }, }) @@ -240,65 +200,49 @@ keywordHandler:addKeyword({ "maelyrra" }, StdModule.say, { keywordHandler:addKeyword({ "fae court" }, StdModule.say, { npcHandler = npcHandler, text = { - "The fae vary greatly in size and appearance. \z - There are different kinds of fae like fauns, pixies, pookas, swan maidens, nymphs and boogies. \z - Those mystical creatures are wielding power in magic and elementals. ...", - "Most of them are rather reclusive and live peaceful lives in their secret realm. \z - Sometimes they are called the ,children of dreams' or ,the dream born' \z - because the fae are born from the mortals' dreams.", + "The fae vary greatly in size and appearance. There are different kinds of fae like fauns, pixies, pookas, swan maidens, nymphs and boogies. Those mystical creatures are wielding power in magic and elementals. ...", + "Most of them are rather reclusive and live peaceful lives in their secret realm. Sometimes they are called the ,children of dreams' or ,the dream born' because the fae are born from the mortals' dreams.", }, }) keywordHandler:addKeyword({ "cults" }, StdModule.say, { npcHandler = npcHandler, text = { - "It doesn't seem that the cults share a common theme or object of reverence but there has to \z - be some connection beyond being at the centre of culminations of disruptive power from beyond. ...", - "The connection is of second thought though. Connected or not, they further the death of our world. \z - That alone makes it imperative to dig those cults out and destroy their cores. ...", - "We won't be able to rout our each and any movement but if we manage to neutralize the worst, \z - we gain some time and deny the enemy much of its leverage on the future of our world.", + "It doesn't seem that the cults share a common theme or object of reverence but there has to be some connection beyond being at the centre of culminations of disruptive power from beyond. ...", + "The connection is of second thought though. Connected or not, they further the death of our world. That alone makes it imperative to dig those cults out and destroy their cores. ...", + "We won't be able to rout our each and any movement but if we manage to neutralize the worst, we gain some time and deny the enemy much of its leverage on the future of our world.", }, }) keywordHandler:addKeyword({ "worst" }, StdModule.say, { npcHandler = npcHandler, text = { - "We have located some of the worst culminations of otherworldly presence and our sources \z - returned information about them with different results of success. ...", - "Some information I can provide you will be rather sparse and much is left to speculation \z - but you should have at least some lead where to go and investigate.", + "We have located some of the worst culminations of otherworldly presence and our sources returned information about them with different results of success. ...", + "Some information I can provide you will be rather sparse and much is left to speculation but you should have at least some lead where to go and investigate.", }, }) keywordHandler:addKeyword({ "investigate" }, StdModule.say, { npcHandler = npcHandler, - text = "Those cults have to be stopped by any means possible. \z - These are desperate times and they demand desperate actions.", + text = "Those cults have to be stopped by any means possible. These are desperate times and they demand desperate actions.", }) keywordHandler:addKeyword({ "actions" }, StdModule.say, { npcHandler = npcHandler, - text = "Spare lives where you see it fit but the cults may not be allowed to exist and disrupt \z - the fabric of the world even more.", + text = "Spare lives where you see it fit but the cults may not be allowed to exist and disrupt the fabric of the world even more.", }) keywordHandler:addKeyword({ "fabric" }, StdModule.say, { npcHandler = npcHandler, - text = "The weakened fabric of our reality still repels the unnatural intruder. The cults provide the \z - thing a hold and supply it with more power, even if we couldn't figure out yet, how this works at all.", + text = "The weakened fabric of our reality still repels the unnatural intruder. The cults provide the thing a hold and supply it with more power, even if we couldn't figure out yet, how this works at all.", }) keywordHandler:addKeyword({ "works" }, StdModule.say, { npcHandler = npcHandler, text = { - "We haven't completely figured out what our enemy exactly is. \z - For one, this thing defies all laws of nature and comprehension, ...", - "that understanding it is either impossible or twist a mind in ways that are not meant to be. \z - Also the Yalahari who figured out way too much about the thing, became tainted and changed by this knowledge ...", - "And ultimately not only fell and became his, they also provided the thing with something of their own, \z - be it knowledge, understanding or even direction, purpose. ...", + "We haven't completely figured out what our enemy exactly is. For one, this thing defies all laws of nature and comprehension, ...", + "that understanding it is either impossible or twist a mind in ways that are not meant to be. Also the Yalahari who figured out way too much about the thing, became tainted and changed by this knowledge ...", + "And ultimately not only fell and became his, they also provided the thing with something of their own, be it knowledge, understanding or even direction, purpose. ...", "In some way their tainted knowledge brought the unthinkable into a resemblance of existence. ...", - "That is why we cant dabble too much in figuring this out and rather concentrate on our \z - fight to severe its ties to our world.", + "That is why we cant dabble too much in figuring this out and rather concentrate on our fight to severe its ties to our world.", }, }) @@ -311,95 +255,86 @@ local config = { missions = { ["minotaurs"] = { text = { - "This is an animal-like cult. Only minotaurs can be found there, \z - but no idea what there are expecting and what they are worshipping. ...", + "This is an animal-like cult. Only minotaurs can be found there, but no idea what there are expecting and what they are worshipping. ...", "Maybe they are a bit different to the creatures you already know. Would you like to dinf out more for me?", }, completeText = { - "Then you got it. Thank you. Here is your reward.", + "You have found the source of power which strengthened the minotaurs. Thanks a lot! Here your reward.", }, - storage = Storage.CultsOfTibia.Minotaurs.Mission, + storage = Storage.Quest.U11_40.CultsOfTibia.Minotaurs.Mission, value = 5, rewardExp = 25000, }, ["prosperity"] = { text = { - "The alleged incentive to follow this cult is infinite prosperity. \z - Therefore most of the worshippers are already very rich citizens of Tibia. ...", - "This cult is abandoned in the recently opened new museum in Thais. \z - This can be entered in the Thais exhibition. Would you like to have a look at this cult?", + "The alleged incentive to follow this cult is infinite prosperity. Therefore most of the worshippers are already very rich citizens of Tibia. ...", + "This cult is abandoned in the recently opened new museum in Thais. This can be entered in the Thais exhibition. Would you like to have a look at this cult?", }, completeText = { - "Then you got it. Thank you. Here is your reward.", + "Thanks a lot. As I already supposed the museum is just a disguise. ...", + "You found out the true meaning. As you have described their cult object the AM on the floor might stand for \"Aurea Manus\". Here is your reward for your effort.", }, - storage = Storage.CultsOfTibia.MotA.Mission, + storage = Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, value = 14, rewardExp = 50000, }, ["barkless"] = { text = { - "However, recently they became more prominent as their leader seems to hava taken a turn for the worse. \z - Rumors of violent acts and disappearing people are linked to this cult. ...", + "However, recently they became more prominent as their leader seems to hava taken a turn for the worse. Rumors of violent acts and disappearing people are linked to this cult. ...", "Someone... Should look into that, don't you think?", }, completeText = { - "Then you got it. Thank you. Here is your reward.", + "The Penitent, thats what they called him? If their spiritual leader and creator of this following changed so radically...", + "Something far more dangerous must have stood behind this.", }, - storage = Storage.CultsOfTibia.Barkless.Mission, + storage = Storage.Quest.U11_40.CultsOfTibia.Barkless.Mission, value = 6, rewardExp = 50000, }, ["orcs"] = { text = { - "Several Edron orcs have taken to a dangerous idol it seems. \z - It may not be too late to stop them if you act quickly. \z - A powerful cult of orcs with a broad following could prove unsurmountable in the end. ...", + "Several Edron orcs have taken to a dangerous idol it seems. It may not be too late to stop them if you act quickly. A powerful cult of orcs with a broad following could prove unsurmountable in the end. ...", }, completeText = { - "Then you got it. Thank you. Here is your reward.", - "Are you prepared to investigate?", + "That was no god - yet you rid the world of a being which, without the help of one, would not even have been here in the first place. Nicely done.", }, - storage = Storage.CultsOfTibia.Orcs.Mission, + storage = Storage.Quest.U11_40.CultsOfTibia.Orcs.Mission, value = 2, rewardExp = 25000, }, ["life"] = { text = { - "Its worshippers wish for eternal, life free of pain and sorrow. \z - The entrance to this cult can be found in the dark pyramid. Would you life to investigate it for me?", + "Its worshippers wish for eternal, life free of pain and sorrow. The entrance to this cult can be found in the dark pyramid. Would you life to investigate it for me?", }, completeText = { - "Then you got it. Thank you. Here is your reward.", + "Thanks a lot. You have revealed the mystery of this cult and killed the sandking. ...", + "The signature AM you have seen, could stand for 'Aeterna Exsistentia' regarding the eternal life. As a reward I give this to you.", }, - storage = Storage.CultsOfTibia.Life.Mission, + storage = Storage.Quest.U11_40.CultsOfTibia.Life.Mission, value = 9, rewardExp = 50000, }, ["misguided"] = { text = { - "There's a camp of outlaws to the east of Thais. \z - Rumour has it that people are going missing but it's not linked to the bandits. ...", - "Lights have been seen at night in the abandoned ruin in the vicinity of the camp, \z - somewhere to the south-west. Brave enough to check it out?", + "There's a camp of outlaws to the east of Thais. Rumour has it that people are going missing but it's not linked to the bandits. ...", + "Lights have been seen at night in the abandoned ruin in the vicinity of the camp, somewhere to the south-west. Brave enough to check it out?", }, completeText = { - "Then you got it. Thank you. Here is your reward.", + "So the leader of these... Misguided was actually controlled and not the other way round? Whatever is behind all this, that's some first-rate irony right there.", }, - storage = Storage.CultsOfTibia.Misguided.Mission, + storage = Storage.Quest.U11_40.CultsOfTibia.Misguided.Mission, value = 4, rewardExp = 50000, }, ["humans"] = { text = { - "It's a forbidden and abandoned place but... There is an ancient temple of Zathroth beneath Carlin. \z - Some say it's not that abandoned anymore. ...", - "Voices, flickering lights in the dead of night, and even a strange gate like sphere wich leads to \z - who knows where. I can't really request this from you but... Someone should take a look, or not?", + "It's a forbidden and abandoned place but... There is an ancient temple of Zathroth beneath Carlin. Some say it's not that abandoned anymore. ...", + "Voices, flickering lights in the dead of night, and even a strange gate like sphere wich leads to who knows where. I can't really request this from you but... Someone should take a look, or not?", }, completeText = { - "Then you got it. Thank you. Here is your reward.", + "Zathroth wasn't behind this after all. That's good... what's not good is that we have to deal with an unknown power now, let's hope for the best.", }, - storage = Storage.CultsOfTibia.Humans.Mission, + storage = Storage.Quest.U11_40.CultsOfTibia.Humans.Mission, value = 2, rewardExp = 25000, }, @@ -419,75 +354,36 @@ local function creatureSayCallback(npc, creature, type, message) end if MsgContains(message, "missions") then - -- Final boss check - if player:getStorageValue(Storage.CultsOfTibia.FinalBoss.Mission) > 2 then - npcHandler:say( - "You have already fulfilled your job to my full satisfaction. \z - The cults are investigated and the final boss is eliminated. \z - I have nothing more for you to do. Fare you well!", - npc, - creature - ) - npcHandler:setTopic(playerId, 0) - elseif - player:getStorageValue(Storage.CultsOfTibia.Minotaurs.Mission) == 6 - and player:getStorageValue(Storage.CultsOfTibia.Life.Mission) == 10 - and player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) == 15 - and player:getStorageValue(Storage.CultsOfTibia.Barkless.Mission) == 7 - and player:getStorageValue(Storage.CultsOfTibia.Misguided.Mission) == 5 - and player:getStorageValue(Storage.CultsOfTibia.Orcs.Mission) == 3 - and player:getStorageValue(Storage.CultsOfTibia.Humans.Mission) == 3 - and player:getStorageValue(Storage.CultsOfTibia.FinalBoss.Mission) < 2 - then - npcHandler:say( - "It seems to me that you have done all the missions I gave you. \z - All the cults have been revealed and now you can kill their leader, the final boss, \z - to save the world from a possible catastrophe.", - npc, - creature - ) + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.FinalBoss.Mission) > 2 then + npcHandler:say("You have already fulfilled your job to my full satisfaction. The cults are investigated and the final boss is eliminated. I have nothing more for you to do. Fare you well!", npc, creature) npcHandler:setTopic(playerId, 0) - if player:getStorageValue(Storage.CultsOfTibia.FinalBoss.Mission) < 1 then - player:setStorageValue(Storage.CultsOfTibia.FinalBoss.Mission, 1) - player:setStorageValue(Storage.CultsOfTibia.FinalBoss.AccessDoor, 1) - end - elseif player:getStorageValue(Storage.CultsOfTibia.FinalBoss.Mission) == 2 then - npcHandler:say("You did it! You put an end to the cults, and as a return, here's your reward.", npc, creature) - npcHandler:setTopic(playerId, 9) - local item = "" - if player:getVocation():getBaseId() == VOCATION.BASE_ID.SORCERER then - player:addItem(26190) - item = "reflecting crown" - end - if player:getVocation():getBaseId() == VOCATION.BASE_ID.DRUID then - player:addItem(26187) - item = "leaf crown" - end - if player:getVocation():getBaseId() == VOCATION.BASE_ID.PALADIN then - player:addItem(26189) - item = "incandescent crown" - end - if player:getVocation():getBaseId() == VOCATION.BASE_ID.KNIGHT then - player:addItem(26188) - item = "iron crown" + elseif player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Minotaurs.Mission) == 6 + and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission) == 10 + and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 15 + and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Mission) == 7 + and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Mission) == 5 + and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Orcs.Mission) == 3 + and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Humans.Mission) == 3 + and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.FinalBoss.Mission) < 2 + then + npcHandler:say({ + "Your actions have weakened the worldly anchors of the enemy and unveiled the source they use to strengthen their cults. ...", + "Our circle has used this opportunity to breach their protective shroud and aim a teleporter to this source. I would like to ask you to use it, to travel to this source and destroy it. ...", + "But be warned, you will need a group twice as great compared to those with which you defeated the cults. Go now, with my blessings.", + }, npc, creature) + npcHandler:setTopic(playerId, 0) + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.FinalBoss.Mission) < 1 then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.FinalBoss.Mission, 1) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.FinalBoss.AccessDoor, 1) end - player:addExperience(50000) - player:addItem(26186) - player:setStorageValue(Storage.CultsOfTibia.FinalBoss.Mission, 3) - player:sendTextMessage(MESSAGE_EXPERIENCE, "You gained 50000 experience points.") - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You gained a mystery box.") - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You gained a " .. item .. ".") - else - npcHandler:say( - "In wich of the following topics are you interested in? Cult of {Life}, \z - Cult of {Prosperity}, Cult of the {Minotaurs}, Cult of the {Barkless}, Cult of the {Misguided}, \z - Cult of {Orcs} or Cult of the {Humans}?", - npc, - creature - ) - npcHandler:setTopic(playerId, 2) + elseif player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.FinalBoss.Mission) == 2 then + npcHandler:say({ + "You have done our world a great favour and reason enough to be proud of yourself. ...", + "Although we could not rout out each and every cult and they will soon find another source to fuel their evil, we have dealt the enemy a vital blow that will take time and resources to recouperate from. ...", + "You have undoubtedly bought your world some valuable time and weakened the enemy. Take my thanks in behalf of the world and keep up your heroic work. For your reward you must have two free slots. Are you ready to receive it?", + }, npc, creature) + npcHandler:setTopic(playerId, 4) end - -- General elseif npcHandler:getTopic(playerId) == 2 then local missionsTable = config.missions[message:lower()] if missionsTable then @@ -501,28 +397,51 @@ local function creatureSayCallback(npc, creature, type, message) player:sendTextMessage(MESSAGE_EXPERIENCE, "You gained " .. rewardExperience[playerId] .. " experience points.") npcHandler:setTopic(playerId, 0) elseif player:getStorageValue(storage[playerId]) > 0 and player:getStorageValue(storage[playerId]) > value[playerId] then - npcHandler:say({ "You already done this mission." }, npc, creature) + npcHandler:say("You already done this mission.", npc, creature) npcHandler:setTopic(playerId, 2) else npcHandler:say(missionsTable.text, npc, creature) npcHandler:setTopic(playerId, 3) end end - -- Accept mission - elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 3 then - if player:getStorageValue(storage[playerId]) < 1 then - npcHandler:say("Very nice! Come back if you have found what's going on in this cult.", npc, creature) - player:setStorageValue(storage[playerId], 1) - if player:getStorageValue(Storage.CultsOfTibia.Questline) < 1 then - player:setStorageValue(Storage.CultsOfTibia.Questline, 1) + elseif MsgContains(message, "yes") then + if npcHandler:getTopic(playerId) == 3 then + if player:getStorageValue(storage[playerId]) < 1 then + npcHandler:say("Very nice! Come back if you have found what's going on in this cult.", npc, creature) + player:setStorageValue(storage[playerId], 1) + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Questline) < 1 then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Questline, 1) + end + npcHandler:setTopic(playerId, 2) + elseif player:getStorageValue(storage[playerId]) > 0 then + npcHandler:say("You have not finished your work yet. Come back when you're done.", npc, creature) + npcHandler:setTopic(playerId, 2) end - npcHandler:setTopic(playerId, 2) - elseif player:getStorageValue(storage[playerId]) > 0 then - npcHandler:say("You have not finished your work yet. Come back when you're done.", npc, creature) - npcHandler:setTopic(playerId, 2) - end - -- Recuse mission - elseif MsgContains(message, "no") and npcHandler:getTopic(playerId) == 3 then + elseif npcHandler:getTopic(playerId) == 4 then + local vocationRewards = { + [VOCATION.BASE_ID.SORCERER] = {itemId = 26190, itemName = "reflecting crown"}, + [VOCATION.BASE_ID.DRUID] = {itemId = 26187, itemName = "leaf crown"}, + [VOCATION.BASE_ID.PALADIN] = {itemId = 26189, itemName = "incandescent crown"}, + [VOCATION.BASE_ID.KNIGHT] = {itemId = 26188, itemName = "iron crown"} + } + local vocationId = player:getVocation():getBaseId() + local reward = vocationRewards[vocationId] + local item = "" + if reward then + player:addItem(reward.itemId) + item = reward.itemName + end + player:addExperience(50000) + player:addItem(26186) + player:addAchievement("Corruption Contained") + player:sendTextMessage(MESSAGE_EXPERIENCE, "You gained 50000 experience points.") + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You gained a mystery box.") + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You gained a " .. item .. ".") + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.FinalBoss.Mission, 3) + npcHandler:say("Here's your reward. Thank you and farewell!", npc, creature) + npcHandler:setTopic(playerId, 0) + end + elseif MsgContains(message, "no") then npcHandler:say("What a pitty! You can come back, when ever you want, if you have changed your opinion.", npc, creature) npcHandler:setTopic(playerId, 0) end diff --git a/data-otservbr-global/npc/iwar.lua b/data-otservbr-global/npc/iwar.lua index d30d368bf5a..b5238538ba9 100644 --- a/data-otservbr-global/npc/iwar.lua +++ b/data-otservbr-global/npc/iwar.lua @@ -49,12 +49,6 @@ npcType.onCloseChannel = function(npc, creature) npcHandler:onCloseChannel(npc, creature) end -local function greetCallback(npc, creature) - local playerId = creature:getId() - - local player = Player(creature) - return true -end local function creatureSayCallback(npc, creature, type, message) local player = Player(creature) local playerId = player:getId() @@ -63,23 +57,22 @@ local function creatureSayCallback(npc, creature, type, message) return false end - local valorPicture = 10000 + local valuePicture = 10000 - -- Começou a quest - if MsgContains(message, "has the cat got your tongue?") and player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) == 4 then - npcHandler:say({ "Nice. You like your picture, haa? Give me 10,000 gold and I will deliver it to the museum. Do you {pay}?" }, npc, creature) + if MsgContains(message, "has the cat got your tongue?") and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 4 then + npcHandler:say("Nice. You like your picture, haa? Give me 10,000 gold and I will deliver it to the museum. Do you {pay}?", npc, creature) npcHandler:setTopic(playerId, 2) npcHandler:setTopic(playerId, 2) elseif MsgContains(message, "pay") or MsgContains(message, "yes") then if npcHandler:getTopic(playerId) == 2 then - if (player:getMoney() + player:getBankBalance()) >= valorPicture then - npcHandler:say({ "Well done. The picture will be delivered to the museum as last as possible." }, npc, creature) + if (player:getMoney() + player:getBankBalance()) >= valuePicture then + npcHandler:say("Well done. The picture will be delivered to the museum as last as possible.", npc, creature) npcHandler:setTopic(playerId, 0) npcHandler:setTopic(playerId, 0) - player:removeMoneyBank(valorPicture) - player:setStorageValue(Storage.CultsOfTibia.MotA.Mission, 5) + player:removeMoneyBank(valuePicture) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, 5) else - npcHandler:say({ "You don't have enough money." }, npc, creature) + npcHandler:say("You don't have enough money.", npc, creature) npcHandler:setTopic(playerId, 1) npcHandler:setTopic(playerId, 1) end @@ -88,12 +81,12 @@ local function creatureSayCallback(npc, creature, type, message) return true end +npcHandler:setMessage(MESSAGE_GREET, "Hiho Storm Killer! Welcome to Kazordoon furniture store.") npcHandler:setMessage(MESSAGE_WALKAWAY, "Well, bye then.") npcHandler:setCallback(CALLBACK_SET_INTERACTION, onAddFocus) npcHandler:setCallback(CALLBACK_REMOVE_INTERACTION, onReleaseFocus) -npcHandler:setCallback(CALLBACK_GREET, greetCallback) npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true) diff --git a/data-otservbr-global/npc/jamesfrancis.lua b/data-otservbr-global/npc/jamesfrancis.lua index bde27b5345d..d5689f6c8d4 100644 --- a/data-otservbr-global/npc/jamesfrancis.lua +++ b/data-otservbr-global/npc/jamesfrancis.lua @@ -23,31 +23,13 @@ npcConfig.flags = { floorchange = false, } -local function greetCallback(npc, creature) - local playerId = creature:getId() - - local player = Player(creature) - local playerId = player:getId() - - if player:getStorageValue(Storage.CultsOfTibia.Minotaurs.Access) < 1 then - npcHandler:setMessage(MESSAGE_GREET, "Gerimor is right. As an expert for minotaurs I am researching these creatures for years. I thought I already knew a lot but the monsters in this cave are {different}. It's a big {mystery}.") - npcHandler:setTopic(playerId, 1) - elseif (player:getStorageValue(Storage.CultsOfTibia.Minotaurs.JamesfrancisTask) >= 0 and player:getStorageValue(Storage.CultsOfTibia.Minotaurs.JamesfrancisTask) <= 50) and player:getStorageValue(Storage.CultsOfTibia.Minotaurs.Mission) < 3 then - npcHandler:setMessage(MESSAGE_GREET, "How is your {mission} going?") - npcHandler:setTopic(playerId, 5) - elseif player:getStorageValue(Storage.CultsOfTibia.Minotaurs.Mission) == 4 then - npcHandler:setMessage(MESSAGE_GREET, { "You say the minotaurs were controlled by a very powerful boss they worshipped. This explains why they had so much more power than the normal ones. ...", "I'm very thankful. Please go to the Druid of Crunor and tell him what you've seen. He might be interested in that." }) - player:setStorageValue(Storage.CultsOfTibia.Minotaurs.Mission, 5) - npcHandler:setTopic(playerId, 10) - end - return true -end npcConfig.voices = { interval = 15000, chance = 50, { text = "Don't enter this area if you are an inexperienced fighter! It would be your end!" }, } + local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) @@ -75,6 +57,28 @@ npcType.onCloseChannel = function(npc, creature) npcHandler:onCloseChannel(npc, creature) end +local function greetCallback(npc, creature) + local player = Player(creature) + local playerId = player:getId() + + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Minotaurs.Mission) < 1 then + npcHandler:setMessage(MESSAGE_GREET, "Gerimor is right. As an expert for minotaurs I am researching these creatures for years. I thought I already knew a lot but the monsters in this cave are {different}. It's a big {mystery}.") + npcHandler:setTopic(playerId, 0) + elseif player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Minotaurs.JamesfrancisTask) <= 50 and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Minotaurs.Mission) < 3 then + npcHandler:setMessage(MESSAGE_GREET, "How is your {mission} going?") + npcHandler:setTopic(playerId, 0) + elseif player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Minotaurs.Mission) == 4 then + npcHandler:setMessage(MESSAGE_GREET, { + "You say the minotaurs were controlled by a very powerful boss they worshipped. This explains why they had so much more power than the normal ones. ...", + "I'm very thankful. Please go to the Druid of Crunor and tell him what you've seen. He might be interested in that.", + }) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Minotaurs.Mission, 5) + npcHandler:setTopic(playerId, 0) + end + + return true +end + local function creatureSayCallback(npc, creature, type, message) local player = Player(creature) local playerId = player:getId() @@ -83,34 +87,30 @@ local function creatureSayCallback(npc, creature, type, message) return false end - -- Start quest - if MsgContains(message, "mystery") and npcHandler:getTopic(playerId) == 1 then - npcHandler:say({ "The minotaurs I faced in the cave are much stronger than the normal ones. What I were able to see before I had to flee: all of them seem to belong to a cult worshipping their god. Could you do me a {favour}?" }, npc, creature) + if MsgContains(message, "mystery") then + npcHandler:say("The minotaurs I faced in the cave are much stronger than the normal ones. What I were able to see before I had to flee: all of them seem to belong to a cult worshipping their god. Could you do me a {favour}?", npc, creature) npcHandler:setTopic(playerId, 2) elseif MsgContains(message, "favour") and npcHandler:getTopic(playerId) == 2 then - npcHandler:say({ "I'd like to work in this cave researching the minotaurs. But right now there are too many of hem and what is more, they are too powerful for me. Could you enter the cave and kill at least 50 of these creatures?" }, npc, creature) + npcHandler:say("I'd like to work in this cave researching the minotaurs. But right now there are too many of hem and what is more, they are too powerful for me. Could you enter the cave and kill at least 50 of these creatures?", npc, creature) npcHandler:setTopic(playerId, 3) - elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 3 then - if player:getStorageValue(Storage.CultsOfTibia.Questline) < 1 then - player:setStorageValue(Storage.CultsOfTibia.Questline, 1) - end - npcHandler:say({ "Very nice. Return to me if you've finished your job." }, npc, creature) - player:setStorageValue(Storage.CultsOfTibia.Minotaurs.Mission, 2) - player:setStorageValue(Storage.CultsOfTibia.Minotaurs.JamesfrancisTask, 0) - player:setStorageValue(Storage.CultsOfTibia.Minotaurs.EntranceAccessDoor, 1) - npcHandler:setTopic(playerId, 0) - -- Delivering the quest - elseif MsgContains(message, "mission") and npcHandler:getTopic(playerId) == 5 then - if player:getStorageValue(Storage.CultsOfTibia.Minotaurs.JamesfrancisTask) >= 50 then - npcHandler:say({ "Great job! You have killed at least 50 of these monsters. I give this key to you to open the door to the inner area. Go there and find out what's going on." }, npc, creature) - player:setStorageValue(Storage.CultsOfTibia.Minotaurs.Mission, 3) - player:setStorageValue(Storage.CultsOfTibia.Minotaurs.AccessDoor, 1) + elseif MsgContains(message, "mission") then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Minotaurs.JamesfrancisTask) >= 50 then + npcHandler:say("Great job! You have killed at least 50 of these monsters. I give this key to you to open the door to the inner area. Go there and find out what's going on.", npc, creature) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Minotaurs.Mission, 3) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Minotaurs.BossAccessDoor, 1) npcHandler:setTopic(playerId, 0) else - npcHandler:say({ "Come back when you have killed enough minotaurs." }, npc, creature) + npcHandler:say("Come back when you have killed enough minotaurs.", npc, creature) npcHandler:setTopic(playerId, 0) end + elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 3 then + npcHandler:say("Very nice. Return to me if you've finished your job.", npc, creature) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Minotaurs.Mission, 2) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Minotaurs.JamesfrancisTask, 0) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Minotaurs.AccessDoor, 1) + npcHandler:setTopic(playerId, 0) end + return true end diff --git a/data-otservbr-global/npc/noozer.lua b/data-otservbr-global/npc/noozer.lua index 855e3e0174b..5a0478fa2f3 100644 --- a/data-otservbr-global/npc/noozer.lua +++ b/data-otservbr-global/npc/noozer.lua @@ -50,15 +50,6 @@ npcType.onCloseChannel = function(npc, creature) npcHandler:onCloseChannel(npc, creature) end -local function greetCallback(npc, creature) - local playerId = creature:getId() - local player = Player(creature) - - npcHandler:setMessage(MESSAGE_GREET, "Hm? Oh! Oh, yes a... visitor! Intruder? Benefactor...? Wha- what are you? If you want to {pass} through this {cave}, I may have to disappoint you. Or maybe not. It... depends. So, just passing through?.") - npcHandler:setTopic(playerId, 1) - - return true -end local function creatureSayCallback(npc, creature, type, message) local player = Player(creature) local playerId = player:getId() @@ -67,8 +58,7 @@ local function creatureSayCallback(npc, creature, type, message) return false end - -- Começou a quest - if MsgContains(message, "pass") and npcHandler:getTopic(playerId) == 1 then + if MsgContains(message, "pass") then npcHandler:say({ "Yes, yes. Or wait - why do you want to.. ah what does it matter. So you want to get through these {caves}, fine. But be warned! ...", "...wait a second, I lost it. What was I going to say again? Ah yes - DANGEROUS! These. Caves. Are. Dangerous. No way you get out alive. Ever. Again. ...", @@ -76,29 +66,31 @@ local function creatureSayCallback(npc, creature, type, message) "Wait - I am the guardian here, yes! The keeper of... something... or another, yes, I... guard this place. With my life. Don't I? Of course! ...", "Is, er... this the moment where I should try to... stop you? Yes? No? Ah, you know what - you go down there, those guys are angry as dung anyway. Try your luck, return to me when you're done. If you still can. Or not.", }, npc, creature) - if player:getStorageValue(Storage.CultsOfTibia.Questline) < 1 then - player:setStorageValue(Storage.CultsOfTibia.Questline, 1) - end - if player:getStorageValue(Storage.CultsOfTibia.Misguided.Mission) < 2 then - player:setStorageValue(Storage.CultsOfTibia.Misguided.Mission, 2) - player:setStorageValue(Storage.CultsOfTibia.Misguided.AccessDoor, 1) + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Mission) < 2 then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Mission, 2) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.AccessDoor, 1) end - elseif MsgContains(message, "cave") and npcHandler:getTopic(playerId) == 1 then - npcHandler:say({ "I was stationed in this cave to... guard something. Right now I am not even sure what that was." }, npc, creature) - elseif MsgContains(message, "job") and npcHandler:getTopic(playerId) == 1 then - npcHandler:say({ "Then don't waste my time. I'm doing some important... business... here. Actually... where am I? If I find out, I will be even more angry than I am now. Out of my sight." }, npc, creature) - elseif MsgContains(message, "mission") and npcHandler:getTopic(playerId) == 1 then - npcHandler:say({ "I was on a mission, too - I guess. It was all quite blurry back then. Maybe I'll leave this place after I recovered completely. I have to find out what happened to me." }, npc, creature) + npcHandler:setTopic(playerId, 0) + elseif MsgContains(message, "cave") then + npcHandler:say("I was stationed in this cave to... guard something. Right now I am not even sure what that was.", npc, creature) + npcHandler:setTopic(playerId, 0) + elseif MsgContains(message, "job") then + npcHandler:say("Then don't waste my time. I'm doing some important... business... here. Actually... where am I? If I find out, I will be even more angry than I am now. Out of my sight.", npc, creature) + npcHandler:setTopic(playerId, 0) + elseif MsgContains(message, "mission") then + npcHandler:say("I was on a mission, too - I guess. It was all quite blurry back then. Maybe I'll leave this place after I recovered completely. I have to find out what happened to me.", npc, creature) + npcHandler:setTopic(playerId, 0) end + return true end +npcHandler:setMessage(MESSAGE_GREET, "Hm? Oh! Oh, yes a... visitor! Intruder? Benefactor...? Wha- what are you? If you want to pass through this cave, I may have to disappoint you. Or maybe not. It... depends. So, just passing through?") npcHandler:setMessage(MESSAGE_WALKAWAY, "Well, bye then.") npcHandler:setCallback(CALLBACK_SET_INTERACTION, onAddFocus) npcHandler:setCallback(CALLBACK_REMOVE_INTERACTION, onReleaseFocus) -npcHandler:setCallback(CALLBACK_GREET, greetCallback) npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true) diff --git a/data-otservbr-global/npc/tigo.lua b/data-otservbr-global/npc/tigo.lua index 70646d20e40..c663f6ff812 100644 --- a/data-otservbr-global/npc/tigo.lua +++ b/data-otservbr-global/npc/tigo.lua @@ -55,12 +55,14 @@ local function greetCallback(npc, creature) local player = Player(creature) - if player:getStorageValue(Storage.CultsOfTibia.Barkless.Mission) < 2 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Mission) < 2 then npcHandler:setMessage(MESSAGE_GREET, "There, there initiate. You will now become one of us, as so many before you. One of the {Barkless}. Walk with us and you will walk tall my friend.") npcHandler:setTopic(playerId, 1) end + return true end + local function creatureSayCallback(npc, creature, type, message) local player = Player(creature) local playerId = player:getId() @@ -69,23 +71,13 @@ local function creatureSayCallback(npc, creature, type, message) return false end - -- Começou a quest - if MsgContains(message, "barkless") and npcHandler:getTopic(playerId) == 1 then + if MsgContains(message, "barkless") and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Mission) == 1 then npcHandler:say({ "You are now one of us. Learn to endure this world's suffering in every facet and take delight in the soothing eternity that waits for the {purest} of us on the other side." }, npc, creature) - npcHandler:setTopic(playerId, 2) - npcHandler:setTopic(playerId, 2) - if player:getStorageValue(Storage.CultsOfTibia.Questline) < 1 then - player:setStorageValue(Storage.CultsOfTibia.Questline, 1) - end - if player:getStorageValue(Storage.CultsOfTibia.Barkless.Mission) < 1 then - player:setStorageValue(Storage.CultsOfTibia.Barkless.Mission, 1) - player:setStorageValue(Storage.CultsOfTibia.Barkless.TrialAccessDoor, 1) - end - elseif MsgContains(message, "purest") and npcHandler:getTopic(playerId) == 2 then + npcHandler:setTopic(playerId, 1) + elseif MsgContains(message, "purest") and npcHandler:getTopic(playerId) == 1 then npcHandler:say({ "Purification is but one of the difficult steps on your way to the other side. The {trial} of tar, sulphur and ice." }, npc, creature) npcHandler:setTopic(playerId, 2) - npcHandler:setTopic(playerId, 2) - elseif MsgContains(message, "trial") and npcHandler:getTopic(playerId) == 3 then + elseif MsgContains(message, "trial") and npcHandler:getTopic(playerId) == 2 then npcHandler:say({ "The trial consists of three steps. The trial of tar, where you will suffer unbearable heat and embrace the stigma of misfortune. ...", "The trial of sulphur, where you will bathe in burning sulphur and embrace the stigma of vanity. Then, there is the trial of purification. The truest of us will be purified to face judgement from the {Penitent}.", @@ -94,9 +86,10 @@ local function creatureSayCallback(npc, creature, type, message) "If he does, follow him into his own chambers. Barkless are neither allowed to go near the throne room, aside from being judged, nor can we actually enter it.", "He should be easy to defeat with his back to the wall, find him - and delvier us from whatever became of the Penitent.", }, npc, creature) - npcHandler:setTopic(playerId, 0) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.TrialAccessDoor, 1) npcHandler:setTopic(playerId, 0) end + return true end diff --git a/data-otservbr-global/scripts/actions/valuables/random_items.lua b/data-otservbr-global/scripts/actions/valuables/random_items.lua index 9e62086a972..2772ac859ce 100644 --- a/data-otservbr-global/scripts/actions/valuables/random_items.lua +++ b/data-otservbr-global/scripts/actions/valuables/random_items.lua @@ -172,6 +172,13 @@ local config = { }, effect = CONST_ME_CRAPS, }, + [26186] = { -- mystery box + chances = { + { from = 0, to = 5001, itemId = 25361 }, -- blood of the mountain + { from = 5002, to = 10001, itemId = 25360 }, -- heart of the mountain + }, + effect = CONST_ME_CRAPS, + }, [27654] = { -- surprise jar chances = { { from = 0, to = 2500, itemId = 3041 }, diff --git a/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua b/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua index 9d0f5eab3b7..5b981b6a088 100644 --- a/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua +++ b/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua @@ -59,38 +59,38 @@ local questTable = { { storage = Storage.Quest.U8_4.InServiceOfYalahar.DoorToLastFight, storageValue = 1 }, { storage = Storage.Quest.U8_4.InServiceOfYalahar.DoorToMatrix, storageValue = 1 }, { storage = Storage.Quest.U8_4.InServiceOfYalahar.DoorToQuara, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Questline, storageValue = 7 }, - { storage = Storage.CultsOfTibia.Minotaurs.JamesfrancisTask, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Minotaurs.Mission, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Minotaurs.BossTimer, storageValue = 1 }, - { storage = Storage.CultsOfTibia.MotA.Mission, storageValue = 1 }, - { storage = Storage.CultsOfTibia.MotA.Stone1, storageValue = 1 }, - { storage = Storage.CultsOfTibia.MotA.Stone2, storageValue = 1 }, - { storage = Storage.CultsOfTibia.MotA.Stone3, storageValue = 1 }, - { storage = Storage.CultsOfTibia.MotA.Answer, storageValue = 1 }, - { storage = Storage.CultsOfTibia.MotA.QuestionId, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Barkless.Mission, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Barkless.sulphur, storageValue = 4 }, - { storage = Storage.CultsOfTibia.Barkless.Tar, storageValue = 3 }, - { storage = Storage.CultsOfTibia.Barkless.Ice, storageValue = 3 }, - { storage = Storage.CultsOfTibia.Barkless.Objects, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Barkless.Temp, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Orcs.Mission, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Orcs.LookType, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Orcs.BossTimer, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Life.Mission, storageValue = 7 }, - { storage = Storage.CultsOfTibia.Life.BossTimer, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Humans.Mission, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Humans.Vaporized, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Humans.Decaying, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Humans.BossTimer, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Misguided.Mission, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Misguided.Monsters, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Misguided.Exorcisms, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Misguided.Time, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Misguided.BossTimer, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Minotaurs.EntranceAccessDoor, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Minotaurs.AccessDoor, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Questline, storageValue = 7 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Minotaurs.JamesfrancisTask, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Minotaurs.Mission, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Minotaurs.BossTimer, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.MotA.Stone1, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.MotA.Stone2, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.MotA.Stone3, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.MotA.Answer, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.MotA.QuestionId, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Barkless.Mission, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Barkless.sulphur, storageValue = 4 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Barkless.Tar, storageValue = 3 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Barkless.Ice, storageValue = 3 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Barkless.Objects, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Barkless.Temp, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Orcs.Mission, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Orcs.LookType, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Orcs.BossTimer, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Life.Mission, storageValue = 7 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Life.BossTimer, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Humans.Mission, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Humans.Vaporized, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Humans.Decaying, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Humans.BossTimer, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Misguided.Mission, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Misguided.Monsters, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Misguided.Exorcisms, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Misguided.Time, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Misguided.BossTimer, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Minotaurs.EntranceAccessDoor, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Minotaurs.AccessDoor, storageValue = 1 }, { storage = Storage.Quest.U7_6.ExplorerSociety.QuestLine, storageValue = 1 }, { storage = Storage.Quest.U7_6.ExplorerSociety.QuestLine, storageValue = 4 }, { storage = Storage.Quest.U7_6.ExplorerSociety.QuestLine, storageValue = 7 }, @@ -302,13 +302,13 @@ local questTable = { { storage = Storage.Quest.U12_60.APiratesTail.RascacoonShortcut, storageValue = 1 }, { storage = Storage.Quest.U12_70.AdventuresOfGalthen.AccessDoor, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Barkless.AccessDoor, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Barkless.TrialAccessDoor, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Barkless.TarAccessDoor, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Barkless.BossAccessDoor, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Life.AccessDoor, storageValue = 1 }, - { storage = Storage.CultsOfTibia.Misguided.AccessDoor, storageValue = 1 }, - { storage = Storage.CultsOfTibia.FinalBoss.AccessDoor, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Barkless.AccessDoor, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Barkless.TrialAccessDoor, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Barkless.TarAccessDoor, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Barkless.BossAccessDoor, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Life.AccessDoor, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.Misguided.AccessDoor, storageValue = 1 }, + { storage = Storage.Quest.U11_40.CultsOfTibia.FinalBoss.AccessDoor, storageValue = 1 }, { storage = Storage.Quest.U10_90.FerumbrasAscension.FirstDoor, storageValue = 1 }, { storage = Storage.Quest.U10_90.FerumbrasAscension.MonsterDoor, storageValue = 1 }, diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_analyser.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_analyser.lua index 17b7ffbc976..ce01d36c244 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_analyser.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_analyser.lua @@ -14,9 +14,9 @@ function cultsOfTibiaAnalyser.onUse(player, item, fromPosition, target, toPositi return false end - if player:getStorageValue(Storage.CultsOfTibia.Life.Mission) == 4 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission) == 4 then if target:getPosition() == sqm or target:getPosition() == Position(sqm.x, sqm.y + 1, sqm.z) or target:getPosition() == Position(sqm.x, sqm.y + 2, sqm.z) then - player:setStorageValue(Storage.CultsOfTibia.Life.Mission, 5) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission, 5) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Well done! The water is analyzed.") end end diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_bosses_levers.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_bosses_levers.lua index 61fb460fd72..265d221feac 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_bosses_levers.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_bosses_levers.lua @@ -1,540 +1,594 @@ local transformid = { - [8911] = 8912, - [8912] = 8911, + [8911] = 8912, + [8912] = 8911, } local geyser = { - [1] = Position(33132, 31917, 15), - [2] = Position(33135, 31919, 15), - [3] = Position(33135, 31923, 15), - [4] = Position(33128, 31922, 15), - [5] = Position(33128, 31918, 15), - [6] = Position(33124, 31920, 15), - [7] = Position(33124, 31925, 15), - [8] = Position(33131, 31927, 15), - [9] = Position(33135, 31926, 15), - [10] = Position(33128, 31929, 15), - [11] = Position(33133, 31930, 15), - [12] = Position(33127, 31933, 15), + [1] = Position(33132, 31917, 15), + [2] = Position(33135, 31919, 15), + [3] = Position(33135, 31923, 15), + [4] = Position(33128, 31922, 15), + [5] = Position(33128, 31918, 15), + [6] = Position(33124, 31920, 15), + [7] = Position(33124, 31925, 15), + [8] = Position(33131, 31927, 15), + [9] = Position(33135, 31926, 15), + [10] = Position(33128, 31929, 15), + [11] = Position(33133, 31930, 15), + [12] = Position(33127, 31933, 15), } local function spawnStolenSoul(t_time) - if t_time == 0 then - local a1 = Position(33034, 31916, 15) - local a2 = Position(33048, 31927, 15) - if not isPlayerInArea(a1, a2) then - return true - end - local newArea = Position(math.random(a1.x, a2.x), math.random(a1.y, a2.y), math.random(a1.z, a2.z)) - Game.createMonster(math.random(1, 2) == 1 and "Stolen Soul" or "Soul Reaper", newArea) - t_time = 31 - end - addEvent(spawnStolenSoul, 1000, t_time - 1) + if t_time == 0 then + local a1 = Position(33034, 31916, 15) + local a2 = Position(33048, 31927, 15) + if not isPlayerInArea(a1, a2) then + return true + end + local newArea = Position(math.random(a1.x, a2.x), math.random(a1.y, a2.y), math.random(a1.z, a2.z)) + Game.createMonster(math.random(1, 2) == 1 and "Stolen Soul" or "Soul Reaper", newArea) + t_time = 31 + end + addEvent(spawnStolenSoul, 1000, t_time - 1) end local function spawnDarkSoul(area, t_time) - if t_time == 0 then - local esperandoPlayer = false - local p1 = Position(33023, 31904, 14) - local p2 = Position(33037, 31915, 14) - local sA1 = Position(33028, 31908, 14) - local sA2 = Position(33036, 31914, 14) - if area == 2 then - p1 = Position(33039, 31902, 14) - p2 = Position(33052, 31916, 14) - sA1 = Position(33042, 31908, 14) - sA2 = Position(33051, 31914, 14) - end - if not isPlayerInArea(p1, p2) then - local a1 = Position(33034, 31916, 15) - local a2 = Position(33048, 31927, 15) - if not isPlayerInArea(a1, a2) then - return true - end - esperandoPlayer = true - else - local monster = {} - for _x = sA1.x, sA2.x, 1 do - for _y = sA1.y, sA2.y, 1 do - local tileMonster = Tile(Position(_x, _y, sA1.z)):getTopCreature() - if tileMonster and tileMonster:isMonster() and tileMonster:getName() == "Dark Soul" then - monster[#monster + 1] = tileMonster - end - end - end - if #monster >= 4 then - for _, pid in pairs(monster) do - pid:remove() - end - end - -- spawn - local newPos = Position(math.random(sA1.x, sA2.x), math.random(sA1.y, sA2.y), math.random(sA1.z, sA2.z)) - Game.createMonster("Dark Soul", newPos) - end - addEvent(spawnDarkSoul, 1000, area, (esperandoPlayer and 1 or 30)) - else - addEvent(spawnDarkSoul, 1000, area, t_time - 1) - end + if t_time == 0 then + local waitingForPlayer = false + local p1 = Position(33023, 31904, 14) + local p2 = Position(33037, 31915, 14) + local sA1 = Position(33028, 31908, 14) + local sA2 = Position(33036, 31914, 14) + if area == 2 then + p1 = Position(33039, 31902, 14) + p2 = Position(33052, 31916, 14) + sA1 = Position(33042, 31908, 14) + sA2 = Position(33051, 31914, 14) + end + if not isPlayerInArea(p1, p2) then + local a1 = Position(33034, 31916, 15) + local a2 = Position(33048, 31927, 15) + if not isPlayerInArea(a1, a2) then + return true + end + waitingForPlayer = true + else + local monsters = {} + for _x = sA1.x, sA2.x, 1 do + for _y = sA1.y, sA2.y, 1 do + local tileMonster = Tile(Position(_x, _y, sA1.z)):getTopCreature() + if tileMonster and tileMonster:isMonster() and tileMonster:getName() == "Dark Soul" then + monsters[#monsters + 1] = tileMonster + end + end + end + if #monsters >= 4 then + for _, pid in pairs(monsters) do + pid:remove() + end + end + local newPos = Position(math.random(sA1.x, sA2.x), math.random(sA1.y, sA2.y), math.random(sA1.z, sA2.z)) + Game.createMonster("Dark Soul", newPos) + end + addEvent(spawnDarkSoul, 1000, area, (waitingForPlayer and 1 or 30)) + else + addEvent(spawnDarkSoul, 1000, area, t_time - 1) + end end local function transformMonster(itid, action, monster, frompos, topos, _temp) - -- minotaur idol - if action == 1 then - local tempo = _temp - for _x = frompos.x, topos.x, 1 do - local tile = Tile(Position(_x, frompos.y, frompos.z)) - if _x % 2 == 0 then - tempo = tempo + 1 - if tile then - if tile:getItemCountById(itid) < 1 then - Game.createItem(itid, 1, Position(_x, frompos.y, frompos.z)) - end - addEvent(transformMonster, tempo * 15000, itid, 2, monster, Position(_x, frompos.y, frompos.z), {}, _temp + 1) - end - end - end - elseif action == 2 then - local tile = Tile(frompos) - if tile:getItemCountById(itid) > 0 then - tile:getItemById(itid):remove() - end - Game.createMonster(monster, frompos) - elseif action == 3 then - local pos = Position(33158, 31912, 15) - local pos2 = Position(33169, 31919, 15) - Game.createMonster(monster, { x = math.random(pos.x, pos2.x), y = math.random(pos.y, pos2.y), z = pos2.z }) - if _temp < itid then - _temp = _temp + 1 - addEvent(transformMonster, 15000, itid, 3, "Sphere Of Wrath", {}, {}, _temp) - end - end + if action == 1 then + local delay = _temp + for _x = frompos.x, topos.x, 1 do + local tile = Tile(Position(_x, frompos.y, frompos.z)) + if _x % 2 == 0 then + delay = delay + 1 + if tile then + if tile:getItemCountById(itid) < 1 then + Game.createItem(itid, 1, Position(_x, frompos.y, frompos.z)) + end + addEvent(transformMonster, delay * 15000, itid, 2, monster, Position(_x, frompos.y, frompos.z), {}, _temp + 1) + end + end + end + elseif action == 2 then + local tile = Tile(frompos) + if tile:getItemCountById(itid) > 0 then + tile:getItemById(itid):remove() + end + Game.createMonster(monster, frompos) + elseif action == 3 then + local pos = Position(33158, 31912, 15) + local pos2 = Position(33169, 31919, 15) + Game.createMonster(monster, { x = math.random(pos.x, pos2.x), y = math.random(pos.y, pos2.y), z = pos2.z }) + if _temp < itid then + _temp = _temp + 1 + addEvent(transformMonster, 15000, itid, 3, "Sphere Of Wrath", {}, {}, _temp) + end + end end -local function ativarGeyser(player) - local frompos = Position(33119, 31913, 15) -- Checagem - local topos = Position(33142, 31936, 15) -- Checagem - if isPlayerInArea(frompos, topos) then - addEvent(function() - local rand = math.random(1, 12) - local geyserPos = Position(geyser[rand]) - local checar1 = Tile(Position(geyserPos)):getItemById(25509) - if checar1 then - addEvent(function() - local player1 = Game.getPlayers()[1] - Game.createItem(25510, 1, geyserPos) - player1:say("SPLASH!", TALKTYPE_MONSTER_SAY, false, false, geyserPos) - addEvent(function() - local checar2 = Tile(Position(geyserPos)):getItemById(25510) - if checar2 then - checar2:remove() - end - end, 9 * 1000) - end, 5 * 1000) - elseif checar2 then - return false - end - addEvent(function() - ativarGeyser() - end, 1 * 1000) - end, 8 * 1000) - end - return true +local function activateGeyser(player) + local frompos = Position(33119, 31913, 15) + local topos = Position(33142, 31936, 15) + if isPlayerInArea(frompos, topos) then + addEvent(function() + local rand = math.random(1, 12) + local geyserPos = Position(geyser[rand]) + local check1 = Tile(Position(geyserPos)):getItemById(25509) + if check1 then + addEvent(function() + local player1 = Game.getPlayers()[1] + Game.createItem(25510, 1, geyserPos) + player1:say("SPLASH!", TALKTYPE_MONSTER_SAY, false, false, geyserPos) + addEvent(function() + local check2 = Tile(Position(geyserPos)):getItemById(25510) + if check2 then + check2:remove() + end + end, 9 * 1000) + end, 5 * 1000) + elseif check2 then + return false + end + addEvent(function() + activateGeyser() + end, 1 * 1000) + end, 8 * 1000) + end + return true end local cultsOfTibiaLevers = Action() + function cultsOfTibiaLevers.onUse(player, item, fromPosition, itemEx, toPosition) - local players = {} - local ittable = {} - local blockmonsters = { "Leiden", "Wine Cask", "Liquor Spirit", "Ravenous Hunger" } - local convertTable = {} - item:transform(transformid[item:getId()]) - - if item:getActionId() == 5501 and item:getId() == 8912 then -- Leiden - if player:getPosition() == Position(33138, 31953, 15) then + local players = {} + local ittable = {} + local blockmonsters = { "Leiden", "Wine Cask", "Liquor Spirit", "Ravenous Hunger" } + local convertTable = {} + item:transform(transformid[item:getId()]) + + if item:getActionId() == 5501 and item:getId() == 8912 then + if player:getPosition() == Position(33138, 31953, 15) then local teleport = 0 - for i = 31953, 31957, 1 do - local newpos = Position(33138, i, 15) - local nplayer = Tile(newpos):getTopCreature() - if nplayer and nplayer:isPlayer() then - teleport = teleport + 1 - end - end + local playersInArea = {} + local frompos = Position(33151, 31942, 15) + local topos = Position(33176, 31966, 15) - local frompos = Position(33151, 31942, 15) -- Checagem - local topos = Position(33176, 31966, 15) -- Checagem - - if isPlayerInArea(frompos, topos) then - player:sendCancelMessage("The room is full.") - return true - end - - for _x = frompos.x, topos.x, 1 do - for _y = frompos.y, topos.y, 1 do - for _z = frompos.z, topos.z, 1 do - local tile = Tile(Position(_x, _y, _z)) - if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then - tile:getTopCreature():remove() - end - end - end - end - - for i = 31953, 31957, 1 do + for i = 31953, 31957 do local newpos = Position(33138, i, 15) local nplayer = Tile(newpos):getTopCreature() - if nplayer and nplayer:isPlayer() then - nplayer:setBossCooldown("Ravenous Hunger", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) - nplayer:teleportTo(Position(33161, 31959, 15), true) - nplayer:sendBosstiaryCooldownTimer() - convertTable[#convertTable + 1] = nplayer:getId() - nplayer:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - end - Game.createMonster("Wine Cask", Position(33162, 31945, 15)) - local leiden = Game.createMonster("Leiden", Position(33162, 31950, 15)) - leiden:setHealth(leiden:getHealth() / 2) - kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33121, 31951, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) - end - end - if item:getActionId() == 5502 and item:getId() == 8912 then -- The False God - if player:getPosition() == Position(33162, 31893, 15) then - local teleport = 0 - for i = 31893, 31897, 1 do - local newpos = Position(33162, i, 15) - local nplayer = Tile(newpos):getTopCreature() - if nplayer and nplayer:isPlayer() then - teleport = teleport + 1 - end - end - - local frompos = Position(33152, 31908, 15) -- Checagem - local topos = Position(33175, 31923, 15) -- Checagem - - if isPlayerInArea(frompos, topos) then - player:sendCancelMessage("The room is full.") - return true - end - - for _x = frompos.x, topos.x, 1 do - for _y = frompos.y, topos.y, 1 do - for _z = frompos.z, topos.z, 1 do - local tile = Tile(Position(_x, _y, _z)) - if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then - tile:getTopCreature():remove() - end - end - end - end - - for i = 31893, 31897, 1 do - local newpos = Position(33162, i, 15) - local nplayer = Tile(newpos):getTopCreature() - if nplayer and nplayer:isPlayer() then - nplayer:setBossCooldown("The False God", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) - nplayer:teleportTo(Position(33169, 31915, 15), true) - convertTable[#convertTable + 1] = nplayer:getId() - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - end - transformMonster(25300, 1, "minotaur idol", Position(33157, 31910, 15), Position(33168, 31910, 15), 0) - transformMonster(25300, 1, "minotaur idol", Position(33158, 31921, 15), Position(33168, 31921, 15), 6) - addEvent(transformMonster, 13 * 15000, 3, 3, "Sphere Of Wrath", {}, {}, 0) - Game.createMonster("The False God", Position(33159, 31914, 15)) - -- funçao - kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33181, 31894, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) - end - end - - if item:getActionId() == 5500 then -- Essence of Malice - if player:getPosition() == Position(33095, 31943, 15) and item:getId() == 8912 then - local teleport = 0 - for i = 31943, 31947, 1 do - local newpos = Position(33095, i, 15) - local nplayer = Tile(newpos):getTopCreature() - if nplayer and nplayer:isPlayer() then - teleport = teleport + 1 - end - end - - local frompos = Position(33084, 31907, 15) -- Checagem - local topos = Position(33114, 31933, 15) -- Checagem - - if isPlayerInArea(frompos, topos) then - player:sendCancelMessage("It looks like there is someone inside.") - return true - end - - for _x = frompos.x, topos.x, 1 do - for _y = frompos.y, topos.y, 1 do - for _z = frompos.z, topos.z, 1 do - local tile = Tile(Position(_x, _y, _z)) - if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then - tile:getTopCreature():remove() - end - end - end - end - - for i = 31943, 31947, 1 do - local newpos = Position(33095, i, 15) - local nplayer = Tile(newpos):getTopCreature() - if nplayer and nplayer:isPlayer() then - nplayer:setBossCooldown("Essence of Malice", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) - nplayer:teleportTo(Position(33098, 31921, 15), true) - convertTable[#convertTable + 1] = nplayer:getId() - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - end - kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33091, 31963, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) - Game.createMonster("Pillar of Summoning", Position(33093, 31919, 15)) - Game.createMonster("Pillar of Death", Position(33098, 31915, 15)) - Game.createMonster("Pillar of Protection", Position(33103, 31919, 15)) - Game.createMonster("Pillar of Healing", Position(33101, 31925, 15)) - Game.createMonster("Pillar of Draining", Position(33095, 31925, 15)) - Game.createMonster("Dorokoll The Mystic STOP", Position(33095, 31924, 15)):registerEvent("HealthPillar") - Game.createMonster("Eshtaba The Conjurer STOP", Position(33094, 31919, 15)):registerEvent("HealthPillar") - Game.createMonster("Eliz The Unyielding STOP", Position(33102, 31919, 15)):registerEvent("HealthPillar") - Game.createMonster("Mezlon The Defiler STOP", Position(33101, 31924, 15)):registerEvent("HealthPillar") - Game.createMonster("Malkhar Deathbringer STOP", Position(33098, 31916, 15)):registerEvent("HealthPillar") - end - end - - if item:getActionId() == 5503 then -- The Souldespoiler - if player:getPosition() == Position(33127, 31892, 15) and item:getId() == 8912 then - local teleport = 0 - for i = 31892, 31896, 1 do - local newpos = Position(33127, i, 15) - local nplayer = Tile(newpos):getTopCreature() - if nplayer and nplayer:isPlayer() then - teleport = teleport + 1 - end - end - - local frompos = Position(33119, 31913, 15) -- Checagem - local topos = Position(33142, 31936, 15) -- Checagem - - if isPlayerInArea(frompos, topos) then - player:sendCancelMessage("It looks like there is someone inside.") - return true - end - - for _x = frompos.x, topos.x, 1 do - for _y = frompos.y, topos.y, 1 do - for _z = frompos.z, topos.z, 1 do - local tile = Tile(Position(_x, _y, _z)) - if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then - tile:getTopCreature():remove() - end - end - end - end - - for i = 31892, 31896, 1 do - local newpos = Position(33127, i, 15) - local nplayer = Tile(newpos):getTopCreature() - if nplayer and nplayer:isPlayer() then - nplayer:setBossCooldown("The Souldespoiler", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) - nplayer:teleportTo(Position(33130, 31919, 15), true) - convertTable[#convertTable + 1] = nplayer:getId() - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - end - kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33109, 31887, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) - Game.createMonster("The Sinister Hermit Dirty", Position(33131, 31925, 15)) - ativarGeyser() - end - end - - if item:getActionId() == 5504 then -- Boss do orc - if player:getPosition() == Position(33164, 31859, 15) and item:getId() == 8912 then - local teleport = 0 - for y = 31859, 31863, 1 do - local newpos = Position(33164, y, 15) - local nplayer = Tile(newpos):getTopCreature() - if nplayer and nplayer:isPlayer() then - teleport = teleport + 1 - end - end - - local frompos = Position(33123, 31846, 15) -- Checagem - local topos = Position(33149, 31871, 15) -- Checagem - - if isPlayerInArea(frompos, topos) then - player:sendCancelMessage("It looks like there is someone inside.") - return true - end - - for _x = frompos.x, topos.x, 1 do - for _y = frompos.y, topos.y, 1 do - for _z = frompos.z, topos.z, 1 do - local tile = Tile(Position(_x, _y, _z)) - if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then - tile:getTopCreature():remove() - end - end - end - end - - for y = 31859, 31863, 1 do - local newpos = Position(33164, y, 15) - local nplayer = Tile(newpos):getTopCreature() - if nplayer and nplayer:isPlayer() then - nplayer:setBossCooldown("The Armored Voidborn", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) - nplayer:teleportTo(Position(33137, 31867, 15), true) - convertTable[#convertTable + 1] = nplayer:getId() - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - end - local function criarRaio1(fromPos, toPos, id, dir) - if dir == 1 then - for _x = fromPos.x, toPos.x, 1 do - local tile = Tile(Position(_x, fromPos.y, fromPos.z)) - if tile and tile:getItemCountById(id) == 0 then - Game.createItem(id, 1, Position(_x, fromPos.y, fromPos.z)) - end - end - elseif dir == 2 then - for _y = fromPos.y, toPos.y, 1 do - local tile = Tile(Position(fromPos.x, _y, fromPos.z)) - if tile and tile:getItemCountById(id) == 0 then - Game.createItem(id, 1, Position(fromPos.x, _y, fromPos.z)) - end - end - end - end - local itensToMonster = { --8633 - Position(33133, 31856, 15), - Position(33140, 31856, 15), - Position(33140, 31863, 15), - Position(33133, 31863, 15), - } - -- criando os itens - for _, position in pairs(itensToMonster) do - local tile = Tile(position) - if tile and tile:getItemCountById(7805) < 1 then - Game.createItem(7805, 1, position) - end - end - -- criando os raios - criarRaio1(Position(33134, 31856, 15), Position(33139, 31856, 15), 6116, 1) - criarRaio1(Position(33134, 31863, 15), Position(33139, 31863, 15), 6116, 1) - criarRaio1(Position(33140, 31857, 15), Position(33140, 31862, 15), 6117, 2) - criarRaio1(Position(33133, 31857, 15), Position(33133, 31862, 15), 6117, 2) - - -- criando os securys - Game.createMonster("Security Golem", Position(33131, 31855, 15)) - Game.createMonster("Security Golem", Position(33142, 31855, 15)) - Game.createMonster("Security Golem", Position(33141, 31863, 15)) - Game.createMonster("Security Golem", Position(33132, 31863, 15)) - - Game.createMonster("Containment Machine", Position(33133, 31864, 15)):registerEvent("MachineDeath") - Game.createMonster("The Armored Voidborn", Position(33135, 31859, 15)):registerEvent("MachineDeath") - kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33179, 31840, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) - end - end - if item:getActionId() == 5505 then -- Boss da areia - if player:getPosition() == Position(33507, 32228, 10) and item:getId() == 8912 then - local teleport = 0 - for _y = 32228, 32232, 1 do - local newpos = Position(33507, _y, 10) - local nplayer = Tile(newpos):getTopCreature() if nplayer and nplayer:isPlayer() then teleport = teleport + 1 + table.insert(playersInArea, nplayer) end end - local frompos = Position(33087, 31848, 15) -- Checagem - local topos = Position(33109, 31871, 15) -- Checagem - - if isPlayerInArea(frompos, topos) then - player:sendCancelMessage("It looks like there is someone inside.") + if teleport ~= 5 then + player:sendCancelMessage("You need exactly 5 players to start this challenge.") return true end - for _x = frompos.x, topos.x, 1 do - for _y = frompos.y, topos.y, 1 do - for _z = frompos.z, topos.z, 1 do - local tile = Tile(Position(_x, _y, _z)) - if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then - tile:getTopCreature():remove() - end - if tile then - local tileItems = tile:getItems() - if type(tileItems) == "table" and #tileItems > 0 then - for _, it in pairs(tileItems) do - if ItemType(it:getId()):isCorpse() then - it:remove() - end - end - end - end - end - end - end - - for _y = 32228, 32232, 1 do - local newpos = Position(33507, _y, 10) - local nplayer = Tile(newpos):getTopCreature() - if nplayer and nplayer:isPlayer() then - nplayer:setBossCooldown("The Sandking", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) - nplayer:teleportTo(Position(33099, 31864, 15), true) - convertTable[#convertTable + 1] = nplayer:getId() - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - end - - Game.createMonster("the sandking fake", Position(33099, 31858, 15)):registerEvent("SandkingThink") - Game.setStorageValue("sandking", 1) - kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33459, 32269, 10), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) - end - end - - -- final boss - if item:getActionId() == 5506 then - if player:getPosition() == Position(33074, 31884, 15) and item:getId() == 8912 then - local convertTable = {} - convertTable[#convertTable + 1] = player:getId() - - local frompos = Position(33023, 31904, 14) -- Checagem - local topos = Position(33052, 31932, 15) -- Checagem - - if isPlayerInArea(frompos, topos) then - player:sendCancelMessage("It looks like there is someone inside.") - return true - end - - local pt1 = Position(33073, 31885, 15) - local pt2 = Position(33075, 31887, 15) - for _x = pt1.x, pt2.x, 1 do - for _y = pt1.y, pt2.y, 1 do - for _z = pt1.z, pt2.z, 1 do - local nplayer = Tile(Position(_x, _y, _z)):getTopCreature() - if nplayer and nplayer:isPlayer() then - convertTable[#convertTable + 1] = nplayer:getId() - end - end - end - end - for _, pid in pairs(convertTable) do - local nplayer = Player(pid) - if nplayer then - nplayer:setBossCooldown("The Source Of Corruption", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) - nplayer:teleportTo(Position(33039, 31925, 15), true) - nplayer:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - end - - Game.createMonster("The Remorseless Corruptor", Position(33039, 31922, 15)) - Game.createMonster("Zarcorix Of Yalahar", Position(33039, 31921, 15)):registerEvent("YalahariHealth") - Game.createMonster("Stolen Soul", Position(33039, 31920, 15)) - Game.createMonster("Soul Reaper", Position(33039, 31919, 15)) - spawnDarkSoul(1, 30) - spawnDarkSoul(2, 30) - spawnStolenSoul(30) - kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33072, 31867, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) - end - end - return true + if isPlayerInArea(frompos, topos) then + player:sendCancelMessage("The room is full.") + return true + end + + for _x = frompos.x, topos.x, 1 do + for _y = frompos.y, topos.y, 1 do + for _z = frompos.z, topos.z, 1 do + local tile = Tile(Position(_x, _y, _z)) + if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then + tile:getTopCreature():remove() + end + end + end + end + + for _, nplayer in ipairs(playersInArea) do + nplayer:setBossCooldown("Ravenous Hunger", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) + nplayer:teleportTo(Position(33161, 31959, 15), true) + nplayer:sendBosstiaryCooldownTimer() + convertTable[#convertTable + 1] = nplayer:getId() + nplayer:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + + Game.createMonster("Wine Cask", Position(33162, 31945, 15)) + local leiden = Game.createMonster("Leiden", Position(33162, 31950, 15)) + leiden:setHealth(leiden:getHealth() / 2) + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33121, 31951, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + end + end + + if item:getActionId() == 5502 and item:getId() == 8912 then + if player:getPosition() == Position(33162, 31893, 15) then + local teleport = 0 + local playersInArea = {} + local frompos = Position(33152, 31908, 15) + local topos = Position(33175, 31923, 15) + + for i = 31893, 31897 do + local newpos = Position(33162, i, 15) + local nplayer = Tile(newpos):getTopCreature() + if nplayer and nplayer:isPlayer() then + teleport = teleport + 1 + table.insert(playersInArea, nplayer) + end + end + + if teleport ~= 5 then + player:sendCancelMessage("You need exactly 5 players to start this challenge.") + return true + end + + if isPlayerInArea(frompos, topos) then + player:sendCancelMessage("The room is full.") + return true + end + + for _x = frompos.x, topos.x, 1 do + for _y = frompos.y, topos.y, 1 do + for _z = frompos.z, topos.z, 1 do + local tile = Tile(Position(_x, _y, _z)) + if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then + tile:getTopCreature():remove() + end + end + end + end + + for _, nplayer in ipairs(playersInArea) do + nplayer:setBossCooldown("The False God", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) + nplayer:teleportTo(Position(33169, 31915, 15), true) + convertTable[#convertTable + 1] = nplayer:getId() + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + + transformMonster(25300, 1, "minotaur idol", Position(33157, 31910, 15), Position(33168, 31910, 15), 0) + transformMonster(25300, 1, "minotaur idol", Position(33158, 31921, 15), Position(33168, 31921, 15), 6) + addEvent(transformMonster, 13 * 15000, 3, 3, "Sphere Of Wrath", {}, {}, 0) + Game.createMonster("The False God", Position(33159, 31914, 15)) + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33181, 31894, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + end + end + + if item:getActionId() == 5500 then + if player:getPosition() == Position(33095, 31943, 15) and item:getId() == 8912 then + local teleport = 0 + local playersInArea = {} + local frompos = Position(33084, 31907, 15) + local topos = Position(33114, 31933, 15) + + for i = 31943, 31947 do + local newpos = Position(33095, i, 15) + local nplayer = Tile(newpos):getTopCreature() + if nplayer and nplayer:isPlayer() then + teleport = teleport + 1 + table.insert(playersInArea, nplayer) + end + end + + if teleport ~= 1 then + player:sendCancelMessage("You need exactly 5 players to start this challenge.") + return true + end + + if isPlayerInArea(frompos, topos) then + player:sendCancelMessage("It looks like there is someone inside.") + return true + end + + for _x = frompos.x, topos.x, 1 do + for _y = frompos.y, topos.y, 1 do + for _z = frompos.z, topos.z, 1 do + local tile = Tile(Position(_x, _y, _z)) + if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then + tile:getTopCreature():remove() + end + end + end + end + + for _, nplayer in ipairs(playersInArea) do + nplayer:setBossCooldown("Essence of Malice", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) + nplayer:teleportTo(Position(33098, 31921, 15), true) + convertTable[#convertTable + 1] = nplayer:getId() + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33091, 31963, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + Game.createMonster("Pillar of Summoning", Position(33093, 31919, 15)) + Game.createMonster("Pillar of Death", Position(33098, 31915, 15)) + Game.createMonster("Pillar of Protection", Position(33103, 31919, 15)) + Game.createMonster("Pillar of Healing", Position(33101, 31925, 15)) + Game.createMonster("Pillar of Draining", Position(33095, 31925, 15)) + Game.createMonster("Dorokoll The Mystic STOP", Position(33095, 31924, 15)):registerEvent("HealthPillar") + Game.createMonster("Eshtaba The Conjurer STOP", Position(33094, 31919, 15)):registerEvent("HealthPillar") + Game.createMonster("Eliz The Unyielding STOP", Position(33102, 31919, 15)):registerEvent("HealthPillar") + Game.createMonster("Mezlon The Defiler STOP", Position(33101, 31924, 15)):registerEvent("HealthPillar") + Game.createMonster("Malkhar Deathbringer STOP", Position(33098, 31916, 15)):registerEvent("HealthPillar") + end + end + + if item:getActionId() == 5503 then + if player:getPosition() == Position(33127, 31892, 15) and item:getId() == 8912 then + local teleport = 0 + local playersInArea = {} + local frompos = Position(33119, 31913, 15) + local topos = Position(33142, 31936, 15) + + for i = 31892, 31896 do + local newpos = Position(33127, i, 15) + local nplayer = Tile(newpos):getTopCreature() + if nplayer and nplayer:isPlayer() then + teleport = teleport + 1 + table.insert(playersInArea, nplayer) + end + end + + if teleport ~= 5 then + player:sendCancelMessage("You need exactly 5 players to start this challenge.") + return true + end + + if isPlayerInArea(frompos, topos) then + player:sendCancelMessage("It looks like there is someone inside.") + return true + end + + for _x = frompos.x, topos.x, 1 do + for _y = frompos.y, topos.y, 1 do + for _z = frompos.z, topos.z, 1 do + local tile = Tile(Position(_x, _y, _z)) + if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then + tile:getTopCreature():remove() + end + end + end + end + + for _, nplayer in ipairs(playersInArea) do + nplayer:setBossCooldown("The Souldespoiler", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) + nplayer:teleportTo(Position(33130, 31919, 15), true) + convertTable[#convertTable + 1] = nplayer:getId() + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33109, 31887, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + Game.createMonster("The Sinister Hermit Dirty", Position(33131, 31925, 15)) + activateGeyser() + end + end + + if item:getActionId() == 5504 then + if player:getPosition() == Position(33164, 31859, 15) and item:getId() == 8912 then + local teleport = 0 + local playersInArea = {} + local frompos = Position(33123, 31846, 15) + local topos = Position(33149, 31871, 15) + + for y = 31859, 31863 do + local newpos = Position(33164, y, 15) + local nplayer = Tile(newpos):getTopCreature() + if nplayer and nplayer:isPlayer() then + teleport = teleport + 1 + table.insert(playersInArea, nplayer) + end + end + + if teleport ~= 5 then + player:sendCancelMessage("You need exactly 5 players to start this challenge.") + return true + end + + if isPlayerInArea(frompos, topos) then + player:sendCancelMessage("It looks like there is someone inside.") + return true + end + + for _x = frompos.x, topos.x, 1 do + for _y = frompos.y, topos.y, 1 do + for _z = frompos.z, topos.z, 1 do + local tile = Tile(Position(_x, _y, _z)) + if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then + tile:getTopCreature():remove() + end + end + end + end + + for _, nplayer in ipairs(playersInArea) do + nplayer:setBossCooldown("The Armored Voidborn", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) + nplayer:teleportTo(Position(33137, 31867, 15), true) + convertTable[#convertTable + 1] = nplayer:getId() + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + + local function createBeam1(fromPos, toPos, id, dir) + if dir == 1 then + for _x = fromPos.x, toPos.x, 1 do + local tile = Tile(Position(_x, fromPos.y, fromPos.z)) + if tile and tile:getItemCountById(id) == 0 then + Game.createItem(id, 1, Position(_x, fromPos.y, fromPos.z)) + end + end + elseif dir == 2 then + for _y = fromPos.y, toPos.y, 1 do + local tile = Tile(Position(fromPos.x, _y, fromPos.z)) + if tile and tile:getItemCountById(id) == 0 then + Game.createItem(id, 1, Position(fromPos.x, _y, fromPos.z)) + end + end + end + end + + local itemsToMonster = { + Position(33133, 31856, 15), + Position(33140, 31856, 15), + Position(33140, 31863, 15), + Position(33133, 31863, 15), + } + + for _, position in pairs(itemsToMonster) do + local tile = Tile(position) + if tile and tile:getItemCountById(7805) < 1 then + Game.createItem(7805, 1, position) + end + end + + createBeam1(Position(33134, 31856, 15), Position(33139, 31856, 15), 6116, 1) + createBeam1(Position(33134, 31863, 15), Position(33139, 31863, 15), 6116, 1) + createBeam1(Position(33140, 31857, 15), Position(33140, 31862, 15), 6117, 2) + createBeam1(Position(33133, 31857, 15), Position(33133, 31862, 15), 6117, 2) + + Game.createMonster("Security Golem", Position(33131, 31855, 15)) + Game.createMonster("Security Golem", Position(33142, 31855, 15)) + Game.createMonster("Security Golem", Position(33141, 31863, 15)) + Game.createMonster("Security Golem", Position(33132, 31863, 15)) + + Game.createMonster("Containment Machine", Position(33133, 31864, 15)):registerEvent("MachineDeath") + Game.createMonster("The Armored Voidborn", Position(33135, 31859, 15)):registerEvent("MachineDeath") + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33179, 31840, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + end + end + + if item:getActionId() == 5505 then + if player:getPosition() == Position(33507, 32228, 10) and item:getId() == 8912 then + local teleport = 0 + local teleport = 0 + local playersInArea = {} + local frompos = Position(33087, 31848, 15) + local topos = Position(33109, 31871, 15) + + for _y = 32228, 32232 do + local newpos = Position(33507, _y, 10) + local nplayer = Tile(newpos):getTopCreature() + if nplayer and nplayer:isPlayer() then + teleport = teleport + 1 + table.insert(playersInArea, nplayer) + end + end + + if teleport ~= 5 then + player:sendCancelMessage("You need exactly 5 players to start this challenge.") + return true + end + + if isPlayerInArea(frompos, topos) then + player:sendCancelMessage("It looks like there is someone inside.") + return true + end + + for _x = frompos.x, topos.x, 1 do + for _y = frompos.y, topos.y, 1 do + for _z = frompos.z, topos.z, 1 do + local tile = Tile(Position(_x, _y, _z)) + if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then + tile:getTopCreature():remove() + end + if tile then + local tileItems = tile:getItems() + if type(tileItems) == "table" and #tileItems > 0 then + for _, it in pairs(tileItems) do + if ItemType(it:getId()):isCorpse() then + it:remove() + end + end + end + end + end + end + end + + for _, nplayer in ipairs(playersInArea) do + nplayer:setBossCooldown("The Sandking", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) + nplayer:teleportTo(Position(33099, 31864, 15), true) + convertTable[#convertTable + 1] = nplayer:getId() + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + + Game.createMonster("the sandking fake", Position(33099, 31858, 15)):registerEvent("SandkingThink") + Game.setStorageValue("sandking", 1) + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33459, 32269, 10), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + end + end + + if item:getActionId() == 5506 then + if player:getPosition() == Position(33074, 31884, 15) and item:getId() == 8912 then + local teleport = 0 + local playersInArea = {} + local frompos = Position(33023, 31904, 14) + local topos = Position(33052, 31932, 15) + + if player:getPosition() == Position(33074, 31884, 15) then + teleport = teleport + 1 + table.insert(playersInArea, player) + else + return true + end + + local pt1 = Position(33073, 31885, 15) + local pt2 = Position(33075, 31887, 15) + for _x = pt1.x, pt2.x do + for _y = pt1.y, pt2.y do + local nplayer = Tile(Position(_x, _y, 15)):getTopCreature() + if nplayer and nplayer:isPlayer() then + teleport = teleport + 1 + table.insert(playersInArea, nplayer) + end + end + end + + if teleport ~= 10 then + player:sendCancelMessage("You need exactly 10 players to start this challenge.") + return true + end + + if isPlayerInArea(frompos, topos) then + player:sendCancelMessage("It looks like there is someone inside.") + return true + end + + 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 and tile:getTopCreature() and tile:getTopCreature():isMonster() then + tile:getTopCreature():remove() + end + if tile then + local tileItems = tile:getItems() + if type(tileItems) == "table" and #tileItems > 0 then + for _, it in pairs(tileItems) do + if ItemType(it:getId()):isCorpse() then + it:remove() + end + end + end + end + end + end + end + + for _, nplayer in ipairs(playersInArea) do + nplayer:setBossCooldown("The Source Of Corruption", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) + nplayer:teleportTo(Position(33039, 31925, 15), true) + nplayer:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + + Game.createMonster("The Remorseless Corruptor", Position(33039, 31922, 15)) + Game.createMonster("Zarcorix Of Yalahar", Position(33039, 31921, 15)):registerEvent("YalahariHealth") + Game.createMonster("Stolen Soul", Position(33039, 31920, 15)) + Game.createMonster("Soul Reaper", Position(33039, 31919, 15)) + spawnDarkSoul(1, 30) + spawnDarkSoul(2, 30) + spawnStolenSoul(30) + + kickerPlayerRoomAfterMin(playersInArea, frompos, topos, Position(33072, 31867, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + end + end + + return true end cultsOfTibiaLevers:aid(5500, 5501, 5502, 5503, 5504, 5505, 5506) diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_counter_agent.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_counter_agent.lua index b59b1508430..24b414399ee 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_counter_agent.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_counter_agent.lua @@ -27,10 +27,10 @@ function cultsOfTibiaCounter.onUse(player, item, fromPosition, target, toPositio return false end - if player:getStorageValue(Storage.CultsOfTibia.Life.Mission) == 6 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission) == 6 then if target:getPosition() == sqm or target:getPosition() == Position(sqm.x, sqm.y + 1, sqm.z) or target:getPosition() == Position(sqm.x, sqm.y + 2, sqm.z) then player:teleportTo(destino) - player:setStorageValue(Storage.CultsOfTibia.Life.Mission, 7) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission, 7) for i, position in pairs(config) do position:sendMagicEffect(CONST_ME_POFF) end diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_crate.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_crate.lua index 0cc39a78e51..33ef2a91c0f 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_crate.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_crate.lua @@ -3,11 +3,11 @@ function cultsOfTibiaCrate.onUse(player, item, fromPosition, target, toPosition, local posCrate = Position(33300, 32277, 12) -- Document if item:getPosition() == posCrate then - if player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) == 7 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 7 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Perfect! You took a wonderful loupe from this crate.") player:addItem(25306, 1) - player:setStorageValue(Storage.CultsOfTibia.MotA.Mission, 8) - elseif player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) > 7 then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, 8) + elseif player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) > 7 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You already took the magnifier.") else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "This crate belongs to Angelo. You should talk to him before taking something out.") diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_cult_symbol.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_cult_symbol.lua index 80a23f7eb63..6663a616b27 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_cult_symbol.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_cult_symbol.lua @@ -16,12 +16,11 @@ local config = { local cultsOfTibiaCult = Action() function cultsOfTibiaCult.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local stg = math.max(player:getStorageValue(Storage.CultsOfTibia.Barkless.Objects), 0) + local stg = math.max(player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Objects), 0) if stg >= 10 then - if player:getStorageValue(Storage.CultsOfTibia.Barkless.Mission) >= 4 then - -- continue + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Mission) >= 4 then else - player:setStorageValue(Storage.CultsOfTibia.Barkless.Mission, 4) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Mission, 4) end return false end @@ -32,19 +31,19 @@ function cultsOfTibiaCult.onUse(player, item, fromPosition, target, toPosition, break end end - local stgTemp = math.max(player:getStorageValue(Storage.CultsOfTibia.Barkless.Temp), 0) + local stgTemp = math.max(player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Temp), 0) local manchaMeta = NewBit(stgTemp) local base = bit.lshift(1, mancha.base) if manchaMeta:hasFlag(base) then return false end manchaMeta:updateFlag(base) - player:setStorageValue(Storage.CultsOfTibia.Barkless.Temp, manchaMeta:getNumber()) - player:setStorageValue(Storage.CultsOfTibia.Barkless.Objects, stg + 1) - if player:getStorageValue(Storage.CultsOfTibia.Barkless.Objects) >= 10 then - player:setStorageValue(Storage.CultsOfTibia.Barkless.Mission, 4) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Temp, manchaMeta:getNumber()) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Objects, stg + 1) + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Objects) >= 10 then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Mission, 4) end - local msg = (player:getStorageValue(Storage.CultsOfTibia.Barkless.Objects) < 10 and "Your body reacts to this strange green substance as you reach out to touch it. You feel an urge for more of this energy." or "You gathered an impressive amount of power from simply touching the strange green symbols of the Barkless. But how...?") + local msg = (player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Objects) < 10 and "Your body reacts to this strange green substance as you reach out to touch it. You feel an urge for more of this energy." or "You gathered an impressive amount of power from simply touching the strange green symbols of the Barkless. But how...?") player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg) return true end diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_document.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_document.lua index 50c81e864b6..019819eff26 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_document.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_document.lua @@ -1,17 +1,18 @@ local cultsOfTibiaDocument = Action() + function cultsOfTibiaDocument.onUse(player, item, fromPosition, target, toPosition, isHotkey) local posDocument = Position(33279, 32169, 8) - -- Document if item:getPosition() == posDocument then - if player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) == 2 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 2 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Dear curator, this recently opened museum is a really nice place to be.") player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "But wait! What about the empty space in front of you? What a pity!") player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It seems that somebody has removed one of the beautiful pictures. But come on! You have the money and we need it.") player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "So for a small expense allowance you'll get it back. Just talk to Iwar in Kazordoon for further information. ") player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Ask him: Has the cat got your tongue?") - player:setStorageValue(Storage.CultsOfTibia.MotA.Mission, 3) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, 3) end end + return true end diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_last_object.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_last_object.lua index 565da77e68c..be82c316271 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_last_object.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_last_object.lua @@ -14,16 +14,17 @@ local config = { } local cultsOfTibiaLastObject = Action() + function cultsOfTibiaLastObject.onUse(player, item) - if player:getStorageValue(Storage.CultsOfTibia.Barkless.Mission) == 4 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Mission) == 4 then for i, position in pairs(config) do position:sendMagicEffect(CONST_ME_YELLOWENERGY) end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The strange symbol in the wall in the back glows violently.") player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The cult object just lies there quietly. The dangerous area around it has been all but dissolved.") player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "As you reach out to touch the cult object, a surge of energy burst from the skull. You banished its power.") - player:setStorageValue(Storage.CultsOfTibia.Barkless.Mission, 5) - player:setStorageValue(Storage.CultsOfTibia.Barkless.BossAccessDoor, 1) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Mission, 5) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.BossAccessDoor, 1) end return true end diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_lever_mota.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_lever_mota.lua index 03aaf3b2004..b6d9564c27a 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_lever_mota.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_lever_mota.lua @@ -4,55 +4,62 @@ local transformid = { } local cultsOfTibiaLeverMota = Action() + function cultsOfTibiaLeverMota.onUse(player, item, fromPosition, itemEx, toPosition) - local posPedra = Position() - local posPedra2 = Position() - local posPedra3 = Position() - local pedraid = 15487 - if player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) ~= 12 then + local stonePos1 = Position() + local stonePos2 = Position() + local stonePos3 = Position() + local stoneId = 15487 + + local missionStatus = player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) + if missionStatus ~= 12 and missionStatus ~= 13 then player:getPosition():sendMagicEffect(CONST_ME_POFF) return false end - for i = 33300, 33305, 1 do + + for i = 33300, 33305 do local newpos = Position(i, 32144, 10) - if Tile(newpos):getItemCountById(pedraid) == 1 then - posPedra = newpos + if Tile(newpos):getItemCountById(stoneId) == 1 then + stonePos1 = newpos end newpos = Position(i, 32146, 10) - if Tile(newpos):getItemCountById(pedraid) == 1 then - posPedra2 = newpos + if Tile(newpos):getItemCountById(stoneId) == 1 then + stonePos2 = newpos end newpos = Position(i, 32148, 10) - if Tile(newpos):getItemCountById(pedraid) == 1 then - posPedra3 = newpos + if Tile(newpos):getItemCountById(stoneId) == 1 then + stonePos3 = newpos end end - local pedra1 = math.random(0, 5) - local pedra2 = math.random(0, 5) - local pedra3 = math.random(0, 5) - -- pedra 1 - local itpedra1 = Tile(posPedra):getItemById(pedraid) - local newpos = { x = 33300 + pedra1, y = itpedra1:getPosition().y, z = itpedra1:getPosition().z } - itpedra1:moveTo(newpos) + + local stone1 = math.random(0, 5) + local stone2 = math.random(0, 5) + local stone3 = math.random(0, 5) + + local itstone1 = Tile(stonePos1):getItemById(stoneId) + local newpos = { x = 33300 + stone1, y = itstone1:getPosition().y, z = itstone1:getPosition().z } + itstone1:moveTo(newpos) Position(newpos):sendMagicEffect(CONST_ME_POFF) - -- pedra 2 - local itpedra2 = Tile(posPedra2):getItemById(pedraid) - local newpos = { x = 33300 + pedra2, y = itpedra2:getPosition().y, z = itpedra2:getPosition().z } - itpedra2:moveTo(newpos) + local itstone2 = Tile(stonePos2):getItemById(stoneId) + local newpos = { x = 33300 + stone2, y = itstone2:getPosition().y, z = itstone2:getPosition().z } + itstone2:moveTo(newpos) Position(newpos):sendMagicEffect(CONST_ME_POFF) - -- pedra 3 - local itpedra3 = Tile(posPedra3):getItemById(pedraid) - local newpos = { x = 33300 + pedra3, y = itpedra3:getPosition().y, z = itpedra3:getPosition().z } - itpedra3:moveTo(newpos) + local itstone3 = Tile(stonePos3):getItemById(stoneId) + local newpos = { x = 33300 + stone3, y = itstone3:getPosition().y, z = itstone3:getPosition().z } + itstone3:moveTo(newpos) Position(newpos):sendMagicEffect(CONST_ME_POFF) - player:setStorageValue(Storage.CultsOfTibia.MotA.Stone1, Stone1) - player:setStorageValue(Storage.CultsOfTibia.MotA.Stone2, Stone2) - player:setStorageValue(Storage.CultsOfTibia.MotA.Stone3, Stone3) - player:setStorageValue(Storage.CultsOfTibia.MotA.AccessDoorGareth, -1) - player:setStorageValue(Storage.CultsOfTibia.MotA.Mission, player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) + 1) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Stone1, stone1) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Stone2, stone2) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Stone3, stone3) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.AccessDoorGareth, -1) + + if missionStatus == 12 then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, 13) + end + item:transform(transformid[item:getId()]) return true end diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_magnifier.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_magnifier.lua index 449e79dc115..e50f94226b0 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_magnifier.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_magnifier.lua @@ -18,9 +18,9 @@ function cultsOfTibiaMagnifier.onUse(player, item, fromPosition, target, toPosit if table.contains({ 2622, 2601, 2596, 2612, 2618 }, target:getId()) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Nothing special. This picture looks genuine.") target:getPosition():sendMagicEffect(CONST_ME_POFF) - elseif target:getPosition() == sqm and target:getId() == 2613 and player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) == 8 then + elseif target:getPosition() == sqm and target:getId() == 2613 and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 8 then target:getPosition():sendMagicEffect(CONST_ME_POFF) - player:setStorageValue(Storage.CultsOfTibia.MotA.Mission, 9) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, 9) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "This is it. It looks like it was painted by a child!") end diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_misguided.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_misguided.lua index 3c555338d21..87d8e77f70b 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_misguided.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_misguided.lua @@ -39,22 +39,26 @@ local function changeMap(mapName) end local cultsOfTibiaMisguided = Action() + function cultsOfTibiaMisguided.onUse(player, item, position, target, targetPosition) - local monster = Monster(target) - if not monster then + local creature = Creature(target) + if not creature then return false end + local map = (type(Game.getStorageValue("cultsMap")) == "string" and Game.getStorageValue("cultsMap") or "illusion") - if monster:getName():lower() == "misguided bully" or monster:getName():lower() == "misguided thief" then - player:setStorageValue(Storage.CultsOfTibia.Misguided.Monsters, 0) + if creature:getName():lower() == "misguided bully" or creature:getName():lower() == "misguided thief" then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Monsters, 0) item:remove(1) - local pos = monster:getPosition() + local pos = creature:getPosition() Game.createItem(25298, 1, pos) - monster:remove() - local newMonster = Game.createMonster("Misguided Shadow", pos) - if newMonster then - newMonster:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + creature:remove() + + local newCreature = Game.createMonster("Misguided Shadow", pos) + if newCreature then + newCreature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) end + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You paralyse the bully and the amulet reveals the true face of the creature behind the possession of this misguided creature.") local it = player:addItem(25296, 1) if map == "illusion" then @@ -62,8 +66,10 @@ function cultsOfTibiaMisguided.onUse(player, item, position, target, targetPosit end it:decay() end + return true end + cultsOfTibiaMisguided:id(25297) cultsOfTibiaMisguided:register() diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_torch.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_torch.lua index c60e5d024b8..bea4debc46e 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_torch.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_torch.lua @@ -3,9 +3,11 @@ local config = { } local cultsOfTibiaTouch = Action() + function cultsOfTibiaTouch.onUse(player, item, fromPosition, target, toPosition, isHotkey) local wallItem - if Game.getStorageValue(12345) >= os.time() then + + if Game.getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Humans.WallDecaying) >= os.time() then player:getPosition():sendMagicEffect(CONST_ME_POFF) else for i = 1, #config do @@ -14,11 +16,12 @@ function cultsOfTibiaTouch.onUse(player, item, fromPosition, target, toPosition, Position(32396, 31806, 8):sendMagicEffect(CONST_ME_POFF) wallItem:remove() player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You hear a loud grinding sound not very far from you. something very heavy seems to have moved.") - Game.setStorageValue(12345, os.time() + 306) + Game.setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Humans.WallDecaying, os.time() + 306) addEvent(Game.createItem, 300000, 1295, 1, Position(32396, 31806, 8)) end end end + return true end diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_bosses_mission_cults.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_bosses_mission_cults.lua index bd4da1601f1..5ce125af212 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_bosses_mission_cults.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_bosses_mission_cults.lua @@ -1,12 +1,12 @@ local bosses = { - ["ravenous hunger"] = { storage = Storage.CultsOfTibia.Barkless.Mission, value = 6 }, - ["the souldespoiler"] = { storage = Storage.CultsOfTibia.Misguided.Mission, value = 4 }, - ["essence of malice"] = { storage = Storage.CultsOfTibia.Humans.Mission, value = 2 }, - ["the unarmored voidborn"] = { storage = Storage.CultsOfTibia.Orcs.Mission, value = 2 }, - ["the false god"] = { storage = Storage.CultsOfTibia.Minotaurs.Mission, value = 4 }, - ["the sandking"] = { storage = Storage.CultsOfTibia.Life.Mission, value = 8, global = "sandking", g_value = 5 }, + ["ravenous hunger"] = { storage = Storage.Quest.U11_40.CultsOfTibia.Barkless.Mission, value = 6 }, + ["the souldespoiler"] = { storage = Storage.Quest.U11_40.CultsOfTibia.Misguided.Mission, value = 4 }, + ["essence of malice"] = { storage = Storage.Quest.U11_40.CultsOfTibia.Humans.Mission, value = 2 }, + ["the unarmored voidborn"] = { storage = Storage.Quest.U11_40.CultsOfTibia.Orcs.Mission, value = 2 }, + ["the false god"] = { storage = Storage.Quest.U11_40.CultsOfTibia.Minotaurs.Mission, value = 4 }, + ["the sandking"] = { storage = Storage.Quest.U11_40.CultsOfTibia.Life.Mission, value = 8, global = "sandking", g_value = 5 }, ["the corruptor of souls"] = { createNew = "The Source Of Corruption", pos = Position(33039, 31922, 15), removeMonster = "zarcorix of yalahar", area1 = Position(33073, 31885, 15), area2 = Position(33075, 31887, 15) }, - ["the source of corruption"] = { storage = Storage.CultsOfTibia.FinalBoss.Mission, value = 2 }, + ["the source of corruption"] = { storage = Storage.Quest.U11_40.CultsOfTibia.FinalBoss.Mission, value = 2 }, } local bossesCults = CreatureEvent("CultsOfTibiaBossDeath") diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_glowing_rubbish_amulet.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_glowing_rubbish_amulet.lua index 55a16295bb3..0ae43c3c140 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_glowing_rubbish_amulet.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_glowing_rubbish_amulet.lua @@ -1,36 +1,40 @@ local glowingRubbishAmulet = CreatureEvent("GlowingRubbishAmuletDeath") + function glowingRubbishAmulet.onDeath(creature, _corpse, _lastHitKiller, mostDamageKiller) - onDeathForParty(creature, mostDamageKiller, function(creature, player) - local amulet = player:getSlotItem(CONST_SLOT_NECKLACE) - if not amulet or amulet:getId() ~= 25296 then - return true - end + onDeathForParty(creature, mostDamageKiller, function(creature, player) + local amulet = player:getSlotItem(CONST_SLOT_NECKLACE) + + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Mission) ~= 3 then + return true + end + + local mStg = math.max(player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Monsters), 0) + local eStg = math.max(player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Exorcisms), 0) - if player:getStorageValue(Storage.CultsOfTibia.Misguided.Mission) ~= 3 then - return true - end + if creature:getName():lower():trim() == "misguided shadow" then + if eStg < 5 then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Exorcisms, eStg + 1) + end + return true + end + + if not amulet or amulet:getId() ~= 25296 then + return true + end - local mStg = math.max(player:getStorageValue(Storage.CultsOfTibia.Misguided.Monsters), 0) - local eStg = math.max(player:getStorageValue(Storage.CultsOfTibia.Misguided.Exorcisms), 0) - if monster:getName():lower() == "misguided shadow" then - if eStg < 5 then - player:setStorageValue(Storage.CultsOfTibia.Misguided.Exorcisms, eStg + 1) - end - return true - end + if creature:getName():lower():trim() == "misguided bully" or creature:getName():lower():trim() == "misguided thief" then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Monsters, mStg + 1) - if monster:getName():lower() == "misguided bully" or monster:getName():lower() == "misguided thief" then - player:setStorageValue(Storage.CultsOfTibia.Misguided.Monsters, mStg + 1) - if player:getStorageValue(Storage.CultsOfTibia.Misguided.Monsters) >= 10 then - amulet:remove() - local it = player:addItem(25297, 1) - if it then - it:decay() - end - end - end - end) - return true + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Monsters) >= 10 then + amulet:remove() + local it = player:addItem(25297, 1) + if it then + it:decay() + end + end + end + end) + return true end glowingRubbishAmulet:register() diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_minotaur_task_count.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_minotaur_task_count.lua index 68f3a0f93a1..267bc2e5d06 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_minotaur_task_count.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_minotaur_task_count.lua @@ -1,9 +1,9 @@ local minotaurTask = CreatureEvent("MinotaurCultTaskDeath") function minotaurTask.onDeath(creature, _corpse, _lastHitKiller, mostDamageKiller) onDeathForParty(creature, mostDamageKiller, function(creature, player) - local storage = player:getStorageValue(Storage.CultsOfTibia.Minotaurs.JamesfrancisTask) + local storage = player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Minotaurs.JamesfrancisTask) if storage >= 0 and storage < 50 then - player:setStorageValue(Storage.CultsOfTibia.Minotaurs.JamesfrancisTask, storage + 1) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Minotaurs.JamesfrancisTask, storage + 1) end end) return true diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_splash.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_splash.lua index 17af493a144..bf8b0ac2d59 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_splash.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_splash.lua @@ -1,4 +1,5 @@ local splash = CreatureEvent("Splash") + function splash.onThink(creature) local hp = (creature:getHealth() / creature:getMaxHealth()) * 100 if hp < 85.0 then diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_begin_task.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_begin_task.lua index f1bf05f4b08..7bb5678841a 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_begin_task.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_begin_task.lua @@ -1,4 +1,4 @@ -function fallFloor(pid, id) +local function fallFloor(pid, id) local player = Player(pid) if not player then return true @@ -10,10 +10,11 @@ function fallFloor(pid, id) end local chance = math.random(0, 100) - if chance <= 1 then + if chance <= 2 then amulet:moveTo(player:getPosition()) end addEvent(fallFloor, 10000, player:getId(), id) + return true end @@ -24,19 +25,15 @@ function beginTask.onEquip(player, item, slot, isCheck) return true end - if player:getStorageValue(Storage.CultsOfTibia.Misguided.Mission) >= 2 and player:getStorageValue(Storage.CultsOfTibia.Misguided.Mission) <= 3 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Mission) >= 2 and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Mission) <= 3 then local equippedBefore = item:getCustomAttribute("task") or 0 - if equippedBefore ~= player:getGuid() and player:getStorageValue(Storage.CultsOfTibia.Misguided.Monsters) < 10 then - player:setStorageValue(Storage.CultsOfTibia.Misguided.Monsters, 0) + if equippedBefore ~= player:getGuid() and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Monsters) < 10 then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Monsters, 0) item:setCustomAttribute("task", player:getGuid()) end - if player:getStorageValue(Storage.CultsOfTibia.Misguided.Mission) == 2 then - player:setStorageValue(Storage.CultsOfTibia.Misguided.Mission, 3) - player:sendTextMessage( - MESSAGE_EVENT_ADVANCE, - "The amulet burns your skin. \z - It hungers for energy right now, gather a large amount of energy as fast as possible to charge it. " - ) + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Mission) == 2 then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Mission, 3) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The amulet burns your skin. It hungers for energy right now, gather a large amount of energy as fast as possible to charge it.") end end addEvent(fallFloor, 10000, player:getId(), item:getId()) diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_check_oasis.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_check_oasis.lua index 5a52cb16748..b4e769d0b29 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_check_oasis.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_check_oasis.lua @@ -6,9 +6,9 @@ function checkOasis.onStepIn(creature, item, position, fromPosition) return true end - if player:getStorageValue(Storage.CultsOfTibia.Life.Mission) == 2 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission) == 2 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a lovely oasis with green fauna and juicy fruit. You didn't expect that.") - player:setStorageValue(Storage.CultsOfTibia.Life.Mission, 3) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission, 3) end return true end diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_energy_fence.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_energy_fence.lua index 7f5314001b4..b8b035c8955 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_energy_fence.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_energy_fence.lua @@ -27,38 +27,26 @@ function energyFence.onStepIn(creature, item, position, fromPosition) end if position == firstCheck or position == Position(firstCheck.x + 1, firstCheck.y, firstCheck.z) or position == Position(firstCheck.x + 2, firstCheck.y, firstCheck.z) then - if player:getStorageValue(Storage.CultsOfTibia.Humans.Vaporized) == 10 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Humans.Vaporized) == 10 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "With you being the vessel binding the power of whitered souls, you step through the magic barrier.") player:getPosition():sendMagicEffect(CONST_ME_ENERGYHIT) else player:teleportTo(fromPosition, true) - player:sendTextMessage( - MESSAGE_EVENT_ADVANCE, - "The combined powers of decaying souls \z - roaming these halls may help breach this barrier, it needs but a vessel to bind them." - ) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The combined powers of decaying souls roaming these halls may help breach this barrier, it needs but a vessel to bind them.") end elseif position == secondCheck or position == Position(secondCheck.x + 1, secondCheck.y, secondCheck.z) then - if player:getStorageValue(Storage.CultsOfTibia.Humans.Decaying) == 10 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Humans.Decaying) == 10 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "With you being the vessel binding the power of whitered souls, you step through the magic barrier.") player:getPosition():sendMagicEffect(CONST_ME_ENERGYHIT) else player:teleportTo(fromPosition, true) - player:sendTextMessage( - MESSAGE_EVENT_ADVANCE, - "The combined powers of decaying souls \z - roaming these halls may help breach this barrier, it needs but a vessel to bind them." - ) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The combined powers of decaying souls roaming these halls may help breach this barrier, it needs but a vessel to bind them.") end elseif misguided then for i, position in pairs(misguided) do - if player:getStorageValue(Storage.CultsOfTibia.Misguided.Exorcisms) >= 5 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Exorcisms) >= 5 then player:getPosition():sendMagicEffect(CONST_ME_ENERGYHIT) - player:sendTextMessage( - MESSAGE_EVENT_ADVANCE, - "As you cross the threshold in to the inner \z - sanctuary of the cult of the Misguided, you feel an eerie presence all around you." - ) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "As you cross the threshold in to the inner sanctuary of the cult of the Misguided, you feel an eerie presence all around you.") break else player:teleportTo(fromPosition, true) diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_ice.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_ice.lua index fe1340bb44f..60bfef4c73c 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_ice.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_ice.lua @@ -1,96 +1,99 @@ -function sendConditionCults(playerid, info, fromPos, toPos, fromPos2, toPos2, time) - local player = Player(playerid) - if not player then - return false - end +local function sendConditionCults(playerId, info, fromPos, toPos, fromPos2, toPos2, time) + local player = Player(playerId) + if not player then + return false + end - if not player:getPosition():isInRange(fromPos2, toPos2) then - if not player:getPosition():isInRange(fromPos, toPos) then - return true - end - end + if not player:getPosition():isInRange(fromPos2, toPos2) then + if not player:getPosition():isInRange(fromPos, toPos) then + return true + end + end - time = time + 2 - if time == 30 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[2]) - elseif time == 60 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[2]) - elseif time == 90 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[2]) - elseif time >= 120 then - local storage = player:getStorageValue(info.storageBarkless) < 0 and 0 or player:getStorageValue(info.storageBarkless) - if storage < 3 and storage ~= 1 and storage ~= 2 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[3]) - player:setStorageValue(info.storageBarkless, 1) - end - end - player:getPosition():sendMagicEffect(info.effect) - addEvent(sendConditionCults, 2000, playerid, info, fromPos, toPos, fromPos2, toPos2, time) + time = time + 2 + if time == 30 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[2]) + elseif time == 60 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[2]) + elseif time == 90 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[2]) + elseif time >= 120 then + local storage = player:getStorageValue(info.storageBarkless) < 0 and 0 or player:getStorageValue(info.storageBarkless) + if storage < 3 and storage ~= 1 and storage ~= 2 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Sulphur) == 3 and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Tar) == 3 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[3]) + player:setStorageValue(info.storageBarkless, 1) + else + return true + end + end + end + player:getPosition():sendMagicEffect(info.effect) + addEvent(sendConditionCults, 2000, playerId, info, fromPos, toPos, fromPos2, toPos2, time) end -local function floorPassage(playerid, info, time) - local player = Player(playerid) - if not player then - return true - end - local storage = player:getStorageValue(info.storageBarkless) < 0 and 0 or player:getStorageValue(info.storageBarkless) - if time == 0 and storage < 3 then - player:setStorageValue(info.storageBarkless, 0) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[6]) - return true - end - if storage == 3 then - return true - end - addEvent(floorPassage, 1000, playerid, info, time - 1) +local function floorPassage(playerId, info, time) + local player = Player(playerId) + if not player then + return true + end + local storage = player:getStorageValue(info.storageBarkless) < 0 and 0 or player:getStorageValue(info.storageBarkless) + if time == 0 and storage < 3 then + player:setStorageValue(info.storageBarkless, 0) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[6]) + return true + end + if storage == 3 then + return true + end + addEvent(floorPassage, 1000, playerId, info, time - 1) end local ice = MoveEvent() function ice.onStepIn(creature, item, position, fromPosition) - local player = creature:getPlayer() - if not player then - return true - end - local setting = { - fromPos = Position(32677, 31393, 8), - toPos = Position(32722, 31440, 8), - fromPos2 = Position(32696, 31429, 8), - toPos2 = Position(32728, 31435, 8), - effect = CONST_ME_GIANTICE, - firstSqm = Position(32698, 31405, 8), - storageBarkless = Storage.CultsOfTibia.Barkless.Ice, - msgs = { - "As you enter the icy cavern, you feel an unnatural frostiness. \z - The ice cold air stings in your face. Survive and prove worthy.", -- on enter - "Your body temperature sinks. You can see your breath freezing in the cold.", -- 30/60 seconds - "The icy cold is grasping to you. You can barely move anymore.", -- 120 seconds - "You are now washed and ready to purify yourself in the chambers of purification.", -- step in the first tile - "You are now ready to prove your worth. Take heart and cross the threshold of ice.", -- step in the second tile - "You took so long. You are no longer purified.", -- there's no time to step - }, - } - if fromPosition.y == 31441 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, setting.msgs[1]) - sendConditionCults(player:getId(), setting, setting.fromPos, setting.toPos, setting.fromPos2, setting.toPos2, 0) - return true - end + local player = creature:getPlayer() + if not player then + return true + end + local setting = { + fromPos = Position(32677, 31393, 8), + toPos = Position(32722, 31440, 8), + fromPos2 = Position(32696, 31429, 8), + toPos2 = Position(32728, 31435, 8), + effect = CONST_ME_GIANTICE, + firstTile = Position(32698, 31405, 8), + storageBarkless = Storage.Quest.U11_40.CultsOfTibia.Barkless.Ice, + msgs = { + "As you enter the icy cavern, you feel an unnatural frostiness. The ice cold air stings in your face. Survive and prove worthy.", -- on enter + "Your body temperature sinks. You can see your breath freezing in the cold.", -- 30/60/90 seconds + "The icy cold is grasping to you. You can barely move anymore.", -- 120 seconds + "You are now washed and ready to purify yourself in the chambers of purification.", -- step on the first tile + "You are now ready to prove your worth. Take heart and cross the threshold of ice.", -- step on the second tile + "You took so long. You are no longer purified.", -- didn't step in time + }, + } + if fromPosition.y == 31441 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, setting.msgs[1]) + sendConditionCults(player:getId(), setting, setting.fromPos, setting.toPos, setting.fromPos2, setting.toPos2, 0) + return true + end - if item:getPosition():compare(setting.firstSqm) then - if player:getStorageValue(setting.storageBarkless) ~= 1 then - return true - end - player:setStorageValue(setting.storageBarkless, 2) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, setting.msgs[4]) - floorPassage(player:getId(), setting, 60) - return true - end + if item:getPosition():compare(setting.firstTile) then + if player:getStorageValue(setting.storageBarkless) ~= 1 then + return true + end + player:setStorageValue(setting.storageBarkless, 2) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, setting.msgs[4]) + floorPassage(player:getId(), setting, 60) + return true + end - if fromPosition.y == 31439 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A bit of warmth returns to your body as you leave the icy cavern.") - return true - end - return true + if fromPosition.y == 31439 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A bit of warmth returns to your body as you leave the icy cavern.") + return true + end + return true end ice:type("stepin") diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_ice_death.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_ice_death.lua index aff8d2462af..cd43068e0c3 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_ice_death.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_ice_death.lua @@ -1,11 +1,11 @@ function Player.sendFakeDeathWindow(self) - -- consider migrating to ProtocolGame::sendDeath local msg = NetworkMessage() + -- I found this in the function ProtocolGame::sendReLoginWindow msg:addByte(0x28) - msg:addByte(0x01) - msg:addByte(2) - msg:addByte(0x00) -- Use death redemption - msg:sendToPlayer(self, false) + msg:addByte(0x00) + msg:addByte(0x00) + msg:addByte(0x00) + msg:sendToPlayer(self) return true end @@ -44,9 +44,9 @@ function iceDeath.onStepIn(creature, item, position, fromPosition) if not player then return true end - if player:getStorageValue(Storage.CultsOfTibia.Barkless.Ice) == 2 then - player:setStorageValue(Storage.CultsOfTibia.Barkless.Ice, 3) - player:setStorageValue(Storage.CultsOfTibia.Barkless.Death, 1) + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Ice) == 2 then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Ice, 3) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Death, 1) for _, conditionType in pairs(conditions) do if player:getCondition(conditionType) then player:removeCondition(conditionType) @@ -58,18 +58,13 @@ function iceDeath.onStepIn(creature, item, position, fromPosition) if it then it:decay() end - player:addHealth((-player:getHealth() + 1)) + player:addHealth(-player:getHealth() + 1) player:sendTextMessage(MESSAGE_BEYOND_LAST, "You were killed by something evil and others.") - -- TODO parse active blessings and show that you didn't lose any blessings - player:sendTextMessage( - MESSAGE_BEYOND_LAST, - "You are still blessed with Wisdom of Solitude, Spark of the Phoenix,Fire of the Suns, \z - Spiritual Shielding, Embrace of Tibia, Heart of the Mountani, Blood of the Montain and Twist of Fate." - ) + player:sendTextMessage(MESSAGE_BEYOND_LAST, "You are still blessed with Wisdom of Solitude, Spark of the Phoenix, Fire of the Suns, Spiritual Shielding, Embrace of Tibia, Heart of the Mountain, Blood of the Mountain, and Twist of Fate.") player:sendTextMessage(MESSAGE_BEYOND_LAST, "You lost 0 experience and 0.00% of all of your skills.") player:sendTextMessage(MESSAGE_BEYOND_LAST, "You did not lose any items.") - player:setStorageValue(Storage.CultsOfTibia.Barkless.Mission, 3) - player:setStorageValue(Storage.CultsOfTibia.Barkless.AccessDoor, 1) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Mission, 3) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.AccessDoor, 1) player:sendTextMessage(MESSAGE_BEYOND_LAST, "The cold has all but disappeared from your body and you're getting warmer. You need to renew all preparations for purification.") player:sendFakeDeathWindow() else diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_looktype.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_looktype.lua index 021ccfc5aae..36a2eb09172 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_looktype.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_looktype.lua @@ -10,10 +10,10 @@ function looktype.onStepIn(creature, item, position, fromPosition) local secondCheck = Position(33128, 31885, 11) local thirdCheck = Position(33175, 31923, 12) if position == firstCheck or position == Position(firstCheck.x + 1, firstCheck.y, firstCheck.z) then - if player:getStorageValue(Storage.CultsOfTibia.Orcs.LookType) < 1 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Orcs.LookType) < 1 then if creature:getOutfit().lookType == 5 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Due to the strength of an orc you are able to pass this rift.") - player:setStorageValue(Storage.CultsOfTibia.Orcs.LookType, 1) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Orcs.LookType, 1) else player:teleportTo(fromPosition, true) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need the strength of an orc to pass this rift.") @@ -21,10 +21,10 @@ function looktype.onStepIn(creature, item, position, fromPosition) end end if position == secondCheck or position == Position(secondCheck.x + 1, secondCheck.y, secondCheck.z) then - if player:getStorageValue(Storage.CultsOfTibia.Orcs.LookType) < 2 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Orcs.LookType) < 2 then if creature:getOutfit().lookType == 2 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "With the help off the might of an orc warlod you are able to pass this rift.") - player:setStorageValue(Storage.CultsOfTibia.Orcs.LookType, 2) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Orcs.LookType, 2) else player:teleportTo(fromPosition, true) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need the might of an orc warlod to pass this rift.") @@ -32,10 +32,10 @@ function looktype.onStepIn(creature, item, position, fromPosition) end end if position == thirdCheck or position == Position(thirdCheck.x + 1, thirdCheck.y, thirdCheck.z) or position == Position(thirdCheck.x + 2, thirdCheck.y, thirdCheck.z) then - if player:getStorageValue(Storage.CultsOfTibia.Orcs.LookType) < 3 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Orcs.LookType) < 3 then if creature:getOutfit().lookType == 6 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "With the help of the wisdom of an orc shaman you are able to pass this rift.") - player:setStorageValue(Storage.CultsOfTibia.Orcs.LookType, 3) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Orcs.LookType, 3) else player:teleportTo(fromPosition, true) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need the wisdom of an orc shaman to pass this rift.") diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_river_teleport.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_river_teleport.lua index a6a7c3f92b8..2654c116985 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_river_teleport.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_river_teleport.lua @@ -12,12 +12,12 @@ function riverTeleport.onStepIn(creature, item, position, fromPosition) return false end - if player:getStorageValue(Storage.CultsOfTibia.Life.Mission) < 7 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission) < 7 then player:teleportTo(Position(33474, 32281, 10)) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) end - if player:getStorageValue(Storage.CultsOfTibia.Life.Mission) >= 7 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission) >= 7 then player:teleportTo(Position(33479, 32235, 10)) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) end diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_sand_entrance.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_sand_entrance.lua index e8937a4bdf1..ad9557521a8 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_sand_entrance.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_sand_entrance.lua @@ -6,7 +6,7 @@ function sandEntrance.onStepIn(creature, item, position, fromPosition) return true end - if player:getStorageValue(Storage.CultsOfTibia.Life.Mission) < 1 and player:getStorageValue(Storage.CultsOfTibia.MotA.Mission) < 1 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission) < 1 and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) < 1 then player:teleportTo(fromPosition, true) player:sendCancelMessage("You can't go there yet.") end diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_tar.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_tar.lua index a19273791b5..662187e440e 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_tar.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_tar.lua @@ -1,122 +1,118 @@ local configQuest = { - ["fire"] = { - itemId = 1857, - beginPos = Position(32748, 31488, 8), - fromPos = Position(32737, 31489, 8), - toPos = Position(32761, 31512, 8), - effect = CONST_ME_HITBYFIRE, - firstSqm = Position(32750, 31508, 8), - secondSqm = Position(32746, 31469, 8), - storageBarkless = Storage.CultsOfTibia.Barkless.Tar, - msgs = { - "As you enter the tar pits, you feel the heat around you rising dramatically. \z - Survive the heat long enough to prove worthy.", -- on enter - "Your body is heating up, the air around you is flickering.", -- 30/60 seconds - "The heat is now unbearable, the blood in your body feels like lava. \z - There's almost no strength left in you - act quickly!", -- 90 segunds - "Embrace the stigma of bad fortune. The tar does not feel so hot anymore. \z - You passed the tar trial.", -- step in the first tile - "Your body reacts to this strange green substance as you reach out to touch it. \z - You feel an urge for more of this energy.", -- step in the second tile - "The tar covering you has cooled down and tell off for the most part. \z - Your body is not heated up anymore.", -- there's no time to step - }, - }, - ["acid"] = { - itemId = 4406, - beginPos = Position(32693, 31478, 8), - fromPos = Position(32647, 31479, 8), - toPos = Position(32710, 31519, 8), - effect = CONST_ME_YELLOW_RINGS, - firstSqm = Position(32680, 31485, 8), - secondSqm = Position(32664, 31504, 8), - storageBarkless = Storage.CultsOfTibia.Barkless.sulphur, - msgs = { - "As you enter the sulphur pits, you feel the dry, burning vapours of the sulphur all around you. Prove worthy, survive the acid.", -- on enter - "The sulphur is burning your skin. You almost feel your body melting away in acid.", -- 30/60 segunds - "The acid burning is now unbearable, you skin feels like a sieve. \z - ]There's almost no strength left in you - act quickly!", -- 90 segunds - "Embrace the stigma of vanity. The sulphur does not burn your skin anymore. \z - You passed the trial.", -- step in the first tile - "You are now ready to prove your worth. \z - Take heart and cross the threshold of sulphur.", -- step in the second tile - "The acid covering you has cooled down and tell off for the most part. \z - Your body is not heated up anymore.", -- there's no time to step - }, - }, + ["fire"] = { + itemId = 1857, + beginPos = Position(32748, 31488, 8), + fromPos = Position(32737, 31489, 8), + toPos = Position(32761, 31512, 8), + effect = CONST_ME_HITBYFIRE, + firstTile = Position(32750, 31508, 8), + secondTile = Position(32746, 31469, 8), + storageBarkless = Storage.Quest.U11_40.CultsOfTibia.Barkless.Tar, + msgs = { + "As you enter the tar pits, you feel the heat around you rising dramatically. Survive the heat long enough to prove worthy.", -- on enter + "Your body is heating up, the air around you is flickering.", -- 30/60 seconds + "The heat is now unbearable, the blood in your body feels like lava. There's almost no strength left in you - act quickly!", -- 90 seconds + "Embrace the stigma of bad fortune. The tar does not feel so hot anymore. You passed the tar trial.", -- step on the first tile + "Your body reacts to this strange green substance as you reach out to touch it. You feel an urge for more of this energy.", -- step on the second tile + "The tar covering you has cooled down and fell off for the most part. Your body is not heated up anymore.", -- didn't step in time + }, + }, + ["acid"] = { + itemId = 4406, + beginPos = Position(32693, 31478, 8), + fromPos = Position(32647, 31479, 8), + toPos = Position(32710, 31519, 8), + effect = CONST_ME_YELLOW_RINGS, + firstTile = Position(32680, 31485, 8), + secondTile = Position(32664, 31504, 8), + storageBarkless = Storage.Quest.U11_40.CultsOfTibia.Barkless.Sulphur, + msgs = { + "As you enter the sulphur pits, you feel the dry, burning vapours of the sulphur all around you. Prove worthy, survive the acid.", -- on enter + "The sulphur is burning your skin. You almost feel your body melting away in acid.", -- 30/60 seconds + "The acid burning is now unbearable, your skin feels like a sieve. There's almost no strength left in you - act quickly!", -- 90 seconds + "Embrace the stigma of vanity. The sulphur does not burn your skin anymore. You passed the trial.", -- step on the first tile + "You are now ready to prove your worth. Take heart and cross the threshold of sulphur.", -- step on the second tile + "The acid covering you has cooled down and fell off for the most part. Your body is not heated up anymore.", -- didn't step in time + }, + }, } -function sendConditionCults(playerid, _type, fromPos, toPos, tempo) - local player = Player(playerid) - if not player or not player:getPosition():isInRange(fromPos, toPos) then - return false - end +local function sendConditionCults(playerId, _type, fromPos, toPos, time) + local player = Player(playerId) + if not player or not player:getPosition():isInRange(fromPos, toPos) then + return false + end - local inf = configQuest[_type] - tempo = tempo + 2 - if tempo == 30 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, inf.msgs[2]) - elseif tempo == 60 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, inf.msgs[2]) - elseif tempo >= 90 then - local stg = player:getStorageValue(inf.storageBarkless) < 0 and 0 or player:getStorageValue(inf.storageBarkless) - if stg < 3 and stg ~= 1 and stg ~= 2 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, inf.msgs[3]) - player:setStorageValue(inf.storageBarkless, 1) - end - end - player:getPosition():sendMagicEffect(inf.effect) - addEvent(sendConditionCults, 2000, playerid, _type, fromPos, toPos, tempo) + local info = configQuest[_type] + time = time + 2 + if time == 30 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[2]) + elseif time == 60 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[2]) + elseif time >= 90 then + local stage = player:getStorageValue(info.storageBarkless) < 0 and 0 or player:getStorageValue(info.storageBarkless) + if stage < 3 and stage ~= 1 and stage ~= 2 then + if _type == "acid" and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Tar) ~= 3 then + return true + end + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[3]) + player:setStorageValue(info.storageBarkless, 1) + if _type == "fire" then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.TarAccessDoor, 1) + elseif _type == "acid" then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.SulphurAccessDoor, 1) + end + end + end + player:getPosition():sendMagicEffect(info.effect) + addEvent(sendConditionCults, 2000, playerId, _type, fromPos, toPos, time) end -function passagemPiso1Piso2(playerid, info, tempo) - local player = Player(playerid) - if not player then - return true - end - local stg = player:getStorageValue(info.storageBarkless) < 0 and 0 or player:getStorageValue(info.storageBarkless) - if tempo == 0 and stg < 3 then - player:setStorageValue(info.storageBarkless, 0) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[6]) - return true - end - if stg == 3 then - return true - end - addEvent(passagemPiso1Piso2, 1000, playerid, info, tempo - 1) +function passageFloor1ToFloor2(playerId, info, time) + local player = Player(playerId) + if not player then + return true + end + local stage = player:getStorageValue(info.storageBarkless) < 0 and 0 or player:getStorageValue(info.storageBarkless) + if time == 0 and stage < 3 then + player:setStorageValue(info.storageBarkless, 0) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[6]) + return true + end + if stage == 3 then + return true + end + addEvent(passageFloor1ToFloor2, 1000, playerId, info, time - 1) end local tar = MoveEvent() function tar.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 - for index, value in pairs(configQuest) do - if item:getId() == value.itemId and fromPosition:compare(value.beginPos) then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, value.msgs[1]) - sendConditionCults(player:getId(), index, value.fromPos, value.toPos, 0) - return true - elseif position:compare(value.firstSqm) and player:getStorageValue(value.storageBarkless) == 1 then - if player:getStorageValue(value.storageBarkless) ~= 1 then - return true - end - player:setStorageValue(value.storageBarkless, 2) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, value.msgs[4]) - passagemPiso1Piso2(player:getId(), value, 60) - elseif position:compare(value.secondSqm) then - if player:getStorageValue(value.storageBarkless) == 2 then - player:setStorageValue(value.storageBarkless, 3) - if player:getStorageValue(Storage.CultsOfTibia.Barkless.sulphur) == 3 and player:getStorageValue(Storage.CultsOfTibia.Barkless.Tar) == 3 then - player:setStorageValue(Storage.CultsOfTibia.Barkless.Mission, 2) - end - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, value.msgs[5]) - end - end - end - return true + for index, value in pairs(configQuest) do + if item:getId() == value.itemId and fromPosition:compare(value.beginPos) then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, value.msgs[1]) + sendConditionCults(player:getId(), index, value.fromPos, value.toPos, 0) + return true + elseif position:compare(value.firstTile) and player:getStorageValue(value.storageBarkless) == 1 then + player:setStorageValue(value.storageBarkless, 2) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, value.msgs[4]) + passageFloor1ToFloor2(player:getId(), value, 60) + elseif position:compare(value.secondTile) then + if player:getStorageValue(value.storageBarkless) == 2 then + player:setStorageValue(value.storageBarkless, 3) + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Sulphur) == 3 and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Tar) == 3 then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Mission, 2) + end + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, value.msgs[5]) + end + end + end + return true end tar:type("stepin") @@ -126,34 +122,34 @@ tar:register() tar = MoveEvent() function tar.onStepOut(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 item:getActionId() == 5531 then - if fromPosition.x == 32736 then - player:getPosition():sendMagicEffect(CONST_ME_POFF) - if player:getStorageValue(Storage.CultsOfTibia.Barkless.Tar) < 3 then - player:teleportTo(Position(32737, 31451, 8), true) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are not ready yet.") - return false - end - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You traverse the tar unharmed.") - end - end - if item:getActionId() == 5530 then - if fromPosition.x == 32717 then - player:getPosition():sendMagicEffect(CONST_ME_POFF) - if player:getStorageValue(Storage.CultsOfTibia.Barkless.sulphur) < 3 then - player:teleportTo(Position(32718, 31444, 8), true) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are not ready yet.") - return false - end - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You traverse the sulphur unharmed.") - end - end - return true + if item:getActionId() == 5531 then + if fromPosition.x == 32736 then + player:getPosition():sendMagicEffect(CONST_ME_POFF) + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Tar) < 3 then + player:teleportTo(Position(32737, 31451, 8), true) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are not ready yet.") + return false + end + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You traverse the tar unharmed.") + end + end + if item:getActionId() == 5530 then + if fromPosition.x == 32717 then + player:getPosition():sendMagicEffect(CONST_ME_POFF) + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Sulphur) < 3 then + player:teleportTo(Position(32718, 31444, 8), true) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are not ready yet.") + return false + end + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You traverse the sulphur unharmed.") + end + end + return true end tar:type("stepout") diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_task_teleport.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_task_teleport.lua index acf48416449..3c254405b38 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_task_teleport.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_task_teleport.lua @@ -1,12 +1,12 @@ local setting = { [32415] = { - storage = Storage.CultsOfTibia.Humans.Decaying, + storage = Storage.Quest.U11_40.CultsOfTibia.Humans.Decaying, max = 10, text = "You absorb the energetic remains of this decaying soul. Its power is very fragile and fleeting", effect = CONST_ME_GREEN_ENERGY_SPARK, }, [32414] = { - storage = Storage.CultsOfTibia.Humans.Vaporized, + storage = Storage.Quest.U11_40.CultsOfTibia.Humans.Vaporized, max = 10, text = "You absorb the energetic remains of this whitering soul. Its power is very fragile and fleeting.", effect = CONST_ME_BLUE_ENERGY_SPARK, @@ -21,11 +21,11 @@ function taskTeleport.onStepIn(creature, item, position, fromPosition) return true end - if player:getStorageValue(Storage.CultsOfTibia.Questline) < 1 then - player:setStorageValue(Storage.CultsOfTibia.Questline, 1) + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Questline) < 1 then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Questline, 1) end - if player:getStorageValue(Storage.CultsOfTibia.Humans.Mission) < 1 then - player:setStorageValue(Storage.CultsOfTibia.Humans.Mission, 1) + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Humans.Mission) < 1 then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Humans.Mission, 1) end for index, value in pairs(setting) do diff --git a/data-otservbr-global/startup/tables/chest.lua b/data-otservbr-global/startup/tables/chest.lua index 09edd338516..cb965e616d5 100644 --- a/data-otservbr-global/startup/tables/chest.lua +++ b/data-otservbr-global/startup/tables/chest.lua @@ -2638,7 +2638,7 @@ ChestUnique = { weight = 4.00, questName = "PaintingOfAGirlQuest", }, - [6311] = { + [6312] = { useKV = true, itemId = 9253, itemPos = { x = 33026, y = 31662, z = 14 }, @@ -2646,6 +2646,15 @@ ChestUnique = { weight = 3.00, questName = "ImbuingCrystalQuest", }, + -- Cults of Tibia Quest + [6313] = { + useKV = true, + itemId = 2472, + itemPos = { x = 32739, y = 31426, z = 8 }, + reward = { { 10420, 5 } }, + weight = 8.00, + questName = "PetrifiedScreamQuest", + }, -- Reward of others scrips files (varied rewards) -- The First dragon Quest -- Treasure chests (data\scripts\actions\quests\first_dragon\treasure_chests.lua) diff --git a/data-otservbr-global/startup/tables/door_quest.lua b/data-otservbr-global/startup/tables/door_quest.lua index 3e5888b7399..a977a5523d6 100644 --- a/data-otservbr-global/startup/tables/door_quest.lua +++ b/data-otservbr-global/startup/tables/door_quest.lua @@ -203,57 +203,59 @@ QuestDoorAction = { itemPos = { { x = 32067, y = 31896, z = 3 } }, }, -- Cults of tibia door - [Storage.CultsOfTibia.Minotaurs.EntranceAccessDoor] = { + [Storage.Quest.U11_40.CultsOfTibia.Minotaurs.BossAccessDoor] = { itemId = false, - itemPos = { { x = 31950, y = 32501, z = 8 } }, + itemPos = { { x = 31957, y = 32468, z = 9 } }, }, - [Storage.CultsOfTibia.Minotaurs.AccessDoor] = { + [Storage.Quest.U11_40.CultsOfTibia.Minotaurs.AccessDoor] = { itemId = false, - itemPos = { { x = 31957, y = 32468, z = 9 } }, + itemPos = { { x = 31950, y = 32501, z = 8 } }, }, - [Storage.CultsOfTibia.MotA.AccessDoorInvestigation] = { + [Storage.Quest.U11_40.CultsOfTibia.MotA.AccessDoorInvestigation] = { itemId = false, itemPos = { { x = 33273, y = 32172, z = 8 } }, }, - [Storage.CultsOfTibia.MotA.AccessDoorGareth] = { + [Storage.Quest.U11_40.CultsOfTibia.MotA.AccessDoorGareth] = { itemId = false, itemPos = { { x = 33220, y = 32147, z = 9 } }, }, - [Storage.CultsOfTibia.MotA.AccessDoorDenominator] = { + [Storage.Quest.U11_40.CultsOfTibia.MotA.AccessDoorDenominator] = { itemId = false, itemPos = { { x = 33220, y = 32149, z = 9 } }, }, - [Storage.CultsOfTibia.Barkless.TrialAccessDoor] = { + [Storage.Quest.U11_40.CultsOfTibia.Barkless.TrialAccessDoor] = { itemId = false, itemPos = { { x = 32688, y = 31543, z = 9 } }, }, - [Storage.CultsOfTibia.Barkless.TarAccessDoor] = { + [Storage.Quest.U11_40.CultsOfTibia.Barkless.TarAccessDoor] = { itemId = false, - itemPos = { - { x = 32747, y = 31462, z = 8 }, - { x = 32678, y = 31506, z = 8 }, - }, + itemPos = { { x = 32747, y = 31462, z = 8 } }, + }, + [Storage.Quest.U11_40.CultsOfTibia.Barkless.SulphurAccessDoor] = { + itemId = false, + itemPos = { { x = 32678, y = 31506, z = 8 } }, }, - [Storage.CultsOfTibia.Barkless.AccessDoor] = { + [Storage.Quest.U11_40.CultsOfTibia.Barkless.AccessDoor] = { itemId = false, itemPos = { - { x = 32742, y = 31408, z = 8 }, { x = 32686, y = 31430, z = 8 }, + { x = 32746, y = 31423, z = 8 }, + { x = 32754, y = 31442, z = 8 }, }, }, - [Storage.CultsOfTibia.Barkless.BossAccessDoor] = { + [Storage.Quest.U11_40.CultsOfTibia.Barkless.BossAccessDoor] = { itemId = false, itemPos = { { x = 32672, y = 31543, z = 9 } }, }, - [Storage.CultsOfTibia.Life.AccessDoor] = { + [Storage.Quest.U11_40.CultsOfTibia.Life.AccessDoor] = { itemId = false, itemPos = { { x = 33295, y = 32271, z = 12 } }, }, - [Storage.CultsOfTibia.Misguided.AccessDoor] = { + [Storage.Quest.U11_40.CultsOfTibia.Misguided.AccessDoor] = { itemId = false, itemPos = { { x = 32508, y = 32370, z = 9 } }, }, - [Storage.CultsOfTibia.FinalBoss.AccessDoor] = { + [Storage.Quest.U11_40.CultsOfTibia.FinalBoss.AccessDoor] = { itemId = false, itemPos = { { x = 33452, y = 32241, z = 7 } }, }, diff --git a/data-otservbr-global/startup/tables/item.lua b/data-otservbr-global/startup/tables/item.lua index 080095b1cf6..9496f267a73 100644 --- a/data-otservbr-global/startup/tables/item.lua +++ b/data-otservbr-global/startup/tables/item.lua @@ -556,6 +556,113 @@ ItemAction = { { x = 32994, y = 32442, z = 11 }, }, }, + -- Cults of Tibia Quest + [5522] = { + itemId = 25687, + itemPos = { + { x = 33279, y = 32169, z = 8 }, + }, + }, + [5523] = { + itemId = 2471, + itemPos = { + { x = 33300, y = 32277, z = 12 }, + }, + }, + [5524] = { + itemId = 2930, + itemPos = { + { x = 32400, y = 31793, z = 8 }, + }, + }, + [5530] = { + itemId = false, + itemPos = { + { x = 32693, y = 31479, z = 8 }, + { x = 32680, y = 31485, z = 8 }, + }, + }, + [5531] = { + itemId = false, + itemPos = { + { x = 32748, y = 31489, z = 8 }, + { x = 32750, y = 31508, z = 8 }, + }, + }, + [5532] = { + itemId = false, + itemPos = { + { x = 32710, y = 31440, z = 8 }, + { x = 32709, y = 31440, z = 8 }, + { x = 32708, y = 31440, z = 8 }, + { x = 32698, y = 31405, z = 8 }, + }, + }, + [5533] = { + itemId = false, + itemPos = { + { x = 32683, y = 31412, z = 8 }, + { x = 32684, y = 31412, z = 8 }, + }, + }, + [5535] = { + itemId = false, + itemPos = { + { x = 32742, y = 31410, z = 8 }, + { x = 32685, y = 31430, z = 8 }, + { x = 32746, y = 31462, z = 8 }, + { x = 32731, y = 31531, z = 9 }, + { x = 32745, y = 31523, z = 9 }, + { x = 32761, y = 31518, z = 9 }, + { x = 32739, y = 31507, z = 9 }, + { x = 32739, y = 31489, z = 9 }, + { x = 32683, y = 31537, z = 9 }, + { x = 32720, y = 31545, z = 8 }, + }, + }, + [5536] = { + itemId = false, + itemPos = { + { x = 32740, y = 31494, z = 9 }, + { x = 32741, y = 31494, z = 9 }, + }, + }, + [5540] = { + itemId = 25761, + itemPos = { + { x = 33135, y = 31859, z = 10 }, + { x = 33136, y = 31859, z = 10 }, + { x = 33128, y = 31885, z = 11 }, + { x = 33129, y = 31885, z = 11 }, + { x = 33175, y = 31923, z = 12 }, + { x = 33176, y = 31923, z = 12 }, + { x = 33177, y = 31923, z = 12 }, + }, + }, + [5581] = { + itemId = 25726, + itemPos = { + { x = 32350, y = 31657, z = 8 }, + { x = 32351, y = 31657, z = 8 }, + { x = 32352, y = 31657, z = 8 }, + { x = 32353, y = 31657, z = 8 }, + { x = 32327, y = 31692, z = 9 }, + { x = 32328, y = 31692, z = 9 }, + { x = 32329, y = 31692, z = 9 }, + { x = 32528, y = 32468, z = 10 }, + { x = 32529, y = 32468, z = 10 }, + { x = 32530, y = 32468, z = 10 }, + { x = 32531, y = 32468, z = 10 }, + { x = 32532, y = 32468, z = 10 }, + { x = 32533, y = 32468, z = 10 }, + { x = 32534, y = 32468, z = 10 }, + { x = 32535, y = 32468, z = 10 }, + { x = 32536, y = 32468, z = 10 }, + { x = 32537, y = 32468, z = 10 }, + { x = 32538, y = 32468, z = 10 }, + { x = 32539, y = 32468, z = 10 }, + }, + }, -- In Service of Yalahar Quest [7812] = { itemId = 7804, diff --git a/data-otservbr-global/startup/tables/lever.lua b/data-otservbr-global/startup/tables/lever.lua index 56ab01b63b7..37e6a1b0544 100644 --- a/data-otservbr-global/startup/tables/lever.lua +++ b/data-otservbr-global/startup/tables/lever.lua @@ -15,6 +15,25 @@ LeverAction = { { x = 32972, y = 32412, z = 11 }, }, }, + -- Cults of Tibia Quest + [5500] = { + itemId = 8911, + itemPos = { + { x = 33095, y = 31942, z = 15 }, + }, + }, + [5501] = { + itemId = 8911, + itemPos = { + { x = 33138, y = 31952, z = 15 }, + }, + }, + [5520] = { + itemId = 9110, + itemPos = { + { x = 33299, y = 32144, z = 10 }, + }, + }, -- The Pits of Inferno Quest [7799] = { itemId = 431, diff --git a/data-otservbr-global/startup/tables/teleport.lua b/data-otservbr-global/startup/tables/teleport.lua index b7147fbbbd5..e6fee86f60f 100644 --- a/data-otservbr-global/startup/tables/teleport.lua +++ b/data-otservbr-global/startup/tables/teleport.lua @@ -9,6 +9,19 @@ TeleportAction = { { x = 32210, y = 32292, z = 6 }, }, }, + -- Cults of Tibia Quest + [5517] = { + itemId = 1949, + itemPos = { + { x = 33459, y = 32267, z = 10 }, + }, + }, + [5518] = { + itemId = 1949, + itemPos = { + { x = 33449, y = 32241, z = 7 }, + }, + }, -- Barbarian Test - Temple Citizen Svargrond [30032] = { itemId = 1949, diff --git a/data/modules/scripts/cults_of_tibia/death.lua b/data/modules/scripts/cults_of_tibia/death.lua index a9a855a9471..c27a9926171 100644 --- a/data/modules/scripts/cults_of_tibia/death.lua +++ b/data/modules/scripts/cults_of_tibia/death.lua @@ -1,8 +1,8 @@ function onRecvbyte(player, msg, byte) if IsRunningGlobalDatapack() and player then - local storageDeathFake = player:getStorageValue(Storage.CultsOfTibia.Barkless.Death) + local storageDeathFake = player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Death) if storageDeathFake == 1 then - player:setStorageValue(Storage.CultsOfTibia.Barkless.Death, 0) + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Death, 0) player:addHealth(player:getMaxHealth()) player:addMana(player:getMaxMana()) player:setHiddenHealth(false) From 527fe6ab49043672d2f5074fde66792ab13c5968 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 10 Oct 2024 20:26:53 +0000 Subject: [PATCH 15/70] Lua code format - (Stylua) --- data-otservbr-global/npc/gareth.lua | 9 +- data-otservbr-global/npc/gerimor.lua | 77 +- data-otservbr-global/npc/jamesfrancis.lua | 1 - .../cults_of_tibia/actions_bosses_levers.lua | 1106 ++++++++--------- .../cults_of_tibia/actions_document.lua | 2 +- .../cults_of_tibia/actions_lever_mota.lua | 12 +- .../cults_of_tibia/actions_misguided.lua | 9 +- .../quests/cults_of_tibia/actions_torch.lua | 4 +- ...creaturescripts_glowing_rubbish_amulet.lua | 66 +- .../cults_of_tibia/movements_begin_task.lua | 2 +- .../quests/cults_of_tibia/movements_ice.lua | 166 +-- .../quests/cults_of_tibia/movements_tar.lua | 256 ++-- .../startup/tables/door_quest.lua | 6 +- 13 files changed, 858 insertions(+), 858 deletions(-) diff --git a/data-otservbr-global/npc/gareth.lua b/data-otservbr-global/npc/gareth.lua index 6be3b8a579f..87524fab271 100644 --- a/data-otservbr-global/npc/gareth.lua +++ b/data-otservbr-global/npc/gareth.lua @@ -86,7 +86,7 @@ local function creatureSayCallback(npc, creature, type, message) if (player:getMoney() + player:getBankBalance()) >= value then npcHandler:say({ "This is a very wise decision. You won't regret it. Congratulations! As your first task I like you to investigate the crime scene of a theft wich occurred last night. ...", - "A very varuable artefact has been stolen. I open the door for you. You can find the room on the same floor as we are right now." + "A very varuable artefact has been stolen. I open the door for you. You can find the room on the same floor as we are right now.", }, npc, creature) player:removeMoneyBank(value) player:addItem(25689, 1) @@ -117,7 +117,7 @@ local function creatureSayCallback(npc, creature, type, message) elseif MsgContains(message, "mission") and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 11 then npcHandler:say({ "You're back, nice. Angelo's team hasn't found an artefact yet? I thought the progress would be faster. Anyway thanks for you efforts. ...", - "I have no work for you right now. If you like to, you can have a look at the last floor. I open the door for you." + "I have no work for you right now. If you like to, you can have a look at the last floor. I open the door for you.", }, npc, creature) player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, 12) player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.AccessDoorGareth, 1) @@ -152,7 +152,7 @@ local function creatureSayCallback(npc, creature, type, message) if MsgContains(message, "bone") and player:getStorageValue(Storage.TheSecretLibrary.Mota) == 2 then npcHandler:say({ "Hmm, interesting. Several years ago I have read some books dealing with strange locking mechanisms. I think what you have found here is a bone lever of category 3. ...", - "Normally this is not used because it is not secure. The production failed and the lever can always be activated as follows: back, back, up, right, left. Just have a try, it should work." + "Normally this is not used because it is not secure. The production failed and the lever can always be activated as follows: back, back, up, right, left. Just have a try, it should work.", }, npc, creature) player:setStorageValue(Storage.TheSecretLibrary.Mota, 3) npcHandler:setTopic(playerId, 14) @@ -161,7 +161,8 @@ local function creatureSayCallback(npc, creature, type, message) if MsgContains(message, "extension") and player:getStorageValue(Storage.TheSecretLibrary.Mota) == 11 then npcHandler:say({ "You have found an inscription I would like to translate for you. The tibianus cipher was used: ...", - "Those who are accorded the honour to visit this exclusive place will smash their blindness and face the truth. ...", "Astonishingly, Dedoras from Cormaya has recently asked me for these kinds of inscriptions. For sure he is able to bring light into the darkness. You should visit him. " + "Those who are accorded the honour to visit this exclusive place will smash their blindness and face the truth. ...", + "Astonishingly, Dedoras from Cormaya has recently asked me for these kinds of inscriptions. For sure he is able to bring light into the darkness. You should visit him. ", }, npc, creature) player:setStorageValue(Storage.TheSecretLibrary.Mota, 12) player:setStorageValue(Storage.TheSecretLibrary.TheLament, 1) diff --git a/data-otservbr-global/npc/gerimor.lua b/data-otservbr-global/npc/gerimor.lua index 495ef3d84bf..0e8b0c0988d 100644 --- a/data-otservbr-global/npc/gerimor.lua +++ b/data-otservbr-global/npc/gerimor.lua @@ -272,7 +272,7 @@ local config = { }, completeText = { "Thanks a lot. As I already supposed the museum is just a disguise. ...", - "You found out the true meaning. As you have described their cult object the AM on the floor might stand for \"Aurea Manus\". Here is your reward for your effort.", + 'You found out the true meaning. As you have described their cult object the AM on the floor might stand for "Aurea Manus". Here is your reward for your effort.', }, storage = Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, value = 14, @@ -357,21 +357,22 @@ local function creatureSayCallback(npc, creature, type, message) if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.FinalBoss.Mission) > 2 then npcHandler:say("You have already fulfilled your job to my full satisfaction. The cults are investigated and the final boss is eliminated. I have nothing more for you to do. Fare you well!", npc, creature) npcHandler:setTopic(playerId, 0) - elseif player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Minotaurs.Mission) == 6 - and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission) == 10 - and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 15 - and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Mission) == 7 - and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Mission) == 5 - and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Orcs.Mission) == 3 - and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Humans.Mission) == 3 - and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.FinalBoss.Mission) < 2 - then - npcHandler:say({ - "Your actions have weakened the worldly anchors of the enemy and unveiled the source they use to strengthen their cults. ...", - "Our circle has used this opportunity to breach their protective shroud and aim a teleporter to this source. I would like to ask you to use it, to travel to this source and destroy it. ...", - "But be warned, you will need a group twice as great compared to those with which you defeated the cults. Go now, with my blessings.", - }, npc, creature) - npcHandler:setTopic(playerId, 0) + elseif + player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Minotaurs.Mission) == 6 + and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Life.Mission) == 10 + and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) == 15 + and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Mission) == 7 + and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Mission) == 5 + and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Orcs.Mission) == 3 + and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Humans.Mission) == 3 + and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.FinalBoss.Mission) < 2 + then + npcHandler:say({ + "Your actions have weakened the worldly anchors of the enemy and unveiled the source they use to strengthen their cults. ...", + "Our circle has used this opportunity to breach their protective shroud and aim a teleporter to this source. I would like to ask you to use it, to travel to this source and destroy it. ...", + "But be warned, you will need a group twice as great compared to those with which you defeated the cults. Go now, with my blessings.", + }, npc, creature) + npcHandler:setTopic(playerId, 0) if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.FinalBoss.Mission) < 1 then player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.FinalBoss.Mission, 1) player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.FinalBoss.AccessDoor, 1) @@ -418,29 +419,29 @@ local function creatureSayCallback(npc, creature, type, message) npcHandler:setTopic(playerId, 2) end elseif npcHandler:getTopic(playerId) == 4 then - local vocationRewards = { - [VOCATION.BASE_ID.SORCERER] = {itemId = 26190, itemName = "reflecting crown"}, - [VOCATION.BASE_ID.DRUID] = {itemId = 26187, itemName = "leaf crown"}, - [VOCATION.BASE_ID.PALADIN] = {itemId = 26189, itemName = "incandescent crown"}, - [VOCATION.BASE_ID.KNIGHT] = {itemId = 26188, itemName = "iron crown"} - } - local vocationId = player:getVocation():getBaseId() - local reward = vocationRewards[vocationId] - local item = "" - if reward then - player:addItem(reward.itemId) - item = reward.itemName - end - player:addExperience(50000) - player:addItem(26186) - player:addAchievement("Corruption Contained") - player:sendTextMessage(MESSAGE_EXPERIENCE, "You gained 50000 experience points.") - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You gained a mystery box.") - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You gained a " .. item .. ".") - player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.FinalBoss.Mission, 3) - npcHandler:say("Here's your reward. Thank you and farewell!", npc, creature) - npcHandler:setTopic(playerId, 0) + local vocationRewards = { + [VOCATION.BASE_ID.SORCERER] = { itemId = 26190, itemName = "reflecting crown" }, + [VOCATION.BASE_ID.DRUID] = { itemId = 26187, itemName = "leaf crown" }, + [VOCATION.BASE_ID.PALADIN] = { itemId = 26189, itemName = "incandescent crown" }, + [VOCATION.BASE_ID.KNIGHT] = { itemId = 26188, itemName = "iron crown" }, + } + local vocationId = player:getVocation():getBaseId() + local reward = vocationRewards[vocationId] + local item = "" + if reward then + player:addItem(reward.itemId) + item = reward.itemName end + player:addExperience(50000) + player:addItem(26186) + player:addAchievement("Corruption Contained") + player:sendTextMessage(MESSAGE_EXPERIENCE, "You gained 50000 experience points.") + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You gained a mystery box.") + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You gained a " .. item .. ".") + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.FinalBoss.Mission, 3) + npcHandler:say("Here's your reward. Thank you and farewell!", npc, creature) + npcHandler:setTopic(playerId, 0) + end elseif MsgContains(message, "no") then npcHandler:say("What a pitty! You can come back, when ever you want, if you have changed your opinion.", npc, creature) npcHandler:setTopic(playerId, 0) diff --git a/data-otservbr-global/npc/jamesfrancis.lua b/data-otservbr-global/npc/jamesfrancis.lua index d5689f6c8d4..bddde257b8b 100644 --- a/data-otservbr-global/npc/jamesfrancis.lua +++ b/data-otservbr-global/npc/jamesfrancis.lua @@ -29,7 +29,6 @@ npcConfig.voices = { { text = "Don't enter this area if you are an inexperienced fighter! It would be your end!" }, } - local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_bosses_levers.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_bosses_levers.lua index 265d221feac..cf30097533c 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_bosses_levers.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_bosses_levers.lua @@ -1,159 +1,159 @@ local transformid = { - [8911] = 8912, - [8912] = 8911, + [8911] = 8912, + [8912] = 8911, } local geyser = { - [1] = Position(33132, 31917, 15), - [2] = Position(33135, 31919, 15), - [3] = Position(33135, 31923, 15), - [4] = Position(33128, 31922, 15), - [5] = Position(33128, 31918, 15), - [6] = Position(33124, 31920, 15), - [7] = Position(33124, 31925, 15), - [8] = Position(33131, 31927, 15), - [9] = Position(33135, 31926, 15), - [10] = Position(33128, 31929, 15), - [11] = Position(33133, 31930, 15), - [12] = Position(33127, 31933, 15), + [1] = Position(33132, 31917, 15), + [2] = Position(33135, 31919, 15), + [3] = Position(33135, 31923, 15), + [4] = Position(33128, 31922, 15), + [5] = Position(33128, 31918, 15), + [6] = Position(33124, 31920, 15), + [7] = Position(33124, 31925, 15), + [8] = Position(33131, 31927, 15), + [9] = Position(33135, 31926, 15), + [10] = Position(33128, 31929, 15), + [11] = Position(33133, 31930, 15), + [12] = Position(33127, 31933, 15), } local function spawnStolenSoul(t_time) - if t_time == 0 then - local a1 = Position(33034, 31916, 15) - local a2 = Position(33048, 31927, 15) - if not isPlayerInArea(a1, a2) then - return true - end - local newArea = Position(math.random(a1.x, a2.x), math.random(a1.y, a2.y), math.random(a1.z, a2.z)) - Game.createMonster(math.random(1, 2) == 1 and "Stolen Soul" or "Soul Reaper", newArea) - t_time = 31 - end - addEvent(spawnStolenSoul, 1000, t_time - 1) + if t_time == 0 then + local a1 = Position(33034, 31916, 15) + local a2 = Position(33048, 31927, 15) + if not isPlayerInArea(a1, a2) then + return true + end + local newArea = Position(math.random(a1.x, a2.x), math.random(a1.y, a2.y), math.random(a1.z, a2.z)) + Game.createMonster(math.random(1, 2) == 1 and "Stolen Soul" or "Soul Reaper", newArea) + t_time = 31 + end + addEvent(spawnStolenSoul, 1000, t_time - 1) end local function spawnDarkSoul(area, t_time) - if t_time == 0 then - local waitingForPlayer = false - local p1 = Position(33023, 31904, 14) - local p2 = Position(33037, 31915, 14) - local sA1 = Position(33028, 31908, 14) - local sA2 = Position(33036, 31914, 14) - if area == 2 then - p1 = Position(33039, 31902, 14) - p2 = Position(33052, 31916, 14) - sA1 = Position(33042, 31908, 14) - sA2 = Position(33051, 31914, 14) - end - if not isPlayerInArea(p1, p2) then - local a1 = Position(33034, 31916, 15) - local a2 = Position(33048, 31927, 15) - if not isPlayerInArea(a1, a2) then - return true - end - waitingForPlayer = true - else - local monsters = {} - for _x = sA1.x, sA2.x, 1 do - for _y = sA1.y, sA2.y, 1 do - local tileMonster = Tile(Position(_x, _y, sA1.z)):getTopCreature() - if tileMonster and tileMonster:isMonster() and tileMonster:getName() == "Dark Soul" then - monsters[#monsters + 1] = tileMonster - end - end - end - if #monsters >= 4 then - for _, pid in pairs(monsters) do - pid:remove() - end - end - local newPos = Position(math.random(sA1.x, sA2.x), math.random(sA1.y, sA2.y), math.random(sA1.z, sA2.z)) - Game.createMonster("Dark Soul", newPos) - end - addEvent(spawnDarkSoul, 1000, area, (waitingForPlayer and 1 or 30)) - else - addEvent(spawnDarkSoul, 1000, area, t_time - 1) - end + if t_time == 0 then + local waitingForPlayer = false + local p1 = Position(33023, 31904, 14) + local p2 = Position(33037, 31915, 14) + local sA1 = Position(33028, 31908, 14) + local sA2 = Position(33036, 31914, 14) + if area == 2 then + p1 = Position(33039, 31902, 14) + p2 = Position(33052, 31916, 14) + sA1 = Position(33042, 31908, 14) + sA2 = Position(33051, 31914, 14) + end + if not isPlayerInArea(p1, p2) then + local a1 = Position(33034, 31916, 15) + local a2 = Position(33048, 31927, 15) + if not isPlayerInArea(a1, a2) then + return true + end + waitingForPlayer = true + else + local monsters = {} + for _x = sA1.x, sA2.x, 1 do + for _y = sA1.y, sA2.y, 1 do + local tileMonster = Tile(Position(_x, _y, sA1.z)):getTopCreature() + if tileMonster and tileMonster:isMonster() and tileMonster:getName() == "Dark Soul" then + monsters[#monsters + 1] = tileMonster + end + end + end + if #monsters >= 4 then + for _, pid in pairs(monsters) do + pid:remove() + end + end + local newPos = Position(math.random(sA1.x, sA2.x), math.random(sA1.y, sA2.y), math.random(sA1.z, sA2.z)) + Game.createMonster("Dark Soul", newPos) + end + addEvent(spawnDarkSoul, 1000, area, (waitingForPlayer and 1 or 30)) + else + addEvent(spawnDarkSoul, 1000, area, t_time - 1) + end end local function transformMonster(itid, action, monster, frompos, topos, _temp) - if action == 1 then - local delay = _temp - for _x = frompos.x, topos.x, 1 do - local tile = Tile(Position(_x, frompos.y, frompos.z)) - if _x % 2 == 0 then - delay = delay + 1 - if tile then - if tile:getItemCountById(itid) < 1 then - Game.createItem(itid, 1, Position(_x, frompos.y, frompos.z)) - end - addEvent(transformMonster, delay * 15000, itid, 2, monster, Position(_x, frompos.y, frompos.z), {}, _temp + 1) - end - end - end - elseif action == 2 then - local tile = Tile(frompos) - if tile:getItemCountById(itid) > 0 then - tile:getItemById(itid):remove() - end - Game.createMonster(monster, frompos) - elseif action == 3 then - local pos = Position(33158, 31912, 15) - local pos2 = Position(33169, 31919, 15) - Game.createMonster(monster, { x = math.random(pos.x, pos2.x), y = math.random(pos.y, pos2.y), z = pos2.z }) - if _temp < itid then - _temp = _temp + 1 - addEvent(transformMonster, 15000, itid, 3, "Sphere Of Wrath", {}, {}, _temp) - end - end + if action == 1 then + local delay = _temp + for _x = frompos.x, topos.x, 1 do + local tile = Tile(Position(_x, frompos.y, frompos.z)) + if _x % 2 == 0 then + delay = delay + 1 + if tile then + if tile:getItemCountById(itid) < 1 then + Game.createItem(itid, 1, Position(_x, frompos.y, frompos.z)) + end + addEvent(transformMonster, delay * 15000, itid, 2, monster, Position(_x, frompos.y, frompos.z), {}, _temp + 1) + end + end + end + elseif action == 2 then + local tile = Tile(frompos) + if tile:getItemCountById(itid) > 0 then + tile:getItemById(itid):remove() + end + Game.createMonster(monster, frompos) + elseif action == 3 then + local pos = Position(33158, 31912, 15) + local pos2 = Position(33169, 31919, 15) + Game.createMonster(monster, { x = math.random(pos.x, pos2.x), y = math.random(pos.y, pos2.y), z = pos2.z }) + if _temp < itid then + _temp = _temp + 1 + addEvent(transformMonster, 15000, itid, 3, "Sphere Of Wrath", {}, {}, _temp) + end + end end local function activateGeyser(player) - local frompos = Position(33119, 31913, 15) - local topos = Position(33142, 31936, 15) - if isPlayerInArea(frompos, topos) then - addEvent(function() - local rand = math.random(1, 12) - local geyserPos = Position(geyser[rand]) - local check1 = Tile(Position(geyserPos)):getItemById(25509) - if check1 then - addEvent(function() - local player1 = Game.getPlayers()[1] - Game.createItem(25510, 1, geyserPos) - player1:say("SPLASH!", TALKTYPE_MONSTER_SAY, false, false, geyserPos) - addEvent(function() - local check2 = Tile(Position(geyserPos)):getItemById(25510) - if check2 then - check2:remove() - end - end, 9 * 1000) - end, 5 * 1000) - elseif check2 then - return false - end - addEvent(function() - activateGeyser() - end, 1 * 1000) - end, 8 * 1000) - end - return true + local frompos = Position(33119, 31913, 15) + local topos = Position(33142, 31936, 15) + if isPlayerInArea(frompos, topos) then + addEvent(function() + local rand = math.random(1, 12) + local geyserPos = Position(geyser[rand]) + local check1 = Tile(Position(geyserPos)):getItemById(25509) + if check1 then + addEvent(function() + local player1 = Game.getPlayers()[1] + Game.createItem(25510, 1, geyserPos) + player1:say("SPLASH!", TALKTYPE_MONSTER_SAY, false, false, geyserPos) + addEvent(function() + local check2 = Tile(Position(geyserPos)):getItemById(25510) + if check2 then + check2:remove() + end + end, 9 * 1000) + end, 5 * 1000) + elseif check2 then + return false + end + addEvent(function() + activateGeyser() + end, 1 * 1000) + end, 8 * 1000) + end + return true end local cultsOfTibiaLevers = Action() function cultsOfTibiaLevers.onUse(player, item, fromPosition, itemEx, toPosition) - local players = {} - local ittable = {} - local blockmonsters = { "Leiden", "Wine Cask", "Liquor Spirit", "Ravenous Hunger" } - local convertTable = {} - item:transform(transformid[item:getId()]) - - if item:getActionId() == 5501 and item:getId() == 8912 then - if player:getPosition() == Position(33138, 31953, 15) then + local players = {} + local ittable = {} + local blockmonsters = { "Leiden", "Wine Cask", "Liquor Spirit", "Ravenous Hunger" } + local convertTable = {} + item:transform(transformid[item:getId()]) + + if item:getActionId() == 5501 and item:getId() == 8912 then + if player:getPosition() == Position(33138, 31953, 15) then local teleport = 0 local playersInArea = {} - local frompos = Position(33151, 31942, 15) - local topos = Position(33176, 31966, 15) + local frompos = Position(33151, 31942, 15) + local topos = Position(33176, 31966, 15) for i = 31953, 31957 do local newpos = Position(33138, i, 15) @@ -169,426 +169,426 @@ function cultsOfTibiaLevers.onUse(player, item, fromPosition, itemEx, toPosition return true end - if isPlayerInArea(frompos, topos) then - player:sendCancelMessage("The room is full.") - return true - end - - for _x = frompos.x, topos.x, 1 do - for _y = frompos.y, topos.y, 1 do - for _z = frompos.z, topos.z, 1 do - local tile = Tile(Position(_x, _y, _z)) - if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then - tile:getTopCreature():remove() - end - end - end - end - - for _, nplayer in ipairs(playersInArea) do - nplayer:setBossCooldown("Ravenous Hunger", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) - nplayer:teleportTo(Position(33161, 31959, 15), true) - nplayer:sendBosstiaryCooldownTimer() - convertTable[#convertTable + 1] = nplayer:getId() - nplayer:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - - Game.createMonster("Wine Cask", Position(33162, 31945, 15)) - local leiden = Game.createMonster("Leiden", Position(33162, 31950, 15)) - leiden:setHealth(leiden:getHealth() / 2) - kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33121, 31951, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) - end - end - - if item:getActionId() == 5502 and item:getId() == 8912 then - if player:getPosition() == Position(33162, 31893, 15) then - local teleport = 0 - local playersInArea = {} - local frompos = Position(33152, 31908, 15) - local topos = Position(33175, 31923, 15) - - for i = 31893, 31897 do - local newpos = Position(33162, i, 15) - local nplayer = Tile(newpos):getTopCreature() - if nplayer and nplayer:isPlayer() then - teleport = teleport + 1 - table.insert(playersInArea, nplayer) - end - end - - if teleport ~= 5 then - player:sendCancelMessage("You need exactly 5 players to start this challenge.") - return true - end - - if isPlayerInArea(frompos, topos) then - player:sendCancelMessage("The room is full.") - return true - end - - for _x = frompos.x, topos.x, 1 do - for _y = frompos.y, topos.y, 1 do - for _z = frompos.z, topos.z, 1 do - local tile = Tile(Position(_x, _y, _z)) - if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then - tile:getTopCreature():remove() - end - end - end - end - - for _, nplayer in ipairs(playersInArea) do - nplayer:setBossCooldown("The False God", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) - nplayer:teleportTo(Position(33169, 31915, 15), true) - convertTable[#convertTable + 1] = nplayer:getId() - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - - transformMonster(25300, 1, "minotaur idol", Position(33157, 31910, 15), Position(33168, 31910, 15), 0) - transformMonster(25300, 1, "minotaur idol", Position(33158, 31921, 15), Position(33168, 31921, 15), 6) - addEvent(transformMonster, 13 * 15000, 3, 3, "Sphere Of Wrath", {}, {}, 0) - Game.createMonster("The False God", Position(33159, 31914, 15)) - kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33181, 31894, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) - end - end - - if item:getActionId() == 5500 then - if player:getPosition() == Position(33095, 31943, 15) and item:getId() == 8912 then - local teleport = 0 - local playersInArea = {} - local frompos = Position(33084, 31907, 15) - local topos = Position(33114, 31933, 15) - - for i = 31943, 31947 do - local newpos = Position(33095, i, 15) - local nplayer = Tile(newpos):getTopCreature() - if nplayer and nplayer:isPlayer() then - teleport = teleport + 1 - table.insert(playersInArea, nplayer) - end - end - - if teleport ~= 1 then - player:sendCancelMessage("You need exactly 5 players to start this challenge.") - return true - end - - if isPlayerInArea(frompos, topos) then - player:sendCancelMessage("It looks like there is someone inside.") - return true - end - - for _x = frompos.x, topos.x, 1 do - for _y = frompos.y, topos.y, 1 do - for _z = frompos.z, topos.z, 1 do - local tile = Tile(Position(_x, _y, _z)) - if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then - tile:getTopCreature():remove() - end - end - end - end - - for _, nplayer in ipairs(playersInArea) do - nplayer:setBossCooldown("Essence of Malice", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) - nplayer:teleportTo(Position(33098, 31921, 15), true) - convertTable[#convertTable + 1] = nplayer:getId() - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - - kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33091, 31963, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) - Game.createMonster("Pillar of Summoning", Position(33093, 31919, 15)) - Game.createMonster("Pillar of Death", Position(33098, 31915, 15)) - Game.createMonster("Pillar of Protection", Position(33103, 31919, 15)) - Game.createMonster("Pillar of Healing", Position(33101, 31925, 15)) - Game.createMonster("Pillar of Draining", Position(33095, 31925, 15)) - Game.createMonster("Dorokoll The Mystic STOP", Position(33095, 31924, 15)):registerEvent("HealthPillar") - Game.createMonster("Eshtaba The Conjurer STOP", Position(33094, 31919, 15)):registerEvent("HealthPillar") - Game.createMonster("Eliz The Unyielding STOP", Position(33102, 31919, 15)):registerEvent("HealthPillar") - Game.createMonster("Mezlon The Defiler STOP", Position(33101, 31924, 15)):registerEvent("HealthPillar") - Game.createMonster("Malkhar Deathbringer STOP", Position(33098, 31916, 15)):registerEvent("HealthPillar") - end - end - - if item:getActionId() == 5503 then - if player:getPosition() == Position(33127, 31892, 15) and item:getId() == 8912 then - local teleport = 0 - local playersInArea = {} - local frompos = Position(33119, 31913, 15) - local topos = Position(33142, 31936, 15) - - for i = 31892, 31896 do - local newpos = Position(33127, i, 15) - local nplayer = Tile(newpos):getTopCreature() - if nplayer and nplayer:isPlayer() then - teleport = teleport + 1 - table.insert(playersInArea, nplayer) - end - end - - if teleport ~= 5 then - player:sendCancelMessage("You need exactly 5 players to start this challenge.") - return true - end - - if isPlayerInArea(frompos, topos) then - player:sendCancelMessage("It looks like there is someone inside.") - return true - end - - for _x = frompos.x, topos.x, 1 do - for _y = frompos.y, topos.y, 1 do - for _z = frompos.z, topos.z, 1 do - local tile = Tile(Position(_x, _y, _z)) - if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then - tile:getTopCreature():remove() - end - end - end - end - - for _, nplayer in ipairs(playersInArea) do - nplayer:setBossCooldown("The Souldespoiler", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) - nplayer:teleportTo(Position(33130, 31919, 15), true) - convertTable[#convertTable + 1] = nplayer:getId() - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - - kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33109, 31887, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) - Game.createMonster("The Sinister Hermit Dirty", Position(33131, 31925, 15)) - activateGeyser() - end - end - - if item:getActionId() == 5504 then - if player:getPosition() == Position(33164, 31859, 15) and item:getId() == 8912 then - local teleport = 0 - local playersInArea = {} - local frompos = Position(33123, 31846, 15) - local topos = Position(33149, 31871, 15) - - for y = 31859, 31863 do - local newpos = Position(33164, y, 15) - local nplayer = Tile(newpos):getTopCreature() - if nplayer and nplayer:isPlayer() then - teleport = teleport + 1 - table.insert(playersInArea, nplayer) - end - end - - if teleport ~= 5 then - player:sendCancelMessage("You need exactly 5 players to start this challenge.") - return true - end - - if isPlayerInArea(frompos, topos) then - player:sendCancelMessage("It looks like there is someone inside.") - return true - end - - for _x = frompos.x, topos.x, 1 do - for _y = frompos.y, topos.y, 1 do - for _z = frompos.z, topos.z, 1 do - local tile = Tile(Position(_x, _y, _z)) - if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then - tile:getTopCreature():remove() - end - end - end - end - - for _, nplayer in ipairs(playersInArea) do - nplayer:setBossCooldown("The Armored Voidborn", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) - nplayer:teleportTo(Position(33137, 31867, 15), true) - convertTable[#convertTable + 1] = nplayer:getId() - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - - local function createBeam1(fromPos, toPos, id, dir) - if dir == 1 then - for _x = fromPos.x, toPos.x, 1 do - local tile = Tile(Position(_x, fromPos.y, fromPos.z)) - if tile and tile:getItemCountById(id) == 0 then - Game.createItem(id, 1, Position(_x, fromPos.y, fromPos.z)) - end - end - elseif dir == 2 then - for _y = fromPos.y, toPos.y, 1 do - local tile = Tile(Position(fromPos.x, _y, fromPos.z)) - if tile and tile:getItemCountById(id) == 0 then - Game.createItem(id, 1, Position(fromPos.x, _y, fromPos.z)) - end - end - end - end - - local itemsToMonster = { - Position(33133, 31856, 15), - Position(33140, 31856, 15), - Position(33140, 31863, 15), - Position(33133, 31863, 15), - } - - for _, position in pairs(itemsToMonster) do - local tile = Tile(position) - if tile and tile:getItemCountById(7805) < 1 then - Game.createItem(7805, 1, position) - end - end - - createBeam1(Position(33134, 31856, 15), Position(33139, 31856, 15), 6116, 1) - createBeam1(Position(33134, 31863, 15), Position(33139, 31863, 15), 6116, 1) - createBeam1(Position(33140, 31857, 15), Position(33140, 31862, 15), 6117, 2) - createBeam1(Position(33133, 31857, 15), Position(33133, 31862, 15), 6117, 2) - - Game.createMonster("Security Golem", Position(33131, 31855, 15)) - Game.createMonster("Security Golem", Position(33142, 31855, 15)) - Game.createMonster("Security Golem", Position(33141, 31863, 15)) - Game.createMonster("Security Golem", Position(33132, 31863, 15)) - - Game.createMonster("Containment Machine", Position(33133, 31864, 15)):registerEvent("MachineDeath") - Game.createMonster("The Armored Voidborn", Position(33135, 31859, 15)):registerEvent("MachineDeath") - kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33179, 31840, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) - end - end - - if item:getActionId() == 5505 then - if player:getPosition() == Position(33507, 32228, 10) and item:getId() == 8912 then - local teleport = 0 - local teleport = 0 - local playersInArea = {} - local frompos = Position(33087, 31848, 15) - local topos = Position(33109, 31871, 15) - - for _y = 32228, 32232 do - local newpos = Position(33507, _y, 10) - local nplayer = Tile(newpos):getTopCreature() - if nplayer and nplayer:isPlayer() then - teleport = teleport + 1 - table.insert(playersInArea, nplayer) - end - end - - if teleport ~= 5 then - player:sendCancelMessage("You need exactly 5 players to start this challenge.") - return true - end - - if isPlayerInArea(frompos, topos) then - player:sendCancelMessage("It looks like there is someone inside.") - return true - end - - for _x = frompos.x, topos.x, 1 do - for _y = frompos.y, topos.y, 1 do - for _z = frompos.z, topos.z, 1 do - local tile = Tile(Position(_x, _y, _z)) - if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then - tile:getTopCreature():remove() - end - if tile then - local tileItems = tile:getItems() - if type(tileItems) == "table" and #tileItems > 0 then - for _, it in pairs(tileItems) do - if ItemType(it:getId()):isCorpse() then - it:remove() - end - end - end - end - end - end - end - - for _, nplayer in ipairs(playersInArea) do - nplayer:setBossCooldown("The Sandking", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) - nplayer:teleportTo(Position(33099, 31864, 15), true) - convertTable[#convertTable + 1] = nplayer:getId() - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - - Game.createMonster("the sandking fake", Position(33099, 31858, 15)):registerEvent("SandkingThink") - Game.setStorageValue("sandking", 1) - kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33459, 32269, 10), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) - end - end - - if item:getActionId() == 5506 then - if player:getPosition() == Position(33074, 31884, 15) and item:getId() == 8912 then - local teleport = 0 - local playersInArea = {} - local frompos = Position(33023, 31904, 14) - local topos = Position(33052, 31932, 15) - - if player:getPosition() == Position(33074, 31884, 15) then - teleport = teleport + 1 - table.insert(playersInArea, player) - else - return true - end - - local pt1 = Position(33073, 31885, 15) - local pt2 = Position(33075, 31887, 15) - for _x = pt1.x, pt2.x do - for _y = pt1.y, pt2.y do - local nplayer = Tile(Position(_x, _y, 15)):getTopCreature() - if nplayer and nplayer:isPlayer() then - teleport = teleport + 1 - table.insert(playersInArea, nplayer) - end - end - end - - if teleport ~= 10 then - player:sendCancelMessage("You need exactly 10 players to start this challenge.") - return true - end - - if isPlayerInArea(frompos, topos) then - player:sendCancelMessage("It looks like there is someone inside.") - return true - end - - 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 and tile:getTopCreature() and tile:getTopCreature():isMonster() then - tile:getTopCreature():remove() - end - if tile then - local tileItems = tile:getItems() - if type(tileItems) == "table" and #tileItems > 0 then - for _, it in pairs(tileItems) do - if ItemType(it:getId()):isCorpse() then - it:remove() - end - end - end - end - end - end - end - - for _, nplayer in ipairs(playersInArea) do - nplayer:setBossCooldown("The Source Of Corruption", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) - nplayer:teleportTo(Position(33039, 31925, 15), true) - nplayer:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - - Game.createMonster("The Remorseless Corruptor", Position(33039, 31922, 15)) - Game.createMonster("Zarcorix Of Yalahar", Position(33039, 31921, 15)):registerEvent("YalahariHealth") - Game.createMonster("Stolen Soul", Position(33039, 31920, 15)) - Game.createMonster("Soul Reaper", Position(33039, 31919, 15)) - spawnDarkSoul(1, 30) - spawnDarkSoul(2, 30) - spawnStolenSoul(30) - - kickerPlayerRoomAfterMin(playersInArea, frompos, topos, Position(33072, 31867, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) - end - end - - return true + if isPlayerInArea(frompos, topos) then + player:sendCancelMessage("The room is full.") + return true + end + + for _x = frompos.x, topos.x, 1 do + for _y = frompos.y, topos.y, 1 do + for _z = frompos.z, topos.z, 1 do + local tile = Tile(Position(_x, _y, _z)) + if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then + tile:getTopCreature():remove() + end + end + end + end + + for _, nplayer in ipairs(playersInArea) do + nplayer:setBossCooldown("Ravenous Hunger", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) + nplayer:teleportTo(Position(33161, 31959, 15), true) + nplayer:sendBosstiaryCooldownTimer() + convertTable[#convertTable + 1] = nplayer:getId() + nplayer:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + + Game.createMonster("Wine Cask", Position(33162, 31945, 15)) + local leiden = Game.createMonster("Leiden", Position(33162, 31950, 15)) + leiden:setHealth(leiden:getHealth() / 2) + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33121, 31951, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + end + end + + if item:getActionId() == 5502 and item:getId() == 8912 then + if player:getPosition() == Position(33162, 31893, 15) then + local teleport = 0 + local playersInArea = {} + local frompos = Position(33152, 31908, 15) + local topos = Position(33175, 31923, 15) + + for i = 31893, 31897 do + local newpos = Position(33162, i, 15) + local nplayer = Tile(newpos):getTopCreature() + if nplayer and nplayer:isPlayer() then + teleport = teleport + 1 + table.insert(playersInArea, nplayer) + end + end + + if teleport ~= 5 then + player:sendCancelMessage("You need exactly 5 players to start this challenge.") + return true + end + + if isPlayerInArea(frompos, topos) then + player:sendCancelMessage("The room is full.") + return true + end + + for _x = frompos.x, topos.x, 1 do + for _y = frompos.y, topos.y, 1 do + for _z = frompos.z, topos.z, 1 do + local tile = Tile(Position(_x, _y, _z)) + if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then + tile:getTopCreature():remove() + end + end + end + end + + for _, nplayer in ipairs(playersInArea) do + nplayer:setBossCooldown("The False God", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) + nplayer:teleportTo(Position(33169, 31915, 15), true) + convertTable[#convertTable + 1] = nplayer:getId() + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + + transformMonster(25300, 1, "minotaur idol", Position(33157, 31910, 15), Position(33168, 31910, 15), 0) + transformMonster(25300, 1, "minotaur idol", Position(33158, 31921, 15), Position(33168, 31921, 15), 6) + addEvent(transformMonster, 13 * 15000, 3, 3, "Sphere Of Wrath", {}, {}, 0) + Game.createMonster("The False God", Position(33159, 31914, 15)) + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33181, 31894, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + end + end + + if item:getActionId() == 5500 then + if player:getPosition() == Position(33095, 31943, 15) and item:getId() == 8912 then + local teleport = 0 + local playersInArea = {} + local frompos = Position(33084, 31907, 15) + local topos = Position(33114, 31933, 15) + + for i = 31943, 31947 do + local newpos = Position(33095, i, 15) + local nplayer = Tile(newpos):getTopCreature() + if nplayer and nplayer:isPlayer() then + teleport = teleport + 1 + table.insert(playersInArea, nplayer) + end + end + + if teleport ~= 1 then + player:sendCancelMessage("You need exactly 5 players to start this challenge.") + return true + end + + if isPlayerInArea(frompos, topos) then + player:sendCancelMessage("It looks like there is someone inside.") + return true + end + + for _x = frompos.x, topos.x, 1 do + for _y = frompos.y, topos.y, 1 do + for _z = frompos.z, topos.z, 1 do + local tile = Tile(Position(_x, _y, _z)) + if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then + tile:getTopCreature():remove() + end + end + end + end + + for _, nplayer in ipairs(playersInArea) do + nplayer:setBossCooldown("Essence of Malice", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) + nplayer:teleportTo(Position(33098, 31921, 15), true) + convertTable[#convertTable + 1] = nplayer:getId() + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33091, 31963, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + Game.createMonster("Pillar of Summoning", Position(33093, 31919, 15)) + Game.createMonster("Pillar of Death", Position(33098, 31915, 15)) + Game.createMonster("Pillar of Protection", Position(33103, 31919, 15)) + Game.createMonster("Pillar of Healing", Position(33101, 31925, 15)) + Game.createMonster("Pillar of Draining", Position(33095, 31925, 15)) + Game.createMonster("Dorokoll The Mystic STOP", Position(33095, 31924, 15)):registerEvent("HealthPillar") + Game.createMonster("Eshtaba The Conjurer STOP", Position(33094, 31919, 15)):registerEvent("HealthPillar") + Game.createMonster("Eliz The Unyielding STOP", Position(33102, 31919, 15)):registerEvent("HealthPillar") + Game.createMonster("Mezlon The Defiler STOP", Position(33101, 31924, 15)):registerEvent("HealthPillar") + Game.createMonster("Malkhar Deathbringer STOP", Position(33098, 31916, 15)):registerEvent("HealthPillar") + end + end + + if item:getActionId() == 5503 then + if player:getPosition() == Position(33127, 31892, 15) and item:getId() == 8912 then + local teleport = 0 + local playersInArea = {} + local frompos = Position(33119, 31913, 15) + local topos = Position(33142, 31936, 15) + + for i = 31892, 31896 do + local newpos = Position(33127, i, 15) + local nplayer = Tile(newpos):getTopCreature() + if nplayer and nplayer:isPlayer() then + teleport = teleport + 1 + table.insert(playersInArea, nplayer) + end + end + + if teleport ~= 5 then + player:sendCancelMessage("You need exactly 5 players to start this challenge.") + return true + end + + if isPlayerInArea(frompos, topos) then + player:sendCancelMessage("It looks like there is someone inside.") + return true + end + + for _x = frompos.x, topos.x, 1 do + for _y = frompos.y, topos.y, 1 do + for _z = frompos.z, topos.z, 1 do + local tile = Tile(Position(_x, _y, _z)) + if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then + tile:getTopCreature():remove() + end + end + end + end + + for _, nplayer in ipairs(playersInArea) do + nplayer:setBossCooldown("The Souldespoiler", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) + nplayer:teleportTo(Position(33130, 31919, 15), true) + convertTable[#convertTable + 1] = nplayer:getId() + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33109, 31887, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + Game.createMonster("The Sinister Hermit Dirty", Position(33131, 31925, 15)) + activateGeyser() + end + end + + if item:getActionId() == 5504 then + if player:getPosition() == Position(33164, 31859, 15) and item:getId() == 8912 then + local teleport = 0 + local playersInArea = {} + local frompos = Position(33123, 31846, 15) + local topos = Position(33149, 31871, 15) + + for y = 31859, 31863 do + local newpos = Position(33164, y, 15) + local nplayer = Tile(newpos):getTopCreature() + if nplayer and nplayer:isPlayer() then + teleport = teleport + 1 + table.insert(playersInArea, nplayer) + end + end + + if teleport ~= 5 then + player:sendCancelMessage("You need exactly 5 players to start this challenge.") + return true + end + + if isPlayerInArea(frompos, topos) then + player:sendCancelMessage("It looks like there is someone inside.") + return true + end + + for _x = frompos.x, topos.x, 1 do + for _y = frompos.y, topos.y, 1 do + for _z = frompos.z, topos.z, 1 do + local tile = Tile(Position(_x, _y, _z)) + if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then + tile:getTopCreature():remove() + end + end + end + end + + for _, nplayer in ipairs(playersInArea) do + nplayer:setBossCooldown("The Armored Voidborn", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) + nplayer:teleportTo(Position(33137, 31867, 15), true) + convertTable[#convertTable + 1] = nplayer:getId() + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + + local function createBeam1(fromPos, toPos, id, dir) + if dir == 1 then + for _x = fromPos.x, toPos.x, 1 do + local tile = Tile(Position(_x, fromPos.y, fromPos.z)) + if tile and tile:getItemCountById(id) == 0 then + Game.createItem(id, 1, Position(_x, fromPos.y, fromPos.z)) + end + end + elseif dir == 2 then + for _y = fromPos.y, toPos.y, 1 do + local tile = Tile(Position(fromPos.x, _y, fromPos.z)) + if tile and tile:getItemCountById(id) == 0 then + Game.createItem(id, 1, Position(fromPos.x, _y, fromPos.z)) + end + end + end + end + + local itemsToMonster = { + Position(33133, 31856, 15), + Position(33140, 31856, 15), + Position(33140, 31863, 15), + Position(33133, 31863, 15), + } + + for _, position in pairs(itemsToMonster) do + local tile = Tile(position) + if tile and tile:getItemCountById(7805) < 1 then + Game.createItem(7805, 1, position) + end + end + + createBeam1(Position(33134, 31856, 15), Position(33139, 31856, 15), 6116, 1) + createBeam1(Position(33134, 31863, 15), Position(33139, 31863, 15), 6116, 1) + createBeam1(Position(33140, 31857, 15), Position(33140, 31862, 15), 6117, 2) + createBeam1(Position(33133, 31857, 15), Position(33133, 31862, 15), 6117, 2) + + Game.createMonster("Security Golem", Position(33131, 31855, 15)) + Game.createMonster("Security Golem", Position(33142, 31855, 15)) + Game.createMonster("Security Golem", Position(33141, 31863, 15)) + Game.createMonster("Security Golem", Position(33132, 31863, 15)) + + Game.createMonster("Containment Machine", Position(33133, 31864, 15)):registerEvent("MachineDeath") + Game.createMonster("The Armored Voidborn", Position(33135, 31859, 15)):registerEvent("MachineDeath") + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33179, 31840, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + end + end + + if item:getActionId() == 5505 then + if player:getPosition() == Position(33507, 32228, 10) and item:getId() == 8912 then + local teleport = 0 + local teleport = 0 + local playersInArea = {} + local frompos = Position(33087, 31848, 15) + local topos = Position(33109, 31871, 15) + + for _y = 32228, 32232 do + local newpos = Position(33507, _y, 10) + local nplayer = Tile(newpos):getTopCreature() + if nplayer and nplayer:isPlayer() then + teleport = teleport + 1 + table.insert(playersInArea, nplayer) + end + end + + if teleport ~= 5 then + player:sendCancelMessage("You need exactly 5 players to start this challenge.") + return true + end + + if isPlayerInArea(frompos, topos) then + player:sendCancelMessage("It looks like there is someone inside.") + return true + end + + for _x = frompos.x, topos.x, 1 do + for _y = frompos.y, topos.y, 1 do + for _z = frompos.z, topos.z, 1 do + local tile = Tile(Position(_x, _y, _z)) + if tile and tile:getTopCreature() and tile:getTopCreature():isMonster() then + tile:getTopCreature():remove() + end + if tile then + local tileItems = tile:getItems() + if type(tileItems) == "table" and #tileItems > 0 then + for _, it in pairs(tileItems) do + if ItemType(it:getId()):isCorpse() then + it:remove() + end + end + end + end + end + end + end + + for _, nplayer in ipairs(playersInArea) do + nplayer:setBossCooldown("The Sandking", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) + nplayer:teleportTo(Position(33099, 31864, 15), true) + convertTable[#convertTable + 1] = nplayer:getId() + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + + Game.createMonster("the sandking fake", Position(33099, 31858, 15)):registerEvent("SandkingThink") + Game.setStorageValue("sandking", 1) + kickerPlayerRoomAfterMin(convertTable, frompos, topos, Position(33459, 32269, 10), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + end + end + + if item:getActionId() == 5506 then + if player:getPosition() == Position(33074, 31884, 15) and item:getId() == 8912 then + local teleport = 0 + local playersInArea = {} + local frompos = Position(33023, 31904, 14) + local topos = Position(33052, 31932, 15) + + if player:getPosition() == Position(33074, 31884, 15) then + teleport = teleport + 1 + table.insert(playersInArea, player) + else + return true + end + + local pt1 = Position(33073, 31885, 15) + local pt2 = Position(33075, 31887, 15) + for _x = pt1.x, pt2.x do + for _y = pt1.y, pt2.y do + local nplayer = Tile(Position(_x, _y, 15)):getTopCreature() + if nplayer and nplayer:isPlayer() then + teleport = teleport + 1 + table.insert(playersInArea, nplayer) + end + end + end + + if teleport ~= 10 then + player:sendCancelMessage("You need exactly 10 players to start this challenge.") + return true + end + + if isPlayerInArea(frompos, topos) then + player:sendCancelMessage("It looks like there is someone inside.") + return true + end + + 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 and tile:getTopCreature() and tile:getTopCreature():isMonster() then + tile:getTopCreature():remove() + end + if tile then + local tileItems = tile:getItems() + if type(tileItems) == "table" and #tileItems > 0 then + for _, it in pairs(tileItems) do + if ItemType(it:getId()):isCorpse() then + it:remove() + end + end + end + end + end + end + end + + for _, nplayer in ipairs(playersInArea) do + nplayer:setBossCooldown("The Source Of Corruption", os.time() + configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN)) + nplayer:teleportTo(Position(33039, 31925, 15), true) + nplayer:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + + Game.createMonster("The Remorseless Corruptor", Position(33039, 31922, 15)) + Game.createMonster("Zarcorix Of Yalahar", Position(33039, 31921, 15)):registerEvent("YalahariHealth") + Game.createMonster("Stolen Soul", Position(33039, 31920, 15)) + Game.createMonster("Soul Reaper", Position(33039, 31919, 15)) + spawnDarkSoul(1, 30) + spawnDarkSoul(2, 30) + spawnStolenSoul(30) + + kickerPlayerRoomAfterMin(playersInArea, frompos, topos, Position(33072, 31867, 15), "You were kicked for exceeding the time limit within the boss room.", "", 60, true, ittable, blockmonsters) + end + end + + return true end cultsOfTibiaLevers:aid(5500, 5501, 5502, 5503, 5504, 5505, 5506) diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_document.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_document.lua index 019819eff26..93b96264d53 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_document.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_document.lua @@ -12,7 +12,7 @@ function cultsOfTibiaDocument.onUse(player, item, fromPosition, target, toPositi player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, 3) end end - + return true end diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_lever_mota.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_lever_mota.lua index b6d9564c27a..51035795573 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_lever_mota.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_lever_mota.lua @@ -10,13 +10,13 @@ function cultsOfTibiaLeverMota.onUse(player, item, fromPosition, itemEx, toPosit local stonePos2 = Position() local stonePos3 = Position() local stoneId = 15487 - + local missionStatus = player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission) if missionStatus ~= 12 and missionStatus ~= 13 then player:getPosition():sendMagicEffect(CONST_ME_POFF) return false end - + for i = 33300, 33305 do local newpos = Position(i, 32144, 10) if Tile(newpos):getItemCountById(stoneId) == 1 then @@ -31,11 +31,11 @@ function cultsOfTibiaLeverMota.onUse(player, item, fromPosition, itemEx, toPosit stonePos3 = newpos end end - + local stone1 = math.random(0, 5) local stone2 = math.random(0, 5) local stone3 = math.random(0, 5) - + local itstone1 = Tile(stonePos1):getItemById(stoneId) local newpos = { x = 33300 + stone1, y = itstone1:getPosition().y, z = itstone1:getPosition().z } itstone1:moveTo(newpos) @@ -55,11 +55,11 @@ function cultsOfTibiaLeverMota.onUse(player, item, fromPosition, itemEx, toPosit player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Stone2, stone2) player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Stone3, stone3) player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.AccessDoorGareth, -1) - + if missionStatus == 12 then player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.MotA.Mission, 13) end - + item:transform(transformid[item:getId()]) return true end diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_misguided.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_misguided.lua index 87d8e77f70b..42b81b970db 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_misguided.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_misguided.lua @@ -45,7 +45,7 @@ function cultsOfTibiaMisguided.onUse(player, item, position, target, targetPosit if not creature then return false end - + local map = (type(Game.getStorageValue("cultsMap")) == "string" and Game.getStorageValue("cultsMap") or "illusion") if creature:getName():lower() == "misguided bully" or creature:getName():lower() == "misguided thief" then player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Monsters, 0) @@ -53,12 +53,12 @@ function cultsOfTibiaMisguided.onUse(player, item, position, target, targetPosit local pos = creature:getPosition() Game.createItem(25298, 1, pos) creature:remove() - + local newCreature = Game.createMonster("Misguided Shadow", pos) if newCreature then newCreature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) end - + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You paralyse the bully and the amulet reveals the true face of the creature behind the possession of this misguided creature.") local it = player:addItem(25296, 1) if map == "illusion" then @@ -66,10 +66,9 @@ function cultsOfTibiaMisguided.onUse(player, item, position, target, targetPosit end it:decay() end - + return true end - cultsOfTibiaMisguided:id(25297) cultsOfTibiaMisguided:register() diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_torch.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_torch.lua index bea4debc46e..7b1d8c4826e 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/actions_torch.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/actions_torch.lua @@ -6,7 +6,7 @@ local cultsOfTibiaTouch = Action() function cultsOfTibiaTouch.onUse(player, item, fromPosition, target, toPosition, isHotkey) local wallItem - + if Game.getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Humans.WallDecaying) >= os.time() then player:getPosition():sendMagicEffect(CONST_ME_POFF) else @@ -21,7 +21,7 @@ function cultsOfTibiaTouch.onUse(player, item, fromPosition, target, toPosition, end end end - + return true end diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_glowing_rubbish_amulet.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_glowing_rubbish_amulet.lua index 0ae43c3c140..a5fbfcc60f4 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_glowing_rubbish_amulet.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/creaturescripts_glowing_rubbish_amulet.lua @@ -1,40 +1,40 @@ local glowingRubbishAmulet = CreatureEvent("GlowingRubbishAmuletDeath") function glowingRubbishAmulet.onDeath(creature, _corpse, _lastHitKiller, mostDamageKiller) - onDeathForParty(creature, mostDamageKiller, function(creature, player) - local amulet = player:getSlotItem(CONST_SLOT_NECKLACE) - + onDeathForParty(creature, mostDamageKiller, function(creature, player) + local amulet = player:getSlotItem(CONST_SLOT_NECKLACE) + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Mission) ~= 3 then - return true - end - - local mStg = math.max(player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Monsters), 0) - local eStg = math.max(player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Exorcisms), 0) - - if creature:getName():lower():trim() == "misguided shadow" then - if eStg < 5 then - player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Exorcisms, eStg + 1) - end - return true - end - - if not amulet or amulet:getId() ~= 25296 then - return true - end - - if creature:getName():lower():trim() == "misguided bully" or creature:getName():lower():trim() == "misguided thief" then - player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Monsters, mStg + 1) - - if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Monsters) >= 10 then - amulet:remove() - local it = player:addItem(25297, 1) - if it then - it:decay() - end - end - end - end) - return true + return true + end + + local mStg = math.max(player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Monsters), 0) + local eStg = math.max(player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Exorcisms), 0) + + if creature:getName():lower():trim() == "misguided shadow" then + if eStg < 5 then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Exorcisms, eStg + 1) + end + return true + end + + if not amulet or amulet:getId() ~= 25296 then + return true + end + + if creature:getName():lower():trim() == "misguided bully" or creature:getName():lower():trim() == "misguided thief" then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Monsters, mStg + 1) + + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Misguided.Monsters) >= 10 then + amulet:remove() + local it = player:addItem(25297, 1) + if it then + it:decay() + end + end + end + end) + return true end glowingRubbishAmulet:register() diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_begin_task.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_begin_task.lua index 7bb5678841a..fb8a88cdb0b 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_begin_task.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_begin_task.lua @@ -14,7 +14,7 @@ local function fallFloor(pid, id) amulet:moveTo(player:getPosition()) end addEvent(fallFloor, 10000, player:getId(), id) - + return true end diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_ice.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_ice.lua index 60bfef4c73c..13649dc1d6f 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_ice.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_ice.lua @@ -1,99 +1,99 @@ local function sendConditionCults(playerId, info, fromPos, toPos, fromPos2, toPos2, time) - local player = Player(playerId) - if not player then - return false - end + local player = Player(playerId) + if not player then + return false + end - if not player:getPosition():isInRange(fromPos2, toPos2) then - if not player:getPosition():isInRange(fromPos, toPos) then - return true - end - end + if not player:getPosition():isInRange(fromPos2, toPos2) then + if not player:getPosition():isInRange(fromPos, toPos) then + return true + end + end - time = time + 2 - if time == 30 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[2]) - elseif time == 60 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[2]) - elseif time == 90 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[2]) - elseif time >= 120 then - local storage = player:getStorageValue(info.storageBarkless) < 0 and 0 or player:getStorageValue(info.storageBarkless) - if storage < 3 and storage ~= 1 and storage ~= 2 then - if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Sulphur) == 3 and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Tar) == 3 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[3]) - player:setStorageValue(info.storageBarkless, 1) - else - return true - end - end - end - player:getPosition():sendMagicEffect(info.effect) - addEvent(sendConditionCults, 2000, playerId, info, fromPos, toPos, fromPos2, toPos2, time) + time = time + 2 + if time == 30 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[2]) + elseif time == 60 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[2]) + elseif time == 90 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[2]) + elseif time >= 120 then + local storage = player:getStorageValue(info.storageBarkless) < 0 and 0 or player:getStorageValue(info.storageBarkless) + if storage < 3 and storage ~= 1 and storage ~= 2 then + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Sulphur) == 3 and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Tar) == 3 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[3]) + player:setStorageValue(info.storageBarkless, 1) + else + return true + end + end + end + player:getPosition():sendMagicEffect(info.effect) + addEvent(sendConditionCults, 2000, playerId, info, fromPos, toPos, fromPos2, toPos2, time) end local function floorPassage(playerId, info, time) - local player = Player(playerId) - if not player then - return true - end - local storage = player:getStorageValue(info.storageBarkless) < 0 and 0 or player:getStorageValue(info.storageBarkless) - if time == 0 and storage < 3 then - player:setStorageValue(info.storageBarkless, 0) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[6]) - return true - end - if storage == 3 then - return true - end - addEvent(floorPassage, 1000, playerId, info, time - 1) + local player = Player(playerId) + if not player then + return true + end + local storage = player:getStorageValue(info.storageBarkless) < 0 and 0 or player:getStorageValue(info.storageBarkless) + if time == 0 and storage < 3 then + player:setStorageValue(info.storageBarkless, 0) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[6]) + return true + end + if storage == 3 then + return true + end + addEvent(floorPassage, 1000, playerId, info, time - 1) end local ice = MoveEvent() function ice.onStepIn(creature, item, position, fromPosition) - local player = creature:getPlayer() - if not player then - return true - end - local setting = { - fromPos = Position(32677, 31393, 8), - toPos = Position(32722, 31440, 8), - fromPos2 = Position(32696, 31429, 8), - toPos2 = Position(32728, 31435, 8), - effect = CONST_ME_GIANTICE, - firstTile = Position(32698, 31405, 8), - storageBarkless = Storage.Quest.U11_40.CultsOfTibia.Barkless.Ice, - msgs = { - "As you enter the icy cavern, you feel an unnatural frostiness. The ice cold air stings in your face. Survive and prove worthy.", -- on enter - "Your body temperature sinks. You can see your breath freezing in the cold.", -- 30/60/90 seconds - "The icy cold is grasping to you. You can barely move anymore.", -- 120 seconds - "You are now washed and ready to purify yourself in the chambers of purification.", -- step on the first tile - "You are now ready to prove your worth. Take heart and cross the threshold of ice.", -- step on the second tile - "You took so long. You are no longer purified.", -- didn't step in time - }, - } - if fromPosition.y == 31441 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, setting.msgs[1]) - sendConditionCults(player:getId(), setting, setting.fromPos, setting.toPos, setting.fromPos2, setting.toPos2, 0) - return true - end + local player = creature:getPlayer() + if not player then + return true + end + local setting = { + fromPos = Position(32677, 31393, 8), + toPos = Position(32722, 31440, 8), + fromPos2 = Position(32696, 31429, 8), + toPos2 = Position(32728, 31435, 8), + effect = CONST_ME_GIANTICE, + firstTile = Position(32698, 31405, 8), + storageBarkless = Storage.Quest.U11_40.CultsOfTibia.Barkless.Ice, + msgs = { + "As you enter the icy cavern, you feel an unnatural frostiness. The ice cold air stings in your face. Survive and prove worthy.", -- on enter + "Your body temperature sinks. You can see your breath freezing in the cold.", -- 30/60/90 seconds + "The icy cold is grasping to you. You can barely move anymore.", -- 120 seconds + "You are now washed and ready to purify yourself in the chambers of purification.", -- step on the first tile + "You are now ready to prove your worth. Take heart and cross the threshold of ice.", -- step on the second tile + "You took so long. You are no longer purified.", -- didn't step in time + }, + } + if fromPosition.y == 31441 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, setting.msgs[1]) + sendConditionCults(player:getId(), setting, setting.fromPos, setting.toPos, setting.fromPos2, setting.toPos2, 0) + return true + end - if item:getPosition():compare(setting.firstTile) then - if player:getStorageValue(setting.storageBarkless) ~= 1 then - return true - end - player:setStorageValue(setting.storageBarkless, 2) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, setting.msgs[4]) - floorPassage(player:getId(), setting, 60) - return true - end + if item:getPosition():compare(setting.firstTile) then + if player:getStorageValue(setting.storageBarkless) ~= 1 then + return true + end + player:setStorageValue(setting.storageBarkless, 2) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, setting.msgs[4]) + floorPassage(player:getId(), setting, 60) + return true + end - if fromPosition.y == 31439 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A bit of warmth returns to your body as you leave the icy cavern.") - return true - end - return true + if fromPosition.y == 31439 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A bit of warmth returns to your body as you leave the icy cavern.") + return true + end + return true end ice:type("stepin") diff --git a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_tar.lua b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_tar.lua index 662187e440e..144ece38ad4 100644 --- a/data-otservbr-global/scripts/quests/cults_of_tibia/movements_tar.lua +++ b/data-otservbr-global/scripts/quests/cults_of_tibia/movements_tar.lua @@ -1,118 +1,118 @@ local configQuest = { - ["fire"] = { - itemId = 1857, - beginPos = Position(32748, 31488, 8), - fromPos = Position(32737, 31489, 8), - toPos = Position(32761, 31512, 8), - effect = CONST_ME_HITBYFIRE, - firstTile = Position(32750, 31508, 8), - secondTile = Position(32746, 31469, 8), - storageBarkless = Storage.Quest.U11_40.CultsOfTibia.Barkless.Tar, - msgs = { - "As you enter the tar pits, you feel the heat around you rising dramatically. Survive the heat long enough to prove worthy.", -- on enter - "Your body is heating up, the air around you is flickering.", -- 30/60 seconds - "The heat is now unbearable, the blood in your body feels like lava. There's almost no strength left in you - act quickly!", -- 90 seconds - "Embrace the stigma of bad fortune. The tar does not feel so hot anymore. You passed the tar trial.", -- step on the first tile - "Your body reacts to this strange green substance as you reach out to touch it. You feel an urge for more of this energy.", -- step on the second tile - "The tar covering you has cooled down and fell off for the most part. Your body is not heated up anymore.", -- didn't step in time - }, - }, - ["acid"] = { - itemId = 4406, - beginPos = Position(32693, 31478, 8), - fromPos = Position(32647, 31479, 8), - toPos = Position(32710, 31519, 8), - effect = CONST_ME_YELLOW_RINGS, - firstTile = Position(32680, 31485, 8), - secondTile = Position(32664, 31504, 8), - storageBarkless = Storage.Quest.U11_40.CultsOfTibia.Barkless.Sulphur, - msgs = { - "As you enter the sulphur pits, you feel the dry, burning vapours of the sulphur all around you. Prove worthy, survive the acid.", -- on enter - "The sulphur is burning your skin. You almost feel your body melting away in acid.", -- 30/60 seconds - "The acid burning is now unbearable, your skin feels like a sieve. There's almost no strength left in you - act quickly!", -- 90 seconds - "Embrace the stigma of vanity. The sulphur does not burn your skin anymore. You passed the trial.", -- step on the first tile - "You are now ready to prove your worth. Take heart and cross the threshold of sulphur.", -- step on the second tile - "The acid covering you has cooled down and fell off for the most part. Your body is not heated up anymore.", -- didn't step in time - }, - }, + ["fire"] = { + itemId = 1857, + beginPos = Position(32748, 31488, 8), + fromPos = Position(32737, 31489, 8), + toPos = Position(32761, 31512, 8), + effect = CONST_ME_HITBYFIRE, + firstTile = Position(32750, 31508, 8), + secondTile = Position(32746, 31469, 8), + storageBarkless = Storage.Quest.U11_40.CultsOfTibia.Barkless.Tar, + msgs = { + "As you enter the tar pits, you feel the heat around you rising dramatically. Survive the heat long enough to prove worthy.", -- on enter + "Your body is heating up, the air around you is flickering.", -- 30/60 seconds + "The heat is now unbearable, the blood in your body feels like lava. There's almost no strength left in you - act quickly!", -- 90 seconds + "Embrace the stigma of bad fortune. The tar does not feel so hot anymore. You passed the tar trial.", -- step on the first tile + "Your body reacts to this strange green substance as you reach out to touch it. You feel an urge for more of this energy.", -- step on the second tile + "The tar covering you has cooled down and fell off for the most part. Your body is not heated up anymore.", -- didn't step in time + }, + }, + ["acid"] = { + itemId = 4406, + beginPos = Position(32693, 31478, 8), + fromPos = Position(32647, 31479, 8), + toPos = Position(32710, 31519, 8), + effect = CONST_ME_YELLOW_RINGS, + firstTile = Position(32680, 31485, 8), + secondTile = Position(32664, 31504, 8), + storageBarkless = Storage.Quest.U11_40.CultsOfTibia.Barkless.Sulphur, + msgs = { + "As you enter the sulphur pits, you feel the dry, burning vapours of the sulphur all around you. Prove worthy, survive the acid.", -- on enter + "The sulphur is burning your skin. You almost feel your body melting away in acid.", -- 30/60 seconds + "The acid burning is now unbearable, your skin feels like a sieve. There's almost no strength left in you - act quickly!", -- 90 seconds + "Embrace the stigma of vanity. The sulphur does not burn your skin anymore. You passed the trial.", -- step on the first tile + "You are now ready to prove your worth. Take heart and cross the threshold of sulphur.", -- step on the second tile + "The acid covering you has cooled down and fell off for the most part. Your body is not heated up anymore.", -- didn't step in time + }, + }, } local function sendConditionCults(playerId, _type, fromPos, toPos, time) - local player = Player(playerId) - if not player or not player:getPosition():isInRange(fromPos, toPos) then - return false - end + local player = Player(playerId) + if not player or not player:getPosition():isInRange(fromPos, toPos) then + return false + end - local info = configQuest[_type] - time = time + 2 - if time == 30 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[2]) - elseif time == 60 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[2]) - elseif time >= 90 then - local stage = player:getStorageValue(info.storageBarkless) < 0 and 0 or player:getStorageValue(info.storageBarkless) - if stage < 3 and stage ~= 1 and stage ~= 2 then - if _type == "acid" and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Tar) ~= 3 then - return true - end - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[3]) - player:setStorageValue(info.storageBarkless, 1) - if _type == "fire" then - player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.TarAccessDoor, 1) - elseif _type == "acid" then - player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.SulphurAccessDoor, 1) - end - end - end - player:getPosition():sendMagicEffect(info.effect) - addEvent(sendConditionCults, 2000, playerId, _type, fromPos, toPos, time) + local info = configQuest[_type] + time = time + 2 + if time == 30 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[2]) + elseif time == 60 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[2]) + elseif time >= 90 then + local stage = player:getStorageValue(info.storageBarkless) < 0 and 0 or player:getStorageValue(info.storageBarkless) + if stage < 3 and stage ~= 1 and stage ~= 2 then + if _type == "acid" and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Tar) ~= 3 then + return true + end + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[3]) + player:setStorageValue(info.storageBarkless, 1) + if _type == "fire" then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.TarAccessDoor, 1) + elseif _type == "acid" then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.SulphurAccessDoor, 1) + end + end + end + player:getPosition():sendMagicEffect(info.effect) + addEvent(sendConditionCults, 2000, playerId, _type, fromPos, toPos, time) end function passageFloor1ToFloor2(playerId, info, time) - local player = Player(playerId) - if not player then - return true - end - local stage = player:getStorageValue(info.storageBarkless) < 0 and 0 or player:getStorageValue(info.storageBarkless) - if time == 0 and stage < 3 then - player:setStorageValue(info.storageBarkless, 0) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[6]) - return true - end - if stage == 3 then - return true - end - addEvent(passageFloor1ToFloor2, 1000, playerId, info, time - 1) + local player = Player(playerId) + if not player then + return true + end + local stage = player:getStorageValue(info.storageBarkless) < 0 and 0 or player:getStorageValue(info.storageBarkless) + if time == 0 and stage < 3 then + player:setStorageValue(info.storageBarkless, 0) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, info.msgs[6]) + return true + end + if stage == 3 then + return true + end + addEvent(passageFloor1ToFloor2, 1000, playerId, info, time - 1) end local tar = MoveEvent() function tar.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 - for index, value in pairs(configQuest) do - if item:getId() == value.itemId and fromPosition:compare(value.beginPos) then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, value.msgs[1]) - sendConditionCults(player:getId(), index, value.fromPos, value.toPos, 0) - return true - elseif position:compare(value.firstTile) and player:getStorageValue(value.storageBarkless) == 1 then - player:setStorageValue(value.storageBarkless, 2) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, value.msgs[4]) - passageFloor1ToFloor2(player:getId(), value, 60) - elseif position:compare(value.secondTile) then - if player:getStorageValue(value.storageBarkless) == 2 then - player:setStorageValue(value.storageBarkless, 3) - if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Sulphur) == 3 and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Tar) == 3 then - player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Mission, 2) - end - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, value.msgs[5]) - end - end - end - return true + for index, value in pairs(configQuest) do + if item:getId() == value.itemId and fromPosition:compare(value.beginPos) then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, value.msgs[1]) + sendConditionCults(player:getId(), index, value.fromPos, value.toPos, 0) + return true + elseif position:compare(value.firstTile) and player:getStorageValue(value.storageBarkless) == 1 then + player:setStorageValue(value.storageBarkless, 2) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, value.msgs[4]) + passageFloor1ToFloor2(player:getId(), value, 60) + elseif position:compare(value.secondTile) then + if player:getStorageValue(value.storageBarkless) == 2 then + player:setStorageValue(value.storageBarkless, 3) + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Sulphur) == 3 and player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Tar) == 3 then + player:setStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Mission, 2) + end + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, value.msgs[5]) + end + end + end + return true end tar:type("stepin") @@ -122,34 +122,34 @@ tar:register() tar = MoveEvent() function tar.onStepOut(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 item:getActionId() == 5531 then - if fromPosition.x == 32736 then - player:getPosition():sendMagicEffect(CONST_ME_POFF) - if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Tar) < 3 then - player:teleportTo(Position(32737, 31451, 8), true) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are not ready yet.") - return false - end - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You traverse the tar unharmed.") - end - end - if item:getActionId() == 5530 then - if fromPosition.x == 32717 then - player:getPosition():sendMagicEffect(CONST_ME_POFF) - if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Sulphur) < 3 then - player:teleportTo(Position(32718, 31444, 8), true) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are not ready yet.") - return false - end - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You traverse the sulphur unharmed.") - end - end - return true + if item:getActionId() == 5531 then + if fromPosition.x == 32736 then + player:getPosition():sendMagicEffect(CONST_ME_POFF) + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Tar) < 3 then + player:teleportTo(Position(32737, 31451, 8), true) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are not ready yet.") + return false + end + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You traverse the tar unharmed.") + end + end + if item:getActionId() == 5530 then + if fromPosition.x == 32717 then + player:getPosition():sendMagicEffect(CONST_ME_POFF) + if player:getStorageValue(Storage.Quest.U11_40.CultsOfTibia.Barkless.Sulphur) < 3 then + player:teleportTo(Position(32718, 31444, 8), true) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are not ready yet.") + return false + end + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You traverse the sulphur unharmed.") + end + end + return true end tar:type("stepout") diff --git a/data-otservbr-global/startup/tables/door_quest.lua b/data-otservbr-global/startup/tables/door_quest.lua index a977a5523d6..3741f778874 100644 --- a/data-otservbr-global/startup/tables/door_quest.lua +++ b/data-otservbr-global/startup/tables/door_quest.lua @@ -205,7 +205,7 @@ QuestDoorAction = { -- Cults of tibia door [Storage.Quest.U11_40.CultsOfTibia.Minotaurs.BossAccessDoor] = { itemId = false, - itemPos = { { x = 31957, y = 32468, z = 9 } }, + itemPos = { { x = 31957, y = 32468, z = 9 } }, }, [Storage.Quest.U11_40.CultsOfTibia.Minotaurs.AccessDoor] = { itemId = false, @@ -229,11 +229,11 @@ QuestDoorAction = { }, [Storage.Quest.U11_40.CultsOfTibia.Barkless.TarAccessDoor] = { itemId = false, - itemPos = { { x = 32747, y = 31462, z = 8 } }, + itemPos = { { x = 32747, y = 31462, z = 8 } }, }, [Storage.Quest.U11_40.CultsOfTibia.Barkless.SulphurAccessDoor] = { itemId = false, - itemPos = { { x = 32678, y = 31506, z = 8 } }, + itemPos = { { x = 32678, y = 31506, z = 8 } }, }, [Storage.Quest.U11_40.CultsOfTibia.Barkless.AccessDoor] = { itemId = false, From 6eae6581f00365143c31f8c591c0a9955c090a36 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Thu, 10 Oct 2024 19:48:03 -0300 Subject: [PATCH 16/70] Update storages.lua --- data-otservbr-global/lib/core/storages.lua | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index 6d5873bcdb8..7781249b9d1 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -2505,34 +2505,34 @@ Storage = { SulphurAccessDoor = 45678, }, Orcs = { - Mission = 45678, - LookType = 45679, - BossTimer = 45680, + Mission = 45679, + LookType = 45680, + BossTimer = 45681, }, Life = { - Mission = 45681, - BossTimer = 45682, - AccessDoor = 45683, + Mission = 45682, + BossTimer = 45683, + AccessDoor = 45684, }, Humans = { - Mission = 45684, - Vaporized = 45685, - Decaying = 45686, - BossTimer = 45687, - WallDecaying = 45688, + Mission = 45685, + Vaporized = 45686, + Decaying = 45687, + BossTimer = 45688, + WallDecaying = 45689, }, Misguided = { - Mission = 45688, - Monsters = 45689, - Exorcisms = 45690, - Time = 45691, - BossTimer = 45692, - AccessDoor = 45693, + Mission = 45690, + Monsters = 45691, + Exorcisms = 45692, + Time = 45693, + BossTimer = 45694, + AccessDoor = 45695, }, FinalBoss = { - Mission = 45694, - BossTimer = 45695, - AccessDoor = 45696, + Mission = 45696, + BossTimer = 45697, + AccessDoor = 45698, }, }, ThreatenedDreams = { -- 45751 - 45850 From 2ba6751cbe18a121407e5764a190c850467097ee Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Thu, 10 Oct 2024 20:28:03 -0300 Subject: [PATCH 17/70] Threatened Dreams Quest --- data-otservbr-global/npc/ahmet.lua | 2 +- data-otservbr-global/npc/alkestios.lua | 22 +++---- data-otservbr-global/npc/maelyrra.lua | 64 +++++-------------- ...release.lua => action_fairies_release.lua} | 0 ...moon_mirror.lua => action_moon_mirror.lua} | 0 ...acher_book.lua => action_poacher_book.lua} | 0 ...her_notes.lua => action_poacher_notes.lua} | 0 ...ght_vial.lua => action_starlight_vial.lua} | 0 ...sun_catcher.lua => action_sun_catcher.lua} | 0 ...ion-whelp_fur.lua => action_whelp_fur.lua} | 0 ...erb_bush.lua => event_raven_herb_bush.lua} | 0 ...zur_room.lua => movement_kroazur_room.lua} | 1 + ...r_notes.lua => movement_poacher_notes.lua} | 0 ...eathers.lua => movement_swan_feathers.lua} | 0 14 files changed, 27 insertions(+), 62 deletions(-) rename data-otservbr-global/scripts/quests/threatened_dreams/{action-fairies_release.lua => action_fairies_release.lua} (100%) rename data-otservbr-global/scripts/quests/threatened_dreams/{action-moon_mirror.lua => action_moon_mirror.lua} (100%) rename data-otservbr-global/scripts/quests/threatened_dreams/{action-poacher_book.lua => action_poacher_book.lua} (100%) rename data-otservbr-global/scripts/quests/threatened_dreams/{action-poacher_notes.lua => action_poacher_notes.lua} (100%) rename data-otservbr-global/scripts/quests/threatened_dreams/{action-starlight_vial.lua => action_starlight_vial.lua} (100%) rename data-otservbr-global/scripts/quests/threatened_dreams/{action-sun_catcher.lua => action_sun_catcher.lua} (100%) rename data-otservbr-global/scripts/quests/threatened_dreams/{action-whelp_fur.lua => action_whelp_fur.lua} (100%) rename data-otservbr-global/scripts/quests/threatened_dreams/{event-raven_herb_bush.lua => event_raven_herb_bush.lua} (100%) rename data-otservbr-global/scripts/quests/threatened_dreams/{movement-kroazur_room.lua => movement_kroazur_room.lua} (99%) rename data-otservbr-global/scripts/quests/threatened_dreams/{movement-poacher_notes.lua => movement_poacher_notes.lua} (100%) rename data-otservbr-global/scripts/quests/threatened_dreams/{movement-swan_feathers.lua => movement_swan_feathers.lua} (100%) diff --git a/data-otservbr-global/npc/ahmet.lua b/data-otservbr-global/npc/ahmet.lua index 8a3db7e2d97..6dc282e780e 100644 --- a/data-otservbr-global/npc/ahmet.lua +++ b/data-otservbr-global/npc/ahmet.lua @@ -178,7 +178,7 @@ local function creatureSayCallback(npc, creature, type, message) return true end -npcHandler:setMessage(MESSAGE_GREET, "Be mourned pilgrim in flesh. I'm selling general goods.") +npcHandler:setMessage(MESSAGE_GREET, "Be mourned pilgrim in flesh. I'm selling general goods. Just ask me for a {trade}.") npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) diff --git a/data-otservbr-global/npc/alkestios.lua b/data-otservbr-global/npc/alkestios.lua index 4b7e593316d..00794577cf1 100644 --- a/data-otservbr-global/npc/alkestios.lua +++ b/data-otservbr-global/npc/alkestios.lua @@ -61,13 +61,9 @@ local function creatureSayCallback(npc, creature, type, message) if MsgContains(message, "mission") then if player:getStorageValue(ThreatenedDreams.Mission01[1]) == 1 and player:getStorageValue(ThreatenedDreams.Mission01.PoacherChest) == 1 then - npcHandler:say({ - "Uhmn.. Maybe Ahmet in Ankrahmun can help we to fake this book.", - }, npc, creature) + npcHandler:say("Uhmn.. Maybe Ahmet in Ankrahmun can help we to fake this book.", npc, creature) elseif player:getStorageValue(ThreatenedDreams.Mission01[1]) == 2 then - npcHandler:say({ - "The poachers are still chasing me. Please hurry and find a way to help me.", - }, npc, creature) + npcHandler:say("The poachers are still chasing me. Please hurry and find a way to help me.", npc, creature) elseif player:getStorageValue(ThreatenedDreams.Mission01[1]) == 3 then npcHandler:say({ "You succeeded! It seems the poachers have read your little faked story about killing white deer and the ensuing doom. They stopped chasing me. Thank you! ...", @@ -80,13 +76,13 @@ local function creatureSayCallback(npc, creature, type, message) "There are fire, ice, energy and earth shrines. If you don't know their locations you can also reach them by most temples in this world. The elemental shrines will transport you to Feyrist now that you bear the magical seal.", }, npc, creature) player:setStorageValue(ThreatenedDreams.Mission01[1], 16) - else - npcHandler:say({ - "I indeed have some troubles since I'm travelling this part of the world. When I took over the body of a white deer I wasn't aware that such an animal is a sought after quarry for hunters and poachers. ...", - "Now I'm living in the constant danger of being caught and killed. Of course, I could just take over another animal but this deer has really grown on me. I'd like to help this beautiful stag but I need your assistance. Are you willing to help me?", - }, npc, creature) - npcHandler:setTopic(playerId, 1) end + elseif MsgContains(message, "help") and player:getStorageValue(ThreatenedDreams.Mission01[1]) < 1 then + npcHandler:say({ + "I indeed have some troubles since I'm travelling this part of the world. When I took over the body of a white deer I wasn't aware that such an animal is a sought after quarry for hunters and poachers. ...", + "Now I'm living in the constant danger of being caught and killed. Of course, I could just take over another animal but this deer has really grown on me. I'd like to help this beautiful stag but I need your assistance. Are you willing to help me?", + }, npc, creature) + npcHandler:setTopic(playerId, 1) elseif MsgContains(message, "yes") then if npcHandler:getTopic(playerId) == 1 then if player:getStorageValue(ThreatenedDreams.QuestLine) == 1 then @@ -131,7 +127,7 @@ keywordHandler:addKeyword({ "fae" }, StdModule.say, { }, }) -npcHandler:setMessage(MESSAGE_GREET, "Nature's blessing, traveller! |PLAYERNAME|!") +npcHandler:setMessage(MESSAGE_GREET, "Nature's blessing, traveller! May you not be affected by any sinister force.") npcHandler:setMessage(MESSAGE_FAREWELL, "May your path always be even.") npcHandler:setMessage(MESSAGE_WALKAWAY, "May your path always be even.") diff --git a/data-otservbr-global/npc/maelyrra.lua b/data-otservbr-global/npc/maelyrra.lua index f582f2418c1..2a4bce29fb6 100644 --- a/data-otservbr-global/npc/maelyrra.lua +++ b/data-otservbr-global/npc/maelyrra.lua @@ -61,39 +61,25 @@ local function creatureSayCallback(npc, creature, type, message) if MsgContains(message, "mission") then if player:getStorageValue(ThreatenedDreams.Mission02[1]) < 1 then - npcHandler:say({ - "Some annoying nightmarish creatures rove about in the tunnels underneath this island. They are threatening the members of my court and devastate the flora and fauna. They also threaten the natural balance. Would you go and fight them for me?", - }, npc, creature) + npcHandler:say("Some annoying nightmarish creatures rove about in the tunnels underneath this island. They are threatening the members of my court and devastate the flora and fauna. They also threaten the natural balance. Would you go and fight them for me?", npc, creature) npcHandler:setTopic(playerId, 1) elseif player:getStorageValue(ThreatenedDreams.Mission02[1]) >= 1 and player:getStorageValue(ThreatenedDreams.Mission02[1]) <= 2 then - npcHandler:say({ - "Have you defeated the nightmare monsters?", - }, npc, creature) + npcHandler:say("Have you defeated the nightmare monsters?", npc, creature) npcHandler:setTopic(playerId, 2) elseif player:getStorageValue(ThreatenedDreams.Mission02[1]) >= 3 and player:getStorageValue(ThreatenedDreams.Mission02[1]) <= 4 then - npcHandler:say({ - "Have you found the moon mirror and freed the captured fairies?", - }, npc, creature) + npcHandler:say("Have you found the moon mirror and freed the captured fairies?", npc, creature) npcHandler:setTopic(playerId, 4) elseif player:getStorageValue(ThreatenedDreams.Mission02[1]) == 5 and player:getStorageValue(ThreatenedDreams.Mission03[1]) == 4 then - npcHandler:say({ - "Have you already found the starlight vial and the sun catcher?", - }, npc, creature) + npcHandler:say("Have you already found the starlight vial and the sun catcher?", npc, creature) npcHandler:setTopic(playerId, 6) elseif player:getStorageValue(ThreatenedDreams.Mission02[1]) == 6 then - npcHandler:say({ - "Could you already gather the three lights?", - }, npc, creature) + npcHandler:say("Could you already gather the three lights?", npc, creature) npcHandler:setTopic(playerId, 7) elseif player:getStorageValue(ThreatenedDreams.Mission02[1]) == 7 then - npcHandler:say({ - "Have you repaired the magical barrier? Is Feyrist safe?", - }, npc, creature) + npcHandler:say("Have you repaired the magical barrier? Is Feyrist safe?", npc, creature) npcHandler:setTopic(playerId, 8) else - npcHandler:say({ - "Thank you again, mortal being! The fae will be forever grateful.", - }, npc, creature) + npcHandler:say("Thank you again, mortal being! The fae will be forever grateful.", npc, creature) npcHandler:setTopic(playerId, 0) end elseif MsgContains(message, "yes") then @@ -110,20 +96,14 @@ local function creatureSayCallback(npc, creature, type, message) local frazzlemawsKills = player:getStorageValue(ThreatenedDreams.Mission02.FrazzlemawsCount) local kroazurKill = player:getStorageValue(ThreatenedDreams.Mission02.KroazurKill) if player:getStorageValue(ThreatenedDreams.Mission02[1]) == 1 and kroazurKill >= 1 and (enfeebledKills + frazzlemawsKills) >= 200 then - npcHandler:say({ - "Thank you! You rendered a great favour to the fae courts and Feyrist alike. Would you help us with another problem?", - }, npc, creature) + npcHandler:say("Thank you! You rendered a great favour to the fae courts and Feyrist alike. Would you help us with another problem?", npc, creature) npcHandler:setTopic(playerId, 3) player:setStorageValue(ThreatenedDreams.Mission02[1], 2) elseif player:getStorageValue(ThreatenedDreams.Mission02[1]) == 2 then - npcHandler:say({ - "You rendered a great favour to the fae courts and Feyrist alike. Would you help us with another problem?", - }, npc, creature) + npcHandler:say("You rendered a great favour to the fae courts and Feyrist alike. Would you help us with another problem?", npc, creature) npcHandler:setTopic(playerId, 3) else - npcHandler:say({ - "You have to kill two hundred of nightmare creatures and the terrible demon Kroazur who's leading them. That should bring some relief for the fae.", - }, npc, creature) + npcHandler:say("You have to kill two hundred of nightmare creatures and the terrible demon Kroazur who's leading them. That should bring some relief for the fae.", npc, creature) npcHandler:setTopic(playerId, 0) end elseif npcHandler:getTopic(playerId) == 3 then @@ -137,20 +117,14 @@ local function creatureSayCallback(npc, creature, type, message) npcHandler:setTopic(playerId, 0) elseif npcHandler:getTopic(playerId) == 4 then if player:getStorageValue(ThreatenedDreams.Mission02.FairiesCounter) == 5 and player:getStorageValue(ThreatenedDreams.Mission02.DarkMoonMirror) == 1 then - npcHandler:say({ - "Thank you, mortal being! Please keep the mirror. I think you may need it soon, because there is another problem. Would you help us again?", - }, npc, creature) + npcHandler:say("Thank you, mortal being! Please keep the mirror. I think you may need it soon, because there is another problem. Would you help us again?", npc, creature) npcHandler:setTopic(playerId, 5) player:setStorageValue(ThreatenedDreams.Mission02[1], 4) elseif player:getStorageValue(ThreatenedDreams.Mission02[1]) == 4 then - npcHandler:say({ - "Please keep the mirror. I think you may need it soon, because there is another problem. Would you help us again?", - }, npc, creature) + npcHandler:say("Please keep the mirror. I think you may need it soon, because there is another problem. Would you help us again?", npc, creature) npcHandler:setTopic(playerId, 5) else - npcHandler:say({ - "Please seek out the tainted fae, retrieve the artefact and free the captured fairies.", - }, npc, creature) + npcHandler:say("Please seek out the tainted fae, retrieve the artefact and free the captured fairies.", npc, creature) npcHandler:setTopic(playerId, 0) end elseif npcHandler:getTopic(playerId) == 5 then @@ -178,23 +152,17 @@ local function creatureSayCallback(npc, creature, type, message) player:setStorageValue(ThreatenedDreams.Mission02[1], 7) npcHandler:setTopic(playerId, 0) else - npcHandler:say({ - "You have to catch the respective lights and store it in the corresponding vessel.", - }, npc, creature) + npcHandler:say("You have to catch the respective lights and store it in the corresponding vessel.", npc, creature) npcHandler:setTopic(playerId, 0) end elseif npcHandler:getTopic(playerId) == 8 then if player:getStorageValue(ThreatenedDreams.Mission02.ChargedMoonMirror) == 0 and player:getStorageValue(ThreatenedDreams.Mission02.ChargedStarlightVial) == 0 and player:getStorageValue(ThreatenedDreams.Mission02.ChargedSunCatcher) == 0 then - npcHandler:say({ - "Thank you, mortal being! The fae will be forever grateful. Take this blossom bag as a little thank-you gift. Such blossoms grow on our trees just once in a decade, so they are quite rare.", - }, npc, creature) + npcHandler:say("Thank you, mortal being! The fae will be forever grateful. Take this blossom bag as a little thank-you gift. Such blossoms grow on our trees just once in a decade, so they are quite rare.", npc, creature) player:addItem(25780, 1) player:setStorageValue(ThreatenedDreams.Mission02[1], 8) npcHandler:setTopic(playerId, 0) else - npcHandler:say({ - "If you charge all fifteen arcane sources with the respective light, Feyrist's protection will be ensured again.", - }, npc, creature) + npcHandler:say("If you charge all fifteen arcane sources with the respective light, Feyrist's protection will be ensured again.", npc, creature) npcHandler:setTopic(playerId, 0) end end diff --git a/data-otservbr-global/scripts/quests/threatened_dreams/action-fairies_release.lua b/data-otservbr-global/scripts/quests/threatened_dreams/action_fairies_release.lua similarity index 100% rename from data-otservbr-global/scripts/quests/threatened_dreams/action-fairies_release.lua rename to data-otservbr-global/scripts/quests/threatened_dreams/action_fairies_release.lua diff --git a/data-otservbr-global/scripts/quests/threatened_dreams/action-moon_mirror.lua b/data-otservbr-global/scripts/quests/threatened_dreams/action_moon_mirror.lua similarity index 100% rename from data-otservbr-global/scripts/quests/threatened_dreams/action-moon_mirror.lua rename to data-otservbr-global/scripts/quests/threatened_dreams/action_moon_mirror.lua diff --git a/data-otservbr-global/scripts/quests/threatened_dreams/action-poacher_book.lua b/data-otservbr-global/scripts/quests/threatened_dreams/action_poacher_book.lua similarity index 100% rename from data-otservbr-global/scripts/quests/threatened_dreams/action-poacher_book.lua rename to data-otservbr-global/scripts/quests/threatened_dreams/action_poacher_book.lua diff --git a/data-otservbr-global/scripts/quests/threatened_dreams/action-poacher_notes.lua b/data-otservbr-global/scripts/quests/threatened_dreams/action_poacher_notes.lua similarity index 100% rename from data-otservbr-global/scripts/quests/threatened_dreams/action-poacher_notes.lua rename to data-otservbr-global/scripts/quests/threatened_dreams/action_poacher_notes.lua diff --git a/data-otservbr-global/scripts/quests/threatened_dreams/action-starlight_vial.lua b/data-otservbr-global/scripts/quests/threatened_dreams/action_starlight_vial.lua similarity index 100% rename from data-otservbr-global/scripts/quests/threatened_dreams/action-starlight_vial.lua rename to data-otservbr-global/scripts/quests/threatened_dreams/action_starlight_vial.lua diff --git a/data-otservbr-global/scripts/quests/threatened_dreams/action-sun_catcher.lua b/data-otservbr-global/scripts/quests/threatened_dreams/action_sun_catcher.lua similarity index 100% rename from data-otservbr-global/scripts/quests/threatened_dreams/action-sun_catcher.lua rename to data-otservbr-global/scripts/quests/threatened_dreams/action_sun_catcher.lua diff --git a/data-otservbr-global/scripts/quests/threatened_dreams/action-whelp_fur.lua b/data-otservbr-global/scripts/quests/threatened_dreams/action_whelp_fur.lua similarity index 100% rename from data-otservbr-global/scripts/quests/threatened_dreams/action-whelp_fur.lua rename to data-otservbr-global/scripts/quests/threatened_dreams/action_whelp_fur.lua diff --git a/data-otservbr-global/scripts/quests/threatened_dreams/event-raven_herb_bush.lua b/data-otservbr-global/scripts/quests/threatened_dreams/event_raven_herb_bush.lua similarity index 100% rename from data-otservbr-global/scripts/quests/threatened_dreams/event-raven_herb_bush.lua rename to data-otservbr-global/scripts/quests/threatened_dreams/event_raven_herb_bush.lua diff --git a/data-otservbr-global/scripts/quests/threatened_dreams/movement-kroazur_room.lua b/data-otservbr-global/scripts/quests/threatened_dreams/movement_kroazur_room.lua similarity index 99% rename from data-otservbr-global/scripts/quests/threatened_dreams/movement-kroazur_room.lua rename to data-otservbr-global/scripts/quests/threatened_dreams/movement_kroazur_room.lua index 46b6a58bd5e..3ca23a4ce84 100644 --- a/data-otservbr-global/scripts/quests/threatened_dreams/movement-kroazur_room.lua +++ b/data-otservbr-global/scripts/quests/threatened_dreams/movement_kroazur_room.lua @@ -1,4 +1,5 @@ local ThreatenedDreams = Storage.Quest.U11_40.ThreatenedDreams + local config = { [25029] = { bossName = "Kroazur", -- boss name diff --git a/data-otservbr-global/scripts/quests/threatened_dreams/movement-poacher_notes.lua b/data-otservbr-global/scripts/quests/threatened_dreams/movement_poacher_notes.lua similarity index 100% rename from data-otservbr-global/scripts/quests/threatened_dreams/movement-poacher_notes.lua rename to data-otservbr-global/scripts/quests/threatened_dreams/movement_poacher_notes.lua diff --git a/data-otservbr-global/scripts/quests/threatened_dreams/movement-swan_feathers.lua b/data-otservbr-global/scripts/quests/threatened_dreams/movement_swan_feathers.lua similarity index 100% rename from data-otservbr-global/scripts/quests/threatened_dreams/movement-swan_feathers.lua rename to data-otservbr-global/scripts/quests/threatened_dreams/movement_swan_feathers.lua From aaeaca5c20e28c9750ddc8636cd5df2c43068b47 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Sun, 13 Oct 2024 11:36:33 -0300 Subject: [PATCH 18/70] Dangerous Depths Quest --- data-otservbr-global/lib/core/quests.lua | 56 ++-- data-otservbr-global/lib/core/storages.lua | 214 +++++++------ data-otservbr-global/npc/gnomus.lua | 291 +++++++++--------- data-otservbr-global/npc/klom_stonecutter.lua | 240 +++++++-------- data-otservbr-global/npc/lardoc_bashsmite.lua | 207 ++++++------- .../creaturescripts/customs/freequests.lua | 30 +- .../actions_crude_lava_pump.lua | 12 +- .../actions_crude_lava_pump_achievements.lua | 18 +- .../dangerous_depth/actions_gnome_chart.lua | 40 +-- .../dangerous_depth/actions_gnome_items.lua | 22 +- .../actions_gnome_trignometre.lua | 34 +- .../dangerous_depth/actions_gnomish_chest.lua | 9 +- .../actions_gnomish_pesticide.lua | 9 +- .../dangerous_depth/actions_lever_barrel.lua | 112 ++++--- .../actions_using_crystals.lua | 36 +-- .../actions_warzone_crystals.lua | 36 +-- .../dangerous_depth/actions_wooden_trash.lua | 5 +- .../creaturescripts_lost_exile_task.lua | 66 ++-- .../movements_energy_entrance.lua | 27 +- .../movements_gnome_ordnance.lua | 4 +- .../movements_gnomes_ordnance_end.lua | 12 +- .../dangerous_depth/movements_lost_exiles.lua | 6 +- .../movements_warzone_entrance.lua | 61 ++-- .../scripts/spells/monster/exploding_cask.lua | 2 +- data-otservbr-global/startup/tables/item.lua | 159 ++++++++++ data-otservbr-global/startup/tables/lever.lua | 9 +- .../startup/tables/teleport.lua | 9 + data/items/items.xml | 4 + 28 files changed, 954 insertions(+), 776 deletions(-) diff --git a/data-otservbr-global/lib/core/quests.lua b/data-otservbr-global/lib/core/quests.lua index bd5cc91bb4f..81f2c71e41f 100644 --- a/data-otservbr-global/lib/core/quests.lua +++ b/data-otservbr-global/lib/core/quests.lua @@ -5463,12 +5463,12 @@ if not Quests then }, [39] = { name = "Dangerous Depths", - startStorageId = Storage.DangerousDepths.Questline, + startStorageId = Storage.Quest.U11_50.DangerousDepths.Questline, startStorageValue = 1, missions = { [1] = { name = "Dwarves: Home Improvement", - storageId = Storage.DangerousDepths.Dwarves.Home, + storageId = Storage.Quest.U11_50.DangerousDepths.Dwarves.Home, missionId = 10380, startValue = 1, endValue = 2, @@ -5476,14 +5476,14 @@ if not Quests then [1] = function(player) return ("Destroy makeshift homes of the Lost to force them to fight you! Try making some \z prisoners in the progress and report back to Klom Stonecutter.\n\nLost Exiles: %d/20\nPrisoners (bonus): \z - %d/3"):format(math.max(player:getStorageValue(Storage.DangerousDepths.Dwarves.LostExiles), 0), math.max(player:getStorageValue(Storage.DangerousDepths.Dwarves.Prisoners), 0)) + %d/3"):format(math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.LostExiles), 0), math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Prisoners), 0)) end, [2] = "You drove off the Lost but more are sure to come. Check back with Klom Stonecutter at a later time.", }, }, [2] = { name = "Dwarves: Subterranean Life", - storageId = Storage.DangerousDepths.Dwarves.Subterranean, + storageId = Storage.Quest.U11_50.DangerousDepths.Dwarves.Subterranean, missionId = 10381, startValue = 1, endValue = 2, @@ -5491,7 +5491,7 @@ if not Quests then [1] = function(player) return ("Klome Stonecutter sent you on a grave mission to exterminate large populaces of \z subterranian life. Looks like the dwarves make short work of the deep intruders.\n\nSubterranean organisms: \z - %d/50"):format(math.max(player:getStorageValue(Storage.DangerousDepths.Dwarves.Organisms), 0)) + %d/50"):format(math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Organisms), 0)) end, [2] = "You helped Klom defend the outpost by cutting down a number of vermin from deep down below. \z The gnomes don't seem to completely approve of this but everyone appreciates the drop in the enemy's ranks.", @@ -5499,7 +5499,7 @@ if not Quests then }, [3] = { name = "Gnomes: Gnomal Warming Measurements", - storageId = Storage.DangerousDepths.Gnomes.Measurements, + storageId = Storage.Quest.U11_50.DangerousDepths.Gnomes.Measurements, missionId = 10382, startValue = 1, endValue = 2, @@ -5507,11 +5507,11 @@ if not Quests then [1] = function(player) return ("Gnomus sent you on a mission to measure the rising heat from below.\n\nLocation A: \z %d/1\nLocation B: %d/1\nLocation C: %d/1\nLocation D: %d/1\nLocation E: %d/1"):format( - math.max(player:getStorageValue(Storage.DangerousDepths.Gnomes.LocationA), 0), - math.max(player:getStorageValue(Storage.DangerousDepths.Gnomes.LocationB), 0), - math.max(player:getStorageValue(Storage.DangerousDepths.Gnomes.LocationC), 0), - math.max(player:getStorageValue(Storage.DangerousDepths.Gnomes.LocationD), 0), - math.max(player:getStorageValue(Storage.DangerousDepths.Gnomes.LocationE), 0) + math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationA), 0), + math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationB), 0), + math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationC), 0), + math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationD), 0), + math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationE), 0) ) end, [2] = "You helped Lardoc Bashsmite fighting back the verminous growth in the northern mineshaft. \z @@ -5520,7 +5520,7 @@ if not Quests then }, [4] = { name = "Gnomes: Ordnance", - storageId = Storage.DangerousDepths.Gnomes.Ordnance, + storageId = Storage.Quest.U11_50.DangerousDepths.Gnomes.Ordnance, missionId = 10383, startValue = 1, endValue = 3, @@ -5529,7 +5529,7 @@ if not Quests then Travel to the east of the cave system and find the old gnome trail where reinforcements will arrive.", [2] = function(player) return ("You found the old gnome trail where ordnance for the gnome outpost arrive, escort them \z - and their pack animals to safety and return to Gnomus.\n\nRescued gnomes: %d/5\nRescued animals: %d/3"):format(math.max(player:getStorageValue(Storage.DangerousDepths.Gnomes.GnomesCount), 0), math.max(player:getStorageValue(Storage.DangerousDepths.Gnomes.CrawlersCount), 0)) + and their pack animals to safety and return to Gnomus.\n\nRescued gnomes: %d/5\nRescued animals: %d/3"):format(math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.GnomesCount), 0), math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.CrawlersCount), 0)) end, [3] = "You helped Lardoc Bashsmite fighting back the verminous growth in the northern mineshaft. \z Return to him later to see if he has more work for you.", @@ -5537,7 +5537,7 @@ if not Quests then }, [5] = { name = "Gnomes: Uncharted Territory", - storageId = Storage.DangerousDepths.Gnomes.Charting, + storageId = Storage.Quest.U11_50.DangerousDepths.Gnomes.Charting, missionId = 10384, startValue = 1, endValue = 2, @@ -5546,12 +5546,12 @@ if not Quests then return ("Chart the area around the deep base for Gnomus. Look for especific landmarks: \z \n\nOld Gate: %d/1\nThe Gaze: %d/1\nLost Ruin: %d/1\nOutpost: %d/1\nBastion: %d/1\nBroken Tower: \z %d/1"):format( - math.max(player:getStorageValue(Storage.DangerousDepths.Gnomes.OldGate), 0), - math.max(player:getStorageValue(Storage.DangerousDepths.Gnomes.TheGaze), 0), - math.max(player:getStorageValue(Storage.DangerousDepths.Gnomes.LostRuin), 0), - math.max(player:getStorageValue(Storage.DangerousDepths.Gnomes.Outpost), 0), - math.max(player:getStorageValue(Storage.DangerousDepths.Gnomes.Bastion), 0), - math.max(player:getStorageValue(Storage.DangerousDepths.Gnomes.BrokenTower), 0) + math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.OldGate), 0), + math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.TheGaze), 0), + math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LostRuin), 0), + math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Outpost), 0), + math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Bastion), 0), + math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.BrokenTower), 0) ) end, [2] = "You helped Gnomus chart the area around the deep base. You found traces of what \z @@ -5560,7 +5560,7 @@ if not Quests then }, [6] = { name = "Scouts: Explosive Growth", - storageId = Storage.DangerousDepths.Scouts.Growth, + storageId = Storage.Quest.U11_50.DangerousDepths.Scouts.Growth, missionId = 10385, startValue = 1, endValue = 2, @@ -5568,11 +5568,11 @@ if not Quests then [1] = function(player) return ("You found the mine shaft. Burn all the growth and report back to Lardoc Bashsmite! \z \n\nFirst Room: %d/1\nSecond room: %d/1\nThird room: %d/1\nFourth room: %d/1\nFifth room: %d/1"):format( - math.max(player:getStorageValue(Storage.DangerousDepths.Scouts.FirstBarrel), 0), - math.max(player:getStorageValue(Storage.DangerousDepths.Scouts.SecondBarrel), 0), - math.max(player:getStorageValue(Storage.DangerousDepths.Scouts.ThirdBarrel), 0), - math.max(player:getStorageValue(Storage.DangerousDepths.Scouts.FourthBarrel), 0), - math.max(player:getStorageValue(Storage.DangerousDepths.Scouts.FifthBarrel), 0) + math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.FirstBarrel), 0), + math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.SecondBarrel), 0), + math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.ThirdBarrel), 0), + math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.FourthBarrel), 0), + math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.FifthBarrel), 0) ) end, [2] = "You helped Lardoc Bashsmite fighting back the verminous growth in the northern mineshaft. \z @@ -5581,7 +5581,7 @@ if not Quests then }, [7] = { name = "Scouts: Pesticide", - storageId = Storage.DangerousDepths.Scouts.Diremaw, + storageId = Storage.Quest.U11_50.DangerousDepths.Scouts.Diremaw, missionId = 10386, startValue = 1, endValue = 2, @@ -5589,7 +5589,7 @@ if not Quests then [1] = function(player) return ("Lardoc asked you to follow a plan of the gnomes to stop the deep threat by trying to \z neutralise diremaw spawn with pesticies. Diremaws lay eggs inside corpses of their skin. \z - \n\nNeutralised: %d/20"):format(math.max(player:getStorageValue(Storage.DangerousDepths.Scouts.DiremawsCount), 0)) + \n\nNeutralised: %d/20"):format(math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.DiremawsCount), 0)) end, [2] = "You reported back to Lardoc Bashsmite to inform him that the gnome's plan to \z neutralise diremaw corpses seems to work.", diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index 7781249b9d1..d9ff1c95524 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -227,107 +227,6 @@ Storage = { Obujos = 50077, DeeplingStatus = 50078, }, - DangerousDepths = { - -- Reserved storage from 50080 - 50199 - Questline = 50080, - Dwarves = { - Status = 50081, - Home = 50082, -- Mission - Subterranean = 50083, -- Mission - LostExiles = 50084, - Prisoners = 50085, - Organisms = 50086, - TimeTaskHome = 50087, - TimeTaskSubterranean = 50088, - }, - Scouts = { - Status = 50090, - Diremaw = 50091, -- Mission - Growth = 50092, -- Mission - DiremawsCount = 50093, - GnomishChest = 50094, - BarrelCount = 50095, - FirstBarrel = 50096, - SecondBarrel = 50097, - ThirdBarrel = 50098, - FourthBarrel = 50099, - FifthBarrel = 50100, - TimeTaskDiremaws = 50101, - TimeTaskGrowth = 50102, - Barrel = 50103, - BarrelTimer = 50104, - }, - Gnomes = { - Status = 50115, - Ordnance = 50116, -- Mission - Measurements = 50117, -- Mission - Charting = 50118, -- Mission - GnomeChartChest = 50119, -- Measurements - GnomeChartPaper = 50120, -- Charting - GnomesCount = 50121, -- Ordnance - CrawlersCount = 50122, -- Ordnance - LocationA = 50123, -- Measurements - LocationB = 50124, -- Measurements - LocationC = 50125, -- Measurements - LocationD = 50126, -- Measurements - LocationE = 50127, -- Measurements - LocationCount = 50128, -- Measurements - OldGate = 50129, -- Charting - TheGaze = 50130, -- Charting - LostRuin = 50131, -- Charting - Outpost = 50132, -- Charting - Bastion = 50133, - -- Charting - BrokenTower = 50134, -- Charting - ChartingCount = 50135, -- Contador - TimeTaskOrdnance = 50136, - TimeTaskMeasurements = 50137, - TimeTaskCharting = 50138, - }, - Access = { - LavaPumpWarzoneVI = 50139, - TimerWarzoneVI = 50140, - LavaPumpWarzoneV = 50141, - TimerWarzoneV = 50142, - LavaPumpWarzoneIV = 50143, - TimerWarzoneIV = 50144, - }, - Crystals = { - WarzoneVI = { - BigCrystal1 = 50155, - BigCrystal2 = 50156, - MediumCrystal1 = 50157, - MediumCrystal2 = 50158, - SmallCrystal1 = 50159, - SmallCrystal2 = 50160, - }, - WarzoneV = { - BigCrystal1 = 50165, - BigCrystal2 = 50166, - MediumCrystal1 = 50167, - MediumCrystal2 = 50168, - SmallCrystal1 = 50169, - SmallCrystal2 = 50170, - }, - WarzoneIV = { - BigCrystal1 = 50175, - BigCrystal2 = 50176, - MediumCrystal1 = 50177, - MediumCrystal2 = 50178, - SmallCrystal1 = 50179, - SmallCrystal2 = 50180, - }, - }, - Bosses = { - TheCountOfTheCore = 50185, - TheDukeOfTheDepths = 50186, - TheBaronFromBelow = 50187, - TheCountOfTheCoreAchiev = 50188, - TheDukeOfTheDepthsAchiev = 50189, - TheBaronFromBelowAchiev = 50190, - LastAchievement = 50191, - }, - }, HeroRathleton = { -- Reserved storage from 50400 - 50419 QuestLine = 50400, @@ -2596,7 +2495,110 @@ Storage = { }, }, U11_50 = { -- update 11.50 - Reserved Storages 45851 - 46000 - DangerousDepths = {}, + DangerousDepths = { + Questline = 45851, + Dwarves = { + Points = 50081, + Home = 50082, + Subterranean = 50083, + LostExiles = 50084, + Prisoners = 50085, + Organisms = 50086, + TimeTaskHome = 50087, + TimeTaskSubterranean = 50088, + }, + Scouts = { + Points = 50090, + Diremaw = 50091, + Growth = 50092, + DiremawsCount = 50093, + GnomishChest = 50094, + BarrelCount = 50095, + FirstBarrel = 50096, + SecondBarrel = 50097, + ThirdBarrel = 50098, + FourthBarrel = 50099, + FifthBarrel = 50100, + TimeTaskDiremaws = 50101, + TimeTaskGrowth = 50102, + Barrel = 50103, + BarrelTimer = 50104, + }, + Gnomes = { + Points = 50115, + Ordnance = 50116, + Measurements = 50117, + Charting = 50118, + GnomeChartChest = 50119, + GnomeChartPaper = 50120, + GnomesCount = 50121, + CrawlersCount = 50122, + LocationA = 50123, + LocationB = 50124, + LocationC = 50125, + LocationD = 50126, + LocationE = 50127, + LocationCount = 50128, + OldGate = 50129, + TheGaze = 50130, + LostRuin = 50131, + Outpost = 50132, + Bastion = 50133, + BrokenTower = 50134, + ChartingCount = 50135, + TimeTaskOrdnance = 50136, + TimeTaskMeasurements = 50137, + TimeTaskCharting = 50138, + }, + Access = { + LavaPumpWarzoneVI = 50139, + TimerWarzoneVI = 50140, + LavaPumpWarzoneV = 50141, + TimerWarzoneV = 50142, + LavaPumpWarzoneIV = 50143, + TimerWarzoneIV = 50144, + }, + Crystals = { + WarzoneVI = { + BigCrystal1 = 50155, + BigCrystal2 = 50156, + MediumCrystal1 = 50157, + MediumCrystal2 = 50158, + SmallCrystal1 = 50159, + SmallCrystal2 = 50160, + }, + WarzoneV = { + BigCrystal1 = 50165, + BigCrystal2 = 50166, + MediumCrystal1 = 50167, + MediumCrystal2 = 50168, + SmallCrystal1 = 50169, + SmallCrystal2 = 50170, + }, + WarzoneIV = { + BigCrystal1 = 50175, + BigCrystal2 = 50176, + MediumCrystal1 = 50177, + MediumCrystal2 = 50178, + SmallCrystal1 = 50179, + SmallCrystal2 = 50180, + }, + }, + Bosses = { + TheCountOfTheCore = 50185, + TheDukeOfTheDepths = 50186, + TheBaronFromBelow = 50187, + TheCountOfTheCoreAchiev = 50188, + TheDukeOfTheDepthsAchiev = 50189, + TheBaronFromBelowAchiev = 50190, + LastAchievement = 50191, + }, + Geodes = { + WarzoneVI = 60001, + WarzoneV = 60002, + WarzoneIV = 60003, + }, + }, HiddenThreats = { QuestLine = 45971, RatterDoor = 45972, @@ -2818,14 +2820,6 @@ Storage = { } GlobalStorage = { - DangerousDepths = { - -- Reserved storage from 60001 - 60009 - Geodes = { - WarzoneVI = 60001, - WarzoneV = 60002, - WarzoneIV = 60003, - }, - }, Feroxa = { -- Reserved storage from 60020 - 60029 Chance = 60020, diff --git a/data-otservbr-global/npc/gnomus.lua b/data-otservbr-global/npc/gnomus.lua index f12104ca8e0..deb9870fc1b 100644 --- a/data-otservbr-global/npc/gnomus.lua +++ b/data-otservbr-global/npc/gnomus.lua @@ -50,38 +50,7 @@ npcType.onCloseChannel = function(npc, creature) npcHandler:onCloseChannel(npc, creature) end -local quantidade = {} - -local function greetCallback(npc, creature) - local player = Player(creature) - local playerId = player:getId() - - if player then - npcHandler:setMessage(MESSAGE_GREET, { "Greetings, member of the Bigfoot Brigade. We could really use some {help} from you right now. You should prove {worthy} to our alliance." }) - npcHandler:setTopic(playerId, 1) - end - return true -end - -keywordHandler:addKeyword({ "help" }, StdModule.say, { npcHandler = npcHandler, text = "If you're willing to help us, we could need an escort for arriving {ordnance}, help with {charting} the cave system and someone needs to get some heat {measurements} fast." }) -keywordHandler:addKeyword({ "worthy" }, StdModule.say, { - npcHandler = npcHandler, - text = { - "You're already known amongst the gnomes, member of the Bigfoot Brigade. I will make sure that the alliance learns of your deeds but you'll still need to help the dwarves and gnomes of this outpost to show your worth. ...", - "We also found {suspicious devices} carried by all kinds of creatures down here. Down here, they are of extreme worth to us since they could contain the key to what's happening all around us. ...", - "If you can aquire any, return them to me and I make sure to tell the others of your generosity. Return to me afterwards to check on your current {status}.", - }, -}) -keywordHandler:addKeyword({ "base" }, StdModule.say, { - npcHandler = npcHandler, - text = { "Gnomish supplies and ingenuity have helped to establish and fortify this outpost. ...", "Our knowledge of the enemy and it's tactics would be of more use if the dwarves would listen to us somewhat more. But gnomes have learned to live with the imperfection of the other races." }, -}) -keywordHandler:addKeyword({ "efforts" }, StdModule.say, { - npcHandler = npcHandler, - text = { "Our surveys of the area showed us some spikes in heat and seismic activity at very specific places. ...", "We conclude this is no coincidence and the enemy is using devices to pump up the lava to flood the area. We have seen it before and had to retreat each time. ...", "This time though we might have a counter prepared - given me manage to pierce their defences." }, -}) -keywordHandler:addKeyword({ "name" }, StdModule.say, { npcHandler = npcHandler, text = "My name is Gnomus." }) -keywordHandler:addKeyword({ "job" }, StdModule.say, { npcHandler = npcHandler, text = "I'm the main gnomish contact for this base. I coordinate our efforts with those of the dwarves to ensure everything is running smoothly." }) +local amount = {} local function creatureSayCallback(npc, creature, type, message) local player = Player(creature) @@ -91,15 +60,14 @@ local function creatureSayCallback(npc, creature, type, message) return false end - local time = configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN) + local time = 20 * 60 * 60 -- 20 hours - -- missão measurements - if MsgContains(message, "measurements") and npcHandler:getTopic(playerId) == 1 then - if player:getStorageValue(Storage.DangerousDepths.Gnomes.Measurements) == 2 and player:getStorageValue(Storage.DangerousDepths.Gnomes.TimeTaskMeasurements) > 0 then -- Ainda não se passaram as 20h - npcHandler:say({ "I don't need your help for now. Come back later." }, npc, creature) + if MsgContains(message, "measurements") then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Measurements) == 2 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.TimeTaskMeasurements) > 0 then + npcHandler:say("I don't need your help for now. Come back later.", npc, creature) npcHandler:setTopic(playerId, 1) end - if player:getStorageValue(Storage.DangerousDepths.Gnomes.Measurements) == 2 and player:getStorageValue(Storage.DangerousDepths.Gnomes.TimeTaskMeasurements) <= 0 then -- Vai fazer a missão após 20h + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Measurements) == 2 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.TimeTaskMeasurements) <= 0 then npcHandler:say({ "The heat down here is not the only problem we have but one of our greatest concerns. Not only is it almost unbearable for us, it also seems to be rising. ...", "We need to find out if this is true and what that means for this place - and for us gnomes. You can help us do this by grabbing one of our trignometres and collecting as much as data from the heat in this area as possible. ...", @@ -107,47 +75,53 @@ local function creatureSayCallback(npc, creature, type, message) }, npc, creature) npcHandler:setTopic(playerId, 2) end - if player:getStorageValue(Storage.DangerousDepths.Gnomes.Measurements) < 1 then -- Não possuía a missão, agora possui! + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Measurements) < 1 then npcHandler:say({ "The heat down here is not the only problem we have but one of our greatest concerns. Not only is it almost unbearable for us, it also seems to be rising. ...", "We need to find out if this is true and what that means for this place - and for us gnomes. You can help us do this by grabbing one of our trignometres and collecting as much as data from the heat in this area as possible. ...", "We'd need at least 5 measurements. Are you willing to do this?", }, npc, creature) npcHandler:setTopic(playerId, 2) - elseif (player:getStorageValue(Storage.DangerousDepths.Gnomes.Measurements) == 1) and (player:getStorageValue(Storage.DangerousDepths.Gnomes.LocationCount) < 5) then -- Está na missão porém não terminou a task! - npcHandler:say({ "Come back when you have finished your job." }, npc, creature) + elseif (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Measurements) == 1) and (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationCount) < 5) then + npcHandler:say("Come back when you have finished your job.", npc, creature) npcHandler:setTopic(playerId, 1) - elseif player:getStorageValue(Storage.DangerousDepths.Gnomes.Measurements) == 1 and player:getStorageValue(Storage.DangerousDepths.Gnomes.LocationCount) == 5 then -- Não possuía a missão, agora possui! - npcHandler:say({ "Excellent, you returned with more data! Let me see... hmm. ...", "Well, we need more data on this but first I will have to show this to our grand horticulturist. Thank you for getting this for us!" }, npc, creature) - player:setStorageValue(Storage.DangerousDepths.Gnomes.TimeTaskMeasurements, os.time() + time) + elseif player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Measurements) == 1 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationCount) == 5 then + npcHandler:say({ + "Excellent, you returned with more data! Let me see... hmm. ...", + "Well, we need more data on this but first I will have to show this to our grand horticulturist. Thank you for getting this for us!" + }, npc, creature) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.TimeTaskMeasurements, os.time() + time) player:addItem(27654, 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.Status, player:getStorageValue(Storage.DangerousDepths.Gnomes.Status) + 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.Measurements, 2) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points) + 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Measurements, 2) npcHandler:setTopic(playerId, 1) end elseif npcHandler:getTopic(playerId) == 2 and MsgContains(message, "yes") then - npcHandler:say({ "How fortunate! There are some trignometres lying around next to that device behind me. Take one and hold it next to high temperature heat sources. ...", "If you gathered enough data, you will actually smell it from the device. ...", "Return to me with the results afterwards. Best of luck, we count on you!" }, npc, creature) - if player:getStorageValue(Storage.DangerousDepths.Questline) < 1 then - player:setStorageValue(Storage.DangerousDepths.Questline, 1) + npcHandler:say({ + "How fortunate! There are some trignometres lying around next to that device behind me. Take one and hold it next to high temperature heat sources. ...", + "If you gathered enough data, you will actually smell it from the device. ...", + "Return to me with the results afterwards. Best of luck, we count on you!" + }, npc, creature) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Questline) < 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Questline, 1) end - player:setStorageValue(Storage.DangerousDepths.Gnomes.Measurements, 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.GnomeChartChest, 1) -- Permissão para usar o baú - player:setStorageValue(Storage.DangerousDepths.Gnomes.LocationCount, 0) -- Garantindo que a task não inicie com -1 - player:setStorageValue(Storage.DangerousDepths.Gnomes.LocationA, 0) -- Garantindo que a task não inicie com -1 - player:setStorageValue(Storage.DangerousDepths.Gnomes.LocationB, 0) -- Garantindo que a task não inicie com -1 - player:setStorageValue(Storage.DangerousDepths.Gnomes.LocationC, 0) -- Garantindo que a task não inicie com -1 - player:setStorageValue(Storage.DangerousDepths.Gnomes.LocationD, 0) -- Garantindo que a task não inicie com -1 - player:setStorageValue(Storage.DangerousDepths.Gnomes.LocationE, 0) -- Garantindo que a task não inicie com -1 + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Measurements, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.GnomeChartChest, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationCount, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationA, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationB, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationC, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationD, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationE, 0) npcHandler:setTopic(playerId, 1) end - -- missão ordnance - if MsgContains(message, "ordnance") and npcHandler:getTopic(playerId) == 1 then - if player:getStorageValue(Storage.DangerousDepths.Gnomes.Ordnance) == 3 and player:getStorageValue(Storage.DangerousDepths.Gnomes.TimeTaskOrdnance) > 0 then -- Ainda não se passaram as 20h - npcHandler:say({ "I don't need your help for now. Come back later." }, npc, creature) + if MsgContains(message, "ordnance") then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Ordnance) == 3 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.TimeTaskOrdnance) > 0 then + npcHandler:say("I don't need your help for now. Come back later.", npc, creature) npcHandler:setTopic(playerId, 1) end - if player:getStorageValue(Storage.DangerousDepths.Gnomes.Ordnance) == 3 and player:getStorageValue(Storage.DangerousDepths.Gnomes.TimeTaskOrdnance) <= 0 then -- Vai fazer a missão após 20h + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Ordnance) == 3 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.TimeTaskOrdnance) <= 0 then npcHandler:say({ "I am constantly waiting for ordnance to arrive. A lot of gnomes intend to travel out here to help us but the main access path to our base is not safe anymore. ...", "Tragically we lost several gnomes after an outbreak of what I can only describe as a force from below. We were completely surprised by their onslaught and retreated to this outpost. ...", @@ -157,7 +131,7 @@ local function creatureSayCallback(npc, creature, type, message) }, npc, creature) npcHandler:setTopic(playerId, 22) end - if player:getStorageValue(Storage.DangerousDepths.Gnomes.Ordnance) < 1 then -- Não possuía a missão, agora possui! + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Ordnance) < 1 then npcHandler:say({ "I am constantly waiting for ordnance to arrive. A lot of gnomes intend to travel out here to help us but the main access path to our base is not safe anymore. ...", "Tragically we lost several gnomes after an outbreak of what I can only describe as a force from below. We were completely surprised by their onslaught and retreated to this outpost. ...", @@ -166,47 +140,48 @@ local function creatureSayCallback(npc, creature, type, message) "Are you willing to help?", }, npc, creature) npcHandler:setTopic(playerId, 22) - elseif (player:getStorageValue(Storage.DangerousDepths.Gnomes.Ordnance) == 1) or (player:getStorageValue(Storage.DangerousDepths.Gnomes.Ordnance) == 2 and player:getStorageValue(Storage.DangerousDepths.Gnomes.GnomesCount) < 5) then -- Está na missão porém não terminou a task! - npcHandler:say({ "Come back when you have finished your job." }, npc, creature) + elseif (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Ordnance) == 1) or (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Ordnance) == 2 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.GnomesCount) < 5) then + npcHandler:say("Come back when you have finished your job.", npc, creature) npcHandler:setTopic(playerId, 1) - elseif player:getStorageValue(Storage.DangerousDepths.Gnomes.Ordnance) == 2 and player:getStorageValue(Storage.DangerousDepths.Gnomes.GnomesCount) >= 5 then -- Não possuía a missão, agora possui! - if player:getStorageValue(Storage.DangerousDepths.Gnomes.CrawlersCount) >= 3 then - npcHandler:say({ "AMAZING! Not only did you salve all our friends - you also rescued the animals! Here is your reward and bonus! ...", "The other are already telling stories about you. Please return to me later if you want to help out some more!" }, npc, creature) - player:setStorageValue(Storage.DangerousDepths.Gnomes.TimeTaskOrdnance, os.time() + time) + elseif player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Ordnance) == 2 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.GnomesCount) >= 5 then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.CrawlersCount) >= 3 then + npcHandler:say({ + "AMAZING! Not only did you salve all our friends - you also rescued the animals! Here is your reward and bonus! ...", + "The other are already telling stories about you. Please return to me later if you want to help out some more!" + }, npc, creature) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.TimeTaskOrdnance, os.time() + time) player:addItem(27654, 2) - player:setStorageValue(Storage.DangerousDepths.Gnomes.Status, player:getStorageValue(Storage.DangerousDepths.Gnomes.Status) + 2) - player:setStorageValue(Storage.DangerousDepths.Gnomes.Ordnance, 3) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points) + 2) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Ordnance, 3) else - npcHandler:say({ "The other are already telling stories about you. Please return to me later if you want to help out some more!" }, npc, creature) - player:setStorageValue(Storage.DangerousDepths.Gnomes.TimeTaskOrdnance, os.time() + time) + npcHandler:say("The other are already telling stories about you. Please return to me later if you want to help out some more!", npc, creature) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.TimeTaskOrdnance, os.time() + time) player:addItem(27654, 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.Status, player:getStorageValue(Storage.DangerousDepths.Gnomes.Status) + 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.Ordnance, 3) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points) + 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Ordnance, 3) end npcHandler:setTopic(playerId, 1) end elseif npcHandler:getTopic(playerId) == 22 and MsgContains(message, "yes") then - npcHandler:say( - { "Excellent, just follow the path to east until you reach a dead end, there is a hole that leads to a small cave underneath which will bring you right to the old trail. ...", "Help whoever you can and return them to the save cave exit - oh, and while you're at it... some of them will have pack animals. If you can rescue those as well, I'll hand you a bonus. Good luck!" }, - npc, - creature - ) - if player:getStorageValue(Storage.DangerousDepths.Questline) < 1 then - player:setStorageValue(Storage.DangerousDepths.Questline, 1) + npcHandler:say({ + "Excellent, just follow the path to east until you reach a dead end, there is a hole that leads to a small cave underneath which will bring you right to the old trail. ...", + "Help whoever you can and return them to the save cave exit - oh, and while you're at it... some of them will have pack animals. If you can rescue those as well, I'll hand you a bonus. Good luck!" + }, npc, creature) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Questline) < 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Questline, 1) end - player:setStorageValue(Storage.DangerousDepths.Gnomes.Ordnance, 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.GnomesCount, 0) -- Garantindo que a task não inicie com -1 - player:setStorageValue(Storage.DangerousDepths.Gnomes.CrawlersCount, 0) -- Garantindo que a task não inicie com -1 + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Ordnance, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.GnomesCount, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.CrawlersCount, 0) npcHandler:setTopic(playerId, 1) end - -- missão charting - if MsgContains(message, "charting") and npcHandler:getTopic(playerId) == 1 then - if player:getStorageValue(Storage.DangerousDepths.Gnomes.Charting) == 2 and player:getStorageValue(Storage.DangerousDepths.Gnomes.TimeTaskCharting) > 0 then -- Ainda não se passaram as 20h - npcHandler:say({ "I don't need your help for now. Come back later." }, npc, creature) + if MsgContains(message, "charting") then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Charting) == 2 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.TimeTaskCharting) > 0 then + npcHandler:say("I don't need your help for now. Come back later.", npc, creature) npcHandler:setTopic(playerId, 1) end - if player:getStorageValue(Storage.DangerousDepths.Gnomes.Charting) == 2 and player:getStorageValue(Storage.DangerousDepths.Gnomes.TimeTaskCharting) <= 0 then -- Vai fazer a missão após 20h + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Charting) == 2 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.TimeTaskCharting) <= 0 then npcHandler:say({ "While exploring these caves to find places to collect spores and grow mushrooms, we found several strange structures. I am convinced that this system was once home to intelligent beings. ...", "However, the creatures from below are now disturbing our research as well as some particularly pesky dwarves who just would not leave us alone. ...", @@ -215,7 +190,7 @@ local function creatureSayCallback(npc, creature, type, message) }, npc, creature) npcHandler:setTopic(playerId, 33) end - if player:getStorageValue(Storage.DangerousDepths.Gnomes.Charting) < 1 then -- Não possuía a missão, agora possui! + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Charting) < 1 then npcHandler:say({ "While exploring these caves to find places to collect spores and grow mushrooms, we found several strange structures. I am convinced that this system was once home to intelligent beings. ...", "However, the creatures from below are now disturbing our research as well as some particularly pesky dwarves who just would not leave us alone. ...", @@ -223,21 +198,21 @@ local function creatureSayCallback(npc, creature, type, message) "I am especially interested in the scattered dark structures around these parts. Would you do that?", }, npc, creature) npcHandler:setTopic(playerId, 33) - elseif (player:getStorageValue(Storage.DangerousDepths.Gnomes.Charting) == 1) and (player:getStorageValue(Storage.DangerousDepths.Gnomes.ChartingCount) < 3) then -- Está na missão porém não terminou a task! - npcHandler:say({ "Come back when you have finished your job." }, npc, creature) + elseif (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Charting) == 1) and (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.ChartingCount) < 3) then + npcHandler:say("Come back when you have finished your job.", npc, creature) npcHandler:setTopic(playerId, 1) end - if player:getStorageValue(Storage.DangerousDepths.Gnomes.Charting) == 1 and player:getStorageValue(Storage.DangerousDepths.Gnomes.ChartingCount) >= 3 then -- Não possuía a missão, agora possui! - npcHandler:say({ "Thank you very much! With those structures mapped out we will be able to complete the puzzle in no time!" }, npc, creature) - if player:getStorageValue(Storage.DangerousDepths.Gnomes.ChartingCount) == 6 then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Charting) == 1 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.ChartingCount) >= 3 then + npcHandler:say("Thank you very much! With those structures mapped out we will be able to complete the puzzle in no time!", npc, creature) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.ChartingCount) == 6 then player:addItem(27654, 2) - player:setStorageValue(Storage.DangerousDepths.Gnomes.Status, player:getStorageValue(Storage.DangerousDepths.Gnomes.Status) + 2) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points) + 2) else player:addItem(27654, 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.Status, player:getStorageValue(Storage.DangerousDepths.Gnomes.Status) + 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points) + 1) end - player:setStorageValue(Storage.DangerousDepths.Gnomes.Charting, 2) - player:setStorageValue(Storage.DangerousDepths.Gnomes.TimeTaskCharting, os.time() + time) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Charting, 2) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.TimeTaskCharting, os.time() + time) npcHandler:setTopic(playerId, 1) end elseif npcHandler:getTopic(playerId) == 33 and MsgContains(message, "yes") then @@ -246,97 +221,125 @@ local function creatureSayCallback(npc, creature, type, message) "Take one from the stack here next to me and map as many structures as possible. However, we need at least three locations to make any sense of this ancient layout at all. ...", "If you manage to map one of each structure around these parts - I assume there must be at least two times as many around here - I will hand you a bonus!", }, npc, creature) - if player:getStorageValue(Storage.DangerousDepths.Questline) < 1 then - player:setStorageValue(Storage.DangerousDepths.Questline, 1) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Questline) < 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Questline, 1) end - player:setStorageValue(Storage.DangerousDepths.Gnomes.Charting, 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.ChartingCount, 0) -- Garantindo que a task não inicie com -1 - player:setStorageValue(Storage.DangerousDepths.Gnomes.GnomeChartPaper, 1) -- Permissão para usar o papel - player:setStorageValue(Storage.DangerousDepths.Gnomes.OldGate, 0) -- Garantindo que a task não inicie com -1 - player:setStorageValue(Storage.DangerousDepths.Gnomes.TheGaze, 0) -- Garantindo que a task não inicie com -1 - player:setStorageValue(Storage.DangerousDepths.Gnomes.LostRuin, 0) -- Garantindo que a task não inicie com -1 - player:setStorageValue(Storage.DangerousDepths.Gnomes.Outpost, 0) -- Garantindo que a task não inicie com -1 - player:setStorageValue(Storage.DangerousDepths.Gnomes.Bastion, 0) -- Garantindo que a task não inicie com -1 - player:setStorageValue(Storage.DangerousDepths.Gnomes.BrokenTower, 0) -- Garantindo que a task não inicie com -1 + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Charting, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.ChartingCount, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.GnomeChartPaper, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.OldGate, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.TheGaze, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LostRuin, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Outpost, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Bastion, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.BrokenTower, 0) npcHandler:setTopic(playerId, 1) end + local plural = "" + if MsgContains(message, "suspicious devices") or MsgContains(message, "suspicious device") then - npcHandler:say({ "If you bring me any suspicious devices on creatures you slay down here, I'll make it worth your while by telling the others of your generosity. How many do you want to offer? " }, npc, creature) + npcHandler:say("If you bring me any suspicious devices on creatures you slay down here, I'll make it worth your while by telling the others of your generosity. How many do you want to offer? ", npc, creature) npcHandler:setTopic(playerId, 55) elseif npcHandler:getTopic(playerId) == 55 then - quantidade[playerId] = tonumber(message) - if quantidade[playerId] then - if quantidade[playerId] > 1 then + amount[playerId] = tonumber(message) + if amount[playerId] then + if amount[playerId] > 1 then plural = plural .. "s" end - npcHandler:say({ "You want to offer " .. quantidade[playerId] .. " suspicious device" .. plural .. ". Which leader shall have it, (Gnomus) of the {gnomes}, (Klom Stonecutter) of the {dwarves} or the {scouts} (Lardoc Bashsmite)?" }, npc, creature) + npcHandler:say("You want to offer " .. amount[playerId] .. " suspicious device" .. plural .. ". Which leader shall have it, (Gnomus) of the {gnomes}, (Klom Stonecutter) of the {dwarves} or the {scouts} (Lardoc Bashsmite)?", npc, creature) npcHandler:setTopic(playerId, 56) else - npcHandler:say({ "Don't waste my time." }, npc, creature) + npcHandler:say("Don't waste my time.", npc, creature) npcHandler:setTopic(playerId, 1) end elseif MsgContains(message, "gnomes") and npcHandler:getTopic(playerId) == 56 then - if player:getItemCount(30888) >= quantidade[playerId] then - npcHandler:say({ "Done." }, npc, creature) - if quantidade[playerId] > 1 then + if player:getItemCount(30888) >= amount[playerId] then + npcHandler:say("Done.", npc, creature) + if amount[playerId] > 1 then plural = plural .. "s" end - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You earned " .. quantidade[playerId] .. " point" .. plural .. " on the gnomes mission.") - player:removeItem(30888, quantidade[playerId]) - player:setStorageValue(Storage.DangerousDepths.Gnomes.Status, player:getStorageValue(Storage.DangerousDepths.Gnomes.Status) + quantidade[playerId]) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You earned " .. amount[playerId] .. " point" .. plural .. " on the gnomes mission.") + player:removeItem(30888, amount[playerId]) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points) + amount[playerId]) else - npcHandler:say({ "You don't have enough suspicious devices." }, npc, creature) + npcHandler:say("You don't have enough suspicious devices.", npc, creature) npcHandler:setTopic(playerId, 1) end elseif MsgContains(message, "dwarves") and npcHandler:getTopic(playerId) == 56 then - if player:getItemCount(30888) >= quantidade[playerId] then - npcHandler:say({ "Done." }, npc, creature) - if quantidade[playerId] > 1 then + if player:getItemCount(30888) >= amount[playerId] then + npcHandler:say("Done.", npc, creature) + if amount[playerId] > 1 then plural = plural .. "s" end - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You earned " .. quantidade[playerId] .. " point" .. plural .. " on the dwarves mission.") - player:removeItem(30888, quantidade[playerId]) - player:setStorageValue(Storage.DangerousDepths.Dwarves.Status, player:getStorageValue(Storage.DangerousDepths.Dwarves.Status) + quantidade[playerId]) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You earned " .. amount[playerId] .. " point" .. plural .. " on the dwarves mission.") + player:removeItem(30888, amount[playerId]) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Points) + amount[playerId]) else - npcHandler:say({ "You don't have enough suspicious devices." }, npc, creature) + npcHandler:say("You don't have enough suspicious devices.", npc, creature) npcHandler:setTopic(playerId, 1) end elseif MsgContains(message, "scouts") and npcHandler:getTopic(playerId) == 56 then - if player:getItemCount(30888) >= quantidade[playerId] then - npcHandler:say({ "Done." }, npc, creature) - if quantidade[playerId] > 1 then + if player:getItemCount(30888) >= amount[playerId] then + npcHandler:say("Done.", npc, creature) + if amount[playerId] > 1 then plural = plural .. "s" end - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You earned " .. quantidade[playerId] .. " point" .. plural .. " on the scouts mission.") - player:removeItem(30888, quantidade[playerId]) - player:setStorageValue(Storage.DangerousDepths.Scouts.Status, player:getStorageValue(Storage.DangerousDepths.Scouts.Status) + quantidade[playerId]) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You earned " .. amount[playerId] .. " point" .. plural .. " on the scouts mission.") + player:removeItem(30888, amount[playerId]) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Points) + amount[playerId]) else - npcHandler:say({ "You don't have enough suspicious devices." }, npc, creature) + npcHandler:say("You don't have enough suspicious devices.", npc, creature) npcHandler:setTopic(playerId, 1) end end - -- Início checagem de pontos de tasks!! if MsgContains(message, "status") then - npcHandler:say({ "So you want to know what we all think about your deeds? What leader's opinion are you interested in, the {gnomes} (Gnomus), the {dwarves} (Klom Stonecutter) or the {scouts} (Lardoc Bashsmite)?" }, npc, creature) + npcHandler:say("So you want to know what we all think about your deeds? What leader's opinion are you interested in, the {gnomes} (Gnomus), the {dwarves} (Klom Stonecutter) or the {scouts} (Lardoc Bashsmite)?", npc, creature) npcHandler:setTopic(playerId, 5) elseif MsgContains(message, "gnomes") and npcHandler:getTopic(playerId) == 5 then - npcHandler:say({ "The gnomes are still in need of your help, member of Bigfoot's Brigade. Prove your worth by answering their calls! (" .. math.max(player:getStorageValue(Storage.DangerousDepths.Gnomes.Status), 0) .. "/10)" }, npc, creature) + npcHandler:say("The gnomes are still in need of your help, member of Bigfoot's Brigade. Prove your worth by answering their calls! (" .. math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points), 0) .. "/10)", npc, creature) elseif MsgContains(message, "dwarves") and npcHandler:getTopic(playerId) == 5 then - npcHandler:say({ "The dwarves are still in need of your help, member of Bigfoot's Brigade. Prove your worth by answering their calls! (" .. math.max(player:getStorageValue(Storage.DangerousDepths.Dwarves.Status), 0) .. "/10)" }, npc, creature) + npcHandler:say("The dwarves are still in need of your help, member of Bigfoot's Brigade. Prove your worth by answering their calls! (" .. math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Points), 0) .. "/10)", npc, creature) elseif MsgContains(message, "scouts") and npcHandler:getTopic(playerId) == 5 then - npcHandler:say({ "The scouts are still in need of your help, member of Bigfoot's Brigade. Prove your worth by answering their calls! (" .. math.max(player:getStorageValue(Storage.DangerousDepths.Scouts.Status), 0) .. "/10)" }, npc, creature) + npcHandler:say("The scouts are still in need of your help, member of Bigfoot's Brigade. Prove your worth by answering their calls! (" .. math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Points), 0) .. "/10)", npc, creature) end + return true end +keywordHandler:addKeyword({ "help" }, StdModule.say, { npcHandler = npcHandler, text = "If you're willing to help us, we could need an escort for arriving {ordnance}, help with {charting} the cave system and someone needs to get some heat {measurements} fast." }) +keywordHandler:addKeyword({ "worthy" }, StdModule.say, { + npcHandler = npcHandler, + text = { + "You're already known amongst the gnomes, member of the Bigfoot Brigade. I will make sure that the alliance learns of your deeds but you'll still need to help the dwarves and gnomes of this outpost to show your worth. ...", + "We also found {suspicious devices} carried by all kinds of creatures down here. Down here, they are of extreme worth to us since they could contain the key to what's happening all around us. ...", + "If you can aquire any, return them to me and I make sure to tell the others of your generosity. Return to me afterwards to check on your current {status}.", + }, +}) +keywordHandler:addKeyword({ "base" }, StdModule.say, { npcHandler = npcHandler, + text = { + "Gnomish supplies and ingenuity have helped to establish and fortify this outpost. ...", + "Our knowledge of the enemy and it's tactics would be of more use if the dwarves would listen to us somewhat more. But gnomes have learned to live with the imperfection of the other races." + }, +}) +keywordHandler:addKeyword({ "efforts" }, StdModule.say, { + npcHandler = npcHandler, + text = { + "Our surveys of the area showed us some spikes in heat and seismic activity at very specific places. ...", + "We conclude this is no coincidence and the enemy is using devices to pump up the lava to flood the area. We have seen it before and had to retreat each time. ...", + "This time though we might have a counter prepared - given me manage to pierce their defences." + }, +}) +keywordHandler:addKeyword({ "name" }, StdModule.say, { npcHandler = npcHandler, text = "My name is Gnomus." }) +keywordHandler:addKeyword({ "job" }, StdModule.say, { npcHandler = npcHandler, text = "I'm the main gnomish contact for this base. I coordinate our efforts with those of the dwarves to ensure everything is running smoothly." }) + +npcHandler:setMessage(MESSAGE_GREET, "Greetings, member of the Bigfoot Brigade. We could really use some {help} from you right now. You should prove {worthy} to our alliance.") npcHandler:setMessage(MESSAGE_WALKAWAY, "Well, bye then.") npcHandler:setCallback(CALLBACK_SET_INTERACTION, onAddFocus) npcHandler:setCallback(CALLBACK_REMOVE_INTERACTION, onReleaseFocus) -npcHandler:setCallback(CALLBACK_GREET, greetCallback) npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true) diff --git a/data-otservbr-global/npc/klom_stonecutter.lua b/data-otservbr-global/npc/klom_stonecutter.lua index 8f238b65a29..4ab78216018 100644 --- a/data-otservbr-global/npc/klom_stonecutter.lua +++ b/data-otservbr-global/npc/klom_stonecutter.lua @@ -23,6 +23,15 @@ npcConfig.flags = { floorchange = false, } +npcConfig.voices = { + interval = 15000, + chance = 50, + { text = "Ah." }, + { text = "We need more volunteers!" }, + { text = 'And they call this "deep"...' }, + { text = "Preparation is paramount." }, +} + local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) @@ -50,51 +59,8 @@ npcType.onCloseChannel = function(npc, creature) npcHandler:onCloseChannel(npc, creature) end -npcConfig.voices = { - interval = 15000, - chance = 50, - { text = "Ah." }, - { text = "We need more volunteers!" }, - { text = 'And they call this "deep"...' }, - { text = "Preparation is paramount." }, -} - local count = {} -local function greetCallback(npc, creature) - local player = Player(creature) - local playerId = player:getId() - - if player then - npcHandler:setMessage(MESSAGE_GREET, { - "Greetings. A warning straight ahead: I don't like loiterin'. If you're not here to {help} us, you're here to waste my time. Which I consider loiterin'. Now, try and prove your {worth} to our alliance. ... ", - "I have sealed some of the areas far too dangerous for anyone to enter. If you can prove you're capable, you'll get an opportunity to help destroy the weird machines, pumping lava into the caves leading to the most dangerous enemies.", - }, 2000) - npcHandler:setTopic(playerId, 1) - end - return true -end - -keywordHandler:addKeyword({ "help" }, StdModule.say, { npcHandler = npcHandler, text = "Well, the biggest problem we need to address are the ever charging {subterraneans} around here. And on top of that, there's the threat of the Lost, who quite made themselves at {home} in these parts." }) -keywordHandler:addKeyword({ "job" }, StdModule.say, { npcHandler = npcHandler, text = "Maintainin' this whole operation, the dwarven involvement 'course. Don't know about them gnomes but if I ain't gettin' those dwarves in line, there'll be chaos down here. I also oversee the {defences} and {counterattacks}." }) -keywordHandler:addKeyword({ "defences" }, StdModule.say, { - npcHandler = npcHandler, - text = { - "The attacks of the enemy forces are fierce but we hold our ground. ... ", - "I'd love to face one of their generals in combat but as their masters they cowardly hide far behind enemy lines and I have other duties to fulfil. ... ", - "I envy you for the chance to thrust into the heart of the enemy, locking weapons with their jaws... or whatever... and see the fear in their eyes when they recognise they were bested.", - }, -}) -keywordHandler:addKeyword({ "counterattacks" }, StdModule.say, { - npcHandler = npcHandler, - text = { "I welcome a fine battle as any dwarf worth his beard should do. As long as it's a battle against something I can hit with my trusty axe. ...", "But here the true {enemy} eludes us. We fight wave after wave of their lackeys and if the gnomes are right the true enemy is up to something far more sinister. " }, -}) -keywordHandler:addKeyword({ "enemy" }, StdModule.say, { - npcHandler = npcHandler, - text = { "I have no idea what kind of creeps are behind all this. Even the gnomes don't and they have handled that stuff way more often. ...", "But even if we knew nothing more about them, the fact alone that they employ the help of those mockeries of all things dwarfish, marks them as an enemy of the dwarves and it's our obligation to annihilate them." }, -}) -keywordHandler:addKeyword({ "name" }, StdModule.say, { npcHandler = npcHandler, text = "Klom Stonecutter's the name. " }) - local function creatureSayCallback(npc, creature, type, message) local player = Player(creature) local playerId = player:getId() @@ -103,103 +69,98 @@ local function creatureSayCallback(npc, creature, type, message) return false end - local time = configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN) + local time = 20 * 60 * 60 -- 20 hours - -- missão subterraneans - if MsgContains(message, "subterraneans") and npcHandler:getTopic(playerId) == 1 then - if player:getStorageValue(Storage.DangerousDepths.Dwarves.Subterranean) == 2 and player:getStorageValue(Storage.DangerousDepths.Dwarves.TimeTaskSubterranean) > 0 then - npcHandler:say({ "I don't need your help for now. Come back later." }, npc, creature) + if MsgContains(message, "subterraneans") then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Subterranean) == 2 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.TimeTaskSubterranean) > 0 then + npcHandler:say("I don't need your help for now. Come back later.", npc, creature) npcHandler:setTopic(playerId, 1) end - if player:getStorageValue(Storage.DangerousDepths.Dwarves.Subterranean) == 2 and player:getStorageValue(Storage.DangerousDepths.Dwarves.TimeTaskSubterranean) <= 0 then - npcHandler:say({ "Vermin. Everywhere. We get a lot of strange four-legged crawlers and worms down here lately. It's getting out of hand and... well, I need a real killer for this. ", "Prepared to get rid of some seriously foul creepers for us?" }, npc, creature) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Subterranean) == 2 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.TimeTaskSubterranean) <= 0 then + npcHandler:say({ + "Vermin. Everywhere. We get a lot of strange four-legged crawlers and worms down here lately. It's getting out of hand and... well, I need a real killer for this. ", + "Prepared to get rid of some seriously foul creepers for us?" + }, npc, creature) npcHandler:setTopic(playerId, 2) end - if player:getStorageValue(Storage.DangerousDepths.Dwarves.Subterranean) < 1 then -- Não possuía a missão, agora possui! - npcHandler:say({ "Vermin. Everywhere. We get a lot of strange four-legged crawlers and worms down here lately. It's getting out of hand and... well, I need a real killer for this. ", "Prepared to get rid of some seriously foul creepers for us?" }, npc, creature) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Subterranean) < 1 then + npcHandler:say({ + "Vermin. Everywhere. We get a lot of strange four-legged crawlers and worms down here lately. It's getting out of hand and... well, I need a real killer for this. ", + "Prepared to get rid of some seriously foul creepers for us?" + }, npc, creature) npcHandler:setTopic(playerId, 2) - elseif (player:getStorageValue(Storage.DangerousDepths.Dwarves.Subterranean) == 1) and (player:getStorageValue(Storage.DangerousDepths.Dwarves.Organisms) < 50) then -- Está na missão porém não terminou a task! - npcHandler:say({ "Come back when you have finished your job." }, npc, creature) + elseif (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Subterranean) == 1) and (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Organisms) < 50) then + npcHandler:say("Come back when you have finished your job.", npc, creature) npcHandler:setTopic(playerId, 1) - elseif (player:getStorageValue(Storage.DangerousDepths.Dwarves.Subterranean) == 1) and (player:getStorageValue(Storage.DangerousDepths.Dwarves.Organisms) >= 50) then - npcHandler:say({ "I'l say I'm blown away but a Klom Stonecutter is not that easily impressed. Still, your got your hands dirt for us and I appreciate that." }, npc, creature) - -- Entregando surprise jar + 1 ponto de missão! - player:setStorageValue(Storage.DangerousDepths.Dwarves.TimeTaskSubterranean, os.time() + time) + elseif (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Subterranean) == 1) and (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Organisms) >= 50) then + npcHandler:say("I'l say I'm blown away but a Klom Stonecutter is not that easily impressed. Still, your got your hands dirt for us and I appreciate that.", npc, creature) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.TimeTaskSubterranean, os.time() + time) player:addItem(27654, 1) - player:setStorageValue(Storage.DangerousDepths.Dwarves.Status, player:getStorageValue(Storage.DangerousDepths.Dwarves.Status) + 1) - player:setStorageValue(Storage.DangerousDepths.Dwarves.Subterranean, 2) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Points) + 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Subterranean, 2) npcHandler:setTopic(playerId, 1) end elseif npcHandler:getTopic(playerId) == 2 and MsgContains(message, "yes") then - npcHandler:say({ "Alright, good. Those things are strolling about and I ain't gonna have that. If it moves more than two legs, destroy it. If it moves legs and tentacles, destroy it again." }, npc, creature) - if player:getStorageValue(Storage.DangerousDepths.Questline) < 1 then - player:setStorageValue(Storage.DangerousDepths.Questline, 1) + npcHandler:say("Alright, good. Those things are strolling about and I ain't gonna have that. If it moves more than two legs, destroy it. If it moves legs and tentacles, destroy it again.", npc, creature) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Questline) < 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Questline, 1) end - player:setStorageValue(Storage.DangerousDepths.Dwarves.Subterranean, 1) - player:setStorageValue(Storage.DangerousDepths.Dwarves.Organisms, 0) -- Garantindo que a task não inicie com -1 - npcHandler:setTopic(playerId, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Subterranean, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Organisms, 0) npcHandler:setTopic(playerId, 1) end - -- missão home - if MsgContains(message, "home") and npcHandler:getTopic(playerId) == 1 then - if player:getStorageValue(Storage.DangerousDepths.Dwarves.Home) == 2 and player:getStorageValue(Storage.DangerousDepths.Dwarves.TimeTaskHome) > 0 then - npcHandler:say({ "I don't need your help for now. Come back later." }, npc, creature) + if MsgContains(message, "home") then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Home) == 2 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.TimeTaskHome) > 0 then + npcHandler:say("I don't need your help for now. Come back later.", npc, creature) npcHandler:setTopic(playerId, 1) end - if player:getStorageValue(Storage.DangerousDepths.Dwarves.Home) == 2 and player:getStorageValue(Storage.DangerousDepths.Dwarves.TimeTaskHome) <= 0 then - npcHandler:say( - { "We need to find a way to drive off the exiles from these caves. Countless makeshift homes are popping up at every corner. Destroy them and get the Lost out of hiding to eliminate them. ... ", "If you can capture a few of them, you'll receive a bonus. Just bring 'em to the border of our outpost and we will take care of the rest. ... ", "Are you ready for that? " }, - npc, - creature - ) - npcHandler:setTopic(playerId, 22) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Home) == 2 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.TimeTaskHome) <= 0 then + npcHandler:say({ + "We need to find a way to drive off the exiles from these caves. Countless makeshift homes are popping up at every corner. Destroy them and get the Lost out of hiding to eliminate them. ... ", + "If you can capture a few of them, you'll receive a bonus. Just bring 'em to the border of our outpost and we will take care of the rest. ... ", "Are you ready for that? " + }, npc, creature) npcHandler:setTopic(playerId, 22) end - if player:getStorageValue(Storage.DangerousDepths.Dwarves.Home) < 1 then -- Não possuía a missão, agora possui! - npcHandler:say( - { "We need to find a way to drive off the exiles from these caves. Countless makeshift homes are popping up at every corner. Destroy them and get the Lost out of hiding to eliminate them. ... ", "If you can capture a few of them, you'll receive a bonus. Just bring 'em to the border of our outpost and we will take care of the rest. ... ", "Are you ready for that? " }, - npc, - creature - ) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Home) < 1 then + npcHandler:say({ + "We need to find a way to drive off the exiles from these caves. Countless makeshift homes are popping up at every corner. Destroy them and get the Lost out of hiding to eliminate them. ... ", + "If you can capture a few of them, you'll receive a bonus. Just bring 'em to the border of our outpost and we will take care of the rest. ... ", "Are you ready for that? " + }, npc, creature) npcHandler:setTopic(playerId, 22) - npcHandler:setTopic(playerId, 22) - elseif (player:getStorageValue(Storage.DangerousDepths.Dwarves.Home) == 1) and (player:getStorageValue(Storage.DangerousDepths.Dwarves.LostExiles) < 20 and player:getStorageValue(Storage.DangerousDepths.Dwarves.Prisoners) < 3) then -- Está na missão porém não terminou nenhuma das tasks! - npcHandler:say({ "Come back when you have finished your job." }, npc, creature) + elseif (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Home) == 1) and (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.LostExiles) < 20 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Prisoners) < 3) then + npcHandler:say("Come back when you have finished your job.", npc, creature) npcHandler:setTopic(playerId, 1) - elseif (player:getStorageValue(Storage.DangerousDepths.Dwarves.Home) == 1) and (player:getStorageValue(Storage.DangerousDepths.Dwarves.LostExiles) >= 20 and player:getStorageValue(Storage.DangerousDepths.Dwarves.Prisoners) < 3) then - npcHandler:say({ "So you did it. Well, that won't be the last of 'em but this sure helps our situation down here. Return to me later if you want to help me again!" }, npc, creature) -- Caso não tenha feito o task bônus - -- Entregando surprise jar + 1 ponto de missão! - player:setStorageValue(Storage.DangerousDepths.Dwarves.TimeTaskHome, os.time() + time) - player:setStorageValue(Storage.DangerousDepths.Dwarves.Home, 2) + elseif (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Home) == 1) and (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.LostExiles) >= 20 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Prisoners) < 3) then + npcHandler:say("So you did it. Well, that won't be the last of 'em but this sure helps our situation down here. Return to me later if you want to help me again!", npc, creature) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.TimeTaskHome, os.time() + time) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Home, 2) player:addItem(27654, 1) - player:setStorageValue(Storage.DangerousDepths.Dwarves.Status, player:getStorageValue(Storage.DangerousDepths.Dwarves.Status) + 1) - npcHandler:setTopic(playerId, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Points) + 1) npcHandler:setTopic(playerId, 1) - elseif (player:getStorageValue(Storage.DangerousDepths.Dwarves.Home) == 1) and (player:getStorageValue(Storage.DangerousDepths.Dwarves.LostExiles) >= 20 and player:getStorageValue(Storage.DangerousDepths.Dwarves.Prisoners) >= 3) then - npcHandler:say({ "So you did it. And you even made prisoners, the bonus is yours! Well, that won't be the last of 'em but this sure helps our situation down here. Return to me later if you want to help me again!" }, npc, creature) -- Se tiver feito ambas - -- Entregando 2 surprise jars + 2 pontos de missão! - player:setStorageValue(Storage.DangerousDepths.Dwarves.TimeTaskHome, os.time() + time) - player:setStorageValue(Storage.DangerousDepths.Dwarves.Home, 2) - player:addItem(27654, 2) -- +1 item pela task bônus! - player:setStorageValue(Storage.DangerousDepths.Dwarves.Status, player:getStorageValue(Storage.DangerousDepths.Dwarves.Status) + 2) -- +1 ponto pela task bônus! + elseif (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Home) == 1) and (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.LostExiles) >= 20 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Prisoners) >= 3) then + npcHandler:say("So you did it. And you even made prisoners, the bonus is yours! Well, that won't be the last of 'em but this sure helps our situation down here. Return to me later if you want to help me again!", npc, creature) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.TimeTaskHome, os.time() + time) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Home, 2) + player:addItem(27654, 2) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Points) + 2) npcHandler:setTopic(playerId, 1) end elseif npcHandler:getTopic(playerId) == 22 and MsgContains(message, "yes") then - npcHandler:say({ "Very well, now try to find some of their makeshift homes and tear'em down. There's bound to be some stragglers you can 'persuade' to surrender, eliminate any resistance. Get back here when you're done." }, npc, creature) - if player:getStorageValue(Storage.DangerousDepths.Questline) < 1 then - player:setStorageValue(Storage.DangerousDepths.Questline, 1) + npcHandler:say("Very well, now try to find some of their makeshift homes and tear'em down. There's bound to be some stragglers you can 'persuade' to surrender, eliminate any resistance. Get back here when you're done.", npc, creature) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Questline) < 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Questline, 1) end - player:setStorageValue(Storage.DangerousDepths.Dwarves.Home, 1) - player:setStorageValue(Storage.DangerousDepths.Dwarves.LostExiles, 0) -- Garantindo que a task não inicie com -1 - player:setStorageValue(Storage.DangerousDepths.Dwarves.Prisoners, 0) -- Garantindo que a task não inicie com -1 - npcHandler:setTopic(playerId, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Home, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.LostExiles, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Prisoners, 0) npcHandler:setTopic(playerId, 1) end local plural = "" + if MsgContains(message, "suspicious devices") or MsgContains(message, "suspicious device") then - npcHandler:say({ "If you bring me any suspicious devices on creatures you slay down here, I'll make it worth your while by telling the others of your generosity. How many do you want to offer? " }, npc, creature) + npcHandler:say("If you bring me any suspicious devices on creatures you slay down here, I'll make it worth your while by telling the others of your generosity. How many do you want to offer?", npc, creature) npcHandler:setTopic(playerId, 55) elseif npcHandler:getTopic(playerId) == 55 then count[playerId] = tonumber(message) @@ -207,68 +168,97 @@ local function creatureSayCallback(npc, creature, type, message) if count[playerId] > 1 then plural = plural .. "s" end - npcHandler:say({ "You want to offer " .. count[playerId] .. " suspicious device" .. plural .. ". Which leader shall have it, (Gnomus) of the {gnomes}, (Klom Stonecutter) of the {dwarves} or the {scouts} (Lardoc Bashsmite)?" }, npc, creature) + npcHandler:say("You want to offer " .. count[playerId] .. " suspicious device" .. plural .. ". Which leader shall have it, (Gnomus) of the {gnomes}, (Klom Stonecutter) of the {dwarves} or the {scouts} (Lardoc Bashsmite)?", npc, creature) npcHandler:setTopic(playerId, 56) else - npcHandler:say({ "Don't waste my time." }, npc, creature) + npcHandler:say("Don't waste my time.", npc, creature) npcHandler:setTopic(playerId, 1) end elseif MsgContains(message, "gnomes") and npcHandler:getTopic(playerId) == 56 then if player:getItemCount(30888) >= count[playerId] then - npcHandler:say({ "Done." }, npc, creature) + npcHandler:say("Done.", npc, creature) if count[playerId] > 1 then plural = plural .. "s" end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You earned " .. count[playerId] .. " point" .. plural .. " on the gnomes mission.") player:removeItem(30888, count[playerId]) - player:setStorageValue(Storage.DangerousDepths.Gnomes.Status, player:getStorageValue(Storage.DangerousDepths.Gnomes.Status) + count[playerId]) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points) + count[playerId]) else - npcHandler:say({ "You don't have enough suspicious devices." }, npc, creature) + npcHandler:say("You don't have enough suspicious devices.", npc, creature) npcHandler:setTopic(playerId, 1) end elseif MsgContains(message, "dwarves") and npcHandler:getTopic(playerId) == 56 then if player:getItemCount(30888) >= count[playerId] then - npcHandler:say({ "Done." }, npc, creature) + npcHandler:say("Done.", npc, creature) if count[playerId] > 1 then plural = plural .. "s" end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You earned " .. count[playerId] .. " point" .. plural .. " on the dwarves mission.") player:removeItem(30888, count[playerId]) - player:setStorageValue(Storage.DangerousDepths.Dwarves.Status, player:getStorageValue(Storage.DangerousDepths.Dwarves.Status) + count[playerId]) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Points) + count[playerId]) else - npcHandler:say({ "You don't have enough suspicious devices." }, npc, creature) + npcHandler:say("You don't have enough suspicious devices.", npc, creature) npcHandler:setTopic(playerId, 1) end elseif MsgContains(message, "scouts") and npcHandler:getTopic(playerId) == 56 then if player:getItemCount(30888) >= count[playerId] then - npcHandler:say({ "Done." }, npc, creature) + npcHandler:say("Done.", npc, creature) if count[playerId] > 1 then plural = plural .. "s" end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You earned " .. count[playerId] .. " point" .. plural .. " on the scouts mission.") player:removeItem(30888, count[playerId]) - player:setStorageValue(Storage.DangerousDepths.Scouts.Status, player:getStorageValue(Storage.DangerousDepths.Scouts.Status) + count[playerId]) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Points) + count[playerId]) else - npcHandler:say({ "You don't have enough suspicious devices." }, npc, creature) + npcHandler:say("You don't have enough suspicious devices.", npc, creature) npcHandler:setTopic(playerId, 1) end end - -- Início checagem de pontos de tasks!! if MsgContains(message, "status") then - npcHandler:say({ "So you want to know what we all think about your deeds? What leader's opinion are you interested in, the {gnomes} (Gnomus), the {dwarves} (Klom Stonecutter) or the {scouts} (Lardoc Bashsmite)?" }, npc, creature) - npcHandler:setTopic(playerId, 5) + npcHandler:say("So you want to know what we all think about your deeds? What leader's opinion are you interested in, the {gnomes} (Gnomus), the {dwarves} (Klom Stonecutter) or the {scouts} (Lardoc Bashsmite)?", npc, creature) npcHandler:setTopic(playerId, 5) elseif MsgContains(message, "gnomes") and npcHandler:getTopic(playerId) == 5 then - npcHandler:say({ "The gnomes are still in need of your help, member of Bigfoot's Brigade. Prove your worth by answering their calls! (" .. math.max(player:getStorageValue(Storage.DangerousDepths.Gnomes.Status), 0) .. "/10)" }, npc, creature) + npcHandler:say("The gnomes are still in need of your help, member of Bigfoot's Brigade. Prove your worth by answering their calls! (" .. math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points), 0) .. "/10)", npc, creature) elseif MsgContains(message, "dwarves") and npcHandler:getTopic(playerId) == 5 then - npcHandler:say({ "The dwarves are still in need of your help, member of Bigfoot's Brigade. Prove your worth by answering their calls! (" .. math.max(player:getStorageValue(Storage.DangerousDepths.Dwarves.Status), 0) .. "/10)" }, npc, creature) + npcHandler:say("The dwarves are still in need of your help, member of Bigfoot's Brigade. Prove your worth by answering their calls! (" .. math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Points), 0) .. "/10)", npc, creature) elseif MsgContains(message, "scouts") and npcHandler:getTopic(playerId) == 5 then - npcHandler:say({ "The scouts are still in need of your help, member of Bigfoot's Brigade. Prove your worth by answering their calls! (" .. math.max(player:getStorageValue(Storage.DangerousDepths.Scouts.Status), 0) .. "/10)" }, npc, creature) + npcHandler:say("The scouts are still in need of your help, member of Bigfoot's Brigade. Prove your worth by answering their calls! (" .. math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Points), 0) .. "/10)", npc, creature) end + return true end +keywordHandler:addKeyword({ "help" }, StdModule.say, { npcHandler = npcHandler, text = "Well, the biggest problem we need to address are the ever charging {subterraneans} around here. And on top of that, there's the threat of the Lost, who quite made themselves at {home} in these parts." }) +keywordHandler:addKeyword({ "job" }, StdModule.say, { npcHandler = npcHandler, text = "Maintainin' this whole operation, the dwarven involvement 'course. Don't know about them gnomes but if I ain't gettin' those dwarves in line, there'll be chaos down here. I also oversee the {defences} and {counterattacks}." }) +keywordHandler:addKeyword({ "defences" }, StdModule.say, { + npcHandler = npcHandler, + text = { + "The attacks of the enemy forces are fierce but we hold our ground. ... ", + "I'd love to face one of their generals in combat but as their masters they cowardly hide far behind enemy lines and I have other duties to fulfil. ... ", + "I envy you for the chance to thrust into the heart of the enemy, locking weapons with their jaws... or whatever... and see the fear in their eyes when they recognise they were bested.", + }, +}) +keywordHandler:addKeyword({ "counterattacks" }, StdModule.say, { + npcHandler = npcHandler, + text = { + "I welcome a fine battle as any dwarf worth his beard should do. As long as it's a battle against something I can hit with my trusty axe. ...", + "But here the true {enemy} eludes us. We fight wave after wave of their lackeys and if the gnomes are right the true enemy is up to something far more sinister. " + }, +}) +keywordHandler:addKeyword({ "enemy" }, StdModule.say, { + npcHandler = npcHandler, + text = { + "I have no idea what kind of creeps are behind all this. Even the gnomes don't and they have handled that stuff way more often. ...", + "But even if we knew nothing more about them, the fact alone that they employ the help of those mockeries of all things dwarfish, marks them as an enemy of the dwarves and it's our obligation to annihilate them." + }, +}) +keywordHandler:addKeyword({ "name" }, StdModule.say, { npcHandler = npcHandler, text = "Klom Stonecutter's the name. " }) + +npcHandler:setMessage(MESSAGE_GREET, { + "Greetings. A warning straight ahead: I don't like loiterin'. If you're not here to {help} us, you're here to waste my time. Which I consider loiterin'. Now, try and prove your {worth} to our alliance. ... ", + "I have sealed some of the areas far too dangerous for anyone to enter. If you can prove you're capable, you'll get an opportunity to help destroy the weird machines, pumping lava into the caves leading to the most dangerous enemies.", +}) npcHandler:setMessage(MESSAGE_WALKAWAY, "Well, bye then.") npcHandler:setCallback(CALLBACK_SET_INTERACTION, onAddFocus) diff --git a/data-otservbr-global/npc/lardoc_bashsmite.lua b/data-otservbr-global/npc/lardoc_bashsmite.lua index 79fbd410d6e..e129b628031 100644 --- a/data-otservbr-global/npc/lardoc_bashsmite.lua +++ b/data-otservbr-global/npc/lardoc_bashsmite.lua @@ -50,37 +50,7 @@ npcType.onCloseChannel = function(npc, creature) npcHandler:onCloseChannel(npc, creature) end -local quantidade = {} - -local function greetCallback(npc, creature) - local player = Player(creature) - local playerId = player:getId() - - if player then - npcHandler:setMessage(MESSAGE_GREET, { "Since you are obviously not one of my relatives who pays me a long overdue visit, we should get {work} right away. We'll see if you can prove your {worth} to our alliance." }) - npcHandler:setTopic(playerId, 1) - end - return true -end - -keywordHandler:addKeyword({ "work" }, StdModule.say, { npcHandler = npcHandler, text = "Here's the situation: a tide of hazardous bugs, the gnomes named them {diremaws}, threatens our base. Then there is some kind of {growth} which seems connected to them somehow. We need to get rid of both." }) -keywordHandler:addKeyword({ "worth" }, StdModule.say, { - npcHandler = npcHandler, - text = { - "You're already known amongst the gnomes, member of the Bigfoot Brigade. I will make sure that the alliance learns of your deeds but you'll still need to help the dwarves and gnomes of this outpost to show your worth. ...", - "We also found suspicious devices carried by all kinds of creatures down here. Down here, they are of extreme worth to us since they could contain the key to what's happening all around us. ... ", - "If you can aquire any, return them to me and I make sure to tell the others of your generosity. Return to me afterwards to check on your current {status}.", - }, -}) -keywordHandler:addKeyword({ "job" }, StdModule.say, { - npcHandler = npcHandler, - text = { - "Leading the charge! It's a war down here. I maintain the outer defences and supplies which are organised back in Kazordoon and also by the gnomes. ...", - "I have sealed some of the areas far too dangerous for anyone to enter. If you can prove you're capable, you'll get an oportunity to help destroying the weird machines, pumping lava into the caves leading to the most dangerous enemies.", - "But even if we knew nothing more about them, the fact alone that they employ the help of those mockeries of all things dwarfish, marks them as an enemy of the dwarves and it's our obligation to annihilate them.", - }, -}) -keywordHandler:addKeyword({ "name" }, StdModule.say, { npcHandler = npcHandler, text = "Bashsmite. That's all you need to know." }) +local amount = {} local function creatureSayCallback(npc, creature, type, message) local player = Player(creature) @@ -90,15 +60,14 @@ local function creatureSayCallback(npc, creature, type, message) return false end - local tempo = configManager.getNumber(configKeys.BOSS_DEFAULT_TIME_TO_FIGHT_AGAIN) + local time = 20 * 60 * 60 -- 20 hours - -- missão diremaws - if MsgContains(message, "diremaws") and npcHandler:getTopic(playerId) == 1 then - if player:getStorageValue(Storage.DangerousDepths.Scouts.Diremaw) == 2 and player:getStorageValue(Storage.DangerousDepths.Scouts.TimeTaskDiremaws) > 0 then -- Ainda não se passaram as 20h - npcHandler:say({ "I don't need your help for now. Come back later." }, npc, creature) + if MsgContains(message, "diremaws") then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Diremaw) == 2 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.TimeTaskDiremaws) > 0 then + npcHandler:say("I don't need your help for now. Come back later.", npc, creature) npcHandler:setTopic(playerId, 1) end - if player:getStorageValue(Storage.DangerousDepths.Scouts.Diremaw) == 2 and player:getStorageValue(Storage.DangerousDepths.Scouts.TimeTaskDiremaws) <= 0 then -- Vai fazer a missão após 20h + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Diremaw) == 2 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.TimeTaskDiremaws) <= 0 then npcHandler:say({ "The gnomes say that these creatures seem to thrive on mushroom sponges. But not only that, apparently they also lay eggs in their own cadavers to breed even faster. ...", "Yes, disgusting. I guess it provides everything their offspring needs... well, we probably shouldn't go into that much further. Instead we should focus on preventing that from happening. ... ", @@ -108,7 +77,7 @@ local function creatureSayCallback(npc, creature, type, message) }, npc, creature) npcHandler:setTopic(playerId, 2) end - if player:getStorageValue(Storage.DangerousDepths.Scouts.Diremaw) < 1 then -- Não possuía a missão, agora possui! + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Diremaw) < 1 then npcHandler:say({ "The gnomes say that these creatures seem to thrive on mushroom sponges. But not only that, apparently they also lay eggs in their own cadavers to breed even faster. ...", "Yes, disgusting. I guess it provides everything their offspring needs... well, we probably shouldn't go into that much further. Instead we should focus on preventing that from happening. ... ", @@ -117,36 +86,34 @@ local function creatureSayCallback(npc, creature, type, message) "Are you willing to help? ", }, npc, creature) npcHandler:setTopic(playerId, 2) - elseif (player:getStorageValue(Storage.DangerousDepths.Scouts.Diremaw) == 1) and (player:getStorageValue(Storage.DangerousDepths.Scouts.DiremawsCount) < 20) then -- Está na missão porém não terminou a task! - npcHandler:say({ "Come back when you have finished your job." }, npc, creature) + elseif (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Diremaw) == 1) and (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.DiremawsCount) < 20) then + npcHandler:say("Come back when you have finished your job.", npc, creature) npcHandler:setTopic(playerId, 1) - elseif player:getStorageValue(Storage.DangerousDepths.Scouts.Diremaw) == 1 and player:getStorageValue(Storage.DangerousDepths.Scouts.DiremawsCount) >= 20 then -- Não possuía a missão, agora possui! - npcHandler:say({ "You got rid of a lot of corpses, very good. Now we have a realistic chance of pushing them back! Return to me later for more work if you want." }, npc, creature) - player:setStorageValue(Storage.DangerousDepths.Dwarves.TimeTaskDiremaws, os.time() + tempo) + elseif player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Diremaw) == 1 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.DiremawsCount) >= 20 then + npcHandler:say("You got rid of a lot of corpses, very good. Now we have a realistic chance of pushing them back! Return to me later for more work if you want.", npc, creature) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.TimeTaskDiremaws, os.time() + time) player:addItem(27654, 1) - player:setStorageValue(Storage.DangerousDepths.Scouts.Status, player:getStorageValue(Storage.DangerousDepths.Scouts.Status) + 1) - player:setStorageValue(Storage.DangerousDepths.Scouts.Diremaw, 2) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Points) + 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Diremaw, 2) npcHandler:setTopic(playerId, 1) end elseif npcHandler:getTopic(playerId) == 2 and MsgContains(message, "yes") then - npcHandler:say({ "Noted. Get one of the gnomish devices from the container next to me and 'use' it on any diremaw corpses to effectively neutralise them. At least the gnomes told me this will work - good luck!" }, npc, creature) - if player:getStorageValue(Storage.DangerousDepths.Questline) < 1 then - player:setStorageValue(Storage.DangerousDepths.Questline, 1) + npcHandler:say("Noted. Get one of the gnomish devices from the container next to me and 'use' it on any diremaw corpses to effectively neutralise them. At least the gnomes told me this will work - good luck!", npc, creature) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Questline) < 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Questline, 1) end - player:setStorageValue(Storage.DangerousDepths.Scouts.Diremaw, 1) - player:setStorageValue(Storage.DangerousDepths.Scouts.GnomishChest, 1) -- Permissão para usar o baú - player:setStorageValue(Storage.DangerousDepths.Scouts.DiremawsCount, 0) -- Garantindo que a task não inicie com -1 - npcHandler:setTopic(playerId, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Diremaw, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.GnomishChest, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.DiremawsCount, 0) npcHandler:setTopic(playerId, 1) end - -- missão growth - if MsgContains(message, "growth") and npcHandler:getTopic(playerId) == 1 then - if player:getStorageValue(Storage.DangerousDepths.Scouts.Growth) == 2 and player:getStorageValue(Storage.DangerousDepths.Scouts.TimeTaskGrowth) > 0 then -- Ainda não se passaram as 20h - npcHandler:say({ "I don't need your help for now. Come back later." }, npc, creature) + if MsgContains(message, "growth") then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Growth) == 2 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.TimeTaskGrowth) > 0 then + npcHandler:say("I don't need your help for now. Come back later.", npc, creature) npcHandler:setTopic(playerId, 1) end - if player:getStorageValue(Storage.DangerousDepths.Scouts.Growth) == 2 and player:getStorageValue(Storage.DangerousDepths.Scouts.TimeTaskGrowth) <= 0 then -- Vai fazer a missão após 20h + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Growth) == 2 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.TimeTaskGrowth) <= 0 then npcHandler:say({ "I can't explain that stuff, even the gnomes don't know what grows in those caves. All we know is that this stuff brought about all the diremaws we are now facing. ...", "This vermin is somehow attracted to this sponge, my guess is they use it as a nourishment, too. We need to get rid of the stuff regularly to reduce their numbers to a manageable level. ...", @@ -156,9 +123,8 @@ local function creatureSayCallback(npc, creature, type, message) "We need someone to take those barrels to the source of the ever growing sponge and burn it down. All of it. There should be at least five locations. Are you up for that? ", }, npc, creature) npcHandler:setTopic(playerId, 22) - npcHandler:setTopic(playerId, 22) end - if player:getStorageValue(Storage.DangerousDepths.Scouts.Growth) < 1 then -- Não possuía a missão, agora possui! + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Growth) < 1 then npcHandler:say({ "I can't explain that stuff, even the gnomes don't know what grows in those caves. All we know is that this stuff brought about all the diremaws we are now facing. ...", "This vermin is somehow attracted to this sponge, my guess is they use it as a nourishment, too. We need to get rid of the stuff regularly to reduce their numbers to a manageable level. ...", @@ -168,109 +134,130 @@ local function creatureSayCallback(npc, creature, type, message) "We need someone to take those barrels to the source of the ever growing sponge and burn it down. All of it. There should be at least five locations. Are you up for that? ", }, npc, creature) npcHandler:setTopic(playerId, 22) - npcHandler:setTopic(playerId, 22) end - if player:getStorageValue(Storage.DangerousDepths.Scouts.Growth) == 1 and player:getStorageValue(Storage.DangerousDepths.Scouts.BarrelCount) >= 3 then -- Não possuía a missão, agora possui! - npcHandler:say({ "You did a great job out there, the stuff will continue to grow, however. Return to me later for more work." }, npc, creature) - player:setStorageValue(Storage.DangerousDepths.Dwarves.TimeTaskGrowth, os.time() + tempo) - if player:getStorageValue(Storage.DangerousDepths.Scouts.BarrelCount) >= 5 then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Growth) == 1 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount) >= 3 then + npcHandler:say("You did a great job out there, the stuff will continue to grow, however. Return to me later for more work.", npc, creature) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.TimeTaskGrowth, os.time() + time) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount) >= 5 then player:addItem(27654, 2) - player:setStorageValue(Storage.DangerousDepths.Scouts.Status, player:getStorageValue(Storage.DangerousDepths.Scouts.Status) + 2) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Points) + 2) else player:addItem(27654, 1) - player:setStorageValue(Storage.DangerousDepths.Scouts.Status, player:getStorageValue(Storage.DangerousDepths.Scouts.Status) + 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Points) + 1) end - player:setStorageValue(Storage.DangerousDepths.Scouts.Growth, 2) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Growth, 2) npcHandler:setTopic(playerId, 1) end elseif npcHandler:getTopic(playerId) == 22 and MsgContains(message, "yes") then - npcHandler:say({ "Noted. Now, get down there and rain some fire on them." }, npc, creature) - if player:getStorageValue(Storage.DangerousDepths.Questline) < 1 then - player:setStorageValue(Storage.DangerousDepths.Questline, 1) + npcHandler:say("Noted. Now, get down there and rain some fire on them.", npc, creature) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Questline) < 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Questline, 1) end - player:setStorageValue(Storage.DangerousDepths.Scouts.Growth, 1) - player:setStorageValue(Storage.DangerousDepths.Scouts.BarrelCount, 0) -- Garantindo que a task não inicie com -1 - player:setStorageValue(Storage.DangerousDepths.Scouts.FirstBarrel, 0) -- Garantindo que a task não inicie com -1 - player:setStorageValue(Storage.DangerousDepths.Scouts.SecondBarrel, 0) -- Garantindo que a task não inicie com -1 - player:setStorageValue(Storage.DangerousDepths.Scouts.ThirdBarrel, 0) -- Garantindo que a task não inicie com -1 - player:setStorageValue(Storage.DangerousDepths.Scouts.FourthBarrel, 0) -- Garantindo que a task não inicie com -1 - player:setStorageValue(Storage.DangerousDepths.Scouts.FifthBarrel, 0) -- Garantindo que a task não inicie com -1 + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Growth, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.FirstBarrel, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.SecondBarrel, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.ThirdBarrel, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.FourthBarrel, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.FifthBarrel, 0) npcHandler:setTopic(playerId, 1) npcHandler:setTopic(playerId, 1) end + local plural = "" + if MsgContains(message, "suspicious devices") or MsgContains(message, "suspicious device") then - npcHandler:say({ "If you bring me any suspicious devices on creatures you slay down here, I'll make it worth your while by telling the others of your generosity. How many do you want to offer? " }, npc, creature) + npcHandler:say("If you bring me any suspicious devices on creatures you slay down here, I'll make it worth your while by telling the others of your generosity. How many do you want to offer? ", npc, creature) npcHandler:setTopic(playerId, 55) elseif npcHandler:getTopic(playerId) == 55 then - quantidade[playerId] = tonumber(message) - if quantidade[playerId] then - if quantidade[playerId] > 1 then + amount[playerId] = tonumber(message) + if amount[playerId] then + if amount[playerId] > 1 then plural = plural .. "s" end - npcHandler:say({ "You want to offer " .. quantidade[playerId] .. " suspicious device" .. plural .. ". Which leader shall have it, (Gnomus) of the {gnomes}, (Klom Stonecutter) of the {dwarves} or the {scouts} (Lardoc Bashsmite)?" }, npc, creature) + npcHandler:say("You want to offer " .. amount[playerId] .. " suspicious device" .. plural .. ". Which leader shall have it, (Gnomus) of the {gnomes}, (Klom Stonecutter) of the {dwarves} or the {scouts} (Lardoc Bashsmite)?", npc, creature) npcHandler:setTopic(playerId, 56) else - npcHandler:say({ "Don't waste my time." }, npc, creature) + npcHandler:say("Don't waste my time.", npc, creature) npcHandler:setTopic(playerId, 1) end elseif MsgContains(message, "gnomes") and npcHandler:getTopic(playerId) == 56 then - if player:getItemCount(30888) >= quantidade[playerId] then - npcHandler:say({ "Done." }, npc, creature) - if quantidade[playerId] > 1 then + if player:getItemCount(30888) >= amount[playerId] then + npcHandler:say("Done.", npc, creature) + if amount[playerId] > 1 then plural = plural .. "s" end - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You earned " .. quantidade[playerId] .. " point" .. plural .. " on the gnomes mission.") - player:removeItem(30888, quantidade[playerId]) - player:setStorageValue(Storage.DangerousDepths.Gnomes.Status, player:getStorageValue(Storage.DangerousDepths.Gnomes.Status) + quantidade[playerId]) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You earned " .. amount[playerId] .. " point" .. plural .. " on the gnomes mission.") + player:removeItem(30888, amount[playerId]) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points) + amount[playerId]) else - npcHandler:say({ "You don't have enough suspicious devices." }, npc, creature) + npcHandler:say("You don't have enough suspicious devices.", npc, creature) npcHandler:setTopic(playerId, 1) end elseif MsgContains(message, "dwarves") and npcHandler:getTopic(playerId) == 56 then - if player:getItemCount(30888) >= quantidade[playerId] then - npcHandler:say({ "Done." }, npc, creature) - if quantidade[playerId] > 1 then + if player:getItemCount(30888) >= amount[playerId] then + npcHandler:say("Done.", npc, creature) + if amount[playerId] > 1 then plural = plural .. "s" end - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You earned " .. quantidade[playerId] .. " point" .. plural .. " on the dwarves mission.") - player:removeItem(30888, quantidade[playerId]) - player:setStorageValue(Storage.DangerousDepths.Dwarves.Status, player:getStorageValue(Storage.DangerousDepths.Dwarves.Status) + quantidade[playerId]) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You earned " .. amount[playerId] .. " point" .. plural .. " on the dwarves mission.") + player:removeItem(30888, amount[playerId]) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Points) + amount[playerId]) else - npcHandler:say({ "You don't have enough suspicious devices." }, npc, creature) + npcHandler:say("You don't have enough suspicious devices.", npc, creature) npcHandler:setTopic(playerId, 1) end elseif MsgContains(message, "scouts") and npcHandler:getTopic(playerId) == 56 then - if player:getItemCount(30888) >= quantidade[playerId] then - npcHandler:say({ "Done." }, npc, creature) - if quantidade[playerId] > 1 then + if player:getItemCount(30888) >= amount[playerId] then + npcHandler:say("Done.", npc, creature) + if amount[playerId] > 1 then plural = plural .. "s" end - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You earned " .. quantidade[playerId] .. " point" .. plural .. " on the scouts mission.") - player:removeItem(30888, quantidade[playerId]) - player:setStorageValue(Storage.DangerousDepths.Scouts.Status, player:getStorageValue(Storage.DangerousDepths.Scouts.Status) + quantidade[playerId]) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You earned " .. amount[playerId] .. " point" .. plural .. " on the scouts mission.") + player:removeItem(30888, amount[playerId]) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Points, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Points) + amount[playerId]) else - npcHandler:say({ "You don't have enough suspicious devices." }, npc, creature) + npcHandler:say("You don't have enough suspicious devices.", npc, creature) npcHandler:setTopic(playerId, 1) end end - -- Início checagem de pontos de tasks!! if MsgContains(message, "status") then - npcHandler:say({ "So you want to know what we all think about your deeds? What leader's opinion are you interested in, the {gnomes} (Gnomus), the {dwarves} (Klom Stonecutter) or the {scouts} (Lardoc Bashsmite)?" }, npc, creature) - npcHandler:setTopic(playerId, 5) + npcHandler:say("So you want to know what we all think about your deeds? What leader's opinion are you interested in, the {gnomes} (Gnomus), the {dwarves} (Klom Stonecutter) or the {scouts} (Lardoc Bashsmite)?", npc, creature) npcHandler:setTopic(playerId, 5) elseif MsgContains(message, "gnomes") and npcHandler:getTopic(playerId) == 5 then - npcHandler:say({ "The gnomes are still in need of your help, member of Bigfoot's Brigade. Prove your worth by answering their calls! (" .. math.max(player:getStorageValue(Storage.DangerousDepths.Gnomes.Status), 0) .. "/10)" }, npc, creature) + npcHandler:say("The gnomes are still in need of your help, member of Bigfoot's Brigade. Prove your worth by answering their calls! (" .. math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points), 0) .. "/10)", npc, creature) elseif MsgContains(message, "dwarves") and npcHandler:getTopic(playerId) == 5 then - npcHandler:say({ "The dwarves are still in need of your help, member of Bigfoot's Brigade. Prove your worth by answering their calls! (" .. math.max(player:getStorageValue(Storage.DangerousDepths.Dwarves.Status), 0) .. "/10)" }, npc, creature) + npcHandler:say("The dwarves are still in need of your help, member of Bigfoot's Brigade. Prove your worth by answering their calls! (" .. math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Points), 0) .. "/10)", npc, creature) elseif MsgContains(message, "scouts") and npcHandler:getTopic(playerId) == 5 then - npcHandler:say({ "The scouts are still in need of your help, member of Bigfoot's Brigade. Prove your worth by answering their calls! (" .. math.max(player:getStorageValue(Storage.DangerousDepths.Scouts.Status), 0) .. "/10)" }, npc, creature) + npcHandler:say("The scouts are still in need of your help, member of Bigfoot's Brigade. Prove your worth by answering their calls! (" .. math.max(player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Points), 0) .. "/10)", npc, creature) end + return true end +keywordHandler:addKeyword({ "work" }, StdModule.say, { npcHandler = npcHandler, text = "Here's the situation: a tide of hazardous bugs, the gnomes named them {diremaws}, threatens our base. Then there is some kind of {growth} which seems connected to them somehow. We need to get rid of both." }) +keywordHandler:addKeyword({ "worth" }, StdModule.say, { + npcHandler = npcHandler, + text = { + "You're already known amongst the gnomes, member of the Bigfoot Brigade. I will make sure that the alliance learns of your deeds but you'll still need to help the dwarves and gnomes of this outpost to show your worth. ...", + "We also found suspicious devices carried by all kinds of creatures down here. Down here, they are of extreme worth to us since they could contain the key to what's happening all around us. ... ", + "If you can aquire any, return them to me and I make sure to tell the others of your generosity. Return to me afterwards to check on your current {status}.", + }, +}) +keywordHandler:addKeyword({ "job" }, StdModule.say, { + npcHandler = npcHandler, + text = { + "Leading the charge! It's a war down here. I maintain the outer defences and supplies which are organised back in Kazordoon and also by the gnomes. ...", + "I have sealed some of the areas far too dangerous for anyone to enter. If you can prove you're capable, you'll get an oportunity to help destroying the weird machines, pumping lava into the caves leading to the most dangerous enemies.", + "But even if we knew nothing more about them, the fact alone that they employ the help of those mockeries of all things dwarfish, marks them as an enemy of the dwarves and it's our obligation to annihilate them.", + }, +}) +keywordHandler:addKeyword({ "name" }, StdModule.say, { npcHandler = npcHandler, text = "Bashsmite. That's all you need to know." }) + + +npcHandler:setMessage(MESSAGE_GREET, "Since you are obviously not one of my relatives who pays me a long overdue visit, we should get {work} right away. We'll see if you can prove your {worth} to our alliance.") npcHandler:setMessage(MESSAGE_WALKAWAY, "Well, bye then.") npcHandler:setCallback(CALLBACK_SET_INTERACTION, onAddFocus) diff --git a/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua b/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua index 5b981b6a088..57ccc933511 100644 --- a/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua +++ b/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua @@ -15,13 +15,13 @@ local questTable = { { storage = Storage.Quest.U9_60.BigfootsBurden.Warzone1Access, storageValue = 2 }, { storage = Storage.Quest.U9_60.BigfootsBurden.Warzone2Access, storageValue = 2 }, { storage = Storage.Quest.U9_60.BigfootsBurden.Warzone3Access, storageValue = 2 }, - { storage = Storage.DangerousDepths.Questline, storageValue = 10 }, - { storage = Storage.DangerousDepths.Access.LavaPumpWarzoneVI, storageValue = 10 }, - { storage = Storage.DangerousDepths.Access.LavaPumpWarzoneV, storageValue = 10 }, - { storage = Storage.DangerousDepths.Access.LavaPumpWarzoneIV, storageValue = 30 }, - { storage = Storage.DangerousDepths.Dwarves.Status, storageValue = 10 }, - { storage = Storage.DangerousDepths.Scouts.Status, storageValue = 10 }, - { storage = Storage.DangerousDepths.Gnomes.Status, storageValue = 10 }, + { storage = Storage.Quest.U11_50.DangerousDepths.Questline, storageValue = 10 }, + { storage = Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneVI, storageValue = 10 }, + { storage = Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneV, storageValue = 10 }, + { storage = Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneIV, storageValue = 30 }, + { storage = Storage.Quest.U11_50.DangerousDepths.Dwarves.Points, storageValue = 10 }, + { storage = Storage.Quest.U11_50.DangerousDepths.Scouts.Points, storageValue = 10 }, + { storage = Storage.Quest.U11_50.DangerousDepths.Gnomes.Points, storageValue = 10 }, { storage = Storage.Quest.U8_4.InServiceOfYalahar.Questline, storageValue = 51 }, { storage = Storage.Quest.U8_4.InServiceOfYalahar.Mission01, storageValue = 6 }, { storage = Storage.Quest.U8_4.InServiceOfYalahar.Mission02, storageValue = 8 }, @@ -265,14 +265,14 @@ local questTable = { { storage = Storage.BanutaSecretTunnel.DeeperBanutaShortcut, storageValue = 1 }, { storage = Storage.Quest.U10_50.OramondQuest.QuestLine, storageValue = 1 }, { storage = Storage.Quest.U10_50.OramondQuest.ToTakeRoots.Mission, storageValue = 3000 }, - { storage = Storage.DangerousDepths.Questline, storageValue = 1 }, - { storage = Storage.DangerousDepths.Dwarves.Home, storageValue = 2 }, - { storage = Storage.DangerousDepths.Dwarves.Subterranean, storageValue = 2 }, - { storage = Storage.DangerousDepths.Gnomes.Measurements, storageValue = 2 }, - { storage = Storage.DangerousDepths.Gnomes.Ordnance, storageValue = 3 }, - { storage = Storage.DangerousDepths.Gnomes.Charting, storageValue = 2 }, - { storage = Storage.DangerousDepths.Scouts.Growth, storageValue = 2 }, - { storage = Storage.DangerousDepths.Scouts.Diremaw, storageValue = 2 }, + { storage = Storage.Quest.U11_50.DangerousDepths.Questline, storageValue = 1 }, + { storage = Storage.Quest.U11_50.DangerousDepths.Dwarves.Home, storageValue = 2 }, + { storage = Storage.Quest.U11_50.DangerousDepths.Dwarves.Subterranean, storageValue = 2 }, + { storage = Storage.Quest.U11_50.DangerousDepths.Gnomes.Measurements, storageValue = 2 }, + { storage = Storage.Quest.U11_50.DangerousDepths.Gnomes.Ordnance, storageValue = 3 }, + { storage = Storage.Quest.U11_50.DangerousDepths.Gnomes.Charting, storageValue = 2 }, + { storage = Storage.Quest.U11_50.DangerousDepths.Scouts.Growth, storageValue = 2 }, + { storage = Storage.Quest.U11_50.DangerousDepths.Scouts.Diremaw, storageValue = 2 }, { storage = Storage.Quest.U11_40.ThreatenedDreams.QuestLine, storageValue = 1 }, { storage = Storage.Quest.U11_40.ThreatenedDreams.Mission01[1], storageValue = 16 }, { storage = Storage.Quest.U11_40.ThreatenedDreams.Mission02.KroazurAccess, storageValue = 1 }, diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/actions_crude_lava_pump.lua b/data-otservbr-global/scripts/quests/dangerous_depth/actions_crude_lava_pump.lua index 64875337f37..85d4abb87f6 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/actions_crude_lava_pump.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/actions_crude_lava_pump.lua @@ -15,8 +15,8 @@ function dangerousDepthPump.onUse(player, item) for _, spectator in pairs(spectators) do if spectator:isPlayer() then local playerSpectator = spectator - if playerSpectator:getStorageValue(Storage.DangerousDepths.Access.LavaPumpWarzoneVI) ~= 1 then - playerSpectator:setStorageValue(Storage.DangerousDepths.Access.LavaPumpWarzoneVI, 1) + if playerSpectator:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneVI) ~= 1 then + playerSpectator:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneVI, 1) end end end @@ -33,8 +33,8 @@ function dangerousDepthPump.onUse(player, item) for _, spectator in pairs(spectators) do if spectator:isPlayer() then local playerSpectator = spectator - if playerSpectator:getStorageValue(Storage.DangerousDepths.Access.LavaPumpWarzoneV) ~= 1 then - playerSpectator:setStorageValue(Storage.DangerousDepths.Access.LavaPumpWarzoneV, 1) + if playerSpectator:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneV) ~= 1 then + playerSpectator:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneV, 1) end end end @@ -51,8 +51,8 @@ function dangerousDepthPump.onUse(player, item) for _, spectator in pairs(spectators) do if spectator:isPlayer() then local playerSpectator = spectator - if playerSpectator:getStorageValue(Storage.DangerousDepths.Access.LavaPumpWarzoneIV) ~= 1 then - playerSpectator:setStorageValue(Storage.DangerousDepths.Access.LavaPumpWarzoneIV, 1) + if playerSpectator:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneIV) ~= 1 then + playerSpectator:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneIV, 1) end end end diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/actions_crude_lava_pump_achievements.lua b/data-otservbr-global/scripts/quests/dangerous_depth/actions_crude_lava_pump_achievements.lua index ad6b13cda90..6b3c2fe73c5 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/actions_crude_lava_pump_achievements.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/actions_crude_lava_pump_achievements.lua @@ -32,30 +32,30 @@ function dangerousDepthAchievements.onUse(player, item) local WarzoneVI = Position(33685, 32304, 15) if positionItem == WarzoneIV then -- Warzone VI - if player:getStorageValue(Storage.DangerousDepths.Bosses.TheBaronFromBelowAchiev) < 1 then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Bosses.TheBaronFromBelowAchiev) < 1 then player:addAchievement("Buried the Baron") - player:setStorageValue(Storage.DangerousDepths.Bosses.TheBaronFromBelowAchiev, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Bosses.TheBaronFromBelowAchiev, 1) end end if positionItem == WarzoneV then -- Warzone V - if player:getStorageValue(Storage.DangerousDepths.Bosses.TheCountOfTheCoreAchiev) < 1 then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Bosses.TheCountOfTheCoreAchiev) < 1 then player:addAchievement("His Days are Counted") - player:setStorageValue(Storage.DangerousDepths.Bosses.TheCountOfTheCoreAchiev, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Bosses.TheCountOfTheCoreAchiev, 1) end end if positionItem == WarzoneVI then -- Warzone IV - if player:getStorageValue(Storage.DangerousDepths.Bosses.TheDukeOfTheDepthsAchiev) < 1 then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Bosses.TheDukeOfTheDepthsAchiev) < 1 then player:addAchievement("Duked It Out") - player:setStorageValue(Storage.DangerousDepths.Bosses.TheDukeOfTheDepthsAchiev, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Bosses.TheDukeOfTheDepthsAchiev, 1) end end - if player:getStorageValue(Storage.DangerousDepths.Bosses.LastAchievement) < 1 then - if player:getStorageValue(Storage.DangerousDepths.Bosses.TheDukeOfTheDepthsAchiev) == 1 and player:getStorageValue(Storage.DangerousDepths.Bosses.TheBaronFromBelowAchiev) == 1 and player:getStorageValue(Storage.DangerousDepths.Bosses.TheCountOfTheCoreAchiev) == 1 then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Bosses.LastAchievement) < 1 then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Bosses.TheDukeOfTheDepthsAchiev) == 1 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Bosses.TheBaronFromBelowAchiev) == 1 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Bosses.TheCountOfTheCoreAchiev) == 1 then player:addAchievement("Death in the Depths") - player:setStorageValue(Storage.DangerousDepths.Bosses.LastAchievement, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Bosses.LastAchievement, 1) end end return true diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnome_chart.lua b/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnome_chart.lua index f3f74036171..f6dbddb003f 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnome_chart.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnome_chart.lua @@ -13,51 +13,51 @@ function dangerousDepthChart.onUse(player, item, isHotkey) return true end - if player:getStorageValue(Storage.DangerousDepths.Gnomes.Charting) == 1 then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Charting) == 1 then if player:getPosition():isInRange(config.OldGate.fromPosition, config.OldGate.toPosition) then - if player:getStorageValue(Storage.DangerousDepths.Gnomes.OldGate) < 1 then - player:setStorageValue(Storage.DangerousDepths.Gnomes.OldGate, 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.ChartingCount, player:getStorageValue(Storage.DangerousDepths.Gnomes.ChartingCount) + 1) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.OldGate) < 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.OldGate, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.ChartingCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.ChartingCount) + 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You charted the location and dimensions of a strange structure, an ancient gate.") player:getPosition():sendMagicEffect(CONST_ME_HITAREA) end end if player:getPosition():isInRange(config.LostRuin.fromPosition, config.LostRuin.toPosition) then - if player:getStorageValue(Storage.DangerousDepths.Gnomes.LostRuin) < 1 then - player:setStorageValue(Storage.DangerousDepths.Gnomes.LostRuin, 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.ChartingCount, player:getStorageValue(Storage.DangerousDepths.Gnomes.ChartingCount) + 1) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LostRuin) < 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LostRuin, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.ChartingCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.ChartingCount) + 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You charted the location and dimensions of a strange structure, a small ruin.") player:getPosition():sendMagicEffect(CONST_ME_HITAREA) end end if player:getPosition():isInRange(config.TheGaze.fromPosition, config.TheGaze.toPosition) then - if player:getStorageValue(Storage.DangerousDepths.Gnomes.TheGaze) < 1 then - player:setStorageValue(Storage.DangerousDepths.Gnomes.TheGaze, 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.ChartingCount, player:getStorageValue(Storage.DangerousDepths.Gnomes.ChartingCount) + 1) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.TheGaze) < 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.TheGaze, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.ChartingCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.ChartingCount) + 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You charted the location and dimensions of a strange structure, resembling a stone face.") player:getPosition():sendMagicEffect(CONST_ME_HITAREA) end end if player:getPosition():isInRange(config.Outpost.fromPosition, config.Outpost.toPosition) then - if player:getStorageValue(Storage.DangerousDepths.Gnomes.Outpost) < 1 then - player:setStorageValue(Storage.DangerousDepths.Gnomes.Outpost, 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.ChartingCount, player:getStorageValue(Storage.DangerousDepths.Gnomes.ChartingCount) + 1) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Outpost) < 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Outpost, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.ChartingCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.ChartingCount) + 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You charted the location and dimensions of a strange structure, an outpost.") player:getPosition():sendMagicEffect(CONST_ME_HITAREA) end end if player:getPosition():isInRange(config.Bastion.fromPosition, config.Bastion.toPosition) then - if player:getStorageValue(Storage.DangerousDepths.Gnomes.Bastion) < 1 then - player:setStorageValue(Storage.DangerousDepths.Gnomes.Bastion, 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.ChartingCount, player:getStorageValue(Storage.DangerousDepths.Gnomes.ChartingCount) + 1) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Bastion) < 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Bastion, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.ChartingCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.ChartingCount) + 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You charted the location and dimensions of a strange structure, a bastion.") player:getPosition():sendMagicEffect(CONST_ME_HITAREA) end end if player:getPosition():isInRange(config.BrokenTower.fromPosition, config.BrokenTower.toPosition) then - if player:getStorageValue(Storage.DangerousDepths.Gnomes.BrokenTower) < 1 then - player:setStorageValue(Storage.DangerousDepths.Gnomes.BrokenTower, 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.ChartingCount, player:getStorageValue(Storage.DangerousDepths.Gnomes.ChartingCount) + 1) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.BrokenTower) < 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.BrokenTower, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.ChartingCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.ChartingCount) + 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You charted the location and dimensions of a strange structure, a broken tower.") player:getPosition():sendMagicEffect(CONST_ME_HITAREA) end @@ -66,5 +66,5 @@ function dangerousDepthChart.onUse(player, item, isHotkey) return true end -dangerousDepthChart:id(31931) +dangerousDepthChart:id(27308) dangerousDepthChart:register() diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnome_items.lua b/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnome_items.lua index 4589b865066..fc5b6f90e39 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnome_items.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnome_items.lua @@ -1,22 +1,24 @@ local dangerousDepthItems = Action() + function dangerousDepthItems.onUse(player, item) - if item:getUniqueId() == 57235 then - if player:getStorageValue(Storage.DangerousDepths.Gnomes.GnomeChartPaper) == 1 then -- Permissão para usar o baú == 1 then - player:addItem(31931, 1) + if item.uid == 57235 then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.GnomeChartPaper) == 1 then + player:addItem(27308, 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a gnome charts.") - player:setStorageValue(Storage.DangerousDepths.Gnomes.GnomeChartPaper, 2) - elseif player:getStorageValue(Storage.DangerousDepths.Gnomes.GnomeChartPaper) == 2 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.GnomeChartPaper, 2) + elseif player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.GnomeChartPaper) == 2 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can not use this item again.") end - elseif item:getUniqueId() == 57236 then - if player:getStorageValue(Storage.DangerousDepths.Gnomes.GnomeChartChest) == 1 then -- Permissão para usar o baú == 1 then - player:addItem(31930, 1) + elseif item.uid == 57236 then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.GnomeChartChest) == 1 then + player:addItem(27307, 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a gnome trignometre.") - player:setStorageValue(Storage.DangerousDepths.Gnomes.GnomeChartChest, 2) - elseif player:getStorageValue(Storage.DangerousDepths.Gnomes.GnomeChartChest) == 2 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.GnomeChartChest, 2) + elseif player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.GnomeChartChest) == 2 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is empty.") end end + return true end diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnome_trignometre.lua b/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnome_trignometre.lua index 458e9f67c2e..baf96e52253 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnome_trignometre.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnome_trignometre.lua @@ -11,43 +11,43 @@ function dangerousDepthTrignometre.onUse(player, item, isHotkey) if not player then return true end - if player:getStorageValue(Storage.DangerousDepths.Gnomes.Measurements) == 1 then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Measurements) == 1 then if player:getPosition():isInRange(config.locationA.fromPosition, config.locationA.toPosition) then - if player:getStorageValue(Storage.DangerousDepths.Gnomes.LocationA) < 1 then - player:setStorageValue(Storage.DangerousDepths.Gnomes.LocationA, 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.LocationCount, player:getStorageValue(Storage.DangerousDepths.Gnomes.LocationCount) + 1) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationA) < 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationA, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationCount) + 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You probed the location successfully.") player:getPosition():sendMagicEffect(CONST_ME_HITAREA) end end if player:getPosition():isInRange(config.locationB.fromPosition, config.locationB.toPosition) then - if player:getStorageValue(Storage.DangerousDepths.Gnomes.LocationB) < 1 then - player:setStorageValue(Storage.DangerousDepths.Gnomes.LocationB, 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.LocationCount, player:getStorageValue(Storage.DangerousDepths.Gnomes.LocationCount) + 1) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationB) < 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationB, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationCount) + 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You probed the location successfully.") player:getPosition():sendMagicEffect(CONST_ME_HITAREA) end end if player:getPosition():isInRange(config.locationC.fromPosition, config.locationC.toPosition) then - if player:getStorageValue(Storage.DangerousDepths.Gnomes.LocationC) < 1 then - player:setStorageValue(Storage.DangerousDepths.Gnomes.LocationC, 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.LocationCount, player:getStorageValue(Storage.DangerousDepths.Gnomes.LocationCount) + 1) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationC) < 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationC, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationCount) + 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You probed the location successfully.") player:getPosition():sendMagicEffect(CONST_ME_HITAREA) end end if player:getPosition():isInRange(config.locationD.fromPosition, config.locationD.toPosition) then - if player:getStorageValue(Storage.DangerousDepths.Gnomes.LocationD) < 1 then - player:setStorageValue(Storage.DangerousDepths.Gnomes.LocationD, 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.LocationCount, player:getStorageValue(Storage.DangerousDepths.Gnomes.LocationCount) + 1) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationD) < 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationD, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationCount) + 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You probed the location successfully.") player:getPosition():sendMagicEffect(CONST_ME_HITAREA) end end if player:getPosition():isInRange(config.locationE.fromPosition, config.locationE.toPosition) then - if player:getStorageValue(Storage.DangerousDepths.Gnomes.LocationE) < 1 then - player:setStorageValue(Storage.DangerousDepths.Gnomes.LocationE, 1) - player:setStorageValue(Storage.DangerousDepths.Gnomes.LocationCount, player:getStorageValue(Storage.DangerousDepths.Gnomes.LocationCount) + 1) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationE) < 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationE, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationCount) + 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You probed the location successfully.") player:getPosition():sendMagicEffect(CONST_ME_HITAREA) end @@ -56,5 +56,5 @@ function dangerousDepthTrignometre.onUse(player, item, isHotkey) return true end -dangerousDepthTrignometre:id(31930) +dangerousDepthTrignometre:id(27307) dangerousDepthTrignometre:register() diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnomish_chest.lua b/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnomish_chest.lua index 6219bb88ac3..418d1d16c9b 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnomish_chest.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnomish_chest.lua @@ -1,10 +1,11 @@ local dangerousDepthChest = Action() + function dangerousDepthChest.onUse(player, item) - if player:getStorageValue(Storage.DangerousDepths.Scouts.GnomishChest) == 1 then - player:addItem(30733, 1) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.GnomishChest) == 1 then + player:addItem(27498, 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found gnomish pesticides.") - player:setStorageValue(Storage.DangerousDepths.Scouts.GnomishChest, 2) - elseif player:getStorageValue(Storage.DangerousDepths.Scouts.GnomishChest) == 2 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.GnomishChest, 2) + elseif player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.GnomishChest) == 2 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is empty.") end return true diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnomish_pesticide.lua b/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnomish_pesticide.lua index a256e3bf6c6..55aae368926 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnomish_pesticide.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnomish_pesticide.lua @@ -1,4 +1,5 @@ local dangerousDepthPesticide = Action() + function dangerousDepthPesticide.onUse(player, item, fromPosition, target, toPosition, isHotkey) if not player then return true @@ -17,15 +18,15 @@ function dangerousDepthPesticide.onUse(player, item, fromPosition, target, toPos local posTarget = target:getPosition() if target:getId() == corpseId then - if player:getStorageValue(Storage.DangerousDepths.Scouts.Diremaw) == 1 and player:getStorageValue(Storage.DangerousDepths.Scouts.DiremawsCount) < 20 then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Diremaw) == 1 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.DiremawsCount) < 20 then if r <= 50 then posTarget:sendMagicEffect(CONST_ME_POISONAREA) local diremaw = Game.createMonster("Diremaw", target:getPosition()) - player:setStorageValue(Storage.DangerousDepths.Scouts.DiremawsCount, player:getStorageValue(Storage.DangerousDepths.Scouts.DiremawsCount) + 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.DiremawsCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.DiremawsCount) + 1) target:transform(30730) else posTarget:sendMagicEffect(CONST_ME_POISONAREA) - player:setStorageValue(Storage.DangerousDepths.Scouts.DiremawsCount, player:getStorageValue(Storage.DangerousDepths.Scouts.DiremawsCount) + 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.DiremawsCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.DiremawsCount) + 1) target:transform(30730) end end @@ -37,5 +38,5 @@ function dangerousDepthPesticide.onUse(player, item, fromPosition, target, toPos return true end -dangerousDepthPesticide:id(30733) +dangerousDepthPesticide:id(27498) dangerousDepthPesticide:register() diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/actions_lever_barrel.lua b/data-otservbr-global/scripts/quests/dangerous_depth/actions_lever_barrel.lua index 327878284a0..d9575d43262 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/actions_lever_barrel.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/actions_lever_barrel.lua @@ -5,32 +5,32 @@ local transformid = { local config = { first = { - [1] = { fromPosition = Position(33877, 32060, 14), toPosition = Position(33888, 32068, 14), stgRoom = Storage.DangerousDepths.Scouts.FirstBarrel }, + [1] = { fromPosition = Position(33877, 32060, 14), toPosition = Position(33888, 32068, 14), stgRoom = Storage.Quest.U11_50.DangerousDepths.Scouts.FirstBarrel }, }, second = { - [1] = { fromPosition = Position(33906, 32026, 14), toPosition = Position(33916, 32037, 14), stgRoom = Storage.DangerousDepths.Scouts.SecondBarrel }, + [1] = { fromPosition = Position(33906, 32026, 14), toPosition = Position(33916, 32037, 14), stgRoom = Storage.Quest.U11_50.DangerousDepths.Scouts.SecondBarrel }, }, third = { - [1] = { fromPosition = Position(33865, 32009, 14), toPosition = Position(33874, 32020, 14), stgRoom = Storage.DangerousDepths.Scouts.ThirdBarrel }, + [1] = { fromPosition = Position(33865, 32009, 14), toPosition = Position(33874, 32020, 14), stgRoom = Storage.Quest.U11_50.DangerousDepths.Scouts.ThirdBarrel }, }, fourth = { - [1] = { fromPosition = Position(33837, 31984, 14), toPosition = Position(33852, 31991, 14), stgRoom = Storage.DangerousDepths.Scouts.FourthBarrel }, + [1] = { fromPosition = Position(33837, 31984, 14), toPosition = Position(33852, 31991, 14), stgRoom = Storage.Quest.U11_50.DangerousDepths.Scouts.FourthBarrel }, }, fifth = { - [1] = { fromPosition = Position(33923, 31982, 14), toPosition = Position(33942, 31998, 14), stgRoom = Storage.DangerousDepths.Scouts.FifthBarrel }, + [1] = { fromPosition = Position(33923, 31982, 14), toPosition = Position(33942, 31998, 14), stgRoom = Storage.Quest.U11_50.DangerousDepths.Scouts.FifthBarrel }, }, } -local function checarPos(item) +local function checkPos(item) for _, info1 in pairs(config.first) do local fromPos, toPos, stgRoom = info1.fromPosition, info1.toPosition, info1.stgRoom if item:getPosition():isInRange(fromPos, toPos) then - local stgbarrel = item:getCustomAttribute(Storage.DangerousDepths.Scouts.Barrel) or -1 - local player = Player(stgbarrel) + local stgBarrel = item:getCustomAttribute(Storage.Quest.U11_50.DangerousDepths.Scouts.Barrel) or -1 + local player = Player(stgBarrel) if player then if player:getStorageValue(stgRoom) < 1 then - player:setStorageValue(Storage.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.DangerousDepths.Scouts.BarrelCount) + 1) - player:setStorageValue(stgRoom, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount) + 1) + player:setStorageValue(stgRoom, 1) end end end @@ -38,12 +38,12 @@ local function checarPos(item) for _, info2 in pairs(config.second) do local fromPos, toPos, stgRoom = info2.fromPosition, info2.toPosition, info2.stgRoom if item:getPosition():isInRange(fromPos, toPos) then - local stgbarrel = item:getCustomAttribute(Storage.DangerousDepths.Scouts.Barrel) or -1 - local player = Player(stgbarrel) + local stgBarrel = item:getCustomAttribute(Storage.Quest.U11_50.DangerousDepths.Scouts.Barrel) or -1 + local player = Player(stgBarrel) if player then if player:getStorageValue(stgRoom) < 1 then - player:setStorageValue(Storage.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.DangerousDepths.Scouts.BarrelCount) + 1) - player:setStorageValue(stgRoom, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount) + 1) + player:setStorageValue(stgRoom, 1) end end end @@ -51,12 +51,12 @@ local function checarPos(item) for _, info3 in pairs(config.third) do local fromPos, toPos, stgRoom = info3.fromPosition, info3.toPosition, info3.stgRoom if item:getPosition():isInRange(fromPos, toPos) then - local stgbarrel = item:getCustomAttribute(Storage.DangerousDepths.Scouts.Barrel) or -1 - local player = Player(stgbarrel) + local stgBarrel = item:getCustomAttribute(Storage.Quest.U11_50.DangerousDepths.Scouts.Barrel) or -1 + local player = Player(stgBarrel) if player then if player:getStorageValue(stgRoom) < 1 then - player:setStorageValue(Storage.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.DangerousDepths.Scouts.BarrelCount) + 1) - player:setStorageValue(stgRoom, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount) + 1) + player:setStorageValue(stgRoom, 1) end end end @@ -64,12 +64,12 @@ local function checarPos(item) for _, info4 in pairs(config.fourth) do local fromPos, toPos, stgRoom = info4.fromPosition, info4.toPosition, info4.stgRoom if item:getPosition():isInRange(fromPos, toPos) then - local stgbarrel = item:getCustomAttribute(Storage.DangerousDepths.Scouts.Barrel) or -1 - local player = Player(stgbarrel) + local stgBarrel = item:getCustomAttribute(Storage.Quest.U11_50.DangerousDepths.Scouts.Barrel) or -1 + local player = Player(stgBarrel) if player then if player:getStorageValue(stgRoom) < 1 then - player:setStorageValue(Storage.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.DangerousDepths.Scouts.BarrelCount) + 1) - player:setStorageValue(stgRoom, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount) + 1) + player:setStorageValue(stgRoom, 1) end end end @@ -77,12 +77,12 @@ local function checarPos(item) for _, info5 in pairs(config.fifth) do local fromPos, toPos, stgRoom = info5.fromPosition, info5.toPosition, info5.stgRoom if item:getPosition():isInRange(fromPos, toPos) then - local stgbarrel = item:getCustomAttribute(Storage.DangerousDepths.Scouts.Barrel) or -1 - local player = Player(stgbarrel) + local stgBarrel = item:getCustomAttribute(Storage.Quest.U11_50.DangerousDepths.Scouts.Barrel) or -1 + local player = Player(stgBarrel) if player then if player:getStorageValue(stgRoom) < 1 then - player:setStorageValue(Storage.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.DangerousDepths.Scouts.BarrelCount) + 1) - player:setStorageValue(stgRoom, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount) + 1) + player:setStorageValue(stgRoom, 1) end end end @@ -93,57 +93,55 @@ local function explode(item) local position = item:getPosition() local fromPosition = Position(position.x - 6, position.y - 6, position.z) local toPosition = Position(position.x + 6, position.y + 6, position.z) + local c = Game.getPlayers()[1] addEvent(function() - for x = fromPosition.x, toPosition.x do - for y = fromPosition.y, toPosition.y do - for z = fromPosition.z, toPosition.z do - Position(x, y, z):sendMagicEffect(CONST_ME_FIREAREA) + for x = fromPosition.x, toPosition.x do + for y = fromPosition.y, toPosition.y do + for z = fromPosition.z, toPosition.z do + if Tile(Position(x, y, z)) then + if Tile(Position(x, y, z)) then + local posEffect = Tile(Position(x, y, z)):getPosition() + local creature = Tile(Position(x, y, z)):getTopCreature() + posEffect:sendMagicEffect(CONST_ME_FIREAREA) + end end end end - checarPos(item) + end + checkPos(item) + c:say("KABOOM!!", TALKTYPE_MONSTER_SAY, false, false, position) if item then item:remove() end end, 2 * 1000) - item:transform(32401) + item:transform(27491) + c:say("Tsssss...!", TALKTYPE_MONSTER_SAY, false, false, position) end local dangerousDepthLever = Action() + function dangerousDepthLever.onUse(player, item) if not player then return true end local posBarrel = Position(33838, 32077, 14) - local stgCount = player:getStorageValue(Storage.DangerousDepths.Scouts.BarrelCount) - local BarrelTimer = player:getStorageValue(Storage.DangerousDepths.Scouts.BarrelTimer) + local stgCount = player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount) + local barrelTimer = player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelTimer) if item:getId() == 2772 then - if player:getStorageValue(Storage.DangerousDepths.Scouts.Growth) == 1 and stgCount < 5 and BarrelTimer <= 0 then - local barrel = Game.createItem(27492, 1, posBarrel) - if not barrel then - return false - end - barrel:setCustomAttribute(Storage.DangerousDepths.Scouts.Barrel, player:getId()) - - addEvent(function(pos, pid) - local tile = Tile(pos) - if tile then - local barrel = tile:getItemById(27492) - if barrel then - explode(barrel) - end + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Growth) == 1 and stgCount < 5 and barrelTimer <= 0 then + local Barrel = Game.createItem(27492, 1, posBarrel) + local stgBarrel = Barrel:getCustomAttribute(Storage.Quest.U11_50.DangerousDepths.Scouts.Barrel) or -1 + Barrel:setCustomAttribute(Storage.Quest.U11_50.DangerousDepths.Scouts.Barrel, player:getId()) + addEvent(function() + if Barrel then + explode(Barrel) end - local player = Player(pid) - if player then - player:setStorageValue(Storage.DangerousDepths.Scouts.BarrelTimer, 0) - end - end, 2 * 60 * 1000, posBarrel, player:getId()) - - --Time is set to 0 when barrel explodes - player:setStorageValue(Storage.DangerousDepths.Scouts.BarrelTimer, os.time() + 2 * 60) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelTimer, 0) + end, 2 * 60 * 1000) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelTimer, os.time() + 2 * 60) end end item:transform(transformid[item:getId()]) @@ -151,4 +149,4 @@ function dangerousDepthLever.onUse(player, item) end dangerousDepthLever:aid(57234) -dangerousDepthLever:register() +dangerousDepthLever:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/actions_using_crystals.lua b/data-otservbr-global/scripts/quests/dangerous_depth/actions_using_crystals.lua index 84dc7e433fa..6f134dab02d 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/actions_using_crystals.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/actions_using_crystals.lua @@ -420,14 +420,14 @@ function dangerousDepthCrystals.onUse(player, item, fromPosition, target, toPosi local targetPosition = target:getPosition() if targetPosition == WarzoneIV and target:getId() == geodeId then -- Warzone 4 BOSS!!! - if Game.getStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneIV) < 30 then + if Game.getStorageValue(Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneIV) < 30 then targetPosition:sendMagicEffect(CONST_ME_HITAREA) item:remove(1) - if Game.getStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneIV) < 0 then - Game.setStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneIV, 0) + if Game.getStorageValue(Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneIV) < 0 then + Game.setStorageValue(Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneIV, 0) end - Game.setStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneIV, Game.getStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneIV) + 1) - if Game.getStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneIV) == 30 then + Game.setStorageValue(Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneIV, Game.getStorageValue(Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneIV) + 1) + if Game.getStorageValue(Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneIV) == 30 then local spectators = Game.getSpectators(targetPosition, false, true, 3, 3, 3, 3) for _, spectator in pairs(spectators) do if spectator:isPlayer() then @@ -445,7 +445,7 @@ function dangerousDepthCrystals.onUse(player, item, fromPosition, target, toPosi Game.createItem(388, 1, Position(33460, 32267, 15)) end end, 8 * 1000) - addEvent(clearForgotten, 30 * 60 * 1000, Position(33638, 32291, 15), Position(33675, 32313, 15), Position(33462, 32267, 15), GlobalStorage.DangerousDepths.Geodes.WarzoneIV) + addEvent(clearForgotten, 30 * 60 * 1000, Position(33638, 32291, 15), Position(33675, 32313, 15), Position(33462, 32267, 15), Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneIV) startWarzoneIV() end end @@ -455,14 +455,14 @@ function dangerousDepthCrystals.onUse(player, item, fromPosition, target, toPosi end if targetPosition == WarzoneV and target:getId() == geodeId then -- Warzone 5 BOSS!!! - if Game.getStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneV) < 30 then + if Game.getStorageValue(Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneV) < 30 then targetPosition:sendMagicEffect(CONST_ME_HITAREA) item:remove(1) - if Game.getStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneV) < 0 then - Game.setStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneV, 0) + if Game.getStorageValue(Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneV) < 0 then + Game.setStorageValue(Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneV, 0) end - Game.setStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneV, Game.getStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneV) + 1) - if Game.getStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneV) == 30 then + Game.setStorageValue(Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneV, Game.getStorageValue(Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneV) + 1) + if Game.getStorageValue(Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneV) == 30 then local spectators = Game.getSpectators(targetPosition, false, true, 3, 3, 3, 3) for _, spectator in pairs(spectators) do if spectator:isPlayer() then @@ -480,7 +480,7 @@ function dangerousDepthCrystals.onUse(player, item, fromPosition, target, toPosi Game.createItem(388, 1, Position(33324, 32109, 15)) end end, 8 * 1000) - addEvent(clearForgotten, 30 * 60 * 1000, Position(33668, 32310, 15), Position(33695, 32343, 15), Position(33323, 32111, 15), GlobalStorage.DangerousDepths.Geodes.WarzoneV) + addEvent(clearForgotten, 30 * 60 * 1000, Position(33668, 32310, 15), Position(33695, 32343, 15), Position(33323, 32111, 15), Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneV) startWarzoneV() end end @@ -490,14 +490,14 @@ function dangerousDepthCrystals.onUse(player, item, fromPosition, target, toPosi end if targetPosition == WarzoneVI and target:getId() == geodeId then -- Warzone 6 BOSS!!! - if Game.getStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneVI) < 30 then + if Game.getStorageValue(Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneVI) < 30 then targetPosition:sendMagicEffect(CONST_ME_HITAREA) item:remove(1) - if Game.getStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneVI) < 0 then - Game.setStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneVI, 0) + if Game.getStorageValue(Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneVI) < 0 then + Game.setStorageValue(Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneVI, 0) end - Game.setStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneVI, Game.getStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneVI) + 1) - if Game.getStorageValue(GlobalStorage.DangerousDepths.Geodes.WarzoneVI) == 30 then + Game.setStorageValue(Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneVI, Game.getStorageValue(Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneVI) + 1) + if Game.getStorageValue(Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneVI) == 30 then local spectators = Game.getSpectators(targetPosition, false, true, 3, 3, 3, 3) for _, spectator in pairs(spectators) do if spectator:isPlayer() then @@ -515,7 +515,7 @@ function dangerousDepthCrystals.onUse(player, item, fromPosition, target, toPosi Game.createItem(388, 1, Position(33275, 32316, 15)) end end, 8 * 1000) - addEvent(clearForgotten, 30 * 60 * 1000, Position(33684, 32293, 15), Position(33724, 32314, 15), Position(33275, 32318, 15), GlobalStorage.DangerousDepths.Geodes.WarzoneVI) + addEvent(clearForgotten, 30 * 60 * 1000, Position(33684, 32293, 15), Position(33724, 32314, 15), Position(33275, 32318, 15), Storage.Quest.U11_50.DangerousDepths.Geodes.WarzoneVI) startWarzoneVI() end end diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/actions_warzone_crystals.lua b/data-otservbr-global/scripts/quests/dangerous_depth/actions_warzone_crystals.lua index 910b900c4da..64ebb40f399 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/actions_warzone_crystals.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/actions_warzone_crystals.lua @@ -2,28 +2,28 @@ local crystalDuration = 5 * 60 -- 5 minutes local crystals = { -- Warzone IV - [57350] = Storage.DangerousDepths.Crystals.WarzoneVI.MediumCrystal1, - [57351] = Storage.DangerousDepths.Crystals.WarzoneVI.BigCrystal1, - [57352] = Storage.DangerousDepths.Crystals.WarzoneVI.BigCrystal2, - [57353] = Storage.DangerousDepths.Crystals.WarzoneVI.MediumCrystal2, - [57354] = Storage.DangerousDepths.Crystals.WarzoneVI.SmallCrystal1, - [57355] = Storage.DangerousDepths.Crystals.WarzoneVI.SmallCrystal2, + [57350] = Storage.Quest.U11_50.DangerousDepths.Crystals.WarzoneVI.MediumCrystal1, + [57351] = Storage.Quest.U11_50.DangerousDepths.Crystals.WarzoneVI.BigCrystal1, + [57352] = Storage.Quest.U11_50.DangerousDepths.Crystals.WarzoneVI.BigCrystal2, + [57353] = Storage.Quest.U11_50.DangerousDepths.Crystals.WarzoneVI.MediumCrystal2, + [57354] = Storage.Quest.U11_50.DangerousDepths.Crystals.WarzoneVI.SmallCrystal1, + [57355] = Storage.Quest.U11_50.DangerousDepths.Crystals.WarzoneVI.SmallCrystal2, -- Warzone V - [57356] = Storage.DangerousDepths.Crystals.WarzoneV.BigCrystal1, - [57357] = Storage.DangerousDepths.Crystals.WarzoneIV.MediumCrystal1, - [57358] = Storage.DangerousDepths.Crystals.WarzoneV.BigCrystal2, - [57359] = Storage.DangerousDepths.Crystals.WarzoneIV.MediumCrystal2, - [57360] = Storage.DangerousDepths.Crystals.WarzoneV.SmallCrystal1, - [57361] = Storage.DangerousDepths.Crystals.WarzoneV.SmallCrystal2, + [57356] = Storage.Quest.U11_50.DangerousDepths.Crystals.WarzoneV.BigCrystal1, + [57357] = Storage.Quest.U11_50.DangerousDepths.Crystals.WarzoneIV.MediumCrystal1, + [57358] = Storage.Quest.U11_50.DangerousDepths.Crystals.WarzoneV.BigCrystal2, + [57359] = Storage.Quest.U11_50.DangerousDepths.Crystals.WarzoneIV.MediumCrystal2, + [57360] = Storage.Quest.U11_50.DangerousDepths.Crystals.WarzoneV.SmallCrystal1, + [57361] = Storage.Quest.U11_50.DangerousDepths.Crystals.WarzoneV.SmallCrystal2, -- Warzone IV - [57362] = Storage.DangerousDepths.Crystals.WarzoneIV.BigCrystal1, - [57363] = Storage.DangerousDepths.Crystals.WarzoneIV.MediumCrystal1, - [57364] = Storage.DangerousDepths.Crystals.WarzoneIV.BigCrystal2, - [57365] = Storage.DangerousDepths.Crystals.WarzoneIV.MediumCrystal2, - [57366] = Storage.DangerousDepths.Crystals.WarzoneIV.SmallCrystal1, - [57367] = Storage.DangerousDepths.Crystals.WarzoneIV.SmallCrystal2, + [57362] = Storage.Quest.U11_50.DangerousDepths.Crystals.WarzoneIV.BigCrystal1, + [57363] = Storage.Quest.U11_50.DangerousDepths.Crystals.WarzoneIV.MediumCrystal1, + [57364] = Storage.Quest.U11_50.DangerousDepths.Crystals.WarzoneIV.BigCrystal2, + [57365] = Storage.Quest.U11_50.DangerousDepths.Crystals.WarzoneIV.MediumCrystal2, + [57366] = Storage.Quest.U11_50.DangerousDepths.Crystals.WarzoneIV.SmallCrystal1, + [57367] = Storage.Quest.U11_50.DangerousDepths.Crystals.WarzoneIV.SmallCrystal2, } local crystalsChance = { diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/actions_wooden_trash.lua b/data-otservbr-global/scripts/quests/dangerous_depth/actions_wooden_trash.lua index 15aa8ec6f4b..0ca92bacb45 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/actions_wooden_trash.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/actions_wooden_trash.lua @@ -1,12 +1,13 @@ local dangerousDepthWooden = Action() + function dangerousDepthWooden.onUse(creature, item) if not creature or not creature:isPlayer() then return true end local r = math.random(1, 100) - local stgValueP = creature:getStorageValue(Storage.DangerousDepths.Dwarves.Prisoners) + local stgValueP = creature:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Prisoners) - if creature:getStorageValue(Storage.DangerousDepths.Dwarves.Home) == 1 and stgValueP < 3 then + if creature:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Home) == 1 and stgValueP < 3 then if r <= 25 then creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You started an escort, get your prisoner to the dwarf outpost!") local prisoner = Game.createMonster("Captured Dwarf", item:getPosition()) diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/creaturescripts_lost_exile_task.lua b/data-otservbr-global/scripts/quests/dangerous_depth/creaturescripts_lost_exile_task.lua index 24abf74281c..72dac0c8fd9 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/creaturescripts_lost_exile_task.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/creaturescripts_lost_exile_task.lua @@ -1,40 +1,63 @@ local fromPos = Position(33768, 32227, 14) -local toPos = Position(33781, 32249, 14) +local toPos = Position(33851, 32352, 14) +local radius = 10 local lostExileKill = CreatureEvent("LastExileDeath") + function lostExileKill.onDeath(creature, _corpse, _lastHitKiller, mostDamageKiller) - onDeathForParty(creature, mostDamageKiller, function(creature, player) - if player:getStorageValue(Storage.DangerousDepths.Dwarves.Home) ~= 1 then - return - end - if not creature:getPosition():isInRange(fromPos, toPos) then - return - end - local storage = player:getStorageValue(Storage.DangerousDepths.Dwarves.LostExiles) - if storage < 20 then - if storage < 0 then - player:setStorageValue(Storage.DangerousDepths.Dwarves.LostExiles, 1) - end - player:setStorageValue(Storage.DangerousDepths.Dwarves.LostExiles, storage + 1) - end - end) - return true + local function isMakeshiftHomeNearby(creature) + local creaturePosition = creature:getPosition() + local spectators = Game.getSpectators(creaturePosition, false, false, radius, radius, radius, radius) -- Busca criaturas em torno da posição da morte + + for _, spectator in ipairs(spectators) do + if spectator:isMonster() and spectator:getName():lower() == "makeshift home" then + return true + end + end + return false + end + + onDeathForParty(creature, mostDamageKiller, function(creature, player) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Home) ~= 1 then + return + end + + if not creature:getPosition():isInRange(fromPos, toPos) then + return + end + + if isMakeshiftHomeNearby(creature) then + return + end + + local storage = player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.LostExiles) + if storage < 20 then + if storage < 0 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.LostExiles, 1) + end + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.LostExiles, storage + 1) + end + end) + + return true end lostExileKill:register() + local wormKill = CreatureEvent("WarzoneWormDeath") + function wormKill.onDeath(creature, _corpse, _lastHitKiller, mostDamageKiller) - local storage = mostDamageKiller:getStorageValue(Storage.DangerousDepths.Dwarves.Organisms) + local storage = mostDamageKiller:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Organisms) onDeathForParty(creature, mostDamageKiller, function(creature, player) - if player:getStorageValue(Storage.DangerousDepths.Dwarves.Subterranean) ~= 1 then + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Subterranean) ~= 1 then return end if storage < 50 then if storage < 0 then - player:setStorageValue(Storage.DangerousDepths.Dwarves.Organisms, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Organisms, 1) end - player:setStorageValue(Storage.DangerousDepths.Dwarves.Organisms, storage + 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Organisms, storage + 1) end end) @@ -44,6 +67,7 @@ end wormKill:register() local makeshiftKill = CreatureEvent("MakeshiftHomeDeath") + function makeshiftKill.onDeath(creature, _corpse, _lastHitKiller, mostDamageKiller) local woodenTrash = Game.createItem(398, 1, creature:getPosition()) woodenTrash:setActionId(57233) diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/movements_energy_entrance.lua b/data-otservbr-global/scripts/quests/dangerous_depth/movements_energy_entrance.lua index c4d76a05488..d386ea782da 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/movements_energy_entrance.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/movements_energy_entrance.lua @@ -14,38 +14,50 @@ function energyEntrance.onStepIn(creature, item, position, fromPosition, toPosit if not player then return true end + + local function hasWarzoneAccess() + return player:getStorageValue(Storage.Quest.U9_60.BigfootsBurden.Warzone1Access) == 1 and + player:getStorageValue(Storage.Quest.U9_60.BigfootsBurden.Warzone2Access) == 1 and + player:getStorageValue(Storage.Quest.U9_60.BigfootsBurden.Warzone3Access) == 1 + end + if player:getPosition() == Position(33831, 32138, 14) then - if player:getStorageValue(Storage.DangerousDepths.Scouts.Status) >= -50 then + local status = player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.Points) + if (hasWarzoneAccess() and status >= 10) or (not hasWarzoneAccess() and status >= 15) then player:teleportTo(Position(34023, 32037, 14)) else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can not use this portal yet.") player:teleportTo(Position(fromPosition.x, fromPosition.y + 1, fromPosition.z)) end + elseif player:getPosition() == Position(34021, 32037, 14) then player:teleportTo(Position(33831, 32141, 14)) - end - if player:getPosition() == Position(33784, 32205, 14) then - if player:getStorageValue(Storage.DangerousDepths.Dwarves.Status) >= -50 then + elseif player:getPosition() == Position(33784, 32205, 14) then + local status = player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Points) + if (hasWarzoneAccess() and status >= 10) or (not hasWarzoneAccess() and status >= 15) then player:teleportTo(Position(33921, 32401, 14)) else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can not use this portal yet.") player:teleportTo(Position(fromPosition.x - 1, fromPosition.y, fromPosition.z)) end + elseif player:getPosition() == Position(33921, 32402, 14) then player:teleportTo(Position(33782, 32205, 14)) - end - if player:getPosition() == Position(33829, 32187, 14) then - if player:getStorageValue(Storage.DangerousDepths.Gnomes.Status) >= -50 then + elseif player:getPosition() == Position(33829, 32187, 14) then + local status = player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points) + if (hasWarzoneAccess() and status >= 10) or (not hasWarzoneAccess() and status >= 15) then player:teleportTo(Position(33982, 32236, 14)) else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can not use this portal yet.") player:teleportTo(Position(fromPosition.x, fromPosition.y - 1, fromPosition.z)) end + elseif player:getPosition() == Position(33982, 32234, 14) then player:teleportTo(Position(33829, 32186, 14)) end + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true @@ -54,4 +66,5 @@ end for index, value in pairs(positions) do energyEntrance:position(value) end + energyEntrance:register() diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/movements_gnome_ordnance.lua b/data-otservbr-global/scripts/quests/dangerous_depth/movements_gnome_ordnance.lua index c74f3db575c..555ba543a26 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/movements_gnome_ordnance.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/movements_gnome_ordnance.lua @@ -6,8 +6,8 @@ function gnomeOrdnance.onStepIn(creature, position, fromPosition, toPosition) return true end - if player:getStorageValue(Storage.DangerousDepths.Gnomes.Ordnance) == 1 then - player:setStorageValue(Storage.DangerousDepths.Gnomes.Ordnance, 2) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Ordnance) == 1 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Ordnance, 2) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You started an escort, get everyone to safety!") end return true diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/movements_gnomes_ordnance_end.lua b/data-otservbr-global/scripts/quests/dangerous_depth/movements_gnomes_ordnance_end.lua index 3bb8c2f8c9e..cda301170c1 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/movements_gnomes_ordnance_end.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/movements_gnomes_ordnance_end.lua @@ -17,9 +17,9 @@ function gnomesOrdnanceEnd.onStepIn(creature, position, fromPosition, toPosition local c = Tile(Position(x, y, z)):getTopCreature() if c then if c:isPlayer() then - if c:getStorageValue(Storage.DangerousDepths.Gnomes.Ordnance) == 2 then - if c:getStorageValue(Storage.DangerousDepths.Gnomes.GnomesCount) < 5 then - c:setStorageValue(Storage.DangerousDepths.Gnomes.GnomesCount, c:getStorageValue(Storage.DangerousDepths.Gnomes.GnomesCount) + 1) + if c:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Ordnance) == 2 then + if c:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.GnomesCount) < 5 then + c:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.GnomesCount, c:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.GnomesCount) + 1) c:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your escort has end.") end end @@ -41,9 +41,9 @@ function gnomesOrdnanceEnd.onStepIn(creature, position, fromPosition, toPosition local c = Tile(Position(x, y, z)):getTopCreature() if c then if c:isPlayer() then - if c:getStorageValue(Storage.DangerousDepths.Gnomes.Ordnance) == 2 then - if c:getStorageValue(Storage.DangerousDepths.Gnomes.CrawlersCount) < 3 then - c:setStorageValue(Storage.DangerousDepths.Gnomes.CrawlersCount, c:getStorageValue(Storage.DangerousDepths.Gnomes.CrawlersCount) + 1) + if c:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Ordnance) == 2 then + if c:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.CrawlersCount) < 3 then + c:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.CrawlersCount, c:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.CrawlersCount) + 1) c:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your escort has end.") end end diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/movements_lost_exiles.lua b/data-otservbr-global/scripts/quests/dangerous_depth/movements_lost_exiles.lua index 2c53dbaba75..5dbb5225fc9 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/movements_lost_exiles.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/movements_lost_exiles.lua @@ -17,9 +17,9 @@ function lostExiles.onStepIn(creature, position, fromPosition, toPosition) local creature = Tile(Position(x, y, z)):getTopCreature() if creature then if creature:isPlayer() then - if creature:getStorageValue(Storage.DangerousDepths.Dwarves.Home) == 1 then - if creature:getStorageValue(Storage.DangerousDepths.Dwarves.Prisoners) < 3 then - creature:setStorageValue(Storage.DangerousDepths.Dwarves.Prisoners, creature:getStorageValue(Storage.DangerousDepths.Dwarves.Prisoners) + 1) + if creature:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Home) == 1 then + if creature:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Prisoners) < 3 then + creature:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Prisoners, creature:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Prisoners) + 1) creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your escort has end.") end end diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/movements_warzone_entrance.lua b/data-otservbr-global/scripts/quests/dangerous_depth/movements_warzone_entrance.lua index 83120868640..098e2c90e7b 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/movements_warzone_entrance.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/movements_warzone_entrance.lua @@ -6,67 +6,56 @@ function warzoneEntrance.onStepIn(creature, item, position, fromPosition, toPosi return true end - local warzoneVI = Position(33367, 32307, 15) + local warzoneVI = Position(33367, 32307, 15) if item:getPosition() == Position(33829, 32128, 14) then - if player:getStorageValue(Storage.DangerousDepths.Access.LavaPumpWarzoneVI) == 1 and player:getStorageValue(Storage.DangerousDepths.Access.TimerWarzoneVI) <= os.time() then - player:setStorageValue(Storage.DangerousDepths.Access.LavaPumpWarzoneVI, 0) - player:setStorageValue(Storage.DangerousDepths.Scouts.Status, player:getStorageValue(Storage.DangerousDepths.Scouts.Status) - 10) - player:setStorageValue(Storage.DangerousDepths.Access.TimerWarzoneVI, os.time() + 8 * 60 * 60) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneVI) == 1 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.TimerWarzoneVI) <= os.time() then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneVI, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.TimerWarzoneVI, os.time() + 8 * 60 * 60) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Entering the warzone (you can enter freely for 8 hours from now).") player:teleportTo(warzoneVI) - elseif player:getStorageValue(Storage.DangerousDepths.Access.LavaPumpWarzoneVI) ~= 1 and player:getStorageValue(Storage.DangerousDepths.Access.TimerWarzoneVI) <= os.time() then + elseif player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneVI) ~= 1 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.TimerWarzoneVI) <= os.time() then player:teleportTo(Position(fromPosition.x + 1, fromPosition.y, fromPosition.z)) - player:sendTextMessage( - MESSAGE_EVENT_ADVANCE, - "You cannot enter this warzone. \z - The enemy still pumps lava into this area. Find a way to stop the pumps!" - ) - elseif player:getStorageValue(Storage.DangerousDepths.Access.TimerWarzoneVI) > os.time() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE,"You cannot enter this warzone. The enemy still pumps lava into this area. Find a way to stop the pumps!") + elseif player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.TimerWarzoneVI) > os.time() then player:teleportTo(warzoneVI) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Entering the warzone.") end end - local warzoneV = Position(33208, 32119, 15) + + local warzoneV = Position(33208, 32119, 15) if item:getPosition() == Position(33777, 32192, 14) then - if player:getStorageValue(Storage.DangerousDepths.Access.LavaPumpWarzoneV) == 1 and player:getStorageValue(Storage.DangerousDepths.Access.TimerWarzoneV) <= os.time() then - player:setStorageValue(Storage.DangerousDepths.Access.LavaPumpWarzoneV, 0) - player:setStorageValue(Storage.DangerousDepths.Dwarves.Status, player:getStorageValue(Storage.DangerousDepths.Dwarves.Status) - 10) - player:setStorageValue(Storage.DangerousDepths.Access.TimerWarzoneV, os.time() + 8 * 60 * 60) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneV) == 1 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.TimerWarzoneV) <= os.time() then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneV, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.TimerWarzoneV, os.time() + 8 * 60 * 60) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Entering the warzone (you can enter freely for 8 hours from now).") player:teleportTo(warzoneV) - elseif player:getStorageValue(Storage.DangerousDepths.Access.LavaPumpWarzoneV) ~= 1 and player:getStorageValue(Storage.DangerousDepths.Access.TimerWarzoneV) <= os.time() then + elseif player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneV) ~= 1 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.TimerWarzoneV) <= os.time() then player:teleportTo(Position(fromPosition.x, fromPosition.y + 1, fromPosition.z)) - player:sendTextMessage( - MESSAGE_EVENT_ADVANCE, - "You cannot enter this warzone. \z - The enemy still pumps lava into this area. Find a way to stop the pumps!" - ) - elseif player:getStorageValue(Storage.DangerousDepths.Access.TimerWarzoneV) > os.time() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You cannot enter this warzone.The enemy still pumps lava into this area. Find a way to stop the pumps!") + elseif player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.TimerWarzoneV) > os.time() then player:teleportTo(warzoneV) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Entering the warzone.") end end - local warzoneIV = Position(33534, 32184, 15) + + local warzoneIV = Position(33534, 32184, 15) if item:getPosition() == Position(33827, 32172, 14) then - if player:getStorageValue(Storage.DangerousDepths.Access.LavaPumpWarzoneIV) == 1 and player:getStorageValue(Storage.DangerousDepths.Access.TimerWarzoneIV) <= os.time() then - player:setStorageValue(Storage.DangerousDepths.Access.LavaPumpWarzoneIV, 0) - player:setStorageValue(Storage.DangerousDepths.Gnomes.Status, player:getStorageValue(Storage.DangerousDepths.Gnomes.Status) - 10) - player:setStorageValue(Storage.DangerousDepths.Access.TimerWarzoneIV, os.time() + 8 * 60 * 60) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneIV) == 1 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.TimerWarzoneIV) <= os.time() then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneIV, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.TimerWarzoneIV, os.time() + 8 * 60 * 60) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Entering the warzone (you can enter freely for 8 hours from now).") player:teleportTo(warzoneIV) - elseif player:getStorageValue(Storage.DangerousDepths.Access.LavaPumpWarzoneIV) ~= 1 and player:getStorageValue(Storage.DangerousDepths.Access.TimerWarzoneIV) <= os.time() then + elseif player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneIV) ~= 1 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.TimerWarzoneIV) <= os.time() then player:teleportTo(Position(fromPosition.x, fromPosition.y + 1, fromPosition.z)) - player:sendTextMessage( - MESSAGE_EVENT_ADVANCE, - "You cannot enter this warzone. \z - The enemy still pumps lava into this area. Find a way to stop the pumps!" - ) - elseif player:getStorageValue(Storage.DangerousDepths.Access.TimerWarzoneIV) > os.time() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You cannot enter this warzone. The enemy still pumps lava into this area. Find a way to stop the pumps!") + elseif player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.TimerWarzoneIV) > os.time() then player:teleportTo(warzoneIV) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Entering the warzone.") end end + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true end diff --git a/data-otservbr-global/scripts/spells/monster/exploding_cask.lua b/data-otservbr-global/scripts/spells/monster/exploding_cask.lua index 5448d0733ff..4af10ce98a9 100644 --- a/data-otservbr-global/scripts/spells/monster/exploding_cask.lua +++ b/data-otservbr-global/scripts/spells/monster/exploding_cask.lua @@ -5,7 +5,7 @@ combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA) local combatCast = Combat() -local barrelId = 23485 +local barrelId = 23486 local bombArea = { { 0, 1, 1, 1, 0 }, { 1, 1, 1, 1, 1 }, diff --git a/data-otservbr-global/startup/tables/item.lua b/data-otservbr-global/startup/tables/item.lua index 9496f267a73..ec8f9883c87 100644 --- a/data-otservbr-global/startup/tables/item.lua +++ b/data-otservbr-global/startup/tables/item.lua @@ -1711,6 +1711,152 @@ ItemAction = { { x = 32242, y = 32611, z = 11 }, }, }, + -- Dangerous Depths Quest + [57231] = { + itemId = 7062, + itemPos = { + {x = 33773, y = 32249, z = 14}, + {x = 33774, y = 32249, z = 14}, + }, + }, + [57240] = { + itemId = false, + itemPos = { + {x = 33979, y = 32209, z = 14}, + {x = 33979, y = 32208, z = 14}, + {x = 33933, y = 32163, z = 14}, + {x = 33925, y = 32217, z = 14}, + {x = 33979, y = 32207, z = 14}, + {x = 33979, y = 32206, z = 14}, + {x = 33925, y = 32215, z = 14}, + {x = 33925, y = 32216, z = 14}, + {x = 33924, y = 32217, z = 14}, + {x = 33924, y = 32218, z = 14}, + {x = 33932, y = 32162, z = 14}, + {x = 33933, y = 32162, z = 14}, + }, + }, + [57241] = { + itemId = false, + itemPos = { + {x = 33990, y = 32195, z = 14}, + {x = 33983, y = 32207, z = 14}, + {x = 33983, y = 32206, z = 14}, + {x = 33983, y = 32208, z = 14}, + {x = 33992, y = 32195, z = 14}, + {x = 33983, y = 32209, z = 14}, + {x = 33991, y = 32195, z = 14}, + }, + }, + [57242] = { + itemId = false, + itemPos = { + {x = 33863, y = 32177, z = 14}, + {x = 33863, y = 32178, z = 14}, + {x = 33863, y = 32179, z = 14}, + {x = 33863, y = 32181, z = 14}, + {x = 33863, y = 32182, z = 14}, + {x = 33863, y = 32180, z = 14}, + {x = 33863, y = 32175, z = 14}, + {x = 33863, y = 32176, z = 14}, + }, + }, + [57300] = { + itemId = false, + itemPos = { + {x = 34033, y = 32000, z = 14}, + {x = 33982, y = 31982, z = 14}, + {x = 34002, y = 31986, z = 14}, + }, + }, + [57301] = { + itemId = false, + itemPos = { + {x = 33993, y = 32264, z = 14}, + {x = 33947, y = 32258, z = 14}, + {x = 34027, y = 32245, z = 14}, + }, + }, + [57302] = { + itemId = false, + itemPos = { + {x = 33927, y = 32338, z = 14}, + {x = 33898, y = 32338, z = 14}, + {x = 33958, y = 32338, z = 14}, + }, + }, + [57350] = { + itemId = 27505, + itemPos = {x = 33214, y = 32280, z = 15}, + }, + [57351] = { + itemId = 27503, + itemPos = {x = 33358, y = 32267, z = 15}, + }, + [57352] = { + itemId = 27503, + itemPos = {x = 33275, y = 32310, z = 15}, + }, + [57353] = { + itemId = 27505, + itemPos = {x = 33302, y = 32353, z = 15}, + }, + [57354] = { + itemId = 27507, + itemPos = {x = 33330, y = 32290, z = 15}, + }, + [57355] = { + itemId = 27507, + itemPos = {x = 33224, y = 32361, z = 15}, + }, + [57356] = { + itemId = 27503, + itemPos = {x = 33212, y = 32147, z = 15}, + }, + [57357] = { + itemId = 27505, + itemPos = {x = 33300, y = 32134, z = 15}, + }, + [57358] = { + itemId = 27503, + itemPos = {x = 33277, y = 32172, z = 15}, + }, + [57359] = { + itemId = 27505, + itemPos = {x = 33246, y = 32162, z = 15}, + }, + [57360] = { + itemId = 27507, + itemPos = {x = 33222, y = 32182, z = 15}, + }, + [57361] = { + itemId = 27507, + itemPos = {x = 33338, y = 32164, z = 15}, + }, + [57362] = { + itemId = 27503, + itemPos = {x = 33428, y = 32181, z = 15}, + }, + [57363] = { + itemId = 27505, + itemPos = {x = 33539, y = 32213, z = 15}, + }, + [57364] = { + itemId = 27503, + itemPos = {x = 33501, y = 32255, z = 15}, + }, + [57365] = { + itemId = 27505, + itemPos = {x = 33493, y = 32216, z = 15}, + }, + [57366] = { + itemId = 27507, + itemPos = {x = 33490, y = 32180, z = 15}, + }, + [57367] = { + itemId = 27507, + itemPos = {x = 33454, y = 32215, z = 15}, + }, -- The Ice Islands Quest, Nibelor 1: Breaking the Ice [60000] = { itemId = 7185, @@ -2774,4 +2920,17 @@ ItemUnique = { itemId = 1949, itemPos = { x = 32826, y = 32347, z = 9 }, }, + -- Dangerous Depths Quest + [57234] = { + itemId = 2472, + itemPos = { x = 33841, y = 32124, z = 14 }, + }, + [57235] = { + itemId = 21301, + itemPos = { x = 33755, y = 32163, z = 14 }, + }, + [57236] = { + itemId = 9253, + itemPos = { x = 33755, y = 32161, z = 14 }, + }, } diff --git a/data-otservbr-global/startup/tables/lever.lua b/data-otservbr-global/startup/tables/lever.lua index 37e6a1b0544..82cccc5c7d5 100644 --- a/data-otservbr-global/startup/tables/lever.lua +++ b/data-otservbr-global/startup/tables/lever.lua @@ -262,9 +262,12 @@ LeverAction = { -- The Pits of Inferno Quest [50160] = { itemId = 2772, - itemPos = { - { x = 32853, y = 32318, z = 9 }, - }, + itemPos = { x = 32853, y = 32318, z = 9 }, + }, + -- The Pits of Inferno Quest + [57234] = { + itemId = 2772, + itemPos = { x = 33841, y = 32080, z = 14 }, }, } diff --git a/data-otservbr-global/startup/tables/teleport.lua b/data-otservbr-global/startup/tables/teleport.lua index e6fee86f60f..3c169a2a2d1 100644 --- a/data-otservbr-global/startup/tables/teleport.lua +++ b/data-otservbr-global/startup/tables/teleport.lua @@ -37,6 +37,15 @@ TeleportAction = { { x = 32177, y = 31869, z = 15 }, }, }, + -- Dangerous Depths Quest + [57230] = { + itemId = 1949, + itemPos = { + {x = 33827, y = 32172, z = 14}, + {x = 33829, y = 32128, z = 14}, + {x = 33777, y = 32192, z = 14}, + }, + }, } TeleportUnique = { diff --git a/data/items/items.xml b/data/items/items.xml index df8ba8c122d..5d86685c379 100644 --- a/data/items/items.xml +++ b/data/items/items.xml @@ -51874,6 +51874,10 @@ hands of its owner. Granted by TibiaRoyal.com"/> + + + + From 4c4a08f11d47696995370739e2a9d9997355419b Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Sun, 13 Oct 2024 14:37:23 +0000 Subject: [PATCH 19/70] Lua code format - (Stylua) --- data-otservbr-global/npc/gnomus.lua | 20 ++-- data-otservbr-global/npc/klom_stonecutter.lua | 14 ++- data-otservbr-global/npc/lardoc_bashsmite.lua | 1 - .../dangerous_depth/actions_gnome_items.lua | 2 +- .../dangerous_depth/actions_lever_barrel.lua | 44 +++---- .../creaturescripts_lost_exile_task.lua | 71 ++++++----- .../movements_energy_entrance.lua | 9 +- .../movements_warzone_entrance.lua | 16 +-- data-otservbr-global/startup/tables/item.lua | 112 +++++++++--------- .../startup/tables/teleport.lua | 6 +- 10 files changed, 143 insertions(+), 152 deletions(-) diff --git a/data-otservbr-global/npc/gnomus.lua b/data-otservbr-global/npc/gnomus.lua index deb9870fc1b..20b44ef0ba1 100644 --- a/data-otservbr-global/npc/gnomus.lua +++ b/data-otservbr-global/npc/gnomus.lua @@ -88,7 +88,7 @@ local function creatureSayCallback(npc, creature, type, message) elseif player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Measurements) == 1 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.LocationCount) == 5 then npcHandler:say({ "Excellent, you returned with more data! Let me see... hmm. ...", - "Well, we need more data on this but first I will have to show this to our grand horticulturist. Thank you for getting this for us!" + "Well, we need more data on this but first I will have to show this to our grand horticulturist. Thank you for getting this for us!", }, npc, creature) player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.TimeTaskMeasurements, os.time() + time) player:addItem(27654, 1) @@ -100,7 +100,7 @@ local function creatureSayCallback(npc, creature, type, message) npcHandler:say({ "How fortunate! There are some trignometres lying around next to that device behind me. Take one and hold it next to high temperature heat sources. ...", "If you gathered enough data, you will actually smell it from the device. ...", - "Return to me with the results afterwards. Best of luck, we count on you!" + "Return to me with the results afterwards. Best of luck, we count on you!", }, npc, creature) if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Questline) < 1 then player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Questline, 1) @@ -147,7 +147,7 @@ local function creatureSayCallback(npc, creature, type, message) if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.CrawlersCount) >= 3 then npcHandler:say({ "AMAZING! Not only did you salve all our friends - you also rescued the animals! Here is your reward and bonus! ...", - "The other are already telling stories about you. Please return to me later if you want to help out some more!" + "The other are already telling stories about you. Please return to me later if you want to help out some more!", }, npc, creature) player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.TimeTaskOrdnance, os.time() + time) player:addItem(27654, 2) @@ -165,7 +165,7 @@ local function creatureSayCallback(npc, creature, type, message) elseif npcHandler:getTopic(playerId) == 22 and MsgContains(message, "yes") then npcHandler:say({ "Excellent, just follow the path to east until you reach a dead end, there is a hole that leads to a small cave underneath which will bring you right to the old trail. ...", - "Help whoever you can and return them to the save cave exit - oh, and while you're at it... some of them will have pack animals. If you can rescue those as well, I'll hand you a bonus. Good luck!" + "Help whoever you can and return them to the save cave exit - oh, and while you're at it... some of them will have pack animals. If you can rescue those as well, I'll hand you a bonus. Good luck!", }, npc, creature) if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Questline) < 1 then player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Questline, 1) @@ -317,18 +317,16 @@ keywordHandler:addKeyword({ "worthy" }, StdModule.say, { "If you can aquire any, return them to me and I make sure to tell the others of your generosity. Return to me afterwards to check on your current {status}.", }, }) -keywordHandler:addKeyword({ "base" }, StdModule.say, { npcHandler = npcHandler, - text = { - "Gnomish supplies and ingenuity have helped to establish and fortify this outpost. ...", - "Our knowledge of the enemy and it's tactics would be of more use if the dwarves would listen to us somewhat more. But gnomes have learned to live with the imperfection of the other races." - }, -}) +keywordHandler:addKeyword({ "base" }, StdModule.say, { npcHandler = npcHandler, text = { + "Gnomish supplies and ingenuity have helped to establish and fortify this outpost. ...", + "Our knowledge of the enemy and it's tactics would be of more use if the dwarves would listen to us somewhat more. But gnomes have learned to live with the imperfection of the other races.", +} }) keywordHandler:addKeyword({ "efforts" }, StdModule.say, { npcHandler = npcHandler, text = { "Our surveys of the area showed us some spikes in heat and seismic activity at very specific places. ...", "We conclude this is no coincidence and the enemy is using devices to pump up the lava to flood the area. We have seen it before and had to retreat each time. ...", - "This time though we might have a counter prepared - given me manage to pierce their defences." + "This time though we might have a counter prepared - given me manage to pierce their defences.", }, }) keywordHandler:addKeyword({ "name" }, StdModule.say, { npcHandler = npcHandler, text = "My name is Gnomus." }) diff --git a/data-otservbr-global/npc/klom_stonecutter.lua b/data-otservbr-global/npc/klom_stonecutter.lua index 4ab78216018..5c67133cc75 100644 --- a/data-otservbr-global/npc/klom_stonecutter.lua +++ b/data-otservbr-global/npc/klom_stonecutter.lua @@ -79,14 +79,14 @@ local function creatureSayCallback(npc, creature, type, message) if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Subterranean) == 2 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.TimeTaskSubterranean) <= 0 then npcHandler:say({ "Vermin. Everywhere. We get a lot of strange four-legged crawlers and worms down here lately. It's getting out of hand and... well, I need a real killer for this. ", - "Prepared to get rid of some seriously foul creepers for us?" + "Prepared to get rid of some seriously foul creepers for us?", }, npc, creature) npcHandler:setTopic(playerId, 2) end if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Subterranean) < 1 then npcHandler:say({ "Vermin. Everywhere. We get a lot of strange four-legged crawlers and worms down here lately. It's getting out of hand and... well, I need a real killer for this. ", - "Prepared to get rid of some seriously foul creepers for us?" + "Prepared to get rid of some seriously foul creepers for us?", }, npc, creature) npcHandler:setTopic(playerId, 2) elseif (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Subterranean) == 1) and (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Organisms) < 50) then @@ -118,14 +118,16 @@ local function creatureSayCallback(npc, creature, type, message) if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Home) == 2 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.TimeTaskHome) <= 0 then npcHandler:say({ "We need to find a way to drive off the exiles from these caves. Countless makeshift homes are popping up at every corner. Destroy them and get the Lost out of hiding to eliminate them. ... ", - "If you can capture a few of them, you'll receive a bonus. Just bring 'em to the border of our outpost and we will take care of the rest. ... ", "Are you ready for that? " + "If you can capture a few of them, you'll receive a bonus. Just bring 'em to the border of our outpost and we will take care of the rest. ... ", + "Are you ready for that? ", }, npc, creature) npcHandler:setTopic(playerId, 22) end if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Home) < 1 then npcHandler:say({ "We need to find a way to drive off the exiles from these caves. Countless makeshift homes are popping up at every corner. Destroy them and get the Lost out of hiding to eliminate them. ... ", - "If you can capture a few of them, you'll receive a bonus. Just bring 'em to the border of our outpost and we will take care of the rest. ... ", "Are you ready for that? " + "If you can capture a few of them, you'll receive a bonus. Just bring 'em to the border of our outpost and we will take care of the rest. ... ", + "Are you ready for that? ", }, npc, creature) npcHandler:setTopic(playerId, 22) elseif (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Home) == 1) and (player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.LostExiles) < 20 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Prisoners) < 3) then @@ -243,14 +245,14 @@ keywordHandler:addKeyword({ "counterattacks" }, StdModule.say, { npcHandler = npcHandler, text = { "I welcome a fine battle as any dwarf worth his beard should do. As long as it's a battle against something I can hit with my trusty axe. ...", - "But here the true {enemy} eludes us. We fight wave after wave of their lackeys and if the gnomes are right the true enemy is up to something far more sinister. " + "But here the true {enemy} eludes us. We fight wave after wave of their lackeys and if the gnomes are right the true enemy is up to something far more sinister. ", }, }) keywordHandler:addKeyword({ "enemy" }, StdModule.say, { npcHandler = npcHandler, text = { "I have no idea what kind of creeps are behind all this. Even the gnomes don't and they have handled that stuff way more often. ...", - "But even if we knew nothing more about them, the fact alone that they employ the help of those mockeries of all things dwarfish, marks them as an enemy of the dwarves and it's our obligation to annihilate them." + "But even if we knew nothing more about them, the fact alone that they employ the help of those mockeries of all things dwarfish, marks them as an enemy of the dwarves and it's our obligation to annihilate them.", }, }) keywordHandler:addKeyword({ "name" }, StdModule.say, { npcHandler = npcHandler, text = "Klom Stonecutter's the name. " }) diff --git a/data-otservbr-global/npc/lardoc_bashsmite.lua b/data-otservbr-global/npc/lardoc_bashsmite.lua index e129b628031..11367640ded 100644 --- a/data-otservbr-global/npc/lardoc_bashsmite.lua +++ b/data-otservbr-global/npc/lardoc_bashsmite.lua @@ -256,7 +256,6 @@ keywordHandler:addKeyword({ "job" }, StdModule.say, { }) keywordHandler:addKeyword({ "name" }, StdModule.say, { npcHandler = npcHandler, text = "Bashsmite. That's all you need to know." }) - npcHandler:setMessage(MESSAGE_GREET, "Since you are obviously not one of my relatives who pays me a long overdue visit, we should get {work} right away. We'll see if you can prove your {worth} to our alliance.") npcHandler:setMessage(MESSAGE_WALKAWAY, "Well, bye then.") diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnome_items.lua b/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnome_items.lua index fc5b6f90e39..bffb5a5bcf5 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnome_items.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/actions_gnome_items.lua @@ -18,7 +18,7 @@ function dangerousDepthItems.onUse(player, item) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is empty.") end end - + return true end diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/actions_lever_barrel.lua b/data-otservbr-global/scripts/quests/dangerous_depth/actions_lever_barrel.lua index d9575d43262..1a478e3200e 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/actions_lever_barrel.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/actions_lever_barrel.lua @@ -29,8 +29,8 @@ local function checkPos(item) local player = Player(stgBarrel) if player then if player:getStorageValue(stgRoom) < 1 then - player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount) + 1) - player:setStorageValue(stgRoom, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount) + 1) + player:setStorageValue(stgRoom, 1) end end end @@ -42,8 +42,8 @@ local function checkPos(item) local player = Player(stgBarrel) if player then if player:getStorageValue(stgRoom) < 1 then - player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount) + 1) - player:setStorageValue(stgRoom, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount) + 1) + player:setStorageValue(stgRoom, 1) end end end @@ -55,8 +55,8 @@ local function checkPos(item) local player = Player(stgBarrel) if player then if player:getStorageValue(stgRoom) < 1 then - player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount) + 1) - player:setStorageValue(stgRoom, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount) + 1) + player:setStorageValue(stgRoom, 1) end end end @@ -68,8 +68,8 @@ local function checkPos(item) local player = Player(stgBarrel) if player then if player:getStorageValue(stgRoom) < 1 then - player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount) + 1) - player:setStorageValue(stgRoom, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount) + 1) + player:setStorageValue(stgRoom, 1) end end end @@ -81,8 +81,8 @@ local function checkPos(item) local player = Player(stgBarrel) if player then if player:getStorageValue(stgRoom) < 1 then - player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount) + 1) - player:setStorageValue(stgRoom, 1) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount, player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelCount) + 1) + player:setStorageValue(stgRoom, 1) end end end @@ -96,21 +96,21 @@ local function explode(item) local c = Game.getPlayers()[1] addEvent(function() - for x = fromPosition.x, toPosition.x do - for y = fromPosition.y, toPosition.y do - for z = fromPosition.z, toPosition.z do - if Tile(Position(x, y, z)) then + for x = fromPosition.x, toPosition.x do + for y = fromPosition.y, toPosition.y do + for z = fromPosition.z, toPosition.z do if Tile(Position(x, y, z)) then - local posEffect = Tile(Position(x, y, z)):getPosition() - local creature = Tile(Position(x, y, z)):getTopCreature() - posEffect:sendMagicEffect(CONST_ME_FIREAREA) + if Tile(Position(x, y, z)) then + local posEffect = Tile(Position(x, y, z)):getPosition() + local creature = Tile(Position(x, y, z)):getTopCreature() + posEffect:sendMagicEffect(CONST_ME_FIREAREA) + end end end end end - end - checkPos(item) - c:say("KABOOM!!", TALKTYPE_MONSTER_SAY, false, false, position) + checkPos(item) + c:say("KABOOM!!", TALKTYPE_MONSTER_SAY, false, false, position) if item then item:remove() end @@ -139,7 +139,7 @@ function dangerousDepthLever.onUse(player, item) if Barrel then explode(Barrel) end - player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelTimer, 0) + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelTimer, 0) end, 2 * 60 * 1000) player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Scouts.BarrelTimer, os.time() + 2 * 60) end @@ -149,4 +149,4 @@ function dangerousDepthLever.onUse(player, item) end dangerousDepthLever:aid(57234) -dangerousDepthLever:register() \ No newline at end of file +dangerousDepthLever:register() diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/creaturescripts_lost_exile_task.lua b/data-otservbr-global/scripts/quests/dangerous_depth/creaturescripts_lost_exile_task.lua index 72dac0c8fd9..2802324b3c3 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/creaturescripts_lost_exile_task.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/creaturescripts_lost_exile_task.lua @@ -5,46 +5,45 @@ local radius = 10 local lostExileKill = CreatureEvent("LastExileDeath") function lostExileKill.onDeath(creature, _corpse, _lastHitKiller, mostDamageKiller) - local function isMakeshiftHomeNearby(creature) - local creaturePosition = creature:getPosition() - local spectators = Game.getSpectators(creaturePosition, false, false, radius, radius, radius, radius) -- Busca criaturas em torno da posição da morte - - for _, spectator in ipairs(spectators) do - if spectator:isMonster() and spectator:getName():lower() == "makeshift home" then - return true - end - end - return false - end - - onDeathForParty(creature, mostDamageKiller, function(creature, player) - if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Home) ~= 1 then - return - end - - if not creature:getPosition():isInRange(fromPos, toPos) then - return - end - - if isMakeshiftHomeNearby(creature) then - return - end - - local storage = player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.LostExiles) - if storage < 20 then - if storage < 0 then - player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.LostExiles, 1) - end - player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.LostExiles, storage + 1) - end - end) - - return true + local function isMakeshiftHomeNearby(creature) + local creaturePosition = creature:getPosition() + local spectators = Game.getSpectators(creaturePosition, false, false, radius, radius, radius, radius) -- Busca criaturas em torno da posição da morte + + for _, spectator in ipairs(spectators) do + if spectator:isMonster() and spectator:getName():lower() == "makeshift home" then + return true + end + end + return false + end + + onDeathForParty(creature, mostDamageKiller, function(creature, player) + if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Home) ~= 1 then + return + end + + if not creature:getPosition():isInRange(fromPos, toPos) then + return + end + + if isMakeshiftHomeNearby(creature) then + return + end + + local storage = player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.LostExiles) + if storage < 20 then + if storage < 0 then + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.LostExiles, 1) + end + player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.LostExiles, storage + 1) + end + end) + + return true end lostExileKill:register() - local wormKill = CreatureEvent("WarzoneWormDeath") function wormKill.onDeath(creature, _corpse, _lastHitKiller, mostDamageKiller) diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/movements_energy_entrance.lua b/data-otservbr-global/scripts/quests/dangerous_depth/movements_energy_entrance.lua index d386ea782da..ebfd9a1f574 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/movements_energy_entrance.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/movements_energy_entrance.lua @@ -16,9 +16,7 @@ function energyEntrance.onStepIn(creature, item, position, fromPosition, toPosit end local function hasWarzoneAccess() - return player:getStorageValue(Storage.Quest.U9_60.BigfootsBurden.Warzone1Access) == 1 and - player:getStorageValue(Storage.Quest.U9_60.BigfootsBurden.Warzone2Access) == 1 and - player:getStorageValue(Storage.Quest.U9_60.BigfootsBurden.Warzone3Access) == 1 + return player:getStorageValue(Storage.Quest.U9_60.BigfootsBurden.Warzone1Access) == 1 and player:getStorageValue(Storage.Quest.U9_60.BigfootsBurden.Warzone2Access) == 1 and player:getStorageValue(Storage.Quest.U9_60.BigfootsBurden.Warzone3Access) == 1 end if player:getPosition() == Position(33831, 32138, 14) then @@ -29,10 +27,8 @@ function energyEntrance.onStepIn(creature, item, position, fromPosition, toPosit player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can not use this portal yet.") player:teleportTo(Position(fromPosition.x, fromPosition.y + 1, fromPosition.z)) end - elseif player:getPosition() == Position(34021, 32037, 14) then player:teleportTo(Position(33831, 32141, 14)) - elseif player:getPosition() == Position(33784, 32205, 14) then local status = player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Dwarves.Points) if (hasWarzoneAccess() and status >= 10) or (not hasWarzoneAccess() and status >= 15) then @@ -41,10 +37,8 @@ function energyEntrance.onStepIn(creature, item, position, fromPosition, toPosit player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can not use this portal yet.") player:teleportTo(Position(fromPosition.x - 1, fromPosition.y, fromPosition.z)) end - elseif player:getPosition() == Position(33921, 32402, 14) then player:teleportTo(Position(33782, 32205, 14)) - elseif player:getPosition() == Position(33829, 32187, 14) then local status = player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Gnomes.Points) if (hasWarzoneAccess() and status >= 10) or (not hasWarzoneAccess() and status >= 15) then @@ -53,7 +47,6 @@ function energyEntrance.onStepIn(creature, item, position, fromPosition, toPosit player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can not use this portal yet.") player:teleportTo(Position(fromPosition.x, fromPosition.y - 1, fromPosition.z)) end - elseif player:getPosition() == Position(33982, 32234, 14) then player:teleportTo(Position(33829, 32186, 14)) end diff --git a/data-otservbr-global/scripts/quests/dangerous_depth/movements_warzone_entrance.lua b/data-otservbr-global/scripts/quests/dangerous_depth/movements_warzone_entrance.lua index 098e2c90e7b..ecb404fe5ef 100644 --- a/data-otservbr-global/scripts/quests/dangerous_depth/movements_warzone_entrance.lua +++ b/data-otservbr-global/scripts/quests/dangerous_depth/movements_warzone_entrance.lua @@ -6,7 +6,7 @@ function warzoneEntrance.onStepIn(creature, item, position, fromPosition, toPosi return true end - local warzoneVI = Position(33367, 32307, 15) + local warzoneVI = Position(33367, 32307, 15) if item:getPosition() == Position(33829, 32128, 14) then if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneVI) == 1 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.TimerWarzoneVI) <= os.time() then player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneVI, 0) @@ -15,14 +15,14 @@ function warzoneEntrance.onStepIn(creature, item, position, fromPosition, toPosi player:teleportTo(warzoneVI) elseif player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneVI) ~= 1 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.TimerWarzoneVI) <= os.time() then player:teleportTo(Position(fromPosition.x + 1, fromPosition.y, fromPosition.z)) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE,"You cannot enter this warzone. The enemy still pumps lava into this area. Find a way to stop the pumps!") + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You cannot enter this warzone. The enemy still pumps lava into this area. Find a way to stop the pumps!") elseif player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.TimerWarzoneVI) > os.time() then player:teleportTo(warzoneVI) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Entering the warzone.") end end - - local warzoneV = Position(33208, 32119, 15) + + local warzoneV = Position(33208, 32119, 15) if item:getPosition() == Position(33777, 32192, 14) then if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneV) == 1 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.TimerWarzoneV) <= os.time() then player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneV, 0) @@ -37,8 +37,8 @@ function warzoneEntrance.onStepIn(creature, item, position, fromPosition, toPosi player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Entering the warzone.") end end - - local warzoneIV = Position(33534, 32184, 15) + + local warzoneIV = Position(33534, 32184, 15) if item:getPosition() == Position(33827, 32172, 14) then if player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneIV) == 1 and player:getStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.TimerWarzoneIV) <= os.time() then player:setStorageValue(Storage.Quest.U11_50.DangerousDepths.Access.LavaPumpWarzoneIV, 0) @@ -53,9 +53,9 @@ function warzoneEntrance.onStepIn(creature, item, position, fromPosition, toPosi player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Entering the warzone.") end end - + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - + return true end diff --git a/data-otservbr-global/startup/tables/item.lua b/data-otservbr-global/startup/tables/item.lua index ec8f9883c87..ec411bca1d7 100644 --- a/data-otservbr-global/startup/tables/item.lua +++ b/data-otservbr-global/startup/tables/item.lua @@ -1715,147 +1715,147 @@ ItemAction = { [57231] = { itemId = 7062, itemPos = { - {x = 33773, y = 32249, z = 14}, - {x = 33774, y = 32249, z = 14}, + { x = 33773, y = 32249, z = 14 }, + { x = 33774, y = 32249, z = 14 }, }, }, [57240] = { itemId = false, itemPos = { - {x = 33979, y = 32209, z = 14}, - {x = 33979, y = 32208, z = 14}, - {x = 33933, y = 32163, z = 14}, - {x = 33925, y = 32217, z = 14}, - {x = 33979, y = 32207, z = 14}, - {x = 33979, y = 32206, z = 14}, - {x = 33925, y = 32215, z = 14}, - {x = 33925, y = 32216, z = 14}, - {x = 33924, y = 32217, z = 14}, - {x = 33924, y = 32218, z = 14}, - {x = 33932, y = 32162, z = 14}, - {x = 33933, y = 32162, z = 14}, + { x = 33979, y = 32209, z = 14 }, + { x = 33979, y = 32208, z = 14 }, + { x = 33933, y = 32163, z = 14 }, + { x = 33925, y = 32217, z = 14 }, + { x = 33979, y = 32207, z = 14 }, + { x = 33979, y = 32206, z = 14 }, + { x = 33925, y = 32215, z = 14 }, + { x = 33925, y = 32216, z = 14 }, + { x = 33924, y = 32217, z = 14 }, + { x = 33924, y = 32218, z = 14 }, + { x = 33932, y = 32162, z = 14 }, + { x = 33933, y = 32162, z = 14 }, }, }, [57241] = { itemId = false, itemPos = { - {x = 33990, y = 32195, z = 14}, - {x = 33983, y = 32207, z = 14}, - {x = 33983, y = 32206, z = 14}, - {x = 33983, y = 32208, z = 14}, - {x = 33992, y = 32195, z = 14}, - {x = 33983, y = 32209, z = 14}, - {x = 33991, y = 32195, z = 14}, + { x = 33990, y = 32195, z = 14 }, + { x = 33983, y = 32207, z = 14 }, + { x = 33983, y = 32206, z = 14 }, + { x = 33983, y = 32208, z = 14 }, + { x = 33992, y = 32195, z = 14 }, + { x = 33983, y = 32209, z = 14 }, + { x = 33991, y = 32195, z = 14 }, }, }, [57242] = { itemId = false, itemPos = { - {x = 33863, y = 32177, z = 14}, - {x = 33863, y = 32178, z = 14}, - {x = 33863, y = 32179, z = 14}, - {x = 33863, y = 32181, z = 14}, - {x = 33863, y = 32182, z = 14}, - {x = 33863, y = 32180, z = 14}, - {x = 33863, y = 32175, z = 14}, - {x = 33863, y = 32176, z = 14}, + { x = 33863, y = 32177, z = 14 }, + { x = 33863, y = 32178, z = 14 }, + { x = 33863, y = 32179, z = 14 }, + { x = 33863, y = 32181, z = 14 }, + { x = 33863, y = 32182, z = 14 }, + { x = 33863, y = 32180, z = 14 }, + { x = 33863, y = 32175, z = 14 }, + { x = 33863, y = 32176, z = 14 }, }, }, [57300] = { itemId = false, itemPos = { - {x = 34033, y = 32000, z = 14}, - {x = 33982, y = 31982, z = 14}, - {x = 34002, y = 31986, z = 14}, + { x = 34033, y = 32000, z = 14 }, + { x = 33982, y = 31982, z = 14 }, + { x = 34002, y = 31986, z = 14 }, }, }, [57301] = { itemId = false, itemPos = { - {x = 33993, y = 32264, z = 14}, - {x = 33947, y = 32258, z = 14}, - {x = 34027, y = 32245, z = 14}, + { x = 33993, y = 32264, z = 14 }, + { x = 33947, y = 32258, z = 14 }, + { x = 34027, y = 32245, z = 14 }, }, }, [57302] = { itemId = false, itemPos = { - {x = 33927, y = 32338, z = 14}, - {x = 33898, y = 32338, z = 14}, - {x = 33958, y = 32338, z = 14}, + { x = 33927, y = 32338, z = 14 }, + { x = 33898, y = 32338, z = 14 }, + { x = 33958, y = 32338, z = 14 }, }, }, [57350] = { itemId = 27505, - itemPos = {x = 33214, y = 32280, z = 15}, + itemPos = { x = 33214, y = 32280, z = 15 }, }, [57351] = { itemId = 27503, - itemPos = {x = 33358, y = 32267, z = 15}, + itemPos = { x = 33358, y = 32267, z = 15 }, }, [57352] = { itemId = 27503, - itemPos = {x = 33275, y = 32310, z = 15}, + itemPos = { x = 33275, y = 32310, z = 15 }, }, [57353] = { itemId = 27505, - itemPos = {x = 33302, y = 32353, z = 15}, + itemPos = { x = 33302, y = 32353, z = 15 }, }, [57354] = { itemId = 27507, - itemPos = {x = 33330, y = 32290, z = 15}, + itemPos = { x = 33330, y = 32290, z = 15 }, }, [57355] = { itemId = 27507, - itemPos = {x = 33224, y = 32361, z = 15}, + itemPos = { x = 33224, y = 32361, z = 15 }, }, [57356] = { itemId = 27503, - itemPos = {x = 33212, y = 32147, z = 15}, + itemPos = { x = 33212, y = 32147, z = 15 }, }, [57357] = { itemId = 27505, - itemPos = {x = 33300, y = 32134, z = 15}, + itemPos = { x = 33300, y = 32134, z = 15 }, }, [57358] = { itemId = 27503, - itemPos = {x = 33277, y = 32172, z = 15}, + itemPos = { x = 33277, y = 32172, z = 15 }, }, [57359] = { itemId = 27505, - itemPos = {x = 33246, y = 32162, z = 15}, + itemPos = { x = 33246, y = 32162, z = 15 }, }, [57360] = { itemId = 27507, - itemPos = {x = 33222, y = 32182, z = 15}, + itemPos = { x = 33222, y = 32182, z = 15 }, }, [57361] = { itemId = 27507, - itemPos = {x = 33338, y = 32164, z = 15}, + itemPos = { x = 33338, y = 32164, z = 15 }, }, [57362] = { itemId = 27503, - itemPos = {x = 33428, y = 32181, z = 15}, + itemPos = { x = 33428, y = 32181, z = 15 }, }, [57363] = { itemId = 27505, - itemPos = {x = 33539, y = 32213, z = 15}, + itemPos = { x = 33539, y = 32213, z = 15 }, }, [57364] = { itemId = 27503, - itemPos = {x = 33501, y = 32255, z = 15}, + itemPos = { x = 33501, y = 32255, z = 15 }, }, [57365] = { itemId = 27505, - itemPos = {x = 33493, y = 32216, z = 15}, + itemPos = { x = 33493, y = 32216, z = 15 }, }, [57366] = { itemId = 27507, - itemPos = {x = 33490, y = 32180, z = 15}, + itemPos = { x = 33490, y = 32180, z = 15 }, }, [57367] = { itemId = 27507, - itemPos = {x = 33454, y = 32215, z = 15}, + itemPos = { x = 33454, y = 32215, z = 15 }, }, -- The Ice Islands Quest, Nibelor 1: Breaking the Ice [60000] = { diff --git a/data-otservbr-global/startup/tables/teleport.lua b/data-otservbr-global/startup/tables/teleport.lua index 3c169a2a2d1..ab761d9a4a7 100644 --- a/data-otservbr-global/startup/tables/teleport.lua +++ b/data-otservbr-global/startup/tables/teleport.lua @@ -41,9 +41,9 @@ TeleportAction = { [57230] = { itemId = 1949, itemPos = { - {x = 33827, y = 32172, z = 14}, - {x = 33829, y = 32128, z = 14}, - {x = 33777, y = 32192, z = 14}, + { x = 33827, y = 32172, z = 14 }, + { x = 33829, y = 32128, z = 14 }, + { x = 33777, y = 32192, z = 14 }, }, }, } From affa57ea4033b34dc85de24c8249c5b80101ff7a Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Sun, 13 Oct 2024 11:45:47 -0300 Subject: [PATCH 20/70] Makeshift Warrior Outfits Quest This is already set up. --- data-otservbr-global/lib/core/storages.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index d9ff1c95524..4101fa677f7 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -2621,7 +2621,6 @@ Storage = { CorymRescued08 = 45987, CorymRescueMission = 45988, }, - MakeshiftWarriorOutfits = {}, }, U11_80 = { -- update 11.80 - Reserved Storages 46001 - 46300 BattleMageOutfits = {}, From c3e111b49c03315ee3ba8e2629ed9fcf627a86ad Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Sun, 13 Oct 2024 11:56:19 -0300 Subject: [PATCH 21/70] Update storages.lua --- data-otservbr-global/lib/core/storages.lua | 162 ++++++++++----------- 1 file changed, 81 insertions(+), 81 deletions(-) diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index 4101fa677f7..58258d890bd 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -2498,105 +2498,105 @@ Storage = { DangerousDepths = { Questline = 45851, Dwarves = { - Points = 50081, - Home = 50082, - Subterranean = 50083, - LostExiles = 50084, - Prisoners = 50085, - Organisms = 50086, - TimeTaskHome = 50087, - TimeTaskSubterranean = 50088, + Points = 45852, + Home = 45853, + Subterranean = 45854, + LostExiles = 45855, + Prisoners = 45856, + Organisms = 45857, + TimeTaskHome = 45858, + TimeTaskSubterranean = 45859, }, Scouts = { - Points = 50090, - Diremaw = 50091, - Growth = 50092, - DiremawsCount = 50093, - GnomishChest = 50094, - BarrelCount = 50095, - FirstBarrel = 50096, - SecondBarrel = 50097, - ThirdBarrel = 50098, - FourthBarrel = 50099, - FifthBarrel = 50100, - TimeTaskDiremaws = 50101, - TimeTaskGrowth = 50102, - Barrel = 50103, - BarrelTimer = 50104, + Points = 45860, + Diremaw = 45861, + Growth = 45862, + DiremawsCount = 45863, + GnomishChest = 45864, + BarrelCount = 45865, + FirstBarrel = 45866, + SecondBarrel = 45867, + ThirdBarrel = 45868, + FourthBarrel = 45869, + FifthBarrel = 45870, + TimeTaskDiremaws = 45871, + TimeTaskGrowth = 45872, + Barrel = 45873, + BarrelTimer = 45874, }, Gnomes = { - Points = 50115, - Ordnance = 50116, - Measurements = 50117, - Charting = 50118, - GnomeChartChest = 50119, - GnomeChartPaper = 50120, - GnomesCount = 50121, - CrawlersCount = 50122, - LocationA = 50123, - LocationB = 50124, - LocationC = 50125, - LocationD = 50126, - LocationE = 50127, - LocationCount = 50128, - OldGate = 50129, - TheGaze = 50130, - LostRuin = 50131, - Outpost = 50132, - Bastion = 50133, - BrokenTower = 50134, - ChartingCount = 50135, - TimeTaskOrdnance = 50136, - TimeTaskMeasurements = 50137, - TimeTaskCharting = 50138, + Points = 45875, + Ordnance = 45876, + Measurements = 45877, + Charting = 45878, + GnomeChartChest = 45879, + GnomeChartPaper = 45880, + GnomesCount = 45881, + CrawlersCount = 45882, + LocationA = 45883, + LocationB = 45884, + LocationC = 45885, + LocationD = 45886, + LocationE = 45887, + LocationCount = 45888, + OldGate = 45889, + TheGaze = 45890, + LostRuin = 45891, + Outpost = 45892, + Bastion = 45893, + BrokenTower = 45894, + ChartingCount = 45895, + TimeTaskOrdnance = 45896, + TimeTaskMeasurements = 45897, + TimeTaskCharting = 45898, }, Access = { - LavaPumpWarzoneVI = 50139, - TimerWarzoneVI = 50140, - LavaPumpWarzoneV = 50141, - TimerWarzoneV = 50142, - LavaPumpWarzoneIV = 50143, - TimerWarzoneIV = 50144, + LavaPumpWarzoneVI = 45899, + TimerWarzoneVI = 45900, + LavaPumpWarzoneV = 45901, + TimerWarzoneV = 45902, + LavaPumpWarzoneIV = 45903, + TimerWarzoneIV = 45904, }, Crystals = { WarzoneVI = { - BigCrystal1 = 50155, - BigCrystal2 = 50156, - MediumCrystal1 = 50157, - MediumCrystal2 = 50158, - SmallCrystal1 = 50159, - SmallCrystal2 = 50160, + BigCrystal1 = 45905, + BigCrystal2 = 45906, + MediumCrystal1 = 45907, + MediumCrystal2 = 45908, + SmallCrystal1 = 45909, + SmallCrystal2 = 45910, }, WarzoneV = { - BigCrystal1 = 50165, - BigCrystal2 = 50166, - MediumCrystal1 = 50167, - MediumCrystal2 = 50168, - SmallCrystal1 = 50169, - SmallCrystal2 = 50170, + BigCrystal1 = 45911, + BigCrystal2 = 45912, + MediumCrystal1 = 45913, + MediumCrystal2 = 45914, + SmallCrystal1 = 45915, + SmallCrystal2 = 45916, }, WarzoneIV = { - BigCrystal1 = 50175, - BigCrystal2 = 50176, - MediumCrystal1 = 50177, - MediumCrystal2 = 50178, - SmallCrystal1 = 50179, - SmallCrystal2 = 50180, + BigCrystal1 = 45917, + BigCrystal2 = 45918, + MediumCrystal1 = 45919, + MediumCrystal2 = 45920, + SmallCrystal1 = 45921, + SmallCrystal2 = 45922, }, }, Bosses = { - TheCountOfTheCore = 50185, - TheDukeOfTheDepths = 50186, - TheBaronFromBelow = 50187, - TheCountOfTheCoreAchiev = 50188, - TheDukeOfTheDepthsAchiev = 50189, - TheBaronFromBelowAchiev = 50190, - LastAchievement = 50191, + TheCountOfTheCore = 45923, + TheDukeOfTheDepths = 45924, + TheBaronFromBelow = 45925, + TheCountOfTheCoreAchiev = 45926, + TheDukeOfTheDepthsAchiev = 45927, + TheBaronFromBelowAchiev = 45928, + LastAchievement = 45929, }, Geodes = { - WarzoneVI = 60001, - WarzoneV = 60002, - WarzoneIV = 60003, + WarzoneVI = 45930, + WarzoneV = 45931, + WarzoneIV = 45932, }, }, HiddenThreats = { From 92c0fa2b3c3a5f0704cb231db6712853cb7efdda Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Mon, 14 Oct 2024 18:34:33 -0300 Subject: [PATCH 22/70] The Secret Library Quest - part 1 --- data-otservbr-global/lib/core/storages.lua | 165 ++++++++++++---- data-otservbr-global/npc/charles.lua | 2 +- data-otservbr-global/npc/dedoras.lua | 176 +++++++++++++---- data-otservbr-global/npc/gail.lua | 4 +- data-otservbr-global/npc/gareth.lua | 18 +- data-otservbr-global/npc/spectulus.lua | 2 +- .../scripts/actions/farmine/boat.lua | 36 ---- .../actions/other/others/quest_system2.lua | 2 +- .../creaturescripts/customs/freequests.lua | 28 +-- .../movements/teleport/falcon_castle.lua | 71 ------- .../cradle_of_monsters/the_monster_fight.lua | 1 + .../actions_asura_mirror.lua | 21 -- .../actions_basinfire.lua | 18 -- .../actions_bastion_access.lua | 13 -- .../actions_blacktp.lua | 14 -- .../actions_bluetp.lua | 14 -- .../actions_boattp.lua | 17 -- .../the_secret_library_quest/actions_bone.lua | 13 -- .../actions_bonedoor.lua | 17 -- .../the_secret_library_quest/actions_book.lua | 14 -- .../actions_bosses_killed.lua | 32 ---- .../actions_corpse.lua | 14 -- .../actions_energybasin.lua | 44 ----- .../actions_enterlibrary.lua | 15 -- .../actions_eyekey.lua | 14 -- .../the_secret_library_quest/actions_fish.lua | 14 -- .../actions_greentp.lua | 14 -- .../actions_leverdoor.lua | 14 -- .../actions_leverruby.lua | 14 -- .../actions_library_entrances.lua | 43 ----- .../actions_lotuskey.lua | 14 -- .../actions_peacock.lua | 14 -- .../actions_pinktp.lua | 14 -- .../actions_sealedbook.lua | 14 -- .../actions_skullground.lua | 15 -- .../actions_statuedeeplings.lua | 34 ---- .../actions_strandhair.lua | 14 -- .../actions_telescop.lua | 13 -- .../asuras/actions_bonefiddle.lua | 46 +++++ .../asuras/actions_chests.lua | 38 ++++ .../asuras/actions_doors.lua | 31 +++ .../asuras/actions_fragrance.lua | 12 ++ .../asuras/actions_keys.lua | 35 ++++ .../asuras/actions_mirror.lua | 19 ++ .../creaturescripts_asuras_mechanic.lua | 39 ++++ .../asuras/movements_elemental_portals.lua | 120 ++++++++++++ .../creaturescripts_falcon_minibosses.lua | 56 ------ .../creaturescripts_kill.lua | 62 ++++++ .../creaturescripts_login.lua | 8 + .../deep_desert/actions_chests.lua | 31 +++ .../deep_desert/actions_doors.lua | 32 ++++ .../deep_desert/actions_totems.lua | 54 ++++++ .../deep_desert/movements_color_puzzle.lua | 42 ++++ .../deep_desert/movements_teleportTo.lua | 171 +++++++++++++++++ .../falcon_bastion/actions_doors.lua | 55 ++++++ .../falcon_bastion/actions_oberonLever.lua | 39 ++++ .../falcon_bastion/movements_bossEntrance.lua | 53 ++++++ ...nts_secret_library_grand_canon_dominus.lua | 16 -- ..._secret_library_grand_chaplain_gaunder.lua | 16 -- ..._secret_library_grand_commander_soeren.lua | 16 -- ...events_secret_library_preceptor_lazare.lua | 14 -- ...obalevents_secret_library_spawn_damage.lua | 84 -------- .../isles/actions_chests.lua | 37 ++++ .../isles/actions_telescope.lua | 13 ++ .../isles/movements_boat_puzzle.lua | 41 ++++ .../isles/movements_stepIn.lua | 98 ++++++++++ .../library/actions_bossesLever.lua | 180 ++++++++++++++++++ .../library/actions_parchment.lua | 54 ++++++ .../library/creaturescripts_ghulosh.lua | 67 +++++++ .../library/creaturescripts_gorzindel.lua | 64 +++++++ .../library/creaturescripts_lokathmor.lua | 12 ++ .../library/creaturescripts_mazzinor.lua | 34 ++++ .../library/movements_gorzindel.lua | 39 ++++ .../library/movements_mazzinor.lua | 21 ++ .../library/movements_timers.lua | 33 ++++ .../liquid_death/actions_brokulLever.lua | 55 ++++++ .../liquid_death/actions_usableItens.lua | 88 +++++++++ .../liquid_death/movements_bossWay.lua | 44 +++++ .../liquid_death/movements_teleportTo.lua | 53 ++++++ .../movements_boat.lua | 17 -- .../movements_crackles.lua | 16 ++ .../movements_golem_teleport.lua | 17 -- .../movements_pink_teleport.lua | 17 -- .../movements_teleport.lua | 35 ---- .../museum/actions_bony_rod.lua | 28 +++ .../museum/actions_chests.lua | 31 +++ .../museum/actions_doors.lua | 27 +++ .../museum/actions_gems.lua | 28 +++ .../museum/actions_levers.lua | 55 ++++++ .../museum/actions_sample_blood.lua | 15 ++ .../museum/movements_teleportTo.lua | 69 +++++++ data-otservbr-global/startup/tables/chest.lua | 10 +- .../startup/tables/door_quest.lua | 19 +- data/items/items.xml | 7 +- 94 files changed, 2410 insertions(+), 999 deletions(-) delete mode 100644 data-otservbr-global/scripts/actions/farmine/boat.lua delete mode 100644 data-otservbr-global/scripts/movements/teleport/falcon_castle.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_asura_mirror.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_basinfire.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bastion_access.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_blacktp.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bluetp.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_boattp.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bone.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bonedoor.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_book.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bosses_killed.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_corpse.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_energybasin.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_enterlibrary.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_eyekey.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_fish.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_greentp.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_leverdoor.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_leverruby.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_library_entrances.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_lotuskey.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_peacock.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_pinktp.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_sealedbook.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_skullground.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_statuedeeplings.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_strandhair.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/actions_telescop.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_bonefiddle.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_chests.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_doors.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_fragrance.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_keys.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_mirror.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/creaturescripts_asuras_mechanic.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/movements_elemental_portals.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_falcon_minibosses.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_login.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_chests.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_doors.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_totems.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_color_puzzle.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_teleportTo.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_doors.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_oberonLever.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/movements_bossEntrance.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_grand_canon_dominus.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_grand_chaplain_gaunder.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_grand_commander_soeren.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_preceptor_lazare.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_spawn_damage.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_chests.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_telescope.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_boat_puzzle.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_stepIn.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_parchment.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_gorzindel.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_lokathmor.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_mazzinor.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_gorzindel.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_mazzinor.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_timers.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_usableItens.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_bossWay.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_teleportTo.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/movements_boat.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/movements_crackles.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/movements_golem_teleport.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/movements_pink_teleport.lua delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/movements_teleport.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_bony_rod.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_chests.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_doors.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_gems.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_levers.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_sample_blood.lua create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/museum/movements_teleportTo.lua diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index 58258d890bd..a3ca644d14f 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -187,39 +187,6 @@ Storage = { AccessDoor = 50043, CatacombDoors = 55047, }, - TheSecretLibrary = { - -- Reserved storage from 50050 - 50074 - TheOrderOfTheFalcon = { - OberonTimer = 50050, - }, - LiquidDeath = 50051, - Mota = 50052, - MotaDoor = 50053, - BasinDoor = 50054, - SkullDoor = 50055, - TheLament = 50056, - GreenTel = 50057, - BlueTel = 50058, - BlackTel = 50059, - PinkTel = 50060, - Peacock = 50061, - HighDry = 50062, - FalconBastionAccess = 50063, - FalconBastionChestsTimer = { - Key0909 = 50064, - }, - MiniBosses = { - GrandCommanderSoeren = 50065, - PreceptorLazare = 50066, - GrandChaplainGaunder = 50067, - GrandCanonDominus = 50068, - DazedLeafGolem = 50069, - }, - LowerBastionAccess = 50070, - UndergroundBastionAccess = 50071, - OberonAccess = 50072, - ShortcutToBastion = 50073, - }, DeeplingBosses = { -- Reserved storage from 50075 - 50079 Jaul = 50075, @@ -2623,11 +2590,133 @@ Storage = { }, }, U11_80 = { -- update 11.80 - Reserved Storages 46001 - 46300 - BattleMageOutfits = {}, - DiscovererOutfits = {}, - MeasuringTibia = {}, TheSecretLibrary = { + Questlog = 46001, + Asuras = { + Questline = 46002, + flammingOrchid = 46003, + SkeletonNotes = 46004, + StrandHair = 46005, + LotusKey = 46006, + EyeKey = 46007, + ScribbledNotes= 46008, + EbonyPiece = 46009, + PeacockBallad = 46010, + BlackSkull = 46011, + SilverChimes = 46012, + DiamondTimer = 46013, + BlazingTimer = 46014, + DarkTimer = 46015, + }, + FalconBastion = { + Questline = 46016, + KillingBosses = 46017, + OberonTimer = 46018, + OberonHeal = 46019, + LastBossMsgInterval = 46020, + }, + Darashia = { + Questline = 46021, + PuzzleSqm = 46022, + FirstChest = 46023, + SecondChest = 46024, + ThirdChest = 46025, + FourthChest = 46026, + RedColor = 46027, + GreenColor = 46028, + BlueColor = 46029, + ColorPuzzle = 46030, + EatenFood = 46031, + FirstTotem = 46032, + SecondTotem = 46033, + ThirdTotem = 46034, + FourthTotem = 46035, + FifthChest = 46036, + ScorpionTimer = 46037, + }, + LiquidDeath = { + Questline = 46038, + Statue1 = 46039, + Statue2 = 46040, + Statue3 = 46041, + Statue4 = 46042, + Statue5 = 46043, + Statue6 = 46044, + Statue7 = 46045, + Statue8 = 46046, + Statue9 = 46047, + StatueCount = 46048, + BrokulTimer = 46049, + }, + MoTA = { + Questline = 46050, + LeverPermission = 46051, + SampleBlood = 46052, + BonyRod = 46053, + BrokenCompass = 46054, + Crystal1 = 46055, + Crystal2 = 46056, + Crystal3 = 46057, + Crystal4 = 46058, + Crystal5 = 46059, + Crystal6 = 46060, + Crystal7 = 46061, + Crystal8 = 46062, + YellowGem = 46063, + GreenGem = 46064, + RedGem = 46065, + FinalBasin = 46066, + SkullSample = 46067, + }, + SmallIslands = { + Questline = 46068, + Parchment = 46069, + Sapphire = 46070, + Shovel = 46071, + Fishing = 46072, + RaxiasTimer = 46073, + BoatStages = 46074, + Hawser = 46075, + }, + LibraryPermission = 46076, + Library = { + Questline = 46077, + MazzinorTimer = 46078, + LokathmorTime = 46079, + GhuloshTime = 46080, + GorzindelTime = 46081, + }, + + -- previous + TheOrderOfTheFalcon = { + OberonTimer = 50050, + }, + LiquidDeath = 50051, + Mota = 50052, + MotaDoor = 50053, + BasinDoor = 50054, + SkullDoor = 50055, + TheLament = 50056, + GreenTel = 50057, + BlueTel = 50058, + BlackTel = 50059, + PinkTel = 50060, + Peacock = 50061, + HighDry = 50062, + FalconBastionAccess = 50063, + MiniBosses = { + GrandCommanderSoeren = 50065, + PreceptorLazare = 50066, + GrandChaplainGaunder = 50067, + GrandCanonDominus = 50068, + DazedLeafGolem = 50069, + }, + LowerBastionAccess = 50070, + UndergroundBastionAccess = 50071, + OberonAccess = 50072, + ShortcutToBastion = 50073, FalconBastionChestsTimer = { + Key0909 = 50064, Coast = 46281, Island = 46282, ThroneHall = 46283, @@ -2647,6 +2736,10 @@ Storage = { ScourgeOfOblivionTimer = 46024, ScourgeOfOblivionKilled = 46025, }, + + BattleMageOutfits = {}, + DiscovererOutfits = {}, + MeasuringTibia = {}, }, U12_00 = { -- update 12.00 - Reserved Storages 46301 - 46600 DreamWarriorOutfits = {}, diff --git a/data-otservbr-global/npc/charles.lua b/data-otservbr-global/npc/charles.lua index 9622620006a..46a6a15ca5c 100644 --- a/data-otservbr-global/npc/charles.lua +++ b/data-otservbr-global/npc/charles.lua @@ -78,7 +78,7 @@ addTravelKeyword("thais", 160, Position(32310, 32210, 6)) addTravelKeyword("liberty bay", 50, Position(32285, 32892, 6)) addTravelKeyword("carlin", 120, Position(32387, 31820, 6)) addTravelKeyword("shortcut", 100, Position(32029, 32466, 7), function(player) - return player:getStorageValue(Storage.TheSecretLibrary.PinkTel) == 2 and player:getStorageValue(Storage.TheSecretLibrary.Mota) == 12 + return player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.PinkTel) == 2 and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Mota) == 12 end) -- Kick diff --git a/data-otservbr-global/npc/dedoras.lua b/data-otservbr-global/npc/dedoras.lua index 79ac24a9678..c7880d0dea5 100644 --- a/data-otservbr-global/npc/dedoras.lua +++ b/data-otservbr-global/npc/dedoras.lua @@ -50,20 +50,35 @@ npcType.onCloseChannel = function(npc, creature) npcHandler:onCloseChannel(npc, creature) end -local function greetCallback(npc, creature) - local player = Player(creature) - local playerId = player:getId() +local quests = { + [1] = {stg = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, value = 3}, + [2] = {stg = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 7}, + [3] = {stg = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, value = 6}, + [4] = {stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, value = 2}, + [5] = {stg = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 8}, + [6] = {stg = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, value = 7} +} + +local function startMission(pid, storage, value) + local player = Player(pid) + if player then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Questlog) < 1 then + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Questlog, 1) + end + if player:getStorageValue(storage) < value then + player:setStorageValue(storage, value) + end + end +end - if player:getStorageValue(Storage.Kilmaresh.First.Access) < 1 then - npcHandler:setMessage(MESSAGE_GREET, "How could I help you?") -- It needs to be revised, it's not the same as the global - npcHandler:setTopic(playerId, 1) - elseif (player:getStorageValue(Storage.Kilmaresh.First.JamesfrancisTask) >= 0 and player:getStorageValue(Storage.Kilmaresh.First.JamesfrancisTask) <= 50) and player:getStorageValue(Storage.Kilmaresh.First.Mission) < 3 then - npcHandler:setMessage(MESSAGE_GREET, "How could I help you?") -- It needs to be revised, it's not the same as the global - npcHandler:setTopic(playerId, 15) - elseif player:getStorageValue(Storage.Kilmaresh.First.Mission) == 4 then - npcHandler:setMessage(MESSAGE_GREET, "How could I help you?") -- It needs to be revised, it's not the same as the global - player:setStorageValue(Storage.Kilmaresh.First.Mission, 5) - npcHandler:setTopic(playerId, 20) +local function isQuestDone(pid) + local player = Player(pid) + if player then + for i = 1, #quests do + if player:getStorageValue(quests[i].stg) ~= quests[i].value then + return false + end + end end return true end @@ -76,36 +91,131 @@ local function creatureSayCallback(npc, creature, type, message) return false end - if MsgContains(message, "report") and player:getStorageValue(Storage.TheSecretLibrary.PinkTel) == 1 then - npcHandler:say({ "Talk to Captain Charles in Port Hope. He told me that he once ran ashore on a small island where he discovered a small ruin. The architecture was like nothing he had seen before." }, npc, creature) - player:setStorageValue(Storage.TheSecretLibrary.PinkTel, 2) - npcHandler:setTopic(playerId, 1) - npcHandler:setTopic(playerId, 1) - end - - if MsgContains(message, "check") and player:getStorageValue(Storage.TheSecretLibrary.HighDry) == 5 then + if MsgContains(message, "search") then npcHandler:say({ - "Marvellous! With this information combined we have all that's needed! ...", - "So let me see. ...", - "Hmm, interesting. And we shouldn't forget about the chant! Yes, excellent! ...", - "So listen: To enter the veiled library, travel to the white raven monastery on the Isle of Kings and enter its main altar room. ...", - "There, use an ordinary scythe on the right of the two monuments, while concentrating on this glyph here and chant the words: Chamek Athra Thull Zathroth ...", - "Oh, and one other thing. For your efforts I want to reward you with one of my old outfits, back from my adventuring days. May it suit you well! ...", - "Hurry now my friend. Time is of essence!", + "I gathered some lore on my own, but I desperately need more information that you might provide me. ...", + "My leads are the {museum} in thais, something strange in the darashian {desert}, rumors about {fishmen}, an ancient {order}, the mysterious {asuri}, or a lost {isle}?", }, npc, creature) - player:setStorageValue(Storage.TheSecretLibrary.HighDry, 6) - npcHandler:setTopic(playerId, 1) - npcHandler:setTopic(playerId, 1) + npcHandler:setTopic(playerId, 2) + elseif npcHandler:getTopic(playerId) == 2 then + if MsgContains(message, "museum") then + npcHandler:say("I have heard that it was recently planned to expand the Museum of Tibian Arts. In the course of these activities unexpected difficulties occurred.", npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, 1) + elseif MsgContains(message, "desert") then + npcHandler:say("There are rumors of a mysterious statue in the desert next to Darashia. Nobody really knows the meaning of it.", npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, 1) + elseif MsgContains(message, "fishmen") then + npcHandler:say({ + "Sightings of strange fishmen in Tiquanda are stirring up the region. You should be careful when investigating this. ...", + "As far as I know a scholar in Edron already dealt with fish-like creatures before.", + }, npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, 1) + elseif MsgContains(message, "order") then + npcHandler:say({ + "Our world has seen many noble knights and orders throughout the centuries. Most of them vanished a long time ago but only few under such mysterious circumstances as the Order of the Falcon. ...", + "This noble alliance of honourable knights once resided in Edron to serve the king. Legend has it they vanished practically over night. Rumor has it their disappearance is connected to a forbidden book.", + }, npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, 1) + elseif MsgContains(message, "asuri") then + npcHandler:say({ + "There's a beautiful but very dangerous palace in the Tiquandan jungle. The young women who live there are actually demons and they are luring unsuspecting mortals in there. ...", + "A lucky survivor told me about a portal at the very top of the palace that may lead to another asuri hideout.", + }, npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, 1) + elseif MsgContains(message, "isle") then + npcHandler:say("Talk to Captain Charles in Port Hope. He told me that he once ran ashore on a small island where he discovered a small ruin. The architecture was like nothing he had seen before.", npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, 1) + end + elseif MsgContains(message, "progress") and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.libraryPermission) < 1 then + npcHandler:say({ + "About what of your mission s do you want to report? The {museum}, the darashian {desert}, the rumors about strange {fishmen}, the ancient {order}, the mysterious {asuri}, or the lost {isle}? ...", + "Or shall me {check} how much information we acquired?" + }, npc, creature) + npcHandler:setTopic(playerId, 3) + elseif npcHandler:getTopic(playerId) == 3 then + if MsgContains(message, "check") then + if isQuestDone(player:getId()) then + npcHandler:say({ + "As I told you: To enter the veiled library, travel to the white raven monastery on the Isle of Kings and enter its main altar room. ...", + "There, use an ordinary scythe on the right of the two monuments, while concentrating on this glyph here and chant the words: Chamek Athra Thull Zathroth ...", + "Hurry now my friend. Time is of essence!" + }, npc, creature) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.libraryPermission, 1) + player:addAchievement("Battle Mage") + player:addOutfit(1069, 1) + player:addOutfit(1070, 1) + npcHandler:setTopic(playerId, 1) + else + npcHandler:say("You're still searching for informations.", npc, creature) + end + end + end return true end +keywordHandler:addKeyword({"looking"}, StdModule.say, {npcHandler = npcHandler, text = "I need the help of some competent {adventurers} to handle a threat to all creation."}) +keywordHandler:addKeyword({"value"}, StdModule.say, {npcHandler = npcHandler, text = "This leaves us with no choice but to take action into our own {hands}."}) +keywordHandler:addKeyword({"threat"}, StdModule.say, {npcHandler = npcHandler, text = "I guess you know about the {background} and there is no need to tell you that the forces from beyond managed to acquire the parts of the godbreaker in a coup."}) +keywordHandler:addKeyword({"disassembled"}, StdModule.say, {npcHandler = npcHandler, text = "The secret locations of the godbreaker {parts} were revealed and due to trickery, the minions of Variphor aquired all of them."}) +keywordHandler:addKeyword({"obscure"}, StdModule.say, {npcHandler = npcHandler, text = "Those pieces of knowledge come in several forms and shapes. For most I can give you more or less specific hints where to start your {search}."}) +keywordHandler:addKeyword({"hands"}, StdModule.say, {npcHandler = npcHandler, text = "You have to {find} the veiled hoard of Zathroth, breach it and destroy the knowledge how to use the godbreaker."}) +keywordHandler:addKeyword({"adventurer"}, StdModule.say, {npcHandler = npcHandler, text = { + "Of course the first to ask would be the famous Avar Tar, but I heard he's already on a quest of his own and ...", + "Well, let's say our last collaboration did not end too well. In fact, I'd be not even surprised if he pretended to not even know me. ...", + "So I have to look elsewhere to handle this new {threat}.", +}}) +keywordHandler:addKeyword({"background"}, StdModule.say, {npcHandler = npcHandler, text = { + "The goodbreaker was created in ancient times, when the war between the gods and their minions was on its height. Its creation took aeons and incredible sacrifices. ...", + "Each part had to be crafted perfectly, to emulate the gods, so it would share 'the same place' with them. ...", + "Mere mortals can not even perceive it in his whole but only recognize the part of it that is the physical representation in our world. ...", + "If it was meant to be used as an actual weapon, as the ultimate threat, or if Zathroth was just tempted to use his knowledge in the ultimate way - to create something that could undo himself - we don't know. ...", + "However in the end even Zathroth deemed it too much of a threat but instead of destroying the contraption once and for all, it was {disassembled} and hidden away.", +}}) +keywordHandler:addKeyword({"parts"}, StdModule.say, {npcHandler = npcHandler, text = { + "The parts alone do them no good. To assemble the parts, great skill, immense power and forbidden knowledge are necessary. ...", + "The skill will be supplied by the fallen Yalahari and the power by Variphor itself. ...", + "The only thing they are still lacking is the knowledge to assemble and operate the {godbreaker}.", +}}) +keywordHandler:addKeyword({"godbreaker"}, StdModule.say, {npcHandler = npcHandler, text = { + "The godbreaker is a complex artifact. Incantation woven into incantation. The powers bound into it are so immense that the slightest mishandling could prove disastrous. ...", + "o figure out how it works, let alone how it can be operated safely, could require several centuries of tireless study. And even then this information would be only partial. ...", + "Yet the creation and operation of the godbreaker is just the kind of forbidden {knowledge} Zathroth values most, so it was compiled and stored.", +}}) +keywordHandler:addKeyword({"knowledge"}, StdModule.say, {npcHandler = npcHandler, text = { + "Of course the dangers of such knowledge were obvious. It was hidden in a sacred place devoted to Zathroth and dangerous knowledge. ...", + "The hidden library, the forbidden hoard, the shrouded trove of knowledge or the veiled hoard of forbidden knowledge, the place has many names in many {myths}.", +}}) +keywordHandler:addKeyword({"myths"}, StdModule.say, {npcHandler = npcHandler, text = { + "The myths agree that the place is well hidden, extremely guarded and contains some of the most powerful pieces of knowledge in this world and probably beyond. ...", + "However the knowledge about the godbreaker now poses a threat to all existence. In the hands of Variphor it can cause disaster in previously unknown ways. The gods themselves are in {peril}.", +}}) +keywordHandler:addKeyword({"peril"}, StdModule.say, {npcHandler = npcHandler, text = { + "Regardless of the dangers, the cult of Zathroth refused to destroy the knowledge of the godbreaker for good. ...", + "They {value} dangerous knowledge that much, that they are unable to part from it, even when faced with the utter destruction of creation.", +}}) +keywordHandler:addKeyword({"find"}, StdModule.say, {npcHandler = npcHandler, text = { + "I know it's asked much but it's no longer a matter of choice. ...", + "The enemy is moving and I have reports that suggest the minions of Variphor are actively searching for Zathroth's library. They must not be allowed to succeed. ...", + "We must be the first to {reach} the hoard and make sure the enemy doesn't get the information he needs.", +}}) +keywordHandler:addKeyword({"reach"}, StdModule.say, {npcHandler = npcHandler, text = { + "I'd recommend to follow the few leads me and my associates could gather so far. ...", + "Old myths, some {rumors} about old texts and other pieces of knowledge that I could use to figure out where to locate the hidden library and how to enter it.", +}}) +keywordHandler:addKeyword({"rumors"}, StdModule.say, {npcHandler = npcHandler, text = { + "Hints about the shrouded hoard are numerous, though most are general mentions in texts that deal with Zathroth. But there are other sources. ...", + "Like texts about ancient liturgies of Zathroth and historical documents that might give us clues. I already compiled everything of value from the sources that were openly available. ...", + "To gather the more {obscure} parts of knowledge, however, I'll need your help.", +}}) + +npcHandler:setMessage(MESSAGE_GREET, "Greetings seekers of knowledge. You seem to be just the person I'm {looking} for.") npcHandler:setMessage(MESSAGE_WALKAWAY, "Well, bye then.") -npcHandler:setCallback(CALLBACK_SET_INTERACTION, onAddFocus) -npcHandler:setCallback(CALLBACK_REMOVE_INTERACTION, onReleaseFocus) + npcHandler:setCallback(CALLBACK_GREET, greetCallback) npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) + npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true) -- npcType registering the npcConfig table diff --git a/data-otservbr-global/npc/gail.lua b/data-otservbr-global/npc/gail.lua index 1c61a2cbc6d..d1e77115c31 100644 --- a/data-otservbr-global/npc/gail.lua +++ b/data-otservbr-global/npc/gail.lua @@ -76,9 +76,9 @@ local function creatureSayCallback(npc, creature, type, message) return false end - if MsgContains(message, "daughter") and player:getStorageValue(Storage.TheSecretLibrary.Peacock) == 1 then + if MsgContains(message, "daughter") and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Peacock) == 1 then npcHandler:say({ "I always feared that I lost her. And yet, all those years, I still had a gleam of hope. I'm devastated to learn about her fate - but at least I have certainty now. Thank you for telling me." }, npc, creature) - player:setStorageValue(Storage.TheSecretLibrary.Peacock, 2) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Peacock, 2) npcHandler:setTopic(playerId, 1) npcHandler:setTopic(playerId, 1) end diff --git a/data-otservbr-global/npc/gareth.lua b/data-otservbr-global/npc/gareth.lua index 87524fab271..8103681f094 100644 --- a/data-otservbr-global/npc/gareth.lua +++ b/data-otservbr-global/npc/gareth.lua @@ -127,8 +127,8 @@ local function creatureSayCallback(npc, creature, type, message) npcHandler:setTopic(playerId, 0) end - if MsgContains(message, "extension") and player:getStorageValue(Storage.TheSecretLibrary.LiquidDeath) == 11 then - if player:getStorageValue(Storage.TheSecretLibrary.LiquidDeath) == 11 then + if MsgContains(message, "extension") and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath) == 11 then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath) == 11 then npcHandler:say("It is planned to extend the MOTA. But this will take time, because our workers have faced a little problem.", npc, creature) npcHandler:setTopic(playerId, 11) end @@ -143,29 +143,29 @@ local function creatureSayCallback(npc, creature, type, message) elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 12 then if npcHandler:getTopic(playerId) == 12 then npcHandler:say("You are a true patron of the arts! I have opened the construction site for you. Start your work right now!", npc, creature) - player:setStorageValue(Storage.TheSecretLibrary.Mota, 1) - player:setStorageValue(Storage.TheSecretLibrary.LiquidDeath, 12) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Mota, 1) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath, 12) npcHandler:setTopic(playerId, 13) end end - if MsgContains(message, "bone") and player:getStorageValue(Storage.TheSecretLibrary.Mota) == 2 then + if MsgContains(message, "bone") and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Mota) == 2 then npcHandler:say({ "Hmm, interesting. Several years ago I have read some books dealing with strange locking mechanisms. I think what you have found here is a bone lever of category 3. ...", "Normally this is not used because it is not secure. The production failed and the lever can always be activated as follows: back, back, up, right, left. Just have a try, it should work.", }, npc, creature) - player:setStorageValue(Storage.TheSecretLibrary.Mota, 3) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Mota, 3) npcHandler:setTopic(playerId, 14) end - if MsgContains(message, "extension") and player:getStorageValue(Storage.TheSecretLibrary.Mota) == 11 then + if MsgContains(message, "extension") and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Mota) == 11 then npcHandler:say({ "You have found an inscription I would like to translate for you. The tibianus cipher was used: ...", "Those who are accorded the honour to visit this exclusive place will smash their blindness and face the truth. ...", "Astonishingly, Dedoras from Cormaya has recently asked me for these kinds of inscriptions. For sure he is able to bring light into the darkness. You should visit him. ", }, npc, creature) - player:setStorageValue(Storage.TheSecretLibrary.Mota, 12) - player:setStorageValue(Storage.TheSecretLibrary.TheLament, 1) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Mota, 12) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.TheLament, 1) npcHandler:setTopic(playerId, 15) end diff --git a/data-otservbr-global/npc/spectulus.lua b/data-otservbr-global/npc/spectulus.lua index 9856bce82c0..2c741fe2288 100644 --- a/data-otservbr-global/npc/spectulus.lua +++ b/data-otservbr-global/npc/spectulus.lua @@ -427,7 +427,7 @@ local function creatureSayCallback(npc, creature, type, message) elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 25 then if npcHandler:getTopic(playerId) == 25 then npcHandler:say("Excellent, excellent. The rumours pointed to the north of Tiquanda, a sunken temple probably half drowned in water. Return to me if you find anything interesting!", npc, creature) - player:setStorageValue(Storage.TheSecretLibrary.LiquidDeath, 1) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath, 1) npcHandler:setTopic(playerId, 0) end end diff --git a/data-otservbr-global/scripts/actions/farmine/boat.lua b/data-otservbr-global/scripts/actions/farmine/boat.lua deleted file mode 100644 index 6a1e381c1e5..00000000000 --- a/data-otservbr-global/scripts/actions/farmine/boat.lua +++ /dev/null @@ -1,36 +0,0 @@ -local boats = { - { pos = { x = 33344, y = 31349, z = 7 }, destination = Position(33326, 31351, 7), unlockShortcut = Storage.TheSecretLibrary.ShortcutToBastion }, - { pos = { x = 33373, y = 31309, z = 7 }, destination = Position(33382, 31292, 7) }, - { pos = { x = 33382, y = 31294, z = 7 }, destination = Position(33374, 31310, 7) }, - { pos = { x = 33328, y = 31352, z = 7 }, destination = Position(33346, 31348, 7), access = Storage.TheSecretLibrary.ShortcutToBastion }, -} - -local boat = Action() - -function boat.onUse(player, item, fromPosition, itemEx, toPosition) - for b = 1, #boats do - if item:getPosition() == Position(boats[b].pos) then - if boats[b].unlockShortcut then - if player:getStorageValue(boats[b].unlockShortcut) < 1 then - player:setStorageValue(boats[b].unlockShortcut, 1) - end - end - if boats[b].access then - if player:getStorageValue(boats[b].access) == 1 then - player:teleportTo(boats[b].destination) - player:getPosition():sendMagicEffect(CONST_ME_WATERSPLASH) - return true - end - else - player:teleportTo(boats[b].destination) - player:getPosition():sendMagicEffect(CONST_ME_WATERSPLASH) - return true - end - end - end -end - -for a = 1, #boats do - boat:position(boats[a].pos) -end -boat:register() diff --git a/data-otservbr-global/scripts/actions/other/others/quest_system2.lua b/data-otservbr-global/scripts/actions/other/others/quest_system2.lua index a187810b3bc..89b61977dfc 100644 --- a/data-otservbr-global/scripts/actions/other/others/quest_system2.lua +++ b/data-otservbr-global/scripts/actions/other/others/quest_system2.lua @@ -309,7 +309,7 @@ This page seems to be part of a book about ancient rituals, mystic incantations name = "Falcon Bastion Access", }, }, - storage = Storage.TheSecretLibrary.FalconBastionAccess, + storage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastionAccess, }, [20002] = { items = { diff --git a/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua b/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua index 57ccc933511..2e4d9f57d82 100644 --- a/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua +++ b/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua @@ -328,20 +328,20 @@ local questTable = { { storage = Storage.Quest.U8_6.WrathOfTheEmperor.TeleportAccess.Zizzle, storageValue = 1 }, { storage = Storage.Quest.U8_6.WrathOfTheEmperor.TeleportAccess.Zlak, storageValue = 1 }, - { storage = Storage.TheSecretLibrary.FalconBastionAccess, storageValue = 1 }, - { storage = Storage.TheSecretLibrary.LowerBastionAccess, storageValue = 1 }, - { storage = Storage.TheSecretLibrary.UndergroundBastionAccess, storageValue = 1 }, - { storage = Storage.TheSecretLibrary.ShortcutToBastion, storageValue = 1 }, - { storage = Storage.TheSecretLibrary.OberonAccess, storageValue = 1 }, - { storage = Storage.TheSecretLibrary.MotaDoor, storageValue = 1 }, - { storage = Storage.TheSecretLibrary.BasinDoor, storageValue = 1 }, - { storage = Storage.TheSecretLibrary.SkullDoor, storageValue = 1 }, - { storage = Storage.TheSecretLibrary.Mota, storageValue = 1 }, - { storage = Storage.TheSecretLibrary.MiniBosses.PreceptorLazare, storageValue = 1 }, - { storage = Storage.TheSecretLibrary.MiniBosses.GrandCanonDominus, storageValue = 1 }, - { storage = Storage.TheSecretLibrary.MiniBosses.GrandChaplainGaunder, storageValue = 1 }, - { storage = Storage.TheSecretLibrary.MiniBosses.GrandCommanderSoeren, storageValue = 1 }, - { storage = Storage.TheSecretLibrary.MiniBosses.DazedLeafGolem, storageValue = 1 }, + { storage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastionAccess, storageValue = 1 }, + { storage = Storage.Quest.U11_80.TheSecretLibrary.LowerBastionAccess, storageValue = 1 }, + { storage = Storage.Quest.U11_80.TheSecretLibrary.UndergroundBastionAccess, storageValue = 1 }, + { storage = Storage.Quest.U11_80.TheSecretLibrary.ShortcutToBastion, storageValue = 1 }, + { storage = Storage.Quest.U11_80.TheSecretLibrary.OberonAccess, storageValue = 1 }, + { storage = Storage.Quest.U11_80.TheSecretLibrary.MotaDoor, storageValue = 1 }, + { storage = Storage.Quest.U11_80.TheSecretLibrary.BasinDoor, storageValue = 1 }, + { storage = Storage.Quest.U11_80.TheSecretLibrary.SkullDoor, storageValue = 1 }, + { storage = Storage.Quest.U11_80.TheSecretLibrary.Mota, storageValue = 1 }, + { storage = Storage.Quest.U11_80.TheSecretLibrary.MiniBosses.PreceptorLazare, storageValue = 1 }, + { storage = Storage.Quest.U11_80.TheSecretLibrary.MiniBosses.GrandCanonDominus, storageValue = 1 }, + { storage = Storage.Quest.U11_80.TheSecretLibrary.MiniBosses.GrandChaplainGaunder, storageValue = 1 }, + { storage = Storage.Quest.U11_80.TheSecretLibrary.MiniBosses.GrandCommanderSoeren, storageValue = 1 }, + { storage = Storage.Quest.U11_80.TheSecretLibrary.MiniBosses.DazedLeafGolem, storageValue = 1 }, { storage = Storage.Quest.U7_4.DjinnWar.EfreetFaction.DoorToLamp, storageValue = 1 }, { storage = Storage.Quest.U7_4.DjinnWar.EfreetFaction.DoorToMaridTerritory, storageValue = 1 }, diff --git a/data-otservbr-global/scripts/movements/teleport/falcon_castle.lua b/data-otservbr-global/scripts/movements/teleport/falcon_castle.lua deleted file mode 100644 index a7473748602..00000000000 --- a/data-otservbr-global/scripts/movements/teleport/falcon_castle.lua +++ /dev/null @@ -1,71 +0,0 @@ -local teleports = { - { position = { x = 33306, y = 31349, z = 8 }, destination = Position(33349, 31346, 8) }, - { position = { x = 33310, y = 31325, z = 8 }, access = Storage.TheSecretLibrary.OberonAccess, destination = Position(33329, 31332, 9) }, - { position = { x = 33329, y = 31333, z = 9 }, destination = Position(33308, 31325, 8) }, - { - positions = { - { x = 33296, y = 31287, z = 9 }, - { x = 33297, y = 31287, z = 9 }, - { x = 33298, y = 31287, z = 9 }, - { x = 33296, y = 31288, z = 9 }, - { x = 33298, y = 31288, z = 9 }, - { x = 33298, y = 31289, z = 9 }, - { x = 33297, y = 31289, z = 9 }, - }, - destination = Position(33363, 31342, 9), - }, -} - -local falconCastle = MoveEvent() - -function falconCastle.onStepIn(creature, item, position, fromPosition) - local player = creature:getPlayer() - if not player then - return false - end - for c = 1, #teleports do - if teleports[c].position then - if player:getPosition() == Position(teleports[c].position) then - if teleports[c].access then - if player:getStorageValue(teleports[c].access) == 1 then - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - player:teleportTo(teleports[c].destination) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - else - player:teleportTo(fromPosition) - end - else - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - player:teleportTo(teleports[c].destination) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - end - elseif teleports[c].positions then - for d = 1, #teleports[c].positions do - if player:getPosition() == Position(teleports[c].positions[d]) then - if player:getStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer) > os.time() then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have faced this boss in the last 20 hours.") - player:teleportTo(fromPosition) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - return false - else - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - player:teleportTo(teleports[c].destination) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - end - end - end - end -end - -for a = 1, #teleports do - if teleports[a].position then - falconCastle:position(teleports[a].position) - elseif teleports[a].positions then - for b = 1, #teleports[a].positions do - falconCastle:position(teleports[a].positions[b]) - end - end -end -falconCastle:register() diff --git a/data-otservbr-global/scripts/quests/cradle_of_monsters/the_monster_fight.lua b/data-otservbr-global/scripts/quests/cradle_of_monsters/the_monster_fight.lua index ac10eead616..d85bd3491e5 100644 --- a/data-otservbr-global/scripts/quests/cradle_of_monsters/the_monster_fight.lua +++ b/data-otservbr-global/scripts/quests/cradle_of_monsters/the_monster_fight.lua @@ -196,6 +196,7 @@ local function setShields(creature, count) end local monsterHealth = CreatureEvent("fight.the-monster.TheMonsterHealth") + function monsterHealth.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType) if not creature then return primaryDamage, primaryType, secondaryDamage, secondaryType diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_asura_mirror.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_asura_mirror.lua deleted file mode 100644 index 0659f5f95e0..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_asura_mirror.lua +++ /dev/null @@ -1,21 +0,0 @@ -local goPos = { x = 32813, y = 32754, z = 9 } - -local asuraMirror = Action() -function asuraMirror.onUse(creature, item, position, fromPosition, pos, target, toPosition) - local player = creature:getPlayer() - if not player then - return - end - - if player:getLevel() >= 250 then - position:sendMagicEffect(CONST_ME_TELEPORT) - player:teleportTo(goPos) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - else - player:sendCancelMessage("You do not have enough level.") - end - return true -end - -asuraMirror:aid(64019) -asuraMirror:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_basinfire.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_basinfire.lua deleted file mode 100644 index b37eede46ca..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_basinfire.lua +++ /dev/null @@ -1,18 +0,0 @@ -local basinFire = Action() - -function basinFire.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.TheSecretLibrary.Mota) == 8 then - if target.itemid == 2114 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a reward.") - player:setStorageValue(Storage.TheSecretLibrary.Mota, 9) - player:removeItem(32408, 1) - player:addItem(32623, 1) - player:setStorageValue(Storage.TheSecretLibrary.BasinDoor, 1) - end - return true - end - return false -end - -basinFire:id(1334) -basinFire:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bastion_access.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bastion_access.lua deleted file mode 100644 index 285722c4a7a..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bastion_access.lua +++ /dev/null @@ -1,13 +0,0 @@ -local bastionAccess = Action() - -function bastionAccess.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local time = getTibiaTimerDayOrNight() - if time == "night" and target:getId() == 27836 and player:getStorageValue(Storage.TheSecretLibrary.FalconBastionAccess) == 1 then - player:teleportTo(Position({ x = 33357, y = 31308, z = 4 })) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - return true -end - -bastionAccess:id(28468) -bastionAccess:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_blacktp.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_blacktp.lua deleted file mode 100644 index bd7e614d317..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_blacktp.lua +++ /dev/null @@ -1,14 +0,0 @@ -local backTp = Action() - -function backTp.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.TheSecretLibrary.BlackTel) == -1 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a skull.") - player:addItem(28489, 1) - player:setStorageValue(Storage.TheSecretLibrary.BlackTel, 1) - return true - end - return false -end - -backTp:uid(1098) -backTp:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bluetp.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bluetp.lua deleted file mode 100644 index 2ab728d4113..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bluetp.lua +++ /dev/null @@ -1,14 +0,0 @@ -local greenTp = Action() - -function greenTp.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.TheSecretLibrary.BlueTel) == -1 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a piece of ebony.") - player:addItem(28491, 1) - player:setStorageValue(Storage.TheSecretLibrary.BlueTel, 1) - return true - end - return false -end - -greenTp:uid(1097) -greenTp:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_boattp.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_boattp.lua deleted file mode 100644 index 257cb2290f1..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_boattp.lua +++ /dev/null @@ -1,17 +0,0 @@ -local boatTp = Action() - -function boatTp.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.TheSecretLibrary.HighDry) == 4 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The raft was not that solid in the end, its parts are floating in the ocean now. But at least you reached dry land.") - player:removeItem(32407, 1) - player:teleportTo(Position(32187, 32474, 7)) - player:setStorageValue(Storage.TheSecretLibrary.HighDry, 5) - player:setStorageValue(Storage.TheSecretLibrary.PinkTel, 3) - player:setStorageValue(Storage.TheSecretLibrary.Mota, 13) - return true - end - return false -end - -boatTp:uid(1104) -boatTp:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bone.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bone.lua deleted file mode 100644 index 2a5244d449b..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bone.lua +++ /dev/null @@ -1,13 +0,0 @@ -local bone = Action() - -function bone.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.TheSecretLibrary.Mota) == 1 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a reward.") - player:setStorageValue(Storage.TheSecretLibrary.Mota, 2) - return true - end - return false -end - -bone:uid(1083) -bone:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bonedoor.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bonedoor.lua deleted file mode 100644 index a2bf76fd430..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bonedoor.lua +++ /dev/null @@ -1,17 +0,0 @@ -local boneDoor = Action() - -function boneDoor.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.TheSecretLibrary.Mota) == 9 then - if target.itemid == 10876 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a reward.") - player:setStorageValue(Storage.TheSecretLibrary.Mota, 10) - player:removeItem(32648, 1) - player:setStorageValue(Storage.TheSecretLibrary.SkullDoor, 1) - end - return true - end - return false -end - -boneDoor:id(1335) -boneDoor:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_book.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_book.lua deleted file mode 100644 index b6ce0469168..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_book.lua +++ /dev/null @@ -1,14 +0,0 @@ -local bookdeepling = Action() - -function bookdeepling.onUse(player, item, frompos, item2, topos) - if player:getStorageValue(Storage.TheSecretLibrary.LiquidDeath) == 1 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The descriptions in this book look like plans detailing the launch of a large-scale assault.") - player:setStorageValue(Storage.TheSecretLibrary.LiquidDeath, 2) - else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "oh sorry") - end - return true -end - -bookdeepling:uid(1073) -bookdeepling:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bosses_killed.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bosses_killed.lua deleted file mode 100644 index a62b922469e..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_bosses_killed.lua +++ /dev/null @@ -1,32 +0,0 @@ -local bosses = { - ["ghulosh"] = { storage = Storage.Quest.U11_80.TheSecretLibrary.GhuloshKilled }, - ["gorzindel"] = { storage = Storage.Quest.U11_80.TheSecretLibrary.GorzindelKilled }, - ["lokathmor"] = { storage = Storage.Quest.U11_80.TheSecretLibrary.LokathmorKilled }, - ["mazzinor"] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MazzinorKilled }, - ["scourge of oblivion"] = { storage = Storage.Quest.U11_80.TheSecretLibrary.ScourgeOfOblivionKilled }, -} - -local bossesSecretLibrary = CreatureEvent("SecretLibraryBossDeath") -function bossesSecretLibrary.onDeath(creature) - local bossConfig = bosses[creature:getName():lower()] - if not bossConfig then - return true - end - onDeathForDamagingPlayers(creature, function(creature, player) - if bossConfig.storage then - player:setStorageValue(bossConfig.storage, 1) - end - local bossesKilled = 0 - for value in pairs(bosses) do - if player:getStorageValue(bosses[value].storage) > 0 then - bossesKilled = bossesKilled + 1 - end - end - if bossesKilled >= 4 then -- number of mini bosses - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.ScourgeOfOblivionDoor, 1) - end - end) - return true -end - -bossesSecretLibrary:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_corpse.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_corpse.lua deleted file mode 100644 index 7f33db76e36..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_corpse.lua +++ /dev/null @@ -1,14 +0,0 @@ -local corpse = Action() - -function corpse.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.TheSecretLibrary.TheLament) == 5 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a scribbled notes.") - player:addItem(28515, 1) - player:setStorageValue(Storage.TheSecretLibrary.TheLament, 6) - return true - end - return false -end - -corpse:uid(1095) -corpse:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_energybasin.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_energybasin.lua deleted file mode 100644 index 99109f91ebb..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_energybasin.lua +++ /dev/null @@ -1,44 +0,0 @@ -local config = { - -- yellow - [1085] = { - itemId = 27868, - msg = "Success", - storage = Storage.TheSecretLibrary.Mota, - getValue = 4, - setValue = 5, - basin = 3514, - }, - -- green - [1086] = { - itemId = 27867, - msg = "Success", - storage = Storage.TheSecretLibrary.Mota, - getValue = 5, - setValue = 6, - basin = 3514, - }, - -- red - [1087] = { itemId = 27869, msg = "Success", storage = Storage.TheSecretLibrary.Mota, getValue = 6, setValue = 7, basin = 3514 }, -} - -local energyBasin = Action() - -function energyBasin.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local setting = config[item.uid] - if setting then - if player:getStorageValue(setting.storage) == setting.getValue then - player:removeItem(setting.itemId, 1) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, setting.msg) - player:setStorageValue(setting.storage, setting.setValue) - else - player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE) - end - end - return true -end - -for index, value in pairs(config) do - energyBasin:uid(index) -end - -energyBasin:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_enterlibrary.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_enterlibrary.lua deleted file mode 100644 index a72a30a9289..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_enterlibrary.lua +++ /dev/null @@ -1,15 +0,0 @@ -local blacktp = Action() - -function blacktp.onUse(player, item, frompos, item2, topos) - if player:getStorageValue(Storage.TheSecretLibrary.HighDry) == 5 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Welcome to the Secret Library.") - player:teleportTo(Position(32516, 32537, 12)) - else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "sorry") - end - - return true -end - -blacktp:uid(26705) -blacktp:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_eyekey.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_eyekey.lua deleted file mode 100644 index 245b1a0184f..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_eyekey.lua +++ /dev/null @@ -1,14 +0,0 @@ -local eyeKey = Action() - -function eyeKey.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.TheSecretLibrary.TheLament) == 4 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a eye key.") - player:addItem(28477, 1) - player:setStorageValue(Storage.TheSecretLibrary.TheLament, 5) - return true - end - return false -end - -eyeKey:uid(1094) -eyeKey:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_fish.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_fish.lua deleted file mode 100644 index 0a02d20a344..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_fish.lua +++ /dev/null @@ -1,14 +0,0 @@ -local fish = Action() - -function fish.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.TheSecretLibrary.HighDry) == 2 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a hawser.") - player:addItem(32407, 1) - player:setStorageValue(Storage.TheSecretLibrary.HighDry, 3) - return true - end - return false -end - -fish:uid(1102) -fish:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_greentp.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_greentp.lua deleted file mode 100644 index 306ca25bf81..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_greentp.lua +++ /dev/null @@ -1,14 +0,0 @@ -local greenTp = Action() - -function greenTp.onUse(player, item, frompos, item2, topos) - if player:getStorageValue(Storage.TheSecretLibrary.GreenTel) == -1 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You see silver chimes dangling on the dragon statue in this room.") - player:addItem(28494, 1) - player:setStorageValue(Storage.TheSecretLibrary.GreenTel, 1) - return true - end - return false -end - -greenTp:uid(1096) -greenTp:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_leverdoor.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_leverdoor.lua deleted file mode 100644 index f8cc5d8af77..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_leverdoor.lua +++ /dev/null @@ -1,14 +0,0 @@ -local leverDoor = Action() - -function leverDoor.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.TheSecretLibrary.Mota) == 3 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a reward.") - player:setStorageValue(Storage.TheSecretLibrary.Mota, 4) - player:setStorageValue(Storage.TheSecretLibrary.MotaDoor, 1) - return true - end - return false -end - -leverDoor:uid(1084) -leverDoor:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_leverruby.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_leverruby.lua deleted file mode 100644 index c9365895118..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_leverruby.lua +++ /dev/null @@ -1,14 +0,0 @@ -local leverRuby = Action() - -function leverRuby.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.TheSecretLibrary.Mota) == 7 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a reward.") - player:addItem(32409, 1) - player:setStorageValue(Storage.TheSecretLibrary.Mota, 8) - return true - end - return false -end - -leverRuby:uid(1088) -leverRuby:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_library_entrances.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_library_entrances.lua deleted file mode 100644 index 7f2565746bc..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_library_entrances.lua +++ /dev/null @@ -1,43 +0,0 @@ -local config = { - { position = { x = 32616, y = 32529, z = 13 }, destination = { x = 32719, y = 32770, z = 10 } }, -- mazzinor - { position = { x = 32718, y = 32768, z = 10 }, destination = { x = 32616, y = 32531, z = 13 } }, - { position = { x = 32724, y = 32728, z = 10 }, destination = { x = 32616, y = 32531, z = 13 } }, - { position = { x = 32660, y = 32736, z = 12 }, destination = { x = 32745, y = 32746, z = 10 } }, -- gorzindel - { position = { x = 32744, y = 32744, z = 10 }, destination = { x = 32660, y = 32734, z = 12 } }, - { position = { x = 32687, y = 32726, z = 10 }, destination = { x = 32660, y = 32734, z = 12 } }, - { position = { x = 32662, y = 32713, z = 13 }, destination = { x = 32745, y = 32770, z = 10 } }, -- ghulosh - { position = { x = 32744, y = 32768, z = 10 }, destination = { x = 32660, y = 32713, z = 13 } }, - { position = { x = 32755, y = 32729, z = 10 }, destination = { x = 32660, y = 32713, z = 13 } }, - { position = { x = 32464, y = 32654, z = 12 }, destination = { x = 32719, y = 32746, z = 10 } }, -- lokathmor - { position = { x = 32718, y = 32744, z = 10 }, destination = { x = 32466, y = 32654, z = 12 } }, - { position = { x = 32750, y = 32696, z = 10 }, destination = { x = 32466, y = 32654, z = 12 } }, - { position = { x = 32480, y = 32601, z = 15 }, destination = { x = 32673, y = 32738, z = 11 } }, -- scourge of oblivion - { position = { x = 32672, y = 32736, z = 11 }, destination = { x = 32480, y = 32599, z = 15 } }, - { position = { x = 32726, y = 32748, z = 11 }, destination = { x = 32480, y = 32599, z = 15 } }, -} - -local libraryEntrances = MoveEvent() -function libraryEntrances.onStepIn(creature, item, position, fromPosition) - local player = creature:getPlayer() - if not player then - return false - end - if player:getLevel() < 250 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need at least level 250 to enter.") - player:teleportTo(fromPosition, true) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - return false - end - for value in pairs(config) do - if Position(config[value].position) == player:getPosition() then - player:teleportTo(Position(config[value].destination)) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - return true - end - end -end - -for value in pairs(config) do - libraryEntrances:position(config[value].position) -end -libraryEntrances:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_lotuskey.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_lotuskey.lua deleted file mode 100644 index 98f3f3c6f1b..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_lotuskey.lua +++ /dev/null @@ -1,14 +0,0 @@ -local lotusKey = Action() - -function lotusKey.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.TheSecretLibrary.TheLament) == 3 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a lotus key.") - player:addItem(28476, 1) - player:setStorageValue(Storage.TheSecretLibrary.TheLament, 4) - return true - end - return false -end - -lotusKey:uid(1093) -lotusKey:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_peacock.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_peacock.lua deleted file mode 100644 index 48bcfb14f81..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_peacock.lua +++ /dev/null @@ -1,14 +0,0 @@ -local peacock = Action() - -function peacock.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.TheSecretLibrary.Peacock) == -1 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found the Peacock Ballad.") - player:addItem(28710, 1) - player:setStorageValue(Storage.TheSecretLibrary.Peacock, 1) - return true - end - return false -end - -peacock:uid(1099) -peacock:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_pinktp.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_pinktp.lua deleted file mode 100644 index 204cf10933d..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_pinktp.lua +++ /dev/null @@ -1,14 +0,0 @@ -local blacktp = Action() - -function blacktp.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.TheSecretLibrary.PinkTel) == -1 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You discovered an old writing desk that contains an ancient map.") - player:addItem(24947, 1) - player:setStorageValue(Storage.TheSecretLibrary.PinkTel, 1) - return true - end - return false -end - -blacktp:uid(1100) -blacktp:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_sealedbook.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_sealedbook.lua deleted file mode 100644 index 8739fea2062..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_sealedbook.lua +++ /dev/null @@ -1,14 +0,0 @@ -local sealedBook = Action() - -function sealedBook.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.TheSecretLibrary.PinkTel) == 2 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a scribbled notes.") - player:addItem(28515, 1) - player:setStorageValue(Storage.TheSecretLibrary.HighDry, 1) - return true - end - return false -end - -sealedBook:uid(1101) -sealedBook:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_skullground.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_skullground.lua deleted file mode 100644 index 7ff399ca43d..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_skullground.lua +++ /dev/null @@ -1,15 +0,0 @@ -local skeleton = Action() - -function skeleton.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.TheSecretLibrary.TheLament) == 2 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found an old letter.") - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have discovered a skeleton. It seems to hold an old letter and its skull is missing.") - player:addItem(28518, 1) - player:setStorageValue(Storage.TheSecretLibrary.TheLament, 3) - return true - end - return false -end - -skeleton:uid(1092) -skeleton:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_statuedeeplings.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_statuedeeplings.lua deleted file mode 100644 index ad186f94e75..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_statuedeeplings.lua +++ /dev/null @@ -1,34 +0,0 @@ -local config = { - [1074] = { itemId = 15895, msg = "The Njey will appreciate your help.", storage = Storage.TheSecretLibrary.LiquidDeath, getValue = 2, setValue = 3 }, - [1075] = { itemId = 15895, msg = "The Njey will appreciate your help.", storage = Storage.TheSecretLibrary.LiquidDeath, getValue = 3, setValue = 4 }, - [1076] = { itemId = 15895, msg = "The Njey will appreciate your help.", storage = Storage.TheSecretLibrary.LiquidDeath, getValue = 4, setValue = 5 }, - [1077] = { itemId = 15895, msg = "The Njey will appreciate your help.", storage = Storage.TheSecretLibrary.LiquidDeath, getValue = 5, setValue = 6 }, - [1078] = { itemId = 15895, msg = "The Njey will appreciate your help.", storage = Storage.TheSecretLibrary.LiquidDeath, getValue = 6, setValue = 7 }, - [1079] = { itemId = 15895, msg = "The Njey will appreciate your help.", storage = Storage.TheSecretLibrary.LiquidDeath, getValue = 7, setValue = 8 }, - [1080] = { itemId = 15895, msg = "The Njey will appreciate your help.", storage = Storage.TheSecretLibrary.LiquidDeath, getValue = 8, setValue = 9 }, - [1081] = { itemId = 15895, msg = "The Njey will appreciate your help.", storage = Storage.TheSecretLibrary.LiquidDeath, getValue = 9, setValue = 10 }, - [1082] = { itemId = 15895, msg = "The Njey will appreciate your help.", storage = Storage.TheSecretLibrary.LiquidDeath, getValue = 10, setValue = 11 }, -} - -local statuedeeplings = Action() - -function statuedeeplings.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local key = config[item.uid] - if key then - if player:getStorageValue(key.storage) == key.getValue then - if table.contains({ key.itemId }, item.itemid) then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, key.msg) - player:setStorageValue(key.storage, key.setValue) - end - else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Empty.") - end - end - return true -end - -for index, value in pairs(config) do - statuedeeplings:uid(index) -end - -statuedeeplings:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_strandhair.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_strandhair.lua deleted file mode 100644 index 7dfda7e1ed7..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_strandhair.lua +++ /dev/null @@ -1,14 +0,0 @@ -local strandHair = Action() - -function strandHair.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.TheSecretLibrary.TheLament) == 1 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a strand of hair.") - player:addItem(28490, 1) - player:setStorageValue(Storage.TheSecretLibrary.TheLament, 2) - return true - end - return false -end - -strandHair:uid(1091) -strandHair:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_telescop.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_telescop.lua deleted file mode 100644 index f53d2c875f6..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/actions_telescop.lua +++ /dev/null @@ -1,13 +0,0 @@ -local telescop = Action() - -function telescop.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.TheSecretLibrary.HighDry) == 3 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "By using the telescope you observate the stellar constellations. This should help you to navigate your way back to mainland.") - player:setStorageValue(Storage.TheSecretLibrary.HighDry, 4) - return true - end - return false -end - -telescop:uid(1103) -telescop:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_bonefiddle.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_bonefiddle.lua new file mode 100644 index 00000000000..ff7a6f972cd --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_bonefiddle.lua @@ -0,0 +1,46 @@ +local actions_asura_bonefiddle = Action() + +function actions_asura_bonefiddle.onUse(player, item, fromPosition, target, toPosition, isHotkey) + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) < 2 then + if item.itemid == 28491 then + if target.itemid == 28490 then + item:remove(1) + target:remove(1) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You attach the ebony wood to the skull. This should meet the requirements of a fingerboard.') + player:addItem(28492) + end + elseif item.itemid == 28492 then + if target.itemid == 28490 then + item:remove(1) + target:remove(1) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You tack the hair to the ebony fingerboard. The strands should be adquate to serve as strings.') + player:addItem(28493) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, 2) + end + end + end + if item.itemid == 28493 then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) == 2 then + if player:getPosition():isInRange(Position(32807, 32762, 10), Position(32809, 32768, 10)) then + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, 3) + end + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, '*There was once a maiden fair, with dark eyes and silken hair. Far away from home she died. No grave, no wake, no mourning.*') + player:getPosition():sendMagicEffect(CONST_ME_SOUND_PURPLE) + elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) == 4 then + if player:getPosition():isInRange(Position(32807, 32762, 10), Position(32809, 32768, 10)) then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You are playing the Peacock Ballad and the portal opens.') + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, 5) + player:getPosition():sendMagicEffect(CONST_ME_SOUND_WHITE) + return true + end + elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) >= 5 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You are playing the bone fiddle.') + player:getPosition():sendMagicEffect(CONST_ME_SOUND_WHITE) + end + end + + return true +end + +actions_asura_bonefiddle:id(28491, 28492, 28493) +actions_asura_bonefiddle:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_chests.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_chests.lua new file mode 100644 index 00000000000..78a9966c717 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_chests.lua @@ -0,0 +1,38 @@ +local chests = { + [4910] = {storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.StrandHair, reward = 28490}, + [4911] = {storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.SkeletonNotes, reward = 28518, message = "You have discovered a skeleton. It seems to hold an old letter and its skull is missing."}, + [4912] = {storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.EyeKey, reward = 28477}, + [4913] = {storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.ScribbledNotes, reward = 28515}, + [4914] = {storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.LotusKey, reward = 28476}, + [4915] = {storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.PeacockBallad, reward = 28710}, + [4916] = {storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.BlackSkull, reward = 28489}, + [4917] = {storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.EbonyPiece, reward = 28491}, + [4918] = {storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.SilverChimes, reward = 28494, message = "You see silver chimes dangling on the dragon statue in this room."} +} + +local actions_asura_chests = Action() + +function actions_asura_chests.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local chest = chests[item.uid] + if not chests[item.uid] then + return true + end + if player:getStorageValue(chest.storage) ~= 1 then + player:addItem(chest.reward, 1) + player:setStorageValue(chest.storage, 1) + if not chest.message then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. ItemType(chest.reward):getName():lower() .. '.') + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, chest.message) + end + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It is empty.') + end + return true +end + +for uid in pairs(chests) do + actions_asura_chests:uid(uid) +end + +actions_asura_chests:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_doors.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_doors.lua new file mode 100644 index 00000000000..0fc79b187e7 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_doors.lua @@ -0,0 +1,31 @@ +local doors = { + [1] = { doorPosition = Position(32962, 32674, 2), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.FlammingOrchid, nivel = 1, level = 250 }, + [2] = { doorPosition = Position(32959, 32679, 2), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, nivel = 1 }, +} + +local actions_asura_doors = Action() + +function actions_asura_doors.onUse(player, item, fromPosition, target, toPosition, isHotkey) + for _, p in pairs(doors) do + if (item:getPosition() == p.doorPosition) and not(Tile(item:getPosition()):getTopCreature()) then + if player:getStorageValue(p.storage) >= p.nivel then + if p.level and player:getLevel() >= p.level then + player:teleportTo(toPosition, true) + item:transform(item.itemid + 1) + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You do not have enough level.') + end + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'The door seems to be sealed against unwanted intruders.') + end + end + end + + return true +end + +actions_asura_doors:aid(4911) +actions_asura_doors:register() + + + diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_fragrance.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_fragrance.lua new file mode 100644 index 00000000000..de93b900210 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_fragrance.lua @@ -0,0 +1,12 @@ +local actions_asura_fragrance = Action() + +function actions_asura_fragrance.onUse(player, item, fromPosition, target, toPosition, isHotkey) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Hmmmm, what an infatuating fragrance!') + player:setStorageValue('fragrance', os.time() + 10*60) + item:remove(1) + + return true +end + +actions_asura_fragrance:id(28495) +actions_asura_fragrance:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_keys.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_keys.lua new file mode 100644 index 00000000000..940eb6e78d3 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_keys.lua @@ -0,0 +1,35 @@ +local doors = { + [1] = {key = 28476, position = Position(32813, 32813, 9)}, + [2] = {key = 28477, position = Position(32864, 32810, 9)} +} + +local locked = 23874 +local opened = 23877 + +local function revert(position) + local lockedDoor = Tile(position):getItemById(opened) + if lockedDoor then + lockedDoor:transform(locked) + end +end + +local actions_asura_keys = Action() + +function actions_asura_keys.onUse(player, item, fromPosition, target, toPosition, isHotkey) + for _, k in pairs(doors) do + if item.itemid == k.key then + if toPosition == k.position and target.itemid == locked then + target:transform(opened) + addEvent(revert, 10*1000, target:getPosition()) + end + end + end + + return true +end + +for _, door in pairs(doors) do + actions_asura_keys:id(door.key) +end + +actions_asura_keys:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_mirror.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_mirror.lua new file mode 100644 index 00000000000..9253e4e653c --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_mirror.lua @@ -0,0 +1,19 @@ +local goPos = Position(32814, 32754, 9) + +local actions_asura_mirror = Action() + +function actions_asura_mirror.onUse(player, item, fromPosition, itemEx, toPosition) + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.FlammingOrchid) >= 1 and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) >= 1 then + if player:getLevel() >= 250 then + player:teleportTo(goPos) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + else + player:sendCancelMessage('You do not have enough level.') + end + else + player:sendCancelMessage('You do not have permission.') + end +end + +actions_asura_mirror:aid(4910) +actions_asura_mirror:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/creaturescripts_asuras_mechanic.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/creaturescripts_asuras_mechanic.lua new file mode 100644 index 00000000000..fd972c80db8 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/creaturescripts_asuras_mechanic.lua @@ -0,0 +1,39 @@ +local redItems = { + 3566, 3379, 3388, 8039, 8053, 8064, 22534, 3381, 7991, 3380, 10439, 3564 +} + +local creaturescripts_asuras_mechanic = CreatureEvent("AsurasMechanic") + +function creaturescripts_asuras_mechanic.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) + if not attacker or not creature then + return primaryDamage, primaryType, secondaryDamage, secondaryType + end + + if attacker:isPlayer() then + if creature:getName():lower() == 'the diamond blossom' then + local slot = attacker:getSlotItem(CONST_SLOT_ARMOR) + if slot then + for i = 1, #redItems do + if slot.itemid == redItems[i] then + return primaryDamage, primaryType, secondaryDamage, secondaryType + end + end + end + elseif creature:getName():lower() == 'the blazing rose' then + local slot = attacker:getSlotItem(CONST_SLOT_RIGHT) + if slot and slot.itemid == 28494 then + return primaryDamage, primaryType, secondaryDamage, secondaryType + end + elseif creature:getName():lower() == 'the lily of night' then + if attacker:getStorageValue('fragrance') > os.time() then + return primaryDamage, primaryType, secondaryDamage, secondaryType + end + end + end + + primaryDamage = 0 + secondaryDamage = 0 + return primaryDamage, primaryType, secondaryDamage, secondaryType +end + +creaturescripts_asuras_mechanic:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/movements_elemental_portals.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/movements_elemental_portals.lua new file mode 100644 index 00000000000..f674db96f5d --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/movements_elemental_portals.lua @@ -0,0 +1,120 @@ +--[[ +4914 = leaving +4915 = entering +--]] + +local entrances = { + [1] = {position = Position(32858, 32795, 11), storage = false, toPosition = Position(32889, 32772, 9)}, + [2] = {position = Position(32857, 32766, 10), fromPos = Position(32856, 32740, 11), toPos = Position(32868, 32752, 11), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.DiamondTimer, exit = Position(32857, 32768, 10), toPosition = Position(32881, 32789, 11), bossName = 'The Diamond Blossom', bossPos = Position(32881, 32792, 11)}, + [3] = {position = Position(32817, 32777, 11), fromPos = Position(32875, 32786, 11), toPos = Position(32887, 32798, 11), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.DarkTimer, exit = Position(32817, 32779, 11), toPosition = Position(32862, 32743, 11), bossName = 'The Lily of Night', bossPos = Position(32862, 32746, 11)}, + [4] = {position = Position(32854, 32737, 10), fromPos = Position(32856, 32768, 11), toPos = Position(32868, 32780, 11), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.BlazingTimer, exit = Position(32854, 32739, 10), toPosition = Position(32862, 32771, 11), bossName = 'The Blazing Rose', bossPos = Position(32862, 32774, 11)}, + +} + +local exites = { + [1] = {position = Position(32862, 32741, 11), toPosition = Position(32817, 32779, 11)}, + [2] = {position = Position(32862, 32769, 11), toPosition = Position(32854, 32739, 10)}, + [3] = {position = Position(32881, 32787, 11), toPosition = Position(32857, 32768, 10)}, + [4] = {position = Position(32887, 32772, 9), toPosition = Position(32858, 32797, 11)}, + [5] = {position = Position(32880, 32828, 11), toPosition = Position(32810, 32765, 10)}, +} + +local defaultMessage = 'You have ten minutes to kill and loot this monster, else you will lose that chance and will be kicked out.' + +local function resetRoom(position) + local spec = Game.getSpectators(position, false, false, 5, 5, 5, 5) + for _, c in pairs(spec) do + if c and c:isPlayer() then + return false + end + end + for _, c in pairs(spec) do + if c then + c:remove() + end + end + return true +end + +local function startBattle(pid, position, b_name, middle) + local player = Player(pid) + if player then + player:teleportTo(position) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:say(defaultMessage, TALKTYPE_MONSTER_SAY) + local monster = Game.createMonster(b_name, middle) + end +end + +local purplePosition = Position(32808, 32765, 10) +local quest = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline +local toPosition_l = Position(32880, 32826, 11) +local hiddenMap = Position(32881, 32819, 11) + +local movements_asura_elemental_portals = MoveEvent() + +function movements_asura_elemental_portals.onStepIn(creature, item, position, fromPosition) + if not creature:isPlayer() then + return false + end + local player = Player(creature:getId()) + if item.actionid == 4915 then + if position == purplePosition then + if player:getStorageValue(quest) >= 5 then + player:teleportTo(toPosition_l) + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You can not use this portal yet.') + player:teleportTo(fromPosition, true) + end + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + -- for bosses!! + for _, k in pairs(entrances) do + if position == k.position then + if k.storage then + if resetRoom(k.bossPos) then + if player:getStorageValue(k.storage) < os.time() then + player:setStorageValue(k.storage, os.time() + 20*60*60) + startBattle(player:getId(), k.toPosition, k.bossName, k.bossPos) + addEvent(function(cid) + local p = Player(cid) + if p then + if p:getPosition():isInRange(k.fromPos, k.toPos) then + p:teleportTo(k.exit) + end + end + end, 10*1000*60, player:getId()) + else + player:sendCancelMessage('You are still exhausted from your last battle.') + player:teleportTo(fromPosition, true) + end + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You must wait. Someone is challenging '..k.bossName..' now.') + player:teleportTo(fromPosition, true) + end + else + player:teleportTo(k.toPosition) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + end + end + elseif item.actionid == 4914 then + if position == hiddenMap then + if player:getStorageValue(quest) == 5 then + player:addItem(28908, 1) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have discovered an old writing desk that contains an ancient map.') + player:setStorageValue(quest, 6) + end + end + for _, k in pairs(exites) do + if position == k.position then + player:teleportTo(k.toPosition) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + end + end + return true +end + +movements_asura_elemental_portals:aid(4914, 4915) +movements_asura_elemental_portals:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_falcon_minibosses.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_falcon_minibosses.lua deleted file mode 100644 index 5ed0af0af8a..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_falcon_minibosses.lua +++ /dev/null @@ -1,56 +0,0 @@ -local grandCommanderSoerenDeath = CreatureEvent("GrandCommanderSoerenDeath") -function grandCommanderSoerenDeath.onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified) - if killer:isPlayer() and killer:getStorageValue(Storage.TheSecretLibrary.MiniBosses.GrandCommanderSoeren) < 1 then - killer:setStorageValue(Storage.TheSecretLibrary.MiniBosses.GrandCommanderSoeren, 1) - if killer:getStorageValue(Storage.TheSecretLibrary.MiniBosses.PreceptorLazare) == 1 then - killer:setStorageValue(Storage.TheSecretLibrary.LowerBastionAccess, 1) -- Access to quest door - end - end -end - -grandCommanderSoerenDeath:register() - -local preceptorLazareDeath = CreatureEvent("PreceptorLazareDeath") -function preceptorLazareDeath.onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified) - if killer:isPlayer() and killer:getStorageValue(Storage.TheSecretLibrary.MiniBosses.PreceptorLazare) < 1 then - killer:setStorageValue(Storage.TheSecretLibrary.MiniBosses.PreceptorLazare, 1) - if killer:getStorageValue(Storage.TheSecretLibrary.MiniBosses.GrandCommanderSoeren) == 1 then - killer:setStorageValue(Storage.TheSecretLibrary.LowerBastionAccess, 1) -- Access to quest door - end - end -end - -preceptorLazareDeath:register() - -local grandChaplainGaunderDeath = CreatureEvent("GrandChaplainGaunderDeath") -function grandChaplainGaunderDeath.onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified) - if killer:isPlayer() and killer:getStorageValue(Storage.TheSecretLibrary.MiniBosses.GrandChaplainGaunder) < 1 then - killer:setStorageValue(Storage.TheSecretLibrary.MiniBosses.GrandChaplainGaunder, 1) - if killer:getStorageValue(Storage.TheSecretLibrary.MiniBosses.GrandCanonDominus) == 1 then - killer:setStorageValue(Storage.TheSecretLibrary.UndergroundBastionAccess, 1) -- Access to quest door - end - end -end - -grandChaplainGaunderDeath:register() - -local grandCanonDominusDeath = CreatureEvent("GrandCanonDominusDeath") -function grandCanonDominusDeath.onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified) - if killer:isPlayer() and killer:getStorageValue(Storage.TheSecretLibrary.MiniBosses.GrandCanonDominus) < 1 then - killer:setStorageValue(Storage.TheSecretLibrary.MiniBosses.GrandCanonDominus, 1) - if killer:getStorageValue(Storage.TheSecretLibrary.MiniBosses.GrandChaplainGaunder) == 1 then - killer:setStorageValue(Storage.TheSecretLibrary.UndergroundBastionAccess, 1) -- Access to quest door - end - end -end - -grandCanonDominusDeath:register() - -local dazedLeafGolemDeath = CreatureEvent("DazedLeafGolemDeath") -function dazedLeafGolemDeath.onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified) - if killer:isPlayer() and killer:getStorageValue(Storage.TheSecretLibrary.OberonAccess) < 1 then - killer:setStorageValue(Storage.TheSecretLibrary.OberonAccess, 1) -- Access to teleport - end -end - -dazedLeafGolemDeath:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua new file mode 100644 index 00000000000..b3e24a6930e --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua @@ -0,0 +1,62 @@ +local defaultTime = 20 + +local creaturescripts_library_bosses = CreatureEvent("killingLibrary") + +function creaturescripts_library_bosses.onKill(player, creature) + if not player:isPlayer() then + return true + end + + if not creature:isMonster() or creature:getMaster() then + return true + end + + local monsterStorages = { + ["grand commander soeren"] = {stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 1}, + ["preceptor lazare"] = {stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 2}, + ["grand chaplain gaunder"] = {stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 3}, + ["grand canon dominus"] = {stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 4}, + ["dazzled leaf golem"] = {stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 5}, + ["grand master oberon"] = {stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 6, achievements = {'Millennial Falcon', 'Master Debater'}, lastBoss = true}, + ["brokul"] = {stg = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 7}, + ["the flaming orchid"] = {stg = Storage.Quest.U11_80.TheSecretLibrary.Asuras.flammingOrchid, value = 1}, + } + + local monsterName = creature:getName():lower() + local monsterStorage = monsterStorages[monsterName] + + if monsterStorage then + for playerid, damage in pairs(creature:getDamageMap()) do + local p = Player(playerid) + if p then + if p:getStorageValue(monsterStorage.stg) < monsterStorage.value then + p:setStorageValue(monsterStorage.stg, monsterStorage.value) + end + if monsterStorage.achievements then + for i = 1, #monsterStorage.achievements do + p:addAchievement(monsterStorage.achievements[i]) + end + end + if monsterStorage.lastBoss then + if p:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline) < 2 then + p:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, 2) + end + end + end + end + end + return true +end + +creaturescripts_library_bosses:register() + + +local creaturescripts_library_bosses_oberon = CreatureEvent("oberonImmune") + +function creaturescripts_library_bosses_oberon.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) + primaryDamage = 0 + secondaryDamage = 0 + return primaryDamage, primaryType, secondaryDamage, secondaryType +end + +creaturescripts_library_bosses_oberon:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_login.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_login.lua new file mode 100644 index 00000000000..f9e9ee258f4 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_login.lua @@ -0,0 +1,8 @@ +local creaturescripts_library_login = CreatureEvent("loginLibrary") + +function creaturescripts_library_login.onLogin(player) + player:registerEvent("killingLibrary") + return true +end + +creaturescripts_library_login:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_chests.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_chests.lua new file mode 100644 index 00000000000..833b56ef6a6 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_chests.lua @@ -0,0 +1,31 @@ +local chests = { + [1] = {position = Position(32970, 32314, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.FirstChest, reward = 28538, questlog = true}, + [2] = {position = Position(32980, 32308, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.SecondChest, reward = 28536, questlog = true}, + [3] = {position = Position(32955, 32282, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.ThirdChest, reward = 28537, questlog = false}, + [4] = {position = Position(32983, 32289, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.FourthChest, reward = 28535, questlog = false}, + [5] = {position = Position(32944, 32309, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.FifthChest, reward = 28818, questlog = true} +} + +local actions_desert_chests = Action() + +function actions_desert_chests.onUse(player, item, fromPosition, target, toPosition, isHotkey) + for _, k in pairs(chests) do + if toPosition == k.position then + if player:getStorageValue(k.storage) ~= 1 then + if k.questlog then + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline)+1) + end + player:addItem(k.reward, 1) + player:setStorageValue(k.storage, 1) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. ItemType(k.reward):getName():lower() .. '.') + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It is empty.') + end + end + end + + return true +end + +actions_desert_chests:aid(4931) +actions_desert_chests:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_doors.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_doors.lua new file mode 100644 index 00000000000..293f04976bc --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_doors.lua @@ -0,0 +1,32 @@ +local doors = { + [1] = {doorPosition = Position(32963, 32319, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, nivel = 40}, + [2] = {doorPosition = Position(32955, 32304, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, nivel = 40}, + [3] = {doorPosition = Position(32984, 32314, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.SecondChest, nivel = 1}, + [4] = {doorPosition = Position(32968, 32324, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.SecondChest, nivel = 1}, + [5] = {doorPosition = Position(32978, 32290, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.EatenFood, nivel = 1}, + [6] = {doorPosition = Position(32963, 32297, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, nivel = 7}, + [7] = {doorPosition = Position(32963, 32299, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, nivel = 7}, + [8] = {doorPosition = Position(32963, 32301, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, nivel = 7}, + [9] = {doorPosition = Position(32963, 32303, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, nivel = 7}, + +} + +local actions_desert_doors = Action() + +function actions_desert_doors.onUse(player, item, fromPosition, target, toPosition, isHotkey) + for _, p in pairs(doors) do + if (item:getPosition() == p.doorPosition) and not(Tile(item:getPosition()):getTopCreature()) + and isInArray({8361, 8355, 20450}, item.itemid)then + if player:getStorageValue(p.storage) >= p.nivel then + player:teleportTo(toPosition, true) + item:transform(item.itemid + 1) + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'The door seems to be sealed against unwanted intruders.') + end + end + end + return true +end + +actions_desert_doors:aid(4930) +actions_desert_doors:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_totems.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_totems.lua new file mode 100644 index 00000000000..8839429eb81 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_totems.lua @@ -0,0 +1,54 @@ +local totems = { + {toPosition = Position(32945, 32292, 8), targetId = 28531, toId = 28532, itemId = 28535, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.FirstTotem}, + {toPosition = Position(32947, 32292, 8), targetId = 28527, toId = 28528, itemId = 28537, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.SecondTotem}, + {toPosition = Position(32949, 32292, 8), targetId = 28533, toId = 28534, itemId = 28538, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.ThirdTotem}, + {toPosition = Position(32951, 32292, 8), targetId = 28529, toId = 28530, itemId = 28536, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.FourthTotem}, +} + +local function isQuestComplete(cid) + local player = Player(cid) + if player then + for _, s in pairs(totems) do + if player:getStorageValue(s.storage) ~= 1 then + return false + end + end + end + return true +end + +local function revert(old, new, position) + local totem = Tile(position):getItemById(new) + if totem then + totem:transform(old) + end +end + +local actions_desert_totems = Action() + +function actions_desert_totems.onUse(player, item, fromPosition, target, toPosition, isHotkey) + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline) == 6 then + for _, k in pairs(totems) do + if toPosition == k.toPosition and item.itemid == k.itemId and target.itemid == k.targetId then + if player:getStorageValue(k.storage) < 1 then + toPosition:sendMagicEffect(CONST_ME_HITAREA) + target:transform(k.toId) + item:remove(1) + player:setStorageValue(k.storage, 1) + addEvent(revert, 15*1000, k.targetId, k.toId, toPosition) + end + end + if isQuestComplete(player:getId()) then + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, 7) + player:say('Access granted!', TALKTYPE_MONSTER_SAY) + end + end + end + return true +end + +for _, totem in pairs(totems) do + actions_desert_totems:id(totem.itemId) +end + +actions_desert_totems:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_color_puzzle.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_color_puzzle.lua new file mode 100644 index 00000000000..baa19a49548 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_color_puzzle.lua @@ -0,0 +1,42 @@ +local color = { + [1] = {itemid = 4858, position = Position(32945, 32288, 10), value = 2, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.RedColor}, + [2] = {itemid = 5581, position = Position(32948, 32288, 10), value = 1, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.GreenColor}, + [3] = {itemid = 8695, position = Position(32951, 32288, 10), value = 3, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.BlueColor}, +} + +local movements_desert_color_puzzle = MoveEvent() + +function movements_desert_color_puzzle.onStepIn(creature, item, position, fromPosition) + if not creature:isPlayer() then + return false + end + local player = Player(creature:getId()) + if player then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.ColorPuzzle) < 1 then + for _, k in pairs(color) do + if item.itemid == k.itemid and position == k.position then + if player:getStorageValue(k.storage) < k.value then + if player:getStorageValue(k.storage) < 0 then + player:setStorageValue(k.storage, 0) + end + player:setStorageValue(k.storage, player:getStorageValue(k.storage) + 1) + else + for i = 1, #color do + player:setStorageValue(color[i].storage, 0) + end + end + end + end + if player:getStorageValue(color[1].storage) == color[1].value and player:getStorageValue(color[2].storage) == color[2].value + and player:getStorageValue(color[3].storage) == color[3].value then + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.ColorPuzzle, 1) + player:say('Access granted!', TALKTYPE_MONSTER_SAY) + end + end + end + + return true +end + +movements_desert_color_puzzle:aid(4933) +movements_desert_color_puzzle:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_teleportTo.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_teleportTo.lua new file mode 100644 index 00000000000..65298337de1 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_teleportTo.lua @@ -0,0 +1,171 @@ +local lastTeleport = Position(32963, 32312, 8) +local scorpionTimer = Storage.Quest.U11_80.TheSecretLibrary.Darashia.ScorpionTimer +local scorpionPosition = Position(32951, 32309, 8) +local fromPos = Position(32943, 32303, 8) +local toPos = Position(32960, 32315, 8) +local exit = Position(32963, 32307, 8) +local bossName = "furious scorpion" + +local teleports = { + [1] = {position = Position(33110, 32385, 7), destination = Position(32958, 32320, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 1}, + [2] = {position = Position(32958, 32322, 8), destination = Position(33110, 32387, 7)}, + [3] = {position = Position(32955, 32288, 10), destination = Position(32955, 32284, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.ColorPuzzle, value = 1, challenge = true}, + [4] = {position = Position(32942, 32283, 10), destination = Position(32942, 32288, 10)}, + [5] = {position = Position(32945, 32313, 8), destination = Position(33101, 32381, 7)} +} + +local tileAccess = { + [1] = {position = Position(32974, 32296, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 2}, + [2] = {position = Position(32967, 32319, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 3}, + [3] = {position = Position(32978, 32290, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 6} +} + +local puzzle = { + {position = Position(32965, 32310, 9), value = 1}, + {position = Position(32965, 32309, 9), value = 2}, + {position = Position(32964, 32309, 9), value = 3}, + {position = Position(32963, 32309, 9), value = 4}, + {position = Position(32962, 32309, 9), value = 5}, + {position = Position(32961, 32309, 9), value = 6}, + {position = Position(32960, 32309, 9), value = 7}, + {position = Position(32959, 32309, 9), value = 8}, + {position = Position(32959, 32310, 9), value = 9}, + {position = Position(32959, 32311, 9), value = 10}, + {position = Position(32958, 32311, 9), value = 11}, + {position = Position(32957, 32311, 9), value = 12}, + {position = Position(32956, 32311, 9), value = 13}, + {position = Position(32956, 32310, 9), value = 14}, + {position = Position(32955, 32310, 9), value = 15}, + {position = Position(32954, 32310, 9), value = 16}, + {position = Position(32953, 32310, 9), value = 17}, + {position = Position(32953, 32311, 9), value = 18}, + {position = Position(32953, 32312, 9), value = 19}, + {position = Position(32953, 32313, 9), value = 20}, + {position = Position(32953, 32314, 9), value = 21}, + {position = Position(32954, 32314, 9), value = 22}, + {position = Position(32955, 32314, 9), value = 23}, + {position = Position(32956, 32314, 9), value = 24}, + {position = Position(32956, 32315, 9), value = 25}, + {position = Position(32956, 32316, 9), value = 26}, + {position = Position(32956, 32317, 9), value = 27}, + {position = Position(32957, 32317, 9), value = 28}, + {position = Position(32957, 32318, 9), value = 29}, + {position = Position(32957, 32319, 9), value = 30}, + {position = Position(32958, 32319, 9), value = 31}, + {position = Position(32959, 32319, 9), value = 32}, + {position = Position(32960, 32319, 9), value = 33}, + {position = Position(32960, 32318, 9), value = 34}, + {position = Position(32960, 32317, 9), value = 35}, + {position = Position(32961, 32317, 9), value = 36}, + {position = Position(32962, 32317, 9), value = 37}, + {position = Position(32962, 32318, 9), value = 38}, + {position = Position(32962, 32319, 9), value = 39} +} + +local function startBattle(pid, position, b_name, middle) + local player = Player(pid) + if player then + player:teleportTo(position) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:say("You have to master this very last challenge within 5 minutes!", TALKTYPE_MONSTER_SAY) + local monster = Game.createMonster(b_name, middle) + end +end + +local function resetRoom(position, name) + local spec = Game.getSpectators(position, false, false, 5, 5, 5, 5) + for _, c in pairs(spec) do + if c and c:isPlayer() then + return false + end + end + for _, c in pairs(spec) do + if c and c:getName():lower() == name then + c:remove() + end + end + return true +end + +local movements_desert_teleportTo = MoveEvent() + +function movements_desert_teleportTo.onStepIn(creature, item, position, fromPosition) + if not creature:isPlayer() then + return false + end + local player = Player(creature:getId()) + if player then + if item.actionid == 4930 then + if position == lastTeleport then + if resetRoom(scorpionPosition, bossName) then + if player:getStorageValue(scorpionTimer) < os.time() then + player:setStorageValue(scorpionTimer, os.time() + 20*60*60) + startBattle(player:getId(), Position(32958, 32309, 8), bossName, scorpionPosition) + addEvent(function(cid) + local p = Player(cid) + if p then + if p:getPosition():isInRange(fromPos, toPos) then + p:teleportTo(exit) + end + end + end, 5*1000*60, player:getId()) + else + player:sendCancelMessage('You are still exhausted from your last battle.') + player:teleportTo(fromPosition, true) + end + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You must wait. Someone is challenging Furious Scorpion now.') + player:teleportTo(fromPosition, true) + end + else + for _, k in pairs(teleports) do + if position == k.position then + if k.storage then + if player:getStorageValue(k.storage) >= k.value then + player:teleportTo(k.destination) + else + if k.challenge then + player:say('You have to master the challenge first!', TALKTYPE_MONSTER_SAY) + end + player:teleportTo(fromPosition, true) + end + else + player:teleportTo(k.destination) + end + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + end + end + elseif item.actionid == 4931 then + for _, k in pairs(puzzle) do + if position == k.position then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm) < #puzzle then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm) == k.value then + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm)+1) + player:getPosition():sendMagicEffect(CONST_ME_SOUND_WHITE) + else + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, 1) + player:getPosition():sendMagicEffect(CONST_ME_SOUND_RED) + end + elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm) == #puzzle then + player:say('Access granted!', TALKTYPE_MONSTER_SAY) + player:getPosition():sendMagicEffect(CONST_ME_SOUND_WHITE) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm)+1) + end + end + end + elseif item.actionid == 4932 then + for _, k in pairs(tileAccess) do + if position == k.position then + if player:getStorageValue(k.storage) < k.value then + player:setStorageValue(k.storage, player:getStorageValue(k.storage) + 1) + end + end + end + end + end + return true +end + +movements_desert_teleportTo:aid(4930, 4931, 4932) +movements_desert_teleportTo:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_doors.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_doors.lua new file mode 100644 index 00000000000..f12ff1951c6 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_doors.lua @@ -0,0 +1,55 @@ +local doors = { + [1] = {doorPosition = Position(33376, 31323, 2), nivel = -1}, + [2] = {doorPosition = Position(33376, 31335, 3), nivel = 1}, + [3] = {doorPosition = Position(33376, 31349, 4), nivel = 2}, + [4] = {doorPosition = Position(33363, 31346, 7), nivel = 4}, -- última porta!! +} + +local boats = { + [1] = {boatPosition = Position(33373, 31309, 7), nivel = 3, toPosition = Position(33382, 31292, 7), message = "A small island emerges out of the mist as you row towards a tiny light inside a dark, forehoding chapel."}, + [2] = {boatPosition = Position(33381, 31294, 7), nivel = 3, toPosition = Position(33374, 31309, 7), message = "Your heart lightens as you return from the gloomy isle."}, + [3] = {boatPosition = Position(33344, 31348, 7), nivel = 3, toPosition = Position(33326, 31352, 7)}, + [4] = {boatPosition = Position(33328, 31352, 7), nivel = 3, toPosition = Position(33346, 31348, 7)}, +} + +local actions_falcon_doors = Action() + +function actions_falcon_doors.onUse(player, item, fromPosition, target, toPosition, isHotkey) + if item:getActionId() == 4920 then -- Portas!! + for _, p in pairs(doors) do + local door = p.doorPosition + local nivel = p.nivel + if (item:getPosition() == door) and not(Tile(item:getPosition()):getTopCreature()) then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses) >= nivel then + player:teleportTo(toPosition, true) + item:transform(item.itemid + 1) + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.") + end + end + end + elseif item:getActionId() == 4921 then -- Barcos!! + for _, p in pairs(boats) do + local boat = p.boatPosition + local nivel = p.nivel + local toPos = p.toPosition + local message = p.message + if item:getPosition() == boat then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses) >= nivel then + player:teleportTo(toPos, true) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + if message then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) + end + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can not use this boat yet.") + end + end + end + end + + return true +end + +actions_falcon_doors:aid(4920, 4921) +actions_falcon_doors:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_oberonLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_oberonLever.lua new file mode 100644 index 00000000000..a36459656e4 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_oberonLever.lua @@ -0,0 +1,39 @@ +local actions_falcon_oberon_lever = Action() + +function actions_falcon_oberon_lever.onUse(player, item, fromPosition, itemEx, toPosition) + local bossName = "Grand Master Oberon" + local playersTable = {} + local fromPosition_ = Position(33356, 31311, 9) + local toPosition_ = Position(33376, 31328, 9) + local exitPosition = Position(33297, 31286, 9) + + if item:getId() == 2772 then + if doCheckBossRoom(player:getId(), bossName, fromPosition_, toPosition_) then + for i = 33358, 33362, 1 do + local newpos = Position(i, 31342, 9) + local nplayer = Tile(newpos):getTopCreature() + if nplayer and nplayer:isPlayer() then + nplayer:teleportTo(Position(33365, 31323, 9), true) + nplayer:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + table.insert(playersTable, nplayer:getId()) + nplayer:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonTimer, os.time() + 20*60*60) + end + end + local oberon = Game.createMonster("Grand Master Oberon", Position(33365, 31318, 9)) + if oberon then + oberon:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonHeal, 0) + end + Game.setStorageValue(GlobalStorage.secretLibrary.FalconBastion.OberonSay, - 1) + Game.createNpc("Oberon's Spite", Position(33363, 31321, 9)) + Game.createNpc("Oberon's Ire", Position(33368, 31321, 9)) + Game.createNpc("Oberon's Bile", Position(33363, 31317, 9)) + Game.createNpc("Oberon's Hate", Position(33368, 31317, 9)) + addEvent(kickPlayersAfterTime, 30*60*1000, playersTable, fromPosition_, toPosition_, exitPosition) + end + end + + return true +end + +actions_falcon_oberon_lever:aid(4922) +actions_falcon_oberon_lever:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/movements_bossEntrance.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/movements_bossEntrance.lua new file mode 100644 index 00000000000..ec22d6f87e9 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/movements_bossEntrance.lua @@ -0,0 +1,53 @@ +local config = { + entrance = Position(33310, 31325, 8), + exit = Position(33330, 31334, 9), +} + +local movements_falcon_bossEntrance = MoveEvent() + +function movements_falcon_bossEntrance.onStepIn(creature, item, position, fromPosition) + if not creature:isPlayer() then + return false + end + + local entrance = config.entrance + local exit = config.exit + + if item:getActionId() == 4920 then + if creature then + if item:getPosition() == entrance then + if creature:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses) >= 5 then + creature:teleportTo(Position(exit.x, exit.y - 2, exit.z), true) + else + creature:teleportTo(Position(entrance.x - 2, entrance.y, entrance.z), true) + end + elseif item:getPosition() == exit then + creature:teleportTo(Position(entrance.x - 2, entrance.y, entrance.z), true) + end + end + elseif item:getActionId() == 4921 then + local blockedPositions = { + Position(33328, 31352, 7), + Position(33373, 31309, 7), + Position(33381, 31294, 7), + Position(33344, 31348, 7) + } + if creature then + if isInArray(blockedPositions, position) then + return true + else + if creature:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonTimer) <= os.time() then + creature:teleportTo(Position(33359, 31340, 9), true) + else + creature:teleportTo(fromPosition, true) + creature:sendCancelMessage('You are still exhausted from your last battle.') + end + end + end + end + + return true +end + +movements_falcon_bossEntrance:aid(4920, 4921) +movements_falcon_bossEntrance:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_grand_canon_dominus.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_grand_canon_dominus.lua deleted file mode 100644 index c2527792c0e..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_grand_canon_dominus.lua +++ /dev/null @@ -1,16 +0,0 @@ -local config = { - monsterName = "Grand Canon Dominus", - bossPosition = Position(33384, 31282, 6), - centerPosition = Position(33384, 31282, 6), - rangeX = 50, - rangeY = 50, -} - -local canonDominus = GlobalEvent("canon dominus") -function canonDominus.onThink(interval, lastExecution) - checkBoss(config.centerPosition, config.rangeX, config.rangeY, config.monsterName, config.bossPosition) - return true -end - -canonDominus:interval(15 * 60 * 1000) -canonDominus:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_grand_chaplain_gaunder.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_grand_chaplain_gaunder.lua deleted file mode 100644 index 402005b0aa8..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_grand_chaplain_gaunder.lua +++ /dev/null @@ -1,16 +0,0 @@ -local config = { - monsterName = "Grand Chaplain Gaunder", - bossPosition = Position(33370, 31327, 5), - centerPosition = Position(33370, 31327, 5), - rangeX = 50, - rangeY = 50, -} - -local chaplaingaunder = GlobalEvent("chaplaingaunder") -function chaplaingaunder.onThink(interval, lastExecution) - checkBoss(config.centerPosition, config.rangeX, config.rangeY, config.monsterName, config.bossPosition) - return true -end - -chaplaingaunder:interval(15 * 60 * 1000) -chaplaingaunder:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_grand_commander_soeren.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_grand_commander_soeren.lua deleted file mode 100644 index 64f4ab330e5..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_grand_commander_soeren.lua +++ /dev/null @@ -1,16 +0,0 @@ -local config = { - monsterName = "Grand Commander Soeren", - bossPosition = Position(33376, 31320, 2), - centerPosition = Position(33376, 31320, 2), - rangeX = 50, - rangeY = 50, -} - -local grandCommander = GlobalEvent("grand commander") -function grandCommander.onThink(interval, lastExecution) - checkBoss(config.centerPosition, config.rangeX, config.rangeY, config.monsterName, config.bossPosition) - return true -end - -grandCommander:interval(15 * 60 * 1000) -- 15 minutes -grandCommander:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_preceptor_lazare.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_preceptor_lazare.lua deleted file mode 100644 index ea05353ad09..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_preceptor_lazare.lua +++ /dev/null @@ -1,14 +0,0 @@ -local config = { - monsterName = "Preceptor Lazare", - bossPosition = Position(33374, 31338, 3), - range = 50, -} - -local preceptorLazare = GlobalEvent("PreceptorLazareRespawn") -function preceptorLazare.onThink(interval, lastExecution) - checkBoss(config.bossPosition, config.range, config.range, config.monsterName, config.bossPosition) - return true -end - -preceptorLazare:interval(15 * 60 * 1000) -- 15 minutes -preceptorLazare:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_spawn_damage.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_spawn_damage.lua deleted file mode 100644 index e33a630b556..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/globalevents_secret_library_spawn_damage.lua +++ /dev/null @@ -1,84 +0,0 @@ -local effects = { - { fromPosition = Position(32526, 32536, 12), toPosition = Position(32526, 32539, 12), effect = CONST_ME_HOLYDAMAGE }, - { fromPosition = Position(32533, 32536, 12), toPosition = Position(32533, 32539, 12), effect = CONST_ME_HOLYDAMAGE }, - { fromPosition = Position(32540, 32536, 12), toPosition = Position(32540, 32539, 12), effect = CONST_ME_HOLYDAMAGE }, - { fromPosition = Position(32544, 32542, 12), toPosition = Position(32546, 32542, 12), effect = CONST_ME_HOLYDAMAGE }, - { fromPosition = Position(32540, 32545, 12), toPosition = Position(32540, 32547, 12), effect = CONST_ME_HOLYDAMAGE }, - { fromPosition = Position(32533, 32545, 12), toPosition = Position(32533, 32547, 12), effect = CONST_ME_HOLYDAMAGE }, - { fromPosition = Position(32526, 32545, 12), toPosition = Position(32526, 32547, 12), effect = CONST_ME_HOLYDAMAGE }, - { fromPosition = Position(32522, 32549, 12), toPosition = Position(32524, 32549, 12), effect = CONST_ME_HOLYDAMAGE }, - { fromPosition = Position(32522, 32554, 12), toPosition = Position(32524, 32554, 12), effect = CONST_ME_HOLYDAMAGE }, - { fromPosition = Position(32522, 32559, 12), toPosition = Position(32524, 32559, 12), effect = CONST_ME_HOLYDAMAGE }, - { fromPosition = Position(32528, 32561, 12), toPosition = Position(32528, 32563, 12), effect = CONST_ME_HOLYDAMAGE }, - { fromPosition = Position(32535, 32561, 12), toPosition = Position(32535, 32563, 12), effect = CONST_ME_HOLYDAMAGE }, - { fromPosition = Position(32542, 32561, 12), toPosition = Position(32542, 32563, 12), effect = CONST_ME_HOLYDAMAGE }, - { fromPosition = Position(33369, 31342, 5), toPosition = Position(33371, 31342, 5), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(33369, 31334, 5), toPosition = Position(33371, 31334, 5), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(33363, 31330, 4), toPosition = Position(33365, 31330, 4), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(33363, 31332, 4), toPosition = Position(33365, 31332, 4), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(33369, 31318, 3), toPosition = Position(33370, 31318, 3), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(33369, 31322, 3), toPosition = Position(33370, 31322, 3), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(33369, 31324, 3), toPosition = Position(33370, 31324, 3), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(33369, 31328, 3), toPosition = Position(33370, 31328, 3), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(33369, 31330, 3), toPosition = Position(33370, 31330, 3), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(33369, 31336, 3), toPosition = Position(33370, 31336, 3), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(33369, 31339, 3), toPosition = Position(33370, 31339, 3), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(33364, 31351, 4), toPosition = Position(33364, 31352, 4), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(33366, 31351, 4), toPosition = Position(33366, 31352, 4), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(31716, 31789, 1), toPosition = Position(31716, 31791, 1), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(31709, 31789, 1), toPosition = Position(31709, 31791, 1), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(31710, 31789, 1), toPosition = Position(31710, 31791, 1), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(31703, 31789, 1), toPosition = Position(31703, 31791, 1), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(31704, 31789, 1), toPosition = Position(31704, 31791, 1), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(31697, 31789, 1), toPosition = Position(31697, 31791, 1), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(31698, 31789, 1), toPosition = Position(31698, 31791, 1), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(31691, 31789, 1), toPosition = Position(31691, 31791, 1), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(31692, 31789, 1), toPosition = Position(31692, 31791, 1), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(32514, 32610, 12), toPosition = Position(32514, 32612, 12), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(32515, 32610, 12), toPosition = Position(32515, 32612, 12), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(32520, 32610, 12), toPosition = Position(32520, 32612, 12), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(32521, 32610, 12), toPosition = Position(32521, 32612, 12), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(32526, 32610, 12), toPosition = Position(32526, 32612, 12), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(32532, 32610, 12), toPosition = Position(32532, 32612, 12), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(32533, 32610, 12), toPosition = Position(32533, 32612, 12), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(32538, 32610, 12), toPosition = Position(32538, 32612, 12), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(32539, 32610, 12), toPosition = Position(32539, 32612, 12), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(32544, 32610, 12), toPosition = Position(32544, 32612, 12), effect = CONST_ME_FIREAREA }, - { fromPosition = Position(32545, 32610, 12), toPosition = Position(32545, 32612, 12), effect = CONST_ME_FIREAREA }, -} - -local spawnDamage = GlobalEvent("spawn damage") -function spawnDamage.onThink(interval) - local jolf - for i = 1, #effects do - local settings = effects[i] - fromPosition = settings.fromPosition - toPosition = settings.toPosition - local spectators = Game.getSpectators(settings.fromPosition, false, true, 7, 7, 5, 5) - if #spectators > 0 then - if settings.effect then - for y = fromPosition.y, toPosition.y do - local newPosition = Position(fromPosition.x, y, fromPosition.z) - newPosition:sendMagicEffect(settings.effect) - - jolf = Tile(newPosition):getTopCreature() - if jolf and jolf:isPlayer() then - doTargetCombatHealth(0, jolf, COMBAT_PHYSICALDAMAGE, -500, -1000, settings.effect) - end - end - for x = fromPosition.x, toPosition.x do - local newPosition2 = Position(x, fromPosition.y, fromPosition.z) - newPosition2:sendMagicEffect(settings.effect) - jolf = Tile(newPosition2):getTopCreature() - if jolf and jolf:isPlayer() then - doTargetCombatHealth(0, jolf, COMBAT_PHYSICALDAMAGE, -10, -500, settings.effect) - end - end - end - end - end - return true -end - -spawnDamage:interval(9000) -spawnDamage:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_chests.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_chests.lua new file mode 100644 index 00000000000..791e63f6535 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_chests.lua @@ -0,0 +1,37 @@ +local chests = { + [4920] = {storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Parchment, reward = 28650, amount = 1}, + [4921] = {storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Sapphire, reward = 675, amount = 2}, + [4922] = {storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Fishing, reward = 3483, amount = 1}, + [4923] = {storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Shovel, reward = 3457, amount = 1}, + [4925] = {storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Hawser, reward = 28707, amount = 1}, +} + +local actions_isles_chests = Action() + +function actions_isles_chests.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local chest = chests[item.uid] + if not chests[item.uid] then + return true + end + + local article = 'a' + + if player:getStorageValue(chest.storage) ~= 1 then + player:addItem(chest.reward, chest.amount) + player:setStorageValue(chest.storage, 1) + if chest.amount > 1 then + article = '' ..chest.amount + end + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format('You have found %s %s.', article, ItemType(chest.reward):getName():lower())) + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It is empty.') + end + + return true +end + +for uid in pairs(chests) do + actions_isles_chests:uid(uid) +end + +actions_isles_chests:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_telescope.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_telescope.lua new file mode 100644 index 00000000000..d2096aa5b91 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_telescope.lua @@ -0,0 +1,13 @@ +local actions_isles_telescope = Action() + +function actions_isles_telescope.onUse(player, item, fromPosition, itemEx, toPosition) + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.BoatStages) == 2 then + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.BoatStages, 3) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'The telescope provides a perfect view over the endless ocean - no land in sight') + end + + return true +end + +actions_isles_telescope:aid(4935) +actions_isles_telescope:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_boat_puzzle.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_boat_puzzle.lua new file mode 100644 index 00000000000..17cfeeacf79 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_boat_puzzle.lua @@ -0,0 +1,41 @@ +local movements_isle_color_puzzle = MoveEvent() + +function movements_isle_color_puzzle.onStepIn(creature, item, position, fromPosition) + if not creature:isPlayer() then + return false + end + local player = Player(creature:getId()) + local boatStage = player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.BoatStages) + if item.actionid == 4936 then + if boatStage < 1 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You see the scattered parts of a wrecked ship. Miraculously the ship telescope survived the wreckm it seems still to be intact.') + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.BoatStages, 1) + elseif boatStage >= 1 and boatStage < 2 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'There are still some loose planks and hawsers. You can\'t use the raft like this, it will sink for sure.') + end + elseif item.actionid == 4937 then + if boatStage <= 1 then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Hawser) == 1 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You use the hawser to lash up the loose planks. The raft should be seaworthy now.') + if player:getItemCount(33209) >= 1 then + player:removeItem(33209, 1) + end + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.BoatStages, 2) + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You see the scattered parts of a wrecked ship. Miraculously the ship telescope survived the wreck it seems still to be intact.') + end + elseif boatStage == 2 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Witout any points of orientation you will never find your way back. Try to find a way to improve your navigation.') + elseif boatStage == 3 then + player:teleportTo(Position(32187, 32473, 7)) + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline) ~= 3 then + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, 3) + end + end + end + + return true +end + +movements_isle_color_puzzle:aid(4936, 4937) +movements_isle_color_puzzle:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_stepIn.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_stepIn.lua new file mode 100644 index 00000000000..dc157564b73 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_stepIn.lua @@ -0,0 +1,98 @@ +local raxias = { + position = Position(33465, 32157, 7), + fromPos = Position(33454, 32151, 8), + toPos = Position(33477, 32171, 8), + storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.RaxiasTimer, + exit = Position(33462, 32159, 7), + toPosition = Position(33466, 32156, 8), + bossName = 'Raxias', + bossPos = Position(33466, 32161, 8) +} + +local turtle = { + fromPosition = Position(32460, 32928, 7), + toPosition = Position(32316, 32701, 7), + storageTimer = GlobalStorage.secretLibrary.SmallIslands.Turtle +} + +local svargrond = { + fromPosition = Position(32119, 31734, 7), + toPosition = Position(32127, 31665, 7) +} + +local defaultMessage = 'You have ten minutes to kill and loot this monster, else you will lose that chance and will be kicked out.' + +local function resetRoom(position) + local spec = Game.getSpectators(position, false, false, 5, 5, 5, 5) + for _, c in pairs(spec) do + if c and c:isPlayer() then + return false + end + end + for _, c in pairs(spec) do + if c then + c:remove() + end + end + return true +end + +local function startBattle(pid, position, b_name, middle) + local player = Player(pid) + + if player then + player:teleportTo(position) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:say(defaultMessage, TALKTYPE_MONSTER_SAY) + local monster = Game.createMonster(b_name, middle) + end +end + +local movements_isle_stepIn = MoveEvent() + +function movements_isle_stepIn.onStepIn(creature, item, position, fromPosition) + if not creature:isPlayer() then + return false + end + + local player = Player(creature:getId()) + + if position == turtle.fromPosition then + if Game.getStorageValue(turtle.storageTimer) > os.time() then + player:teleportTo(turtle.toPosition) + else + player:say('The turtle is hungry... You must feed it.', TALKTYPE_MONSTER_SAY) + player:teleportTo(fromPosition, true) + end + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + elseif position == svargrond.fromPosition then + player:teleportTo(svargrond.toPosition) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + elseif position == raxias.position then + if resetRoom(raxias.bossPos) then + if player:getStorageValue(raxias.storage) < os.time() then + startBattle(player:getId(), raxias.toPosition, raxias.bossName, raxias.bossPos) + player:setStorageValue(raxias.storage, os.time() + 20*60*60) + addEvent(function(cid) + local p = Player(cid) + if p then + if p:getPosition():isInRange(raxias.fromPos, raxias.toPos) then + p:teleportTo(raxias.exit) + end + end + end, 10*1000*60, player:getId()) + else + player:sendCancelMessage('You are still exhausted from your last battle.') + player:teleportTo(fromPosition, true) + end + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You must wait. Someone is challenging '.. raxias.bossName ..' now.') + player:teleportTo(fromPosition, true) + end + end + + return true +end + +movements_isle_stepIn:aid(4935) +movements_isle_stepIn:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua new file mode 100644 index 00000000000..42b7f33fd87 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua @@ -0,0 +1,180 @@ +-- Mazzinor info start +local mazzinorSummons = { + name = 'Wild Knowledge', + eventName = 'mazzinorDeath', + middlePosition = Position(32724, 32720, 10), + timing = 25, + positions = { + [1] = Position(32719, 32718, 10), + [2] = Position(32723, 32719, 10), + [3] = Position(32728, 32718, 10), + [4] = Position(32724, 32724, 10) + } +} + +local ghuloshSummons = { + name = 'Bone Jaw', + eventName = '', + middlePosition = Position(32756, 32721, 10), + timing = 25, + positions = { + [1] = Position(32755, 32721, 10) + } +} + +local gorzindelSummons = { + name = 'Mean Minion', + name2 = 'Malicious Minion', + eventName = '', + middlePosition = Position(32687, 32719, 10), + timing = 25, + positions = { + [1] = Position(32687, 32717, 10) + }, + positions2 = { + [1] = Position(32687, 32720, 10) + }, + tomesPosition = { + [1] = {name = "stolen knowledge of armor", position = Position(32687, 32707, 10)}, + [2] = {name = "stolen knowledge of summoning", position = Position(32698, 32715, 10)}, + [3] = {name = "stolen knowledge of lifesteal", position = Position(32693, 32729, 10)}, + [4] = {name = "stolen knowledge of spells", position = Position(32681, 32729, 10)}, + [5] = {name = "stolen knowledge of healing", position = Position(32676, 32715, 10)} + } +} + + +local lokathmorSummons = { + name = 'Knowledge Raider', + eventName = '', + middlePosition = Position(32751, 32689, 10), + timing = 25, + positions = { + [1] = Position(32747, 32684, 10), + [2] = Position(32755, 32684, 10), + [3] = Position(32755, 32694, 10), + [4] = Position(32747, 32694, 10) + } +} + +local bossNames = {'mazzinor', 'supercharged mazzinor', 'lokathmor', 'ghulosh', 'ghuloshz\' deathgaze', 'gorzindel', 'stolen tome of portals'} + +local function spawnSummons(k, monsterName, eventName, timing, positionTable, middlePosition, isGorzindel) + local spectators = Game.getSpectators(middlePosition, false, false, 12, 12, 12, 12) + local hasPlayer = false + + -- It must block spawn flooding + for _, c in pairs(spectators) do + if c and c:isPlayer() then + hasPlayer = true + end + end + + if isGorzindel then + local hasTome = false + for _, c in pairs(spectators) do + for i = 1, #gorzindelSummons.tomesPosition do + if c and (c:getName():lower() == gorzindelSummons.tomesPosition[i].name) then + hasTome = true + end + end + end + if not hasTome then + return false + end + end + if hasPlayer then + if k <= 4 then + for i = 1, #positionTable do + local sqm = positionTable[i] + if sqm then sqm:sendMagicEffect(CONST_ME_TELEPORT) end + end + k = k + 1 + addEvent(spawnSummons, 2*1000, k, monsterName, eventName, timing, positionTable, middlePosition, isGorzindel) + else + for i = 1, #positionTable do + local monster = Game.createMonster(monsterName, positionTable[i]) + if monster then monster:registerEvent(eventName) end + end + addEvent(function() + spawnSummons(1, monsterName, eventName, timing, positionTable, middlePosition, isGorzindel) + end, timing * 1000) + end + end +end +-- Mazzinor info ending + +local leverInfo = { + [1] = {bossName = 'Mazzinor', storage = Storage.Quest.U11_80.TheSecretLibrary.Library.MazzinorTime, exit = Position(32616, 32532, 13), + position = Position(32720, 32773, 10), type = "x", bossPosition = Position(32724, 32720, 10), + teleportTo = Position(32724, 32726, 10), fromPosition = Position(32715, 32712, 10), toPosition = Position(32733, 32729, 10)}, + [2] = {bossName = 'Lokathmor', storage = Storage.Quest.U11_80.TheSecretLibrary.Library.LokathmorTime, exit = Position(32467, 32654, 12), + position = Position(32720, 32749, 10), type = "x", bossPosition = Position(32751, 32689, 10), + teleportTo = Position(32750, 32694, 10), fromPosition = Position(32741, 32680, 10), toPosition = Position(32759, 32697, 10)}, + [3] = {bossName = 'Ghulosh', storage = Storage.Quest.U11_80.TheSecretLibrary.Library.GhuloshTime, exit = Position(32659, 32713, 13), + position = Position(32746, 32773, 10), type = "x", bossPosition = Position(32756, 32721, 10), + teleportTo = Position(32755, 32727, 10), fromPosition = Position(32745, 32711, 10), toPosition = Position(32768, 32730, 10)}, + [4] = {bossName = 'Gorzindel', storage = Storage.Quest.U11_80.TheSecretLibrary.Library.GorzindelTime, exit = Position(32660, 32734, 12), + position = Position(32746, 32749, 10), type = "x", bossPosition = Position(32685, 32717, 10), + teleportTo = Position(32687, 32724, 10), fromPosition = Position(32671, 32703, 10), toPosition = Position(32702, 32734, 10)}, +} + +local actions_library_bossesLever = Action() + +function actions_library_bossesLever.onUse(player, item, fromPosition, itemEx, toPosition) + local playersTable = {} + + for _, lever in pairs(leverInfo) do + if toPosition == lever.position then + if doCheckBossRoom(player:getId(), lever.bossName, lever.fromPosition, lever.toPosition) then + if lever.type == 'x' then + local startPos = lever.position.x + 1 + for x = startPos, startPos + 4 do + local sqm = Tile(Position(x, lever.position.y, lever.position.z)) + if sqm then + local c = sqm:getTopCreature() + if c and c:isPlayer() then + table.insert(playersTable, c:getId()) + c:teleportTo(lever.teleportTo) + c:setStorageValue(lever.storage, os.time() + 20*60*60) + end + end + end + end + + local monster = Game.createMonster(lever.bossName, lever.bossPosition) + + if monster then + if lever.bossName:lower() == 'mazzinor' then + addEvent(spawnSummons, 4*1000, 1, mazzinorSummons.name, mazzinorSummons.eventName, + mazzinorSummons.timing, mazzinorSummons.positions, mazzinorSummons.middlePosition, false) + elseif lever.bossName:lower() == 'lokathmor' then + addEvent(spawnSummons, 4*1000, 1, lokathmorSummons.name, lokathmorSummons.eventName, + lokathmorSummons.timing, lokathmorSummons.positions, lokathmorSummons.middlePosition, false) + elseif lever.bossName:lower() == 'ghulosh' then + addEvent(spawnSummons, 4*1000, 1, ghuloshSummons.name, ghuloshSummons.eventName, + ghuloshSummons.timing, ghuloshSummons.positions, ghuloshSummons.middlePosition, false) + local book = Game.createMonster('The Book of Death', Position(32755, 32716, 10)) + Game.setStorageValue(GlobalStorage.secretLibrary.Library.Ghulosh, 1) + elseif lever.bossName:lower() == 'gorzindel' then + addEvent(spawnSummons, 4*1000, 1, gorzindelSummons.name, gorzindelSummons.eventName, + gorzindelSummons.timing, gorzindelSummons.positions, gorzindelSummons.middlePosition, true) + addEvent(spawnSummons, 4*1000, 1, gorzindelSummons.name2, gorzindelSummons.eventName, + gorzindelSummons.timing, gorzindelSummons.positions2, gorzindelSummons.middlePosition, true) + local tome = Game.createMonster('Stolen Tome of Portals', Position(32688, 32715, 10)) + for _, k in pairs(gorzindelSummons.tomesPosition) do + local monster = Game.createMonster(k.name, k.position) + local minion = Game.createMonster('Malicious Minion', k.position) + end + end + end + addEvent(kickPlayersAfterTime, 30*60*1000, playersTable, lever.fromPosition, lever.toPosition, lever.exit) + end + end + end + + return true +end + +actions_library_bossesLever:aid(4950) +actions_library_bossesLever:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_parchment.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_parchment.lua new file mode 100644 index 00000000000..250b7dda38c --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_parchment.lua @@ -0,0 +1,54 @@ +local deskPosition = Position(32743, 32689, 10) +local center = Position(32751, 32689, 10) + +local function isStuck(mustFree) + local c = Tile(center):getTopCreature() + + if c and c:isMonster() then + if c:getName():lower() == 'lokathmor' and c:getSpeed() == 0 then + if mustFree then + c:say('THE DISCHARGE OF THE BOOK BREAKS LOKATHMORS STANCE!', TALKTYPE_MONSTER_SAY) + local cHealth = c:getHealth() + local monster = Game.createMonster('Lokathmor', center, true) + c:remove() + if monster then + monster:addHealth(-(monster:getHealth() - cHealth)) + end + else + return true + end + end + end + + return false +end + +local function freeRoom() + local spectators = Game.getSpectators(center, false, false, 9, 9, 9, 9) + for _, p in pairs(spectators) do + if p and p:isMonster() then + if p:getName():lower() == 'force field' then + p:remove() + end + end + end + + isStuck(true) +end + +local actions_library_parchment = Action() + +function onUse(player, item, fromPosition, target, toPosition, isHotkey) + if toPosition == deskPosition then + if isStuck(false) then + player:say('THE DARK KNOWLEDGE PILLS THE BOOK WITH RAW POWER. READY TO BE UNLEASHED!', TALKTYPE_MONSTER_SAY) + freeRoom() + item:remove(1) + end + end + + return true +end + +actions_library_parchment:id(28488) +actions_library_parchment:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua new file mode 100644 index 00000000000..14f79a9bc2c --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua @@ -0,0 +1,67 @@ +local info = { + stages = { + {p = 75, v = 1}, + {p = 50, v = 2}, + {p = 25, v = 3} + }, + stg = GlobalStorage.secretLibrary.Library.Ghulosh +} + +local function nextStage(storage) + if Game.getStorageValue(storage) < 1 then + Game.setStorageValue(storage, 1) + end + Game.setStorageValue(storage, Game.getStorageValue(storage)+1) +end + +local creaturescripts_library_ghulosh = CreatureEvent("ghuloshThink") + +function creaturescripts_library_ghulosh.onThink(creature, interval) + local stage = 0 + + for _, k in pairs(info.stages) do + if Game.getStorageValue(info.stg) == k.v then + stage = k.p + end + end + + local position = creature:getPosition() + local cHealth = creature:getHealth() + local percentageHealth = (cHealth/creature:getMaxHealth())*100 + + if percentageHealth <= stage then + local monster = Game.createMonster('ghulosh\' deathgaze', position, true) + nextStage(info.stg) + creature:remove() + if monster then + monster:addHealth(-(monster:getHealth() - cHealth)) + monster:say('FEEL MY WRATH!!', TALKTYPE_MONSTER_SAY) + end + end +end + +creaturescripts_library_ghulosh:register() + +local function doSpawn(monster, k, position) + if k <= 4 then + position:sendMagicEffect(CONST_ME_TELEPORT) + k = k + 1 + addEvent(doSpawn, 2*1000, monster, k, position) + else + local monster = Game.createMonster(monster, position) + end +end + +local creaturescripts_library_ghulosh = CreatureEvent("ghuloshDeath") + +function creaturescripts_library_ghulosh.onDeath(creature, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) + local cPos = creature:getPosition() + + if creature:getName():lower() == 'the book of death' then + Game.createMonster('Concentrated Death', cPos) + elseif creature:getName():lower() == 'concentrated death' then + addEvent(doSpawn, 4*1000, 'The Book of Death', 1, Position(32755, 32716, 10)) + end +end + +creaturescripts_library_ghulosh:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_gorzindel.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_gorzindel.lua new file mode 100644 index 00000000000..e666f7bc803 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_gorzindel.lua @@ -0,0 +1,64 @@ +local knowledges = { + "stolen knowledge of armor", + "stolen knowledge of summoning", + "stolen knowledge of lifesteal", + "stolen knowledge of spells", + "stolen knowledge of healing", +} + +local middlePosition = Position(32687, 32719, 10) + +local creaturescripts_gorzindel = CreatureEvent("gorzindelDeath") + +function creaturescripts_gorzindel.onDeath(creature, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) + local cPos = creature:getPosition() + + if isInArray(knowledges, creature:getName():lower()) then + addEvent(function() + local spectators = Game.getSpectators(middlePosition, false, false, 12, 12, 12, 12) + local hasKnowledges = false + for _, c in pairs(spectators) do + if c and isInArray(knowledges, c:getName():lower()) then + hasKnowledges = true + end + end + if not hasKnowledges then + for _, c in pairs(spectators) do + if c then + if c:getName():lower() == "mean minion" then + c:getPosition():sendMagicEffect(CONST_ME_POFF) + c:remove() + elseif c:getName():lower() == "gorzindel" then + c:unregisterEvent('gorzindelHealth') + end + end + end + end + end, 1*1000) + elseif creature:getName():lower() == "stolen tome of portals" then + local portal = Game.createItem(1949, 1, cPos) + if portal then + portal:setActionId(4952) + addEvent(function() + Game.createMonster("stolen tome of portals", cPos, true, true) + local sqm = Tile(cPos):getItemById(1949) + if sqm then + sqm:remove(1) + end + end, 10*1000) + end + end +end + +creaturescripts_gorzindel:register() + + +local creaturescripts_gorzindel = CreatureEvent("gorzindelHealth") + +function creaturescripts_gorzindel.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) + primaryDamage = 0 + secondaryDamage = 0 + return primaryDamage, primaryType, secondaryDamage, secondaryType +end + +creaturescripts_gorzindel:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_lokathmor.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_lokathmor.lua new file mode 100644 index 00000000000..44969d7b485 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_lokathmor.lua @@ -0,0 +1,12 @@ +local paper = 28488 + +local creaturescripts_library_lokathmor = CreatureEvent("lokathmorDeath") + +function creaturescripts_library_lokathmor.onDeath(creature, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) + local cPos = creature:getPosition() + if creature:getName():lower() == "dark knowledge" then + local item = Game.createItem(paper, 1, cPos) + end +end + +creaturescripts_library_lokathmor:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_mazzinor.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_mazzinor.lua new file mode 100644 index 00000000000..d4e04a194cd --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_mazzinor.lua @@ -0,0 +1,34 @@ +local vortexId = 28673 +local actionId = 4951 + +local creaturescripts_library_mazzinor = CreatureEvent("mazzinorDeath") + +function creaturescripts_library_mazzinor.onDeath(creature, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) + local cPos = creature:getPosition() + if creature:getName():lower() == "wild knowledge" then + local vortex = Game.createItem(vortexId, 1, cPos) + if vortex then + vortex:setActionId(actionId) + addEvent(function(cPos) + local item = Tile(cPos):getItemById(vortexId) + if item then + item:remove() + end + end, 1*1000*60, cPos) + end + end +end + +creaturescripts_library_mazzinor:register() + + +local creaturescripts_library_mazzinor = CreatureEvent("mazzinorHealth") + +function creaturescripts_library_mazzinor.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) + creature:addHealth(primaryDamage or secondaryDamage) + primaryDamage = 0 + secondaryDamage = 0 + return primaryDamage, primaryType, secondaryDamage, secondaryType +end + +creaturescripts_library_mazzinor:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_gorzindel.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_gorzindel.lua new file mode 100644 index 00000000000..0b946eecfdd --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_gorzindel.lua @@ -0,0 +1,39 @@ +local tomesPosition = { + [1] = {position = Position(32687, 32707, 10), open = true}, + [2] = {position = Position(32698, 32715, 10), open = true}, + [3] = {position = Position(32693, 32729, 10), open = true}, + [4] = {position = Position(32681, 32729, 10), open = true}, + [5] = {position = Position(32676, 32715, 10), open = true} +} + +local middlePosition = Position(32687, 32719, 10) + +local movements_library_gorzindel = MoveEvent() + +function movements_library_gorzindel.onStepIn(creature, item, position, fromPosition) + if not creature:isPlayer() then + return false + end + + local player = Player(creature:getId()) + + for _, k in pairs(tomesPosition) do + if k.open then + player:teleportTo(k.position) + k.open = false + addEvent(function(cid) + local p = Player(cid) + if p then + p:teleportTo(middlePosition) + k.open = true + end + end, 10*1000, player:getId()) + break + end + end + + return true +end + +movements_library_gorzindel:aid(4952) +movements_library_gorzindel:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_mazzinor.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_mazzinor.lua new file mode 100644 index 00000000000..d9c38d5b109 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_mazzinor.lua @@ -0,0 +1,21 @@ +local outfit = createConditionObject(CONDITION_OUTFIT) +setConditionParam(outfit, CONDITION_PARAM_TICKS, 30*1000) +addOutfitCondition(outfit, {lookType = 1065}) + +local movements_library_mazzinor = MoveEvent() + +function movements_library_mazzinor.onStepIn(creature, item, position, fromPosition) + if not creature:isPlayer() then + return false + end + + creature:addCondition(outfit) + creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The remains deporalize you temporaly.") + creature:getPosition():sendMagicEffect(CONST_ME_ENERGYHIT) + item:remove(1) + + return true +end + +movements_library_mazzinor:aid(4951) +movements_library_mazzinor:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_timers.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_timers.lua new file mode 100644 index 00000000000..3176f30a353 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_timers.lua @@ -0,0 +1,33 @@ +local timers = { + [1] = {position = Position(32616, 32529, 13), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.MazzinorTime, toPosition = Position(32720, 32770, 10)}, + [2] = {position = Position(32464, 32654, 12), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.LokathmorTime, toPosition = Position(32720, 32746, 10)}, + [3] = {position = Position(32662, 32713, 13), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.GhuloshTime, toPosition = Position(32746, 32770, 10)}, + [4] = {position = Position(32660, 32736, 12), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.GorzindelTime, toPosition = Position(32746, 32746, 10)}, +} + +local movements_library_timers = MoveEvent() + +function movements_library_timers.onStepIn(creature, item, position, fromPosition) + if not creature:isPlayer() then + return false + end + + local player = Player(creature:getId()) + + for _, k in pairs(timers) do + if position == k.position then + if player:getStorageValue(k.timer) <= os.time() then + player:teleportTo(k.toPosition) + else + player:teleportTo(fromPosition, true) + player:sendCancelMessage('You are still exhausted from your last battle.') + end + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + end + + return true +end + +movements_library_timers:aid(4950) +movements_library_timers:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua new file mode 100644 index 00000000000..d48bc954103 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua @@ -0,0 +1,55 @@ +local transform = { + [9110] = 9111, + [9111] = 9110 +} + +local leverInfo = { + [1] = {bossName = "Brokul", bossPosition = Position(33483, 31437, 15), leverPosition = Position(33522, 31464, 15), + pushPosition = Position(33522, 31465, 15), leverFromPos = Position(33520, 31465, 15), leverToPos = Position(33524, 31465, 15), + storageTimer = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimer, teleportTo = Position(33484, 31446, 15), + globalTimer = GlobalStorage.secretLibrary.LiquidDeath.BrokulTimer, roomFromPosition = Position(33472, 31427, 15), roomToPosition = Position(33496, 31450, 15), + exitPosition = Position(33528, 31464, 14)}, +} + +local actions_liquid_brokulLever = Action() + +function actions_liquid_brokulLever.onUse(player, item, fromPosition, target, toPosition, isHotkey) + if not player then + return true + end + + local playersTable = {} + local iPos = item:getPosition() + local pPos = player:getPosition() + + if item.itemid == 9110 then + for i = 1, #leverInfo do + if iPos == leverInfo[i].leverPosition then + local leverTable = leverInfo[i] + if pPos == leverTable.pushPosition then + if doCheckBossRoom(player:getId(), leverTable.bossName, leverTable.roomFromPosition, leverTable.roomToPosition) then + for i = leverTable.leverFromPos.x, leverTable.leverToPos.x do + local newPos = Position(i, leverTable.leverFromPos.y, leverTable.leverFromPos.z) + local creature = Tile(newPos):getTopCreature() + if creature and creature:isPlayer() then + creature:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimer, os.time() + 20*60*60) + creature:teleportTo(leverTable.teleportTo, true) + creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + table.insert(playersTable, creature:getId()) + end + end + local monster = Game.createMonster(leverTable.bossName, leverTable.bossPosition) + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, leverTable.roomFromPosition, leverTable.roomToPosition, leverTable.exitPosition) + end + end + end + end + end + + item:transform(transform[item.itemid]) + + return true +end + +actions_liquid_brokulLever:aid(4901) +actions_liquid_brokulLever:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_usableItens.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_usableItens.lua new file mode 100644 index 00000000000..9d5d0d07b78 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_usableItens.lua @@ -0,0 +1,88 @@ +local config = { + statues = { + [1] = {position = Position(33598, 31398, 14), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue1}, + [2] = {position = Position(33602, 31439, 13), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue2}, + [3] = {position = Position(33587, 31461, 14), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue3}, + [4] = {position = Position(33588, 31461, 14), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue4}, + [5] = {position = Position(33549, 31459, 14), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue5}, + [6] = {position = Position(33577, 31475, 15), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue6}, + [7] = {position = Position(33612, 31465, 15), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue7}, + [8] = {position = Position(33565, 31423, 13), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue8}, + [9] = {position = Position(33574, 31441, 15), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue9} + }, + bookInfo = { + id = 15475, + position = Position(32881, 32435, 8), + storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 3, + message = "The descriptions in this book look like plans detailing the launch of a large-scale assault." + }, + statueEffect = CONST_ME_THUNDER, + statueMessage = 'The Njey will appreciate your help.', + statueMessage_ = 'You recently fixed that idol.', + statueId = {17240, 17241}, + fixedId = {17239, 17242}, + countStatues = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.StatueCount, + maxValue = 9 +} + +local function doRevert(position, id, newId) + local item = Tile(position):getItemById(newId) + if item then + item:transform(id) + end +end + +local function fixStatue(position, id) + local item = Tile(position):getItemById(id) + local newId = 0 + + if id == config.statueId[1] then + newId = config.fixedId[1] + else + newId = config.fixedId[2] + end + + if item then + item:transform(newId) + position:sendMagicEffect(config.statueEffect) + end + + addEvent(doRevert, 10*1000, position, id, newId) +end + +local actions_liquid_usableItens = Action() + +function actions_liquid_usableItens.onUse(player, item, position, fromPosition, pos, target, toPosition) + local b = config.bookInfo + + if item:getId() == b.id and item:getPosition() == b.position then + if player:getStorageValue(b.storage) == b.value then + player:setStorageValue(b.storage, player:getStorageValue(b.storage) + 1) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, b.message) + end + else + local statueId = config.statueId + if item.itemid == statueId[1] or item.itemid == statueId[2] then + for _, k in pairs(config.statues) do + if position == k.position then + if player:getStorageValue(k.storage) < 1 then + player:setStorageValue(k.storage, 1) + player:setStorageValue(config.countStatues, math.max(player:getStorageValue(config.countStatues), 0) + 1) + if player:getStorageValue(config.countStatues) == config.maxValue then + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline) + 1) + end + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, config.statueMessage) + fixStatue(position, item.itemid) + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, config.statueMessage_) + end + end + end + end + end + + return true +end + +actions_liquid_usableItens:aid(4900) +actions_liquid_usableItens:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_bossWay.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_bossWay.lua new file mode 100644 index 00000000000..2f205e1f1c2 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_bossWay.lua @@ -0,0 +1,44 @@ +local config = { + acessos = { + [1] = {fromPos = Position(33525, 31464, 14), toPos = Position(33525, 31464, 15), + storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 6, + message = "Without the help of other Njey you will probably not make enough of a difference in this battle.", + timer = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimer}, + }, + defaultMessage = "You are not ready to pass yet.", + notime = "You need to wait 20 hours to face this boss again." +} + +local movements_liquid_bossWay = MoveEvent() + +function movements_liquid_bossWay.onStepIn(creature, item, position, fromPosition) + if not creature:isPlayer() then + return false + end + + local player = Player(creature:getId()) + + if player then + local acessos = config.acessos + for i = 1, #acessos do + if acessos[i].fromPos == position then + if player:getStorageValue(acessos[i].storage) < acessos[i].value then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, acessos[i].message) + player:teleportTo(fromPosition, true) + else + if player:getStorageValue(acessos[i].timer) > os.time() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, config.notime) + player:teleportTo(fromPosition, true) + else + player:teleportTo(acessos[i].toPos, true) + end + end + end + end + end + + return true +end + +movements_liquid_bossWay:aid(4901) +movements_liquid_bossWay:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_teleportTo.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_teleportTo.lua new file mode 100644 index 00000000000..d3157603a07 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_teleportTo.lua @@ -0,0 +1,53 @@ +local config = { + teleports = { + [1] = {fromPos = Position(32873, 32512, 7), toPos = Position(32881, 32471, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 2, effect = CONST_ME_WATERSPLASH, achievementName = 'Spectulation'}, + [2] = {fromPos = Position(32881, 32473, 9), toPos = Position(32871, 32513, 7), effect = CONST_ME_WATERSPLASH}, + [3] = {fromPos = Position(33584, 31388, 13), toPos = Position(33584, 31391, 13), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 4, effect = CONST_ME_TELEPORT, message = 'You squeeze through an ancient small passage. There are small symbols carved deep into the coral you cannot read.'}, + [4] = {fromPos = Position(33560, 31395, 13), toPos = Position(33561, 31391, 13), effect = CONST_ME_TELEPORT}, + }, + defaultMessage = "You are not ready to pass yet." +} + +local movements_liquid_teleportTo = MoveEvent() + +function movements_liquid_teleportTo.onStepIn(creature, item, position, fromPosition) + if not creature:isPlayer() then + return false + end + + local player = Player(creature:getId()) + + if player then + for i = 1, #config.teleports do + local tab = config.teleports + if position == tab[i].fromPos then + if tab[i].storage then + if player:getStorageValue(tab[i].storage) >= tab[i].value then + player:teleportTo(tab[i].toPos) + if tab[i].message then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, tab[i].message) + end + if tab[i].achievementName and not player:hasAchievement(tab[i].achievementName) then + player:addAchievement(tab[i].achievementName) + end + if player:getStorageValue(tab[i].storage) == tab[i].value then + player:setStorageValue(tab[i].storage, player:getStorageValue(tab[i].storage) + 1) + end + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, config.defaultMessage) + player:teleportTo(fromPosition, true) + return true + end + else + player:teleportTo(tab[i].toPos) + end + player:getPosition():sendMagicEffect(tab[i].effect) + end + end + end + + return true +end + +movements_liquid_teleportTo:aid(4900) +movements_liquid_teleportTo:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_boat.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_boat.lua deleted file mode 100644 index d076b5e22f2..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_boat.lua +++ /dev/null @@ -1,17 +0,0 @@ -local boat = MoveEvent() - -function boat.onStepIn(creature, item, toPosition, fromPosition) - local player = creature:getPlayer() - if not player then - return true - end - - if player:getStorageValue(Storage.TheSecretLibrary.HighDry) == 1 then - player:setStorageValue(Storage.TheSecretLibrary.HighDry, 2) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "There are still some loose planks and hawsers. You can't use the raft like this, it will sink for sure.") - end - return true -end - -boat:aid(26701) -boat:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_crackles.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_crackles.lua new file mode 100644 index 00000000000..d9fc268d061 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_crackles.lua @@ -0,0 +1,16 @@ +local movements_crackles = MoveEvent() + +function movements_crackles.onStepIn(creature, item, position, fromPosition) + if not creature:isPlayer() then + return false + end + + local player = Player(creature:getId()) + + player:teleportTo(Position(player:getPosition().x, player:getPosition().y, player:getPosition().z + 1)) + + return true +end + +movements_crackles:aid(4910) +movements_crackles:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_golem_teleport.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_golem_teleport.lua deleted file mode 100644 index c8f53be5453..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_golem_teleport.lua +++ /dev/null @@ -1,17 +0,0 @@ -local golemTeleport = MoveEvent() - -function golemTeleport.onStepIn(creature, item, toPosition, fromPosition) - local player = creature:getPlayer() - if not player then - return true - end - - if player:getStorageValue(Storage.TheSecretLibrary.Mota) == 10 then - player:setStorageValue(Storage.TheSecretLibrary.Mota, 11) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - return true -end - -golemTeleport:aid(26688) -golemTeleport:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_pink_teleport.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_pink_teleport.lua deleted file mode 100644 index 772926ede5e..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_pink_teleport.lua +++ /dev/null @@ -1,17 +0,0 @@ -local pinkTeleport = MoveEvent() - -function pinkTeleport.onStepIn(creature, item, toPosition, fromPosition) - local player = creature:getPlayer() - if not player then - return true - end - - if player:getStorageValue(Storage.TheSecretLibrary.Peacock) == 2 then - player:teleportTo(Position(32880, 32828, 11)) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - return true -end - -pinkTeleport:aid(26698) -pinkTeleport:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_teleport.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_teleport.lua deleted file mode 100644 index e788c64e0a4..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_teleport.lua +++ /dev/null @@ -1,35 +0,0 @@ -local destination = { - [64007] = Position(33345, 31347, 7), --Falcon - [64008] = Position(33357, 31308, 4), --Falcon - [64009] = Position(33382, 31292, 7), --Falcon - [64010] = Position(33327, 31351, 7), --Falcon - [64011] = Position(33201, 31765, 1), --Falcon - [64012] = Position(33327, 31351, 7), --Falcon - [64013] = Position(32958, 32324, 8), --Deep desert - [64014] = Position(33110, 32386, 7), --Deep desert -} - -local teleport = MoveEvent() - -function teleport.onStepIn(creature, item, position, fromPosition) - local player = creature:getPlayer() - if not player then - return true - end - - local teleport = destination[item.actionid] - if teleport then - player:teleportTo(teleport) - fromPosition:sendMagicEffect(CONST_ME_TELEPORT) - teleport:sendMagicEffect(CONST_ME_TELEPORT) - end - return true -end - -teleport:type("stepin") - -for index, value in pairs(destination) do - teleport:aid(index) -end - -teleport:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_bony_rod.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_bony_rod.lua new file mode 100644 index 00000000000..e558b3074fa --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_bony_rod.lua @@ -0,0 +1,28 @@ +local basin = 2113 +local finalBasin = Position(33339, 32117, 10) + +local actions_museum_bony_rod = Action() + +function actions_museum_bony_rod.onUse(player, item, fromPosition, target, toPosition, isHotkey) + if item.itemid == 28709 then + if target.itemid == 27847 then + item:remove(1) + player:addItem(28708, 1) + end + elseif item.itemid == 28708 then + if target.itemid == basin then + item:setAttribute(ITEM_ATTRIBUTE_DURATION, 15*1000) + player:say('Recharging...', TALKTYPE_MONSTER_SAY) + else + if target:getPosition() == finalBasin and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.FinalBasin) ~= 1 then + target:getPosition():sendMagicEffect(CONST_ME_DRAWBLOOD) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.FinalBasin, 1) + end + end + end + + return true +end + +actions_museum_bony_rod:id(28708, 28709) +actions_museum_bony_rod:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_chests.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_chests.lua new file mode 100644 index 00000000000..5eb59f2f0a2 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_chests.lua @@ -0,0 +1,31 @@ +local chests = { + [4900] = {storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.SampleBlood, reward = 27874}, + [4901] = {storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.BonyRod, reward = 27847}, + [4902] = {storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.BrokenCompass, reward = 25746}, +} + +local actions_museum_chests = Action() + +function actions_museum_chests.onUse(player, item, fromPosition, target, toPosition, isHotkey) + local chest = chests[item.uid] + + if not chests[item.uid] then + return true + end + + if player:getStorageValue(chest.storage) ~= 1 then + player:addItem(chest.reward, 1) + player:setStorageValue(chest.storage, 1) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. ItemType(chest.reward):getName():lower() .. '.') + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It is empty.') + end + + return true +end + +for uid in pairs(chests) do + actions_museum_chests:uid(uid) +end + +actions_museum_chests:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_doors.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_doors.lua new file mode 100644 index 00000000000..a204eb844b2 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_doors.lua @@ -0,0 +1,27 @@ +local doors = { + [1] = {doorPosition = Position(33246, 32122, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, nivel = 2}, + [2] = {doorPosition = Position(33208, 32071, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission, nivel = 1}, + [3] = {doorPosition = Position(33208, 32074, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission, nivel = 1}, + [4] = {doorPosition = Position(33341, 32117, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.FinalBasin, nivel = 1}, + [5] = {doorPosition = Position(33344, 32120, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.SkullSample, nivel = 1} +} + +local actions_museum_doors = Action() + +function actions_museum_doors.onUse(player, item, fromPosition, target, toPosition, isHotkey) + for _, p in pairs(doors) do + if (item:getPosition() == p.doorPosition) and not(Tile(item:getPosition()):getTopCreature()) then + if player:getStorageValue(p.storage) >= p.nivel then + player:teleportTo(toPosition, true) + item:transform(item.itemid + 1) + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'The door seems to be sealed against unwanted intruders.') + end + end + end + + return true +end + +actions_museum_doors:aid(4905) +actions_museum_doors:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_gems.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_gems.lua new file mode 100644 index 00000000000..c3e8abecb81 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_gems.lua @@ -0,0 +1,28 @@ +local basins = { + [1] = {position = Position(33219, 32100, 9), item = 27868, storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.YellowGem}, + [2] = {position = Position(33260, 32084, 9), item = 27867, storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.GreenGem}, + [3] = {position = Position(33318, 32090, 9), item = 27869, storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.RedGem}, +} + +local actions_museum_gems = Action() + +function actions_museum_gems.onUse(player, item, fromPosition, target, toPosition, isHotkey) + for _, p in pairs(basins) do + if p.item == item.itemid then + if player:getStorageValue(p.storage) < 1 then + target:getPosition():sendMagicEffect(CONST_ME_SOUND_PURPLE) + player:setStorageValue(p.storage, 1) + item:remove(1) + end + end + end + + return true +end + +for _, gem in pairs(basins) do + actions_museum_gems:id(gem.item) +end + +actions_museum_gems:register() + diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_levers.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_levers.lua new file mode 100644 index 00000000000..c32ad7f96cc --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_levers.lua @@ -0,0 +1,55 @@ +local boneLever = Position(33204, 32069, 8) +local middleLever = Position(33251, 32039, 8) +local thirdLever = Position(33218, 32096, 10) + +local transform = { + [9110] = 9111, + [9111] = 9110 +} + +local actions_museum_levers = Action() + +function actions_museum_levers.onUse(player, item, fromPosition, target, toPosition, isHotkey) + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission) ~= 1 then + if item:getPosition() == boneLever then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) == 3 then + player:say('You don\'t know what to do.', TALKTYPE_MONSTER_SAY) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, 4) + elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) == 5 then + if player:getStorageValue('museumTimer') > os.time() then + player:say('back, back, up, right, left', TALKTYPE_MONSTER_SAY) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission, 1) + else + player:say('You\'re too late.', TALKTYPE_MONSTER_SAY) + return true + end + end + elseif item:getPosition() == middleLever then + if item.itemid == 9110 then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) == 5 and player:getStorageValue('museumTimer') < os.time() then + player:say('As you turn the lever you can heart it ticking. Maybe you should hurry up!', TALKTYPE_MONSTER_SAY) + player:setStorageValue('museumTimer', os.time() + 2*60) + item:transform(item.itemid + 1) + end + end + end + end + + if item:getPosition() == thirdLever and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.FinalBasin) ~= 1 then + if player:getStorageValue('takenRod') < os.time() then + player:addItem(28709, 1) + player:setStorageValue('takenRod', os.time() + 2*60) + else + return true + end + end + + if item.itemid == 9110 or item.itemid == 9111 then + item:transform(transform[item:getId()]) + end + + return true +end + +actions_museum_levers:aid(4906) +actions_museum_levers:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_sample_blood.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_sample_blood.lua new file mode 100644 index 00000000000..57cae97f827 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_sample_blood.lua @@ -0,0 +1,15 @@ +local skullPosition = Position(33348, 32117, 10) + +local actions_museum_sample_blood = Action() + +function actions_museum_sample_blood.onUse(player, item, fromPosition, target, toPosition, isHotkey) + if target:getPosition() == skullPosition and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.SkullSample) ~= 1 then + item:remove(1) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.SkullSample, 1) + end + + return true +end + +actions_museum_sample_blood:id(27874) +actions_museum_sample_blood:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/movements_teleportTo.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/movements_teleportTo.lua new file mode 100644 index 00000000000..3a6a56825d4 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/movements_teleportTo.lua @@ -0,0 +1,69 @@ +local teleports = { + [1] = {fromPos = Position(33246, 32107, 8), toPos = Position(33246, 32096, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, nivel = 2, nextValue = 3}, + [2] = {fromPos = Position(33246, 32098, 8), toPos = Position(33246, 32109, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, nivel = 2}, +} + +local lastroom_enter = Position(33344, 32117, 10) +local lastroom_exit = Position(33365, 32147, 10) + +local function sendFire(position) + for x = position.x - 1, position.x + 1 do + local newPos = Position(x, position.y, position.z) + newPos:sendMagicEffect(CONST_ME_FIREATTACK) + end +end + +local movements_museum_teleportTo = MoveEvent() + +function movements_museum_teleportTo.onStepIn(creature, item, position, fromPosition) + if not creature:isPlayer() then + return false + end + + local player = Player(creature:getId()) + + if item.actionid == 4905 then + for _, p in pairs(teleports) do + if (position == p.fromPos) then + if player:getStorageValue(p.storage) >= p.nivel then + player:teleportTo(p.toPos) + sendFire(p.toPos) + if p.nextValue and player:getStorageValue(p.storage) < p.nextValue then + player:setStorageValue(p.storage, p.nextValue) + end + else + player:teleportTo(fromPosition, true) + end + end + end + elseif item.actionid == 4906 then + local hasPermission = false + + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.YellowGem) >= 1 and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.GreenGem) >= 1 + and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.RedGem) >= 1 then + hasPermission = true + end + + if not hasPermission then + player:teleportTo(Position(33226, 32084, 9)) + end + elseif item.actionid == 4907 then + if position == lastroom_enter then + player:teleportTo(Position(33363, 32146, 10)) + elseif position == lastroom_exit and player:getStorageValue('trialTimer') < os.time() then + player:teleportTo(Position(33336, 32117, 10)) + -- Trial + else + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) < 6 then + player:setStorageValue('trialTimer', os.time() + 3*60) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, 6) + player:say('rkawdmawfjawkjnfjkawnkjnawkdjawkfmalkwmflkmawkfnzxc', TALKTYPE_MONSTER_SAY) + end + end + end + + return true +end + +movements_museum_teleportTo:aid(4905, 4906, 4907) +movements_museum_teleportTo:register() \ No newline at end of file diff --git a/data-otservbr-global/startup/tables/chest.lua b/data-otservbr-global/startup/tables/chest.lua index cb965e616d5..d8bea5fa1ae 100644 --- a/data-otservbr-global/startup/tables/chest.lua +++ b/data-otservbr-global/startup/tables/chest.lua @@ -181,15 +181,15 @@ ChestUnique = { reward = { { 2970, 1 } }, storage = Storage.Quest.Key.ID3899, }, - [5012] = { + --[[ [5012] = { isKey = true, itemId = 23740, itemPos = { x = 33377, y = 31321, z = 1 }, reward = { { 2969, 1 } }, storage = Storage.Quest.Key.ID0909, - timerStorage = Storage.TheSecretLibrary.FalconBastionChestsTimer.Key0909, + timerStorage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastionChestsTimer.Key0909, time = 24, -- hour - }, + }, ]] -- Bear Room Quest (rookgaard) key 4601 [5013] = { isKey = true, @@ -1080,7 +1080,7 @@ ChestUnique = { weight = 15.00, storage = Storage.Quest.U8_54.TomesOfKnowledge.TopTower, }, - [6105] = { + --[[[6105] = { itemId = 23741, itemPos = { x = 33352, y = 31318, z = 7 }, randomReward = { { 9081, 1 }, { 28821, 1 }, { 28823, 1 }, { 9058, 1 }, { 6299, 1 }, { 3052, 1 }, { 3035, 10 } }, @@ -1127,7 +1127,7 @@ ChestUnique = { reward = { { nil, nil } }, timerStorage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastionChestsTimer.UndergroundBastion, time = 24, -- hour - }, + }, ]] -- Blood Herb Quest [6111] = { useKV = true, diff --git a/data-otservbr-global/startup/tables/door_quest.lua b/data-otservbr-global/startup/tables/door_quest.lua index 3741f778874..61395a4726d 100644 --- a/data-otservbr-global/startup/tables/door_quest.lua +++ b/data-otservbr-global/startup/tables/door_quest.lua @@ -71,7 +71,7 @@ QuestDoorAction = { }, }, -- Secret library quest door - [Storage.TheSecretLibrary.Mota] = { + --[[[Storage.TheSecretLibrary.Mota] = { itemId = false, itemPos = { { x = 33208, y = 32071, z = 8 }, @@ -89,7 +89,7 @@ QuestDoorAction = { [Storage.TheSecretLibrary.SkullDoor] = { itemId = false, itemPos = { { x = 33344, y = 32120, z = 10 } }, - }, + }, ]] -- Koshei the deathless quest door [Storage.Quest.U8_1.KosheiTheDeathless.RewardDoor] = { itemId = false, @@ -796,18 +796,19 @@ QuestDoorAction = { { x = 32012, y = 31565, z = 7 }, }, }, - [Storage.TheSecretLibrary.MiniBosses.PreceptorLazare] = { + -- Secret library quest door + --[[ [Storage.Quest.U11_80.TheSecretLibrary.MiniBosses.PreceptorLazare] = { itemId = 6260, itemPos = { { x = 33376, y = 31335, z = 3 } }, }, - [Storage.TheSecretLibrary.LowerBastionAccess] = { + [Storage.Quest.U11_80.TheSecretLibrary.LowerBastionAccess] = { itemId = 6260, itemPos = { { x = 33371, y = 31349, z = 4 }, { x = 33375, y = 31346, z = 5 }, }, }, - [Storage.TheSecretLibrary.UndergroundBastionAccess] = { + [Storage.Quest.U11_80.TheSecretLibrary.UndergroundBastionAccess] = { itemId = false, itemPos = { { x = 33366, y = 31343, z = 7 }, @@ -815,13 +816,13 @@ QuestDoorAction = { { x = 32191, y = 31823, z = 8 }, }, }, - [Storage.Quest.U12_20.GraveDanger.Bosses.KingZelosDoor] = { - itemId = false, - itemPos = { { x = 32173, y = 31922, z = 8 } }, - }, [Storage.Quest.U11_80.TheSecretLibrary.ScourgeOfOblivionDoor] = { itemId = false, itemPos = { { x = 32480, y = 32591, z = 15 } }, + }, ]] + [Storage.Quest.U12_20.GraveDanger.Bosses.KingZelosDoor] = { + itemId = false, + itemPos = { { x = 32173, y = 31922, z = 8 } }, }, [Storage.Quest.U12_70.AdventuresOfGalthen.AccessDoor] = { itemId = false, diff --git a/data/items/items.xml b/data/items/items.xml index 5d86685c379..f6d18b8d69e 100644 --- a/data/items/items.xml +++ b/data/items/items.xml @@ -53204,7 +53204,10 @@ hands of its owner. Granted by TibiaRoyal.com"/> - + + + + @@ -53998,7 +54001,7 @@ hands of its owner. Granted by TibiaRoyal.com"/> - + From 27842ab77d44567a1d0304b215d73718232f791a Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 14 Oct 2024 21:35:25 +0000 Subject: [PATCH 23/70] Lua code format - (Stylua) --- data-otservbr-global/lib/core/storages.lua | 4 +- data-otservbr-global/npc/dedoras.lua | 157 +++++++++++------- .../asuras/actions_bonefiddle.lua | 12 +- .../asuras/actions_chests.lua | 24 +-- .../asuras/actions_doors.lua | 9 +- .../asuras/actions_fragrance.lua | 6 +- .../asuras/actions_keys.lua | 8 +- .../asuras/actions_mirror.lua | 8 +- .../creaturescripts_asuras_mechanic.lua | 23 ++- .../asuras/movements_elemental_portals.lua | 35 ++-- .../creaturescripts_kill.lua | 19 +-- .../creaturescripts_login.lua | 2 +- .../deep_desert/actions_chests.lua | 18 +- .../deep_desert/actions_doors.lua | 26 ++- .../deep_desert/actions_totems.lua | 12 +- .../deep_desert/movements_color_puzzle.lua | 13 +- .../deep_desert/movements_teleportTo.lua | 112 ++++++------- .../falcon_bastion/actions_doors.lua | 68 ++++---- .../falcon_bastion/actions_oberonLever.lua | 8 +- .../falcon_bastion/movements_bossEntrance.lua | 6 +- .../isles/actions_chests.lua | 20 +-- .../isles/actions_telescope.lua | 4 +- .../isles/movements_boat_puzzle.lua | 12 +- .../isles/movements_stepIn.lua | 22 +-- .../library/actions_bossesLever.lua | 112 ++++++------- .../library/actions_parchment.lua | 12 +- .../library/creaturescripts_ghulosh.lua | 28 ++-- .../library/creaturescripts_gorzindel.lua | 9 +- .../library/creaturescripts_lokathmor.lua | 2 +- .../library/creaturescripts_mazzinor.lua | 5 +- .../library/movements_gorzindel.lua | 14 +- .../library/movements_mazzinor.lua | 6 +- .../library/movements_timers.lua | 12 +- .../liquid_death/actions_brokulLever.lua | 23 ++- .../liquid_death/actions_usableItens.lua | 39 ++--- .../liquid_death/movements_bossWay.lua | 9 +- .../liquid_death/movements_teleportTo.lua | 12 +- .../movements_crackles.lua | 2 +- .../museum/actions_bony_rod.lua | 4 +- .../museum/actions_chests.lua | 12 +- .../museum/actions_doors.lua | 16 +- .../museum/actions_gems.lua | 7 +- .../museum/actions_levers.lua | 22 +-- .../museum/actions_sample_blood.lua | 2 +- .../museum/movements_teleportTo.lua | 17 +- 45 files changed, 514 insertions(+), 479 deletions(-) diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index a3ca644d14f..593b854abdf 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -2599,14 +2599,14 @@ Storage = { StrandHair = 46005, LotusKey = 46006, EyeKey = 46007, - ScribbledNotes= 46008, + ScribbledNotes = 46008, EbonyPiece = 46009, PeacockBallad = 46010, BlackSkull = 46011, SilverChimes = 46012, DiamondTimer = 46013, BlazingTimer = 46014, - DarkTimer = 46015, + DarkTimer = 46015, }, FalconBastion = { Questline = 46016, diff --git a/data-otservbr-global/npc/dedoras.lua b/data-otservbr-global/npc/dedoras.lua index c7880d0dea5..ea0e42b9e0d 100644 --- a/data-otservbr-global/npc/dedoras.lua +++ b/data-otservbr-global/npc/dedoras.lua @@ -51,12 +51,12 @@ npcType.onCloseChannel = function(npc, creature) end local quests = { - [1] = {stg = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, value = 3}, - [2] = {stg = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 7}, - [3] = {stg = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, value = 6}, - [4] = {stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, value = 2}, - [5] = {stg = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 8}, - [6] = {stg = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, value = 7} + [1] = { stg = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, value = 3 }, + [2] = { stg = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 7 }, + [3] = { stg = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, value = 6 }, + [4] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, value = 2 }, + [5] = { stg = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 8 }, + [6] = { stg = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, value = 7 }, } local function startMission(pid, storage, value) @@ -128,9 +128,9 @@ local function creatureSayCallback(npc, creature, type, message) end elseif MsgContains(message, "progress") and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.libraryPermission) < 1 then npcHandler:say({ - "About what of your mission s do you want to report? The {museum}, the darashian {desert}, the rumors about strange {fishmen}, the ancient {order}, the mysterious {asuri}, or the lost {isle}? ...", - "Or shall me {check} how much information we acquired?" - }, npc, creature) + "About what of your mission s do you want to report? The {museum}, the darashian {desert}, the rumors about strange {fishmen}, the ancient {order}, the mysterious {asuri}, or the lost {isle}? ...", + "Or shall me {check} how much information we acquired?", + }, npc, creature) npcHandler:setTopic(playerId, 3) elseif npcHandler:getTopic(playerId) == 3 then if MsgContains(message, "check") then @@ -138,7 +138,7 @@ local function creatureSayCallback(npc, creature, type, message) npcHandler:say({ "As I told you: To enter the veiled library, travel to the white raven monastery on the Isle of Kings and enter its main altar room. ...", "There, use an ordinary scythe on the right of the two monuments, while concentrating on this glyph here and chant the words: Chamek Athra Thull Zathroth ...", - "Hurry now my friend. Time is of essence!" + "Hurry now my friend. Time is of essence!", }, npc, creature) player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.libraryPermission, 1) player:addAchievement("Battle Mage") @@ -149,66 +149,105 @@ local function creatureSayCallback(npc, creature, type, message) npcHandler:say("You're still searching for informations.", npc, creature) end end - end return true end -keywordHandler:addKeyword({"looking"}, StdModule.say, {npcHandler = npcHandler, text = "I need the help of some competent {adventurers} to handle a threat to all creation."}) -keywordHandler:addKeyword({"value"}, StdModule.say, {npcHandler = npcHandler, text = "This leaves us with no choice but to take action into our own {hands}."}) -keywordHandler:addKeyword({"threat"}, StdModule.say, {npcHandler = npcHandler, text = "I guess you know about the {background} and there is no need to tell you that the forces from beyond managed to acquire the parts of the godbreaker in a coup."}) -keywordHandler:addKeyword({"disassembled"}, StdModule.say, {npcHandler = npcHandler, text = "The secret locations of the godbreaker {parts} were revealed and due to trickery, the minions of Variphor aquired all of them."}) -keywordHandler:addKeyword({"obscure"}, StdModule.say, {npcHandler = npcHandler, text = "Those pieces of knowledge come in several forms and shapes. For most I can give you more or less specific hints where to start your {search}."}) -keywordHandler:addKeyword({"hands"}, StdModule.say, {npcHandler = npcHandler, text = "You have to {find} the veiled hoard of Zathroth, breach it and destroy the knowledge how to use the godbreaker."}) -keywordHandler:addKeyword({"adventurer"}, StdModule.say, {npcHandler = npcHandler, text = { - "Of course the first to ask would be the famous Avar Tar, but I heard he's already on a quest of his own and ...", - "Well, let's say our last collaboration did not end too well. In fact, I'd be not even surprised if he pretended to not even know me. ...", - "So I have to look elsewhere to handle this new {threat}.", -}}) -keywordHandler:addKeyword({"background"}, StdModule.say, {npcHandler = npcHandler, text = { - "The goodbreaker was created in ancient times, when the war between the gods and their minions was on its height. Its creation took aeons and incredible sacrifices. ...", - "Each part had to be crafted perfectly, to emulate the gods, so it would share 'the same place' with them. ...", - "Mere mortals can not even perceive it in his whole but only recognize the part of it that is the physical representation in our world. ...", - "If it was meant to be used as an actual weapon, as the ultimate threat, or if Zathroth was just tempted to use his knowledge in the ultimate way - to create something that could undo himself - we don't know. ...", - "However in the end even Zathroth deemed it too much of a threat but instead of destroying the contraption once and for all, it was {disassembled} and hidden away.", -}}) -keywordHandler:addKeyword({"parts"}, StdModule.say, {npcHandler = npcHandler, text = { - "The parts alone do them no good. To assemble the parts, great skill, immense power and forbidden knowledge are necessary. ...", - "The skill will be supplied by the fallen Yalahari and the power by Variphor itself. ...", - "The only thing they are still lacking is the knowledge to assemble and operate the {godbreaker}.", -}}) -keywordHandler:addKeyword({"godbreaker"}, StdModule.say, {npcHandler = npcHandler, text = { - "The godbreaker is a complex artifact. Incantation woven into incantation. The powers bound into it are so immense that the slightest mishandling could prove disastrous. ...", - "o figure out how it works, let alone how it can be operated safely, could require several centuries of tireless study. And even then this information would be only partial. ...", - "Yet the creation and operation of the godbreaker is just the kind of forbidden {knowledge} Zathroth values most, so it was compiled and stored.", -}}) -keywordHandler:addKeyword({"knowledge"}, StdModule.say, {npcHandler = npcHandler, text = { +keywordHandler:addKeyword({ "looking" }, StdModule.say, { npcHandler = npcHandler, text = "I need the help of some competent {adventurers} to handle a threat to all creation." }) +keywordHandler:addKeyword({ "value" }, StdModule.say, { npcHandler = npcHandler, text = "This leaves us with no choice but to take action into our own {hands}." }) +keywordHandler:addKeyword({ "threat" }, StdModule.say, { npcHandler = npcHandler, text = "I guess you know about the {background} and there is no need to tell you that the forces from beyond managed to acquire the parts of the godbreaker in a coup." }) +keywordHandler:addKeyword({ "disassembled" }, StdModule.say, { npcHandler = npcHandler, text = "The secret locations of the godbreaker {parts} were revealed and due to trickery, the minions of Variphor aquired all of them." }) +keywordHandler:addKeyword({ "obscure" }, StdModule.say, { npcHandler = npcHandler, text = "Those pieces of knowledge come in several forms and shapes. For most I can give you more or less specific hints where to start your {search}." }) +keywordHandler:addKeyword({ "hands" }, StdModule.say, { npcHandler = npcHandler, text = "You have to {find} the veiled hoard of Zathroth, breach it and destroy the knowledge how to use the godbreaker." }) +keywordHandler:addKeyword( + { "adventurer" }, + StdModule.say, + { npcHandler = npcHandler, text = { + "Of course the first to ask would be the famous Avar Tar, but I heard he's already on a quest of his own and ...", + "Well, let's say our last collaboration did not end too well. In fact, I'd be not even surprised if he pretended to not even know me. ...", + "So I have to look elsewhere to handle this new {threat}.", + } } +) +keywordHandler:addKeyword( + { "background" }, + StdModule.say, + { + npcHandler = npcHandler, + text = { + "The goodbreaker was created in ancient times, when the war between the gods and their minions was on its height. Its creation took aeons and incredible sacrifices. ...", + "Each part had to be crafted perfectly, to emulate the gods, so it would share 'the same place' with them. ...", + "Mere mortals can not even perceive it in his whole but only recognize the part of it that is the physical representation in our world. ...", + "If it was meant to be used as an actual weapon, as the ultimate threat, or if Zathroth was just tempted to use his knowledge in the ultimate way - to create something that could undo himself - we don't know. ...", + "However in the end even Zathroth deemed it too much of a threat but instead of destroying the contraption once and for all, it was {disassembled} and hidden away.", + }, + } +) +keywordHandler:addKeyword( + { "parts" }, + StdModule.say, + { npcHandler = npcHandler, text = { + "The parts alone do them no good. To assemble the parts, great skill, immense power and forbidden knowledge are necessary. ...", + "The skill will be supplied by the fallen Yalahari and the power by Variphor itself. ...", + "The only thing they are still lacking is the knowledge to assemble and operate the {godbreaker}.", + } } +) +keywordHandler:addKeyword( + { "godbreaker" }, + StdModule.say, + { + npcHandler = npcHandler, + text = { + "The godbreaker is a complex artifact. Incantation woven into incantation. The powers bound into it are so immense that the slightest mishandling could prove disastrous. ...", + "o figure out how it works, let alone how it can be operated safely, could require several centuries of tireless study. And even then this information would be only partial. ...", + "Yet the creation and operation of the godbreaker is just the kind of forbidden {knowledge} Zathroth values most, so it was compiled and stored.", + }, + } +) +keywordHandler:addKeyword({ "knowledge" }, StdModule.say, { npcHandler = npcHandler, text = { "Of course the dangers of such knowledge were obvious. It was hidden in a sacred place devoted to Zathroth and dangerous knowledge. ...", "The hidden library, the forbidden hoard, the shrouded trove of knowledge or the veiled hoard of forbidden knowledge, the place has many names in many {myths}.", -}}) -keywordHandler:addKeyword({"myths"}, StdModule.say, {npcHandler = npcHandler, text = { - "The myths agree that the place is well hidden, extremely guarded and contains some of the most powerful pieces of knowledge in this world and probably beyond. ...", - "However the knowledge about the godbreaker now poses a threat to all existence. In the hands of Variphor it can cause disaster in previously unknown ways. The gods themselves are in {peril}.", -}}) -keywordHandler:addKeyword({"peril"}, StdModule.say, {npcHandler = npcHandler, text = { +} }) +keywordHandler:addKeyword( + { "myths" }, + StdModule.say, + { + npcHandler = npcHandler, + text = { + "The myths agree that the place is well hidden, extremely guarded and contains some of the most powerful pieces of knowledge in this world and probably beyond. ...", + "However the knowledge about the godbreaker now poses a threat to all existence. In the hands of Variphor it can cause disaster in previously unknown ways. The gods themselves are in {peril}.", + }, + } +) +keywordHandler:addKeyword({ "peril" }, StdModule.say, { npcHandler = npcHandler, text = { "Regardless of the dangers, the cult of Zathroth refused to destroy the knowledge of the godbreaker for good. ...", "They {value} dangerous knowledge that much, that they are unable to part from it, even when faced with the utter destruction of creation.", -}}) -keywordHandler:addKeyword({"find"}, StdModule.say, {npcHandler = npcHandler, text = { - "I know it's asked much but it's no longer a matter of choice. ...", - "The enemy is moving and I have reports that suggest the minions of Variphor are actively searching for Zathroth's library. They must not be allowed to succeed. ...", - "We must be the first to {reach} the hoard and make sure the enemy doesn't get the information he needs.", -}}) -keywordHandler:addKeyword({"reach"}, StdModule.say, {npcHandler = npcHandler, text = { +} }) +keywordHandler:addKeyword( + { "find" }, + StdModule.say, + { npcHandler = npcHandler, text = { + "I know it's asked much but it's no longer a matter of choice. ...", + "The enemy is moving and I have reports that suggest the minions of Variphor are actively searching for Zathroth's library. They must not be allowed to succeed. ...", + "We must be the first to {reach} the hoard and make sure the enemy doesn't get the information he needs.", + } } +) +keywordHandler:addKeyword({ "reach" }, StdModule.say, { npcHandler = npcHandler, text = { "I'd recommend to follow the few leads me and my associates could gather so far. ...", "Old myths, some {rumors} about old texts and other pieces of knowledge that I could use to figure out where to locate the hidden library and how to enter it.", -}}) -keywordHandler:addKeyword({"rumors"}, StdModule.say, {npcHandler = npcHandler, text = { - "Hints about the shrouded hoard are numerous, though most are general mentions in texts that deal with Zathroth. But there are other sources. ...", - "Like texts about ancient liturgies of Zathroth and historical documents that might give us clues. I already compiled everything of value from the sources that were openly available. ...", - "To gather the more {obscure} parts of knowledge, however, I'll need your help.", -}}) +} }) +keywordHandler:addKeyword( + { "rumors" }, + StdModule.say, + { + npcHandler = npcHandler, + text = { + "Hints about the shrouded hoard are numerous, though most are general mentions in texts that deal with Zathroth. But there are other sources. ...", + "Like texts about ancient liturgies of Zathroth and historical documents that might give us clues. I already compiled everything of value from the sources that were openly available. ...", + "To gather the more {obscure} parts of knowledge, however, I'll need your help.", + }, + } +) npcHandler:setMessage(MESSAGE_GREET, "Greetings seekers of knowledge. You seem to be just the person I'm {looking} for.") npcHandler:setMessage(MESSAGE_WALKAWAY, "Well, bye then.") diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_bonefiddle.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_bonefiddle.lua index ff7a6f972cd..42e81e13f29 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_bonefiddle.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_bonefiddle.lua @@ -6,14 +6,14 @@ function actions_asura_bonefiddle.onUse(player, item, fromPosition, target, toPo if target.itemid == 28490 then item:remove(1) target:remove(1) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You attach the ebony wood to the skull. This should meet the requirements of a fingerboard.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You attach the ebony wood to the skull. This should meet the requirements of a fingerboard.") player:addItem(28492) end elseif item.itemid == 28492 then if target.itemid == 28490 then item:remove(1) target:remove(1) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You tack the hair to the ebony fingerboard. The strands should be adquate to serve as strings.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You tack the hair to the ebony fingerboard. The strands should be adquate to serve as strings.") player:addItem(28493) player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, 2) end @@ -24,17 +24,17 @@ function actions_asura_bonefiddle.onUse(player, item, fromPosition, target, toPo if player:getPosition():isInRange(Position(32807, 32762, 10), Position(32809, 32768, 10)) then player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, 3) end - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, '*There was once a maiden fair, with dark eyes and silken hair. Far away from home she died. No grave, no wake, no mourning.*') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "*There was once a maiden fair, with dark eyes and silken hair. Far away from home she died. No grave, no wake, no mourning.*") player:getPosition():sendMagicEffect(CONST_ME_SOUND_PURPLE) elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) == 4 then if player:getPosition():isInRange(Position(32807, 32762, 10), Position(32809, 32768, 10)) then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You are playing the Peacock Ballad and the portal opens.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are playing the Peacock Ballad and the portal opens.") player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, 5) player:getPosition():sendMagicEffect(CONST_ME_SOUND_WHITE) return true end elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) >= 5 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You are playing the bone fiddle.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are playing the bone fiddle.") player:getPosition():sendMagicEffect(CONST_ME_SOUND_WHITE) end end @@ -43,4 +43,4 @@ function actions_asura_bonefiddle.onUse(player, item, fromPosition, target, toPo end actions_asura_bonefiddle:id(28491, 28492, 28493) -actions_asura_bonefiddle:register() \ No newline at end of file +actions_asura_bonefiddle:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_chests.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_chests.lua index 78a9966c717..a17b35d7b80 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_chests.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_chests.lua @@ -1,13 +1,13 @@ local chests = { - [4910] = {storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.StrandHair, reward = 28490}, - [4911] = {storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.SkeletonNotes, reward = 28518, message = "You have discovered a skeleton. It seems to hold an old letter and its skull is missing."}, - [4912] = {storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.EyeKey, reward = 28477}, - [4913] = {storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.ScribbledNotes, reward = 28515}, - [4914] = {storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.LotusKey, reward = 28476}, - [4915] = {storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.PeacockBallad, reward = 28710}, - [4916] = {storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.BlackSkull, reward = 28489}, - [4917] = {storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.EbonyPiece, reward = 28491}, - [4918] = {storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.SilverChimes, reward = 28494, message = "You see silver chimes dangling on the dragon statue in this room."} + [4910] = { storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.StrandHair, reward = 28490 }, + [4911] = { storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.SkeletonNotes, reward = 28518, message = "You have discovered a skeleton. It seems to hold an old letter and its skull is missing." }, + [4912] = { storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.EyeKey, reward = 28477 }, + [4913] = { storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.ScribbledNotes, reward = 28515 }, + [4914] = { storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.LotusKey, reward = 28476 }, + [4915] = { storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.PeacockBallad, reward = 28710 }, + [4916] = { storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.BlackSkull, reward = 28489 }, + [4917] = { storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.EbonyPiece, reward = 28491 }, + [4918] = { storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.SilverChimes, reward = 28494, message = "You see silver chimes dangling on the dragon statue in this room." }, } local actions_asura_chests = Action() @@ -21,12 +21,12 @@ function actions_asura_chests.onUse(player, item, fromPosition, target, toPositi player:addItem(chest.reward, 1) player:setStorageValue(chest.storage, 1) if not chest.message then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. ItemType(chest.reward):getName():lower() .. '.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a " .. ItemType(chest.reward):getName():lower() .. ".") else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, chest.message) end else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It is empty.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is empty.") end return true end @@ -35,4 +35,4 @@ for uid in pairs(chests) do actions_asura_chests:uid(uid) end -actions_asura_chests:register() \ No newline at end of file +actions_asura_chests:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_doors.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_doors.lua index 0fc79b187e7..28f232d1034 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_doors.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_doors.lua @@ -7,16 +7,16 @@ local actions_asura_doors = Action() function actions_asura_doors.onUse(player, item, fromPosition, target, toPosition, isHotkey) for _, p in pairs(doors) do - if (item:getPosition() == p.doorPosition) and not(Tile(item:getPosition()):getTopCreature()) then + if (item:getPosition() == p.doorPosition) and not (Tile(item:getPosition()):getTopCreature()) then if player:getStorageValue(p.storage) >= p.nivel then if p.level and player:getLevel() >= p.level then player:teleportTo(toPosition, true) item:transform(item.itemid + 1) else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You do not have enough level.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You do not have enough level.") end else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'The door seems to be sealed against unwanted intruders.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.") end end end @@ -26,6 +26,3 @@ end actions_asura_doors:aid(4911) actions_asura_doors:register() - - - diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_fragrance.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_fragrance.lua index de93b900210..c97010268dd 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_fragrance.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_fragrance.lua @@ -1,12 +1,12 @@ local actions_asura_fragrance = Action() function actions_asura_fragrance.onUse(player, item, fromPosition, target, toPosition, isHotkey) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Hmmmm, what an infatuating fragrance!') - player:setStorageValue('fragrance', os.time() + 10*60) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Hmmmm, what an infatuating fragrance!") + player:setStorageValue("fragrance", os.time() + 10 * 60) item:remove(1) return true end actions_asura_fragrance:id(28495) -actions_asura_fragrance:register() \ No newline at end of file +actions_asura_fragrance:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_keys.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_keys.lua index 940eb6e78d3..96715bf213f 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_keys.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_keys.lua @@ -1,6 +1,6 @@ local doors = { - [1] = {key = 28476, position = Position(32813, 32813, 9)}, - [2] = {key = 28477, position = Position(32864, 32810, 9)} + [1] = { key = 28476, position = Position(32813, 32813, 9) }, + [2] = { key = 28477, position = Position(32864, 32810, 9) }, } local locked = 23874 @@ -20,7 +20,7 @@ function actions_asura_keys.onUse(player, item, fromPosition, target, toPosition if item.itemid == k.key then if toPosition == k.position and target.itemid == locked then target:transform(opened) - addEvent(revert, 10*1000, target:getPosition()) + addEvent(revert, 10 * 1000, target:getPosition()) end end end @@ -32,4 +32,4 @@ for _, door in pairs(doors) do actions_asura_keys:id(door.key) end -actions_asura_keys:register() \ No newline at end of file +actions_asura_keys:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_mirror.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_mirror.lua index 9253e4e653c..448152746f2 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_mirror.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_mirror.lua @@ -3,17 +3,17 @@ local goPos = Position(32814, 32754, 9) local actions_asura_mirror = Action() function actions_asura_mirror.onUse(player, item, fromPosition, itemEx, toPosition) - if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.FlammingOrchid) >= 1 and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) >= 1 then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.FlammingOrchid) >= 1 and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) >= 1 then if player:getLevel() >= 250 then player:teleportTo(goPos) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) else - player:sendCancelMessage('You do not have enough level.') + player:sendCancelMessage("You do not have enough level.") end else - player:sendCancelMessage('You do not have permission.') + player:sendCancelMessage("You do not have permission.") end end actions_asura_mirror:aid(4910) -actions_asura_mirror:register() \ No newline at end of file +actions_asura_mirror:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/creaturescripts_asuras_mechanic.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/creaturescripts_asuras_mechanic.lua index fd972c80db8..ed1038ba9c9 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/creaturescripts_asuras_mechanic.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/creaturescripts_asuras_mechanic.lua @@ -1,5 +1,16 @@ local redItems = { - 3566, 3379, 3388, 8039, 8053, 8064, 22534, 3381, 7991, 3380, 10439, 3564 + 3566, + 3379, + 3388, + 8039, + 8053, + 8064, + 22534, + 3381, + 7991, + 3380, + 10439, + 3564, } local creaturescripts_asuras_mechanic = CreatureEvent("AsurasMechanic") @@ -10,7 +21,7 @@ function creaturescripts_asuras_mechanic.onHealthChange(creature, attacker, prim end if attacker:isPlayer() then - if creature:getName():lower() == 'the diamond blossom' then + if creature:getName():lower() == "the diamond blossom" then local slot = attacker:getSlotItem(CONST_SLOT_ARMOR) if slot then for i = 1, #redItems do @@ -19,13 +30,13 @@ function creaturescripts_asuras_mechanic.onHealthChange(creature, attacker, prim end end end - elseif creature:getName():lower() == 'the blazing rose' then + elseif creature:getName():lower() == "the blazing rose" then local slot = attacker:getSlotItem(CONST_SLOT_RIGHT) if slot and slot.itemid == 28494 then return primaryDamage, primaryType, secondaryDamage, secondaryType end - elseif creature:getName():lower() == 'the lily of night' then - if attacker:getStorageValue('fragrance') > os.time() then + elseif creature:getName():lower() == "the lily of night" then + if attacker:getStorageValue("fragrance") > os.time() then return primaryDamage, primaryType, secondaryDamage, secondaryType end end @@ -36,4 +47,4 @@ function creaturescripts_asuras_mechanic.onHealthChange(creature, attacker, prim return primaryDamage, primaryType, secondaryDamage, secondaryType end -creaturescripts_asuras_mechanic:register() \ No newline at end of file +creaturescripts_asuras_mechanic:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/movements_elemental_portals.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/movements_elemental_portals.lua index f674db96f5d..1e3b7f9f09b 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/movements_elemental_portals.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/movements_elemental_portals.lua @@ -4,22 +4,21 @@ --]] local entrances = { - [1] = {position = Position(32858, 32795, 11), storage = false, toPosition = Position(32889, 32772, 9)}, - [2] = {position = Position(32857, 32766, 10), fromPos = Position(32856, 32740, 11), toPos = Position(32868, 32752, 11), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.DiamondTimer, exit = Position(32857, 32768, 10), toPosition = Position(32881, 32789, 11), bossName = 'The Diamond Blossom', bossPos = Position(32881, 32792, 11)}, - [3] = {position = Position(32817, 32777, 11), fromPos = Position(32875, 32786, 11), toPos = Position(32887, 32798, 11), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.DarkTimer, exit = Position(32817, 32779, 11), toPosition = Position(32862, 32743, 11), bossName = 'The Lily of Night', bossPos = Position(32862, 32746, 11)}, - [4] = {position = Position(32854, 32737, 10), fromPos = Position(32856, 32768, 11), toPos = Position(32868, 32780, 11), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.BlazingTimer, exit = Position(32854, 32739, 10), toPosition = Position(32862, 32771, 11), bossName = 'The Blazing Rose', bossPos = Position(32862, 32774, 11)}, - + [1] = { position = Position(32858, 32795, 11), storage = false, toPosition = Position(32889, 32772, 9) }, + [2] = { position = Position(32857, 32766, 10), fromPos = Position(32856, 32740, 11), toPos = Position(32868, 32752, 11), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.DiamondTimer, exit = Position(32857, 32768, 10), toPosition = Position(32881, 32789, 11), bossName = "The Diamond Blossom", bossPos = Position(32881, 32792, 11) }, + [3] = { position = Position(32817, 32777, 11), fromPos = Position(32875, 32786, 11), toPos = Position(32887, 32798, 11), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.DarkTimer, exit = Position(32817, 32779, 11), toPosition = Position(32862, 32743, 11), bossName = "The Lily of Night", bossPos = Position(32862, 32746, 11) }, + [4] = { position = Position(32854, 32737, 10), fromPos = Position(32856, 32768, 11), toPos = Position(32868, 32780, 11), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.BlazingTimer, exit = Position(32854, 32739, 10), toPosition = Position(32862, 32771, 11), bossName = "The Blazing Rose", bossPos = Position(32862, 32774, 11) }, } local exites = { - [1] = {position = Position(32862, 32741, 11), toPosition = Position(32817, 32779, 11)}, - [2] = {position = Position(32862, 32769, 11), toPosition = Position(32854, 32739, 10)}, - [3] = {position = Position(32881, 32787, 11), toPosition = Position(32857, 32768, 10)}, - [4] = {position = Position(32887, 32772, 9), toPosition = Position(32858, 32797, 11)}, - [5] = {position = Position(32880, 32828, 11), toPosition = Position(32810, 32765, 10)}, + [1] = { position = Position(32862, 32741, 11), toPosition = Position(32817, 32779, 11) }, + [2] = { position = Position(32862, 32769, 11), toPosition = Position(32854, 32739, 10) }, + [3] = { position = Position(32881, 32787, 11), toPosition = Position(32857, 32768, 10) }, + [4] = { position = Position(32887, 32772, 9), toPosition = Position(32858, 32797, 11) }, + [5] = { position = Position(32880, 32828, 11), toPosition = Position(32810, 32765, 10) }, } -local defaultMessage = 'You have ten minutes to kill and loot this monster, else you will lose that chance and will be kicked out.' +local defaultMessage = "You have ten minutes to kill and loot this monster, else you will lose that chance and will be kicked out." local function resetRoom(position) local spec = Game.getSpectators(position, false, false, 5, 5, 5, 5) @@ -63,7 +62,7 @@ function movements_asura_elemental_portals.onStepIn(creature, item, position, fr if player:getStorageValue(quest) >= 5 then player:teleportTo(toPosition_l) else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You can not use this portal yet.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can not use this portal yet.") player:teleportTo(fromPosition, true) end player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) @@ -74,7 +73,7 @@ function movements_asura_elemental_portals.onStepIn(creature, item, position, fr if k.storage then if resetRoom(k.bossPos) then if player:getStorageValue(k.storage) < os.time() then - player:setStorageValue(k.storage, os.time() + 20*60*60) + player:setStorageValue(k.storage, os.time() + 20 * 60 * 60) startBattle(player:getId(), k.toPosition, k.bossName, k.bossPos) addEvent(function(cid) local p = Player(cid) @@ -83,13 +82,13 @@ function movements_asura_elemental_portals.onStepIn(creature, item, position, fr p:teleportTo(k.exit) end end - end, 10*1000*60, player:getId()) + end, 10 * 1000 * 60, player:getId()) else - player:sendCancelMessage('You are still exhausted from your last battle.') + player:sendCancelMessage("You are still exhausted from your last battle.") player:teleportTo(fromPosition, true) end else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You must wait. Someone is challenging '..k.bossName..' now.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You must wait. Someone is challenging " .. k.bossName .. " now.") player:teleportTo(fromPosition, true) end else @@ -102,7 +101,7 @@ function movements_asura_elemental_portals.onStepIn(creature, item, position, fr if position == hiddenMap then if player:getStorageValue(quest) == 5 then player:addItem(28908, 1) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have discovered an old writing desk that contains an ancient map.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have discovered an old writing desk that contains an ancient map.") player:setStorageValue(quest, 6) end end @@ -117,4 +116,4 @@ function movements_asura_elemental_portals.onStepIn(creature, item, position, fr end movements_asura_elemental_portals:aid(4914, 4915) -movements_asura_elemental_portals:register() \ No newline at end of file +movements_asura_elemental_portals:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua index b3e24a6930e..9924b14933b 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua @@ -12,14 +12,14 @@ function creaturescripts_library_bosses.onKill(player, creature) end local monsterStorages = { - ["grand commander soeren"] = {stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 1}, - ["preceptor lazare"] = {stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 2}, - ["grand chaplain gaunder"] = {stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 3}, - ["grand canon dominus"] = {stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 4}, - ["dazzled leaf golem"] = {stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 5}, - ["grand master oberon"] = {stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 6, achievements = {'Millennial Falcon', 'Master Debater'}, lastBoss = true}, - ["brokul"] = {stg = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 7}, - ["the flaming orchid"] = {stg = Storage.Quest.U11_80.TheSecretLibrary.Asuras.flammingOrchid, value = 1}, + ["grand commander soeren"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 1 }, + ["preceptor lazare"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 2 }, + ["grand chaplain gaunder"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 3 }, + ["grand canon dominus"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 4 }, + ["dazzled leaf golem"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 5 }, + ["grand master oberon"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 6, achievements = { "Millennial Falcon", "Master Debater" }, lastBoss = true }, + ["brokul"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 7 }, + ["the flaming orchid"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.Asuras.flammingOrchid, value = 1 }, } local monsterName = creature:getName():lower() @@ -50,7 +50,6 @@ end creaturescripts_library_bosses:register() - local creaturescripts_library_bosses_oberon = CreatureEvent("oberonImmune") function creaturescripts_library_bosses_oberon.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) @@ -59,4 +58,4 @@ function creaturescripts_library_bosses_oberon.onHealthChange(creature, attacker return primaryDamage, primaryType, secondaryDamage, secondaryType end -creaturescripts_library_bosses_oberon:register() \ No newline at end of file +creaturescripts_library_bosses_oberon:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_login.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_login.lua index f9e9ee258f4..73a1e37c8ce 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_login.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_login.lua @@ -5,4 +5,4 @@ function creaturescripts_library_login.onLogin(player) return true end -creaturescripts_library_login:register() \ No newline at end of file +creaturescripts_library_login:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_chests.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_chests.lua index 833b56ef6a6..b11d6209acb 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_chests.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_chests.lua @@ -1,9 +1,9 @@ local chests = { - [1] = {position = Position(32970, 32314, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.FirstChest, reward = 28538, questlog = true}, - [2] = {position = Position(32980, 32308, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.SecondChest, reward = 28536, questlog = true}, - [3] = {position = Position(32955, 32282, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.ThirdChest, reward = 28537, questlog = false}, - [4] = {position = Position(32983, 32289, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.FourthChest, reward = 28535, questlog = false}, - [5] = {position = Position(32944, 32309, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.FifthChest, reward = 28818, questlog = true} + [1] = { position = Position(32970, 32314, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.FirstChest, reward = 28538, questlog = true }, + [2] = { position = Position(32980, 32308, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.SecondChest, reward = 28536, questlog = true }, + [3] = { position = Position(32955, 32282, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.ThirdChest, reward = 28537, questlog = false }, + [4] = { position = Position(32983, 32289, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.FourthChest, reward = 28535, questlog = false }, + [5] = { position = Position(32944, 32309, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.FifthChest, reward = 28818, questlog = true }, } local actions_desert_chests = Action() @@ -13,13 +13,13 @@ function actions_desert_chests.onUse(player, item, fromPosition, target, toPosit if toPosition == k.position then if player:getStorageValue(k.storage) ~= 1 then if k.questlog then - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline)+1) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline) + 1) end player:addItem(k.reward, 1) player:setStorageValue(k.storage, 1) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. ItemType(k.reward):getName():lower() .. '.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a " .. ItemType(k.reward):getName():lower() .. ".") else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It is empty.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is empty.") end end end @@ -28,4 +28,4 @@ function actions_desert_chests.onUse(player, item, fromPosition, target, toPosit end actions_desert_chests:aid(4931) -actions_desert_chests:register() \ No newline at end of file +actions_desert_chests:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_doors.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_doors.lua index 293f04976bc..af6f490e1d2 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_doors.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_doors.lua @@ -1,27 +1,25 @@ local doors = { - [1] = {doorPosition = Position(32963, 32319, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, nivel = 40}, - [2] = {doorPosition = Position(32955, 32304, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, nivel = 40}, - [3] = {doorPosition = Position(32984, 32314, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.SecondChest, nivel = 1}, - [4] = {doorPosition = Position(32968, 32324, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.SecondChest, nivel = 1}, - [5] = {doorPosition = Position(32978, 32290, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.EatenFood, nivel = 1}, - [6] = {doorPosition = Position(32963, 32297, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, nivel = 7}, - [7] = {doorPosition = Position(32963, 32299, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, nivel = 7}, - [8] = {doorPosition = Position(32963, 32301, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, nivel = 7}, - [9] = {doorPosition = Position(32963, 32303, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, nivel = 7}, - + [1] = { doorPosition = Position(32963, 32319, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, nivel = 40 }, + [2] = { doorPosition = Position(32955, 32304, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, nivel = 40 }, + [3] = { doorPosition = Position(32984, 32314, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.SecondChest, nivel = 1 }, + [4] = { doorPosition = Position(32968, 32324, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.SecondChest, nivel = 1 }, + [5] = { doorPosition = Position(32978, 32290, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.EatenFood, nivel = 1 }, + [6] = { doorPosition = Position(32963, 32297, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, nivel = 7 }, + [7] = { doorPosition = Position(32963, 32299, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, nivel = 7 }, + [8] = { doorPosition = Position(32963, 32301, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, nivel = 7 }, + [9] = { doorPosition = Position(32963, 32303, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, nivel = 7 }, } local actions_desert_doors = Action() function actions_desert_doors.onUse(player, item, fromPosition, target, toPosition, isHotkey) for _, p in pairs(doors) do - if (item:getPosition() == p.doorPosition) and not(Tile(item:getPosition()):getTopCreature()) - and isInArray({8361, 8355, 20450}, item.itemid)then + if (item:getPosition() == p.doorPosition) and not (Tile(item:getPosition()):getTopCreature()) and isInArray({ 8361, 8355, 20450 }, item.itemid) then if player:getStorageValue(p.storage) >= p.nivel then player:teleportTo(toPosition, true) item:transform(item.itemid + 1) else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'The door seems to be sealed against unwanted intruders.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.") end end end @@ -29,4 +27,4 @@ function actions_desert_doors.onUse(player, item, fromPosition, target, toPositi end actions_desert_doors:aid(4930) -actions_desert_doors:register() \ No newline at end of file +actions_desert_doors:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_totems.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_totems.lua index 8839429eb81..86fd5d2edca 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_totems.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_totems.lua @@ -1,8 +1,8 @@ local totems = { - {toPosition = Position(32945, 32292, 8), targetId = 28531, toId = 28532, itemId = 28535, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.FirstTotem}, - {toPosition = Position(32947, 32292, 8), targetId = 28527, toId = 28528, itemId = 28537, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.SecondTotem}, - {toPosition = Position(32949, 32292, 8), targetId = 28533, toId = 28534, itemId = 28538, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.ThirdTotem}, - {toPosition = Position(32951, 32292, 8), targetId = 28529, toId = 28530, itemId = 28536, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.FourthTotem}, + { toPosition = Position(32945, 32292, 8), targetId = 28531, toId = 28532, itemId = 28535, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.FirstTotem }, + { toPosition = Position(32947, 32292, 8), targetId = 28527, toId = 28528, itemId = 28537, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.SecondTotem }, + { toPosition = Position(32949, 32292, 8), targetId = 28533, toId = 28534, itemId = 28538, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.ThirdTotem }, + { toPosition = Position(32951, 32292, 8), targetId = 28529, toId = 28530, itemId = 28536, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.FourthTotem }, } local function isQuestComplete(cid) @@ -35,12 +35,12 @@ function actions_desert_totems.onUse(player, item, fromPosition, target, toPosit target:transform(k.toId) item:remove(1) player:setStorageValue(k.storage, 1) - addEvent(revert, 15*1000, k.targetId, k.toId, toPosition) + addEvent(revert, 15 * 1000, k.targetId, k.toId, toPosition) end end if isQuestComplete(player:getId()) then player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, 7) - player:say('Access granted!', TALKTYPE_MONSTER_SAY) + player:say("Access granted!", TALKTYPE_MONSTER_SAY) end end end diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_color_puzzle.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_color_puzzle.lua index baa19a49548..d7b635a9857 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_color_puzzle.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_color_puzzle.lua @@ -1,7 +1,7 @@ local color = { - [1] = {itemid = 4858, position = Position(32945, 32288, 10), value = 2, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.RedColor}, - [2] = {itemid = 5581, position = Position(32948, 32288, 10), value = 1, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.GreenColor}, - [3] = {itemid = 8695, position = Position(32951, 32288, 10), value = 3, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.BlueColor}, + [1] = { itemid = 4858, position = Position(32945, 32288, 10), value = 2, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.RedColor }, + [2] = { itemid = 5581, position = Position(32948, 32288, 10), value = 1, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.GreenColor }, + [3] = { itemid = 8695, position = Position(32951, 32288, 10), value = 3, storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.BlueColor }, } local movements_desert_color_puzzle = MoveEvent() @@ -27,10 +27,9 @@ function movements_desert_color_puzzle.onStepIn(creature, item, position, fromPo end end end - if player:getStorageValue(color[1].storage) == color[1].value and player:getStorageValue(color[2].storage) == color[2].value - and player:getStorageValue(color[3].storage) == color[3].value then + if player:getStorageValue(color[1].storage) == color[1].value and player:getStorageValue(color[2].storage) == color[2].value and player:getStorageValue(color[3].storage) == color[3].value then player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.ColorPuzzle, 1) - player:say('Access granted!', TALKTYPE_MONSTER_SAY) + player:say("Access granted!", TALKTYPE_MONSTER_SAY) end end end @@ -39,4 +38,4 @@ function movements_desert_color_puzzle.onStepIn(creature, item, position, fromPo end movements_desert_color_puzzle:aid(4933) -movements_desert_color_puzzle:register() \ No newline at end of file +movements_desert_color_puzzle:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_teleportTo.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_teleportTo.lua index 65298337de1..3852f47a5cc 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_teleportTo.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_teleportTo.lua @@ -7,59 +7,59 @@ local exit = Position(32963, 32307, 8) local bossName = "furious scorpion" local teleports = { - [1] = {position = Position(33110, 32385, 7), destination = Position(32958, 32320, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 1}, - [2] = {position = Position(32958, 32322, 8), destination = Position(33110, 32387, 7)}, - [3] = {position = Position(32955, 32288, 10), destination = Position(32955, 32284, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.ColorPuzzle, value = 1, challenge = true}, - [4] = {position = Position(32942, 32283, 10), destination = Position(32942, 32288, 10)}, - [5] = {position = Position(32945, 32313, 8), destination = Position(33101, 32381, 7)} + [1] = { position = Position(33110, 32385, 7), destination = Position(32958, 32320, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 1 }, + [2] = { position = Position(32958, 32322, 8), destination = Position(33110, 32387, 7) }, + [3] = { position = Position(32955, 32288, 10), destination = Position(32955, 32284, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.ColorPuzzle, value = 1, challenge = true }, + [4] = { position = Position(32942, 32283, 10), destination = Position(32942, 32288, 10) }, + [5] = { position = Position(32945, 32313, 8), destination = Position(33101, 32381, 7) }, } local tileAccess = { - [1] = {position = Position(32974, 32296, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 2}, - [2] = {position = Position(32967, 32319, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 3}, - [3] = {position = Position(32978, 32290, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 6} + [1] = { position = Position(32974, 32296, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 2 }, + [2] = { position = Position(32967, 32319, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 3 }, + [3] = { position = Position(32978, 32290, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 6 }, } local puzzle = { - {position = Position(32965, 32310, 9), value = 1}, - {position = Position(32965, 32309, 9), value = 2}, - {position = Position(32964, 32309, 9), value = 3}, - {position = Position(32963, 32309, 9), value = 4}, - {position = Position(32962, 32309, 9), value = 5}, - {position = Position(32961, 32309, 9), value = 6}, - {position = Position(32960, 32309, 9), value = 7}, - {position = Position(32959, 32309, 9), value = 8}, - {position = Position(32959, 32310, 9), value = 9}, - {position = Position(32959, 32311, 9), value = 10}, - {position = Position(32958, 32311, 9), value = 11}, - {position = Position(32957, 32311, 9), value = 12}, - {position = Position(32956, 32311, 9), value = 13}, - {position = Position(32956, 32310, 9), value = 14}, - {position = Position(32955, 32310, 9), value = 15}, - {position = Position(32954, 32310, 9), value = 16}, - {position = Position(32953, 32310, 9), value = 17}, - {position = Position(32953, 32311, 9), value = 18}, - {position = Position(32953, 32312, 9), value = 19}, - {position = Position(32953, 32313, 9), value = 20}, - {position = Position(32953, 32314, 9), value = 21}, - {position = Position(32954, 32314, 9), value = 22}, - {position = Position(32955, 32314, 9), value = 23}, - {position = Position(32956, 32314, 9), value = 24}, - {position = Position(32956, 32315, 9), value = 25}, - {position = Position(32956, 32316, 9), value = 26}, - {position = Position(32956, 32317, 9), value = 27}, - {position = Position(32957, 32317, 9), value = 28}, - {position = Position(32957, 32318, 9), value = 29}, - {position = Position(32957, 32319, 9), value = 30}, - {position = Position(32958, 32319, 9), value = 31}, - {position = Position(32959, 32319, 9), value = 32}, - {position = Position(32960, 32319, 9), value = 33}, - {position = Position(32960, 32318, 9), value = 34}, - {position = Position(32960, 32317, 9), value = 35}, - {position = Position(32961, 32317, 9), value = 36}, - {position = Position(32962, 32317, 9), value = 37}, - {position = Position(32962, 32318, 9), value = 38}, - {position = Position(32962, 32319, 9), value = 39} + { position = Position(32965, 32310, 9), value = 1 }, + { position = Position(32965, 32309, 9), value = 2 }, + { position = Position(32964, 32309, 9), value = 3 }, + { position = Position(32963, 32309, 9), value = 4 }, + { position = Position(32962, 32309, 9), value = 5 }, + { position = Position(32961, 32309, 9), value = 6 }, + { position = Position(32960, 32309, 9), value = 7 }, + { position = Position(32959, 32309, 9), value = 8 }, + { position = Position(32959, 32310, 9), value = 9 }, + { position = Position(32959, 32311, 9), value = 10 }, + { position = Position(32958, 32311, 9), value = 11 }, + { position = Position(32957, 32311, 9), value = 12 }, + { position = Position(32956, 32311, 9), value = 13 }, + { position = Position(32956, 32310, 9), value = 14 }, + { position = Position(32955, 32310, 9), value = 15 }, + { position = Position(32954, 32310, 9), value = 16 }, + { position = Position(32953, 32310, 9), value = 17 }, + { position = Position(32953, 32311, 9), value = 18 }, + { position = Position(32953, 32312, 9), value = 19 }, + { position = Position(32953, 32313, 9), value = 20 }, + { position = Position(32953, 32314, 9), value = 21 }, + { position = Position(32954, 32314, 9), value = 22 }, + { position = Position(32955, 32314, 9), value = 23 }, + { position = Position(32956, 32314, 9), value = 24 }, + { position = Position(32956, 32315, 9), value = 25 }, + { position = Position(32956, 32316, 9), value = 26 }, + { position = Position(32956, 32317, 9), value = 27 }, + { position = Position(32957, 32317, 9), value = 28 }, + { position = Position(32957, 32318, 9), value = 29 }, + { position = Position(32957, 32319, 9), value = 30 }, + { position = Position(32958, 32319, 9), value = 31 }, + { position = Position(32959, 32319, 9), value = 32 }, + { position = Position(32960, 32319, 9), value = 33 }, + { position = Position(32960, 32318, 9), value = 34 }, + { position = Position(32960, 32317, 9), value = 35 }, + { position = Position(32961, 32317, 9), value = 36 }, + { position = Position(32962, 32317, 9), value = 37 }, + { position = Position(32962, 32318, 9), value = 38 }, + { position = Position(32962, 32319, 9), value = 39 }, } local function startBattle(pid, position, b_name, middle) @@ -99,7 +99,7 @@ function movements_desert_teleportTo.onStepIn(creature, item, position, fromPosi if position == lastTeleport then if resetRoom(scorpionPosition, bossName) then if player:getStorageValue(scorpionTimer) < os.time() then - player:setStorageValue(scorpionTimer, os.time() + 20*60*60) + player:setStorageValue(scorpionTimer, os.time() + 20 * 60 * 60) startBattle(player:getId(), Position(32958, 32309, 8), bossName, scorpionPosition) addEvent(function(cid) local p = Player(cid) @@ -108,13 +108,13 @@ function movements_desert_teleportTo.onStepIn(creature, item, position, fromPosi p:teleportTo(exit) end end - end, 5*1000*60, player:getId()) + end, 5 * 1000 * 60, player:getId()) else - player:sendCancelMessage('You are still exhausted from your last battle.') + player:sendCancelMessage("You are still exhausted from your last battle.") player:teleportTo(fromPosition, true) end else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You must wait. Someone is challenging Furious Scorpion now.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You must wait. Someone is challenging Furious Scorpion now.") player:teleportTo(fromPosition, true) end else @@ -125,7 +125,7 @@ function movements_desert_teleportTo.onStepIn(creature, item, position, fromPosi player:teleportTo(k.destination) else if k.challenge then - player:say('You have to master the challenge first!', TALKTYPE_MONSTER_SAY) + player:say("You have to master the challenge first!", TALKTYPE_MONSTER_SAY) end player:teleportTo(fromPosition, true) end @@ -141,16 +141,16 @@ function movements_desert_teleportTo.onStepIn(creature, item, position, fromPosi if position == k.position then if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm) < #puzzle then if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm) == k.value then - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm)+1) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm) + 1) player:getPosition():sendMagicEffect(CONST_ME_SOUND_WHITE) else player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, 1) player:getPosition():sendMagicEffect(CONST_ME_SOUND_RED) end elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm) == #puzzle then - player:say('Access granted!', TALKTYPE_MONSTER_SAY) + player:say("Access granted!", TALKTYPE_MONSTER_SAY) player:getPosition():sendMagicEffect(CONST_ME_SOUND_WHITE) - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm)+1) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm) + 1) end end end @@ -168,4 +168,4 @@ function movements_desert_teleportTo.onStepIn(creature, item, position, fromPosi end movements_desert_teleportTo:aid(4930, 4931, 4932) -movements_desert_teleportTo:register() \ No newline at end of file +movements_desert_teleportTo:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_doors.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_doors.lua index f12ff1951c6..f56002172a1 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_doors.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_doors.lua @@ -1,55 +1,55 @@ local doors = { - [1] = {doorPosition = Position(33376, 31323, 2), nivel = -1}, - [2] = {doorPosition = Position(33376, 31335, 3), nivel = 1}, - [3] = {doorPosition = Position(33376, 31349, 4), nivel = 2}, - [4] = {doorPosition = Position(33363, 31346, 7), nivel = 4}, -- última porta!! + [1] = { doorPosition = Position(33376, 31323, 2), nivel = -1 }, + [2] = { doorPosition = Position(33376, 31335, 3), nivel = 1 }, + [3] = { doorPosition = Position(33376, 31349, 4), nivel = 2 }, + [4] = { doorPosition = Position(33363, 31346, 7), nivel = 4 }, -- última porta!! } local boats = { - [1] = {boatPosition = Position(33373, 31309, 7), nivel = 3, toPosition = Position(33382, 31292, 7), message = "A small island emerges out of the mist as you row towards a tiny light inside a dark, forehoding chapel."}, - [2] = {boatPosition = Position(33381, 31294, 7), nivel = 3, toPosition = Position(33374, 31309, 7), message = "Your heart lightens as you return from the gloomy isle."}, - [3] = {boatPosition = Position(33344, 31348, 7), nivel = 3, toPosition = Position(33326, 31352, 7)}, - [4] = {boatPosition = Position(33328, 31352, 7), nivel = 3, toPosition = Position(33346, 31348, 7)}, + [1] = { boatPosition = Position(33373, 31309, 7), nivel = 3, toPosition = Position(33382, 31292, 7), message = "A small island emerges out of the mist as you row towards a tiny light inside a dark, forehoding chapel." }, + [2] = { boatPosition = Position(33381, 31294, 7), nivel = 3, toPosition = Position(33374, 31309, 7), message = "Your heart lightens as you return from the gloomy isle." }, + [3] = { boatPosition = Position(33344, 31348, 7), nivel = 3, toPosition = Position(33326, 31352, 7) }, + [4] = { boatPosition = Position(33328, 31352, 7), nivel = 3, toPosition = Position(33346, 31348, 7) }, } local actions_falcon_doors = Action() function actions_falcon_doors.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if item:getActionId() == 4920 then -- Portas!! - for _, p in pairs(doors) do - local door = p.doorPosition - local nivel = p.nivel - if (item:getPosition() == door) and not(Tile(item:getPosition()):getTopCreature()) then - if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses) >= nivel then - player:teleportTo(toPosition, true) - item:transform(item.itemid + 1) - else + if item:getActionId() == 4920 then -- Portas!! + for _, p in pairs(doors) do + local door = p.doorPosition + local nivel = p.nivel + if (item:getPosition() == door) and not (Tile(item:getPosition()):getTopCreature()) then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses) >= nivel then + player:teleportTo(toPosition, true) + item:transform(item.itemid + 1) + else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.") - end end end - elseif item:getActionId() == 4921 then -- Barcos!! - for _, p in pairs(boats) do - local boat = p.boatPosition - local nivel = p.nivel - local toPos = p.toPosition - local message = p.message - if item:getPosition() == boat then - if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses) >= nivel then - player:teleportTo(toPos, true) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - if message then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) - end - else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can not use this boat yet.") + end + elseif item:getActionId() == 4921 then -- Barcos!! + for _, p in pairs(boats) do + local boat = p.boatPosition + local nivel = p.nivel + local toPos = p.toPosition + local message = p.message + if item:getPosition() == boat then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses) >= nivel then + player:teleportTo(toPos, true) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + if message then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) end + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can not use this boat yet.") end end end + end return true end actions_falcon_doors:aid(4920, 4921) -actions_falcon_doors:register() \ No newline at end of file +actions_falcon_doors:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_oberonLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_oberonLever.lua index a36459656e4..5578096c0ad 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_oberonLever.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_oberonLever.lua @@ -16,19 +16,19 @@ function actions_falcon_oberon_lever.onUse(player, item, fromPosition, itemEx, t nplayer:teleportTo(Position(33365, 31323, 9), true) nplayer:getPosition():sendMagicEffect(CONST_ME_TELEPORT) table.insert(playersTable, nplayer:getId()) - nplayer:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonTimer, os.time() + 20*60*60) + nplayer:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonTimer, os.time() + 20 * 60 * 60) end end local oberon = Game.createMonster("Grand Master Oberon", Position(33365, 31318, 9)) if oberon then oberon:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonHeal, 0) end - Game.setStorageValue(GlobalStorage.secretLibrary.FalconBastion.OberonSay, - 1) + Game.setStorageValue(GlobalStorage.secretLibrary.FalconBastion.OberonSay, -1) Game.createNpc("Oberon's Spite", Position(33363, 31321, 9)) Game.createNpc("Oberon's Ire", Position(33368, 31321, 9)) Game.createNpc("Oberon's Bile", Position(33363, 31317, 9)) Game.createNpc("Oberon's Hate", Position(33368, 31317, 9)) - addEvent(kickPlayersAfterTime, 30*60*1000, playersTable, fromPosition_, toPosition_, exitPosition) + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, fromPosition_, toPosition_, exitPosition) end end @@ -36,4 +36,4 @@ function actions_falcon_oberon_lever.onUse(player, item, fromPosition, itemEx, t end actions_falcon_oberon_lever:aid(4922) -actions_falcon_oberon_lever:register() \ No newline at end of file +actions_falcon_oberon_lever:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/movements_bossEntrance.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/movements_bossEntrance.lua index ec22d6f87e9..6e4c94edc39 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/movements_bossEntrance.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/movements_bossEntrance.lua @@ -30,7 +30,7 @@ function movements_falcon_bossEntrance.onStepIn(creature, item, position, fromPo Position(33328, 31352, 7), Position(33373, 31309, 7), Position(33381, 31294, 7), - Position(33344, 31348, 7) + Position(33344, 31348, 7), } if creature then if isInArray(blockedPositions, position) then @@ -40,7 +40,7 @@ function movements_falcon_bossEntrance.onStepIn(creature, item, position, fromPo creature:teleportTo(Position(33359, 31340, 9), true) else creature:teleportTo(fromPosition, true) - creature:sendCancelMessage('You are still exhausted from your last battle.') + creature:sendCancelMessage("You are still exhausted from your last battle.") end end end @@ -50,4 +50,4 @@ function movements_falcon_bossEntrance.onStepIn(creature, item, position, fromPo end movements_falcon_bossEntrance:aid(4920, 4921) -movements_falcon_bossEntrance:register() \ No newline at end of file +movements_falcon_bossEntrance:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_chests.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_chests.lua index 791e63f6535..aafc676b172 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_chests.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_chests.lua @@ -1,9 +1,9 @@ local chests = { - [4920] = {storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Parchment, reward = 28650, amount = 1}, - [4921] = {storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Sapphire, reward = 675, amount = 2}, - [4922] = {storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Fishing, reward = 3483, amount = 1}, - [4923] = {storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Shovel, reward = 3457, amount = 1}, - [4925] = {storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Hawser, reward = 28707, amount = 1}, + [4920] = { storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Parchment, reward = 28650, amount = 1 }, + [4921] = { storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Sapphire, reward = 675, amount = 2 }, + [4922] = { storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Fishing, reward = 3483, amount = 1 }, + [4923] = { storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Shovel, reward = 3457, amount = 1 }, + [4925] = { storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Hawser, reward = 28707, amount = 1 }, } local actions_isles_chests = Action() @@ -14,17 +14,17 @@ function actions_isles_chests.onUse(player, item, fromPosition, target, toPositi return true end - local article = 'a' + local article = "a" if player:getStorageValue(chest.storage) ~= 1 then player:addItem(chest.reward, chest.amount) player:setStorageValue(chest.storage, 1) if chest.amount > 1 then - article = '' ..chest.amount + article = "" .. chest.amount end - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format('You have found %s %s.', article, ItemType(chest.reward):getName():lower())) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("You have found %s %s.", article, ItemType(chest.reward):getName():lower())) else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It is empty.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is empty.") end return true @@ -34,4 +34,4 @@ for uid in pairs(chests) do actions_isles_chests:uid(uid) end -actions_isles_chests:register() \ No newline at end of file +actions_isles_chests:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_telescope.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_telescope.lua index d2096aa5b91..191db8e4cc6 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_telescope.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_telescope.lua @@ -3,11 +3,11 @@ local actions_isles_telescope = Action() function actions_isles_telescope.onUse(player, item, fromPosition, itemEx, toPosition) if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.BoatStages) == 2 then player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.BoatStages, 3) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'The telescope provides a perfect view over the endless ocean - no land in sight') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The telescope provides a perfect view over the endless ocean - no land in sight") end return true end actions_isles_telescope:aid(4935) -actions_isles_telescope:register() \ No newline at end of file +actions_isles_telescope:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_boat_puzzle.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_boat_puzzle.lua index 17cfeeacf79..573776cc699 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_boat_puzzle.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_boat_puzzle.lua @@ -8,24 +8,24 @@ function movements_isle_color_puzzle.onStepIn(creature, item, position, fromPosi local boatStage = player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.BoatStages) if item.actionid == 4936 then if boatStage < 1 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You see the scattered parts of a wrecked ship. Miraculously the ship telescope survived the wreckm it seems still to be intact.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You see the scattered parts of a wrecked ship. Miraculously the ship telescope survived the wreckm it seems still to be intact.") player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.BoatStages, 1) elseif boatStage >= 1 and boatStage < 2 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'There are still some loose planks and hawsers. You can\'t use the raft like this, it will sink for sure.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "There are still some loose planks and hawsers. You can't use the raft like this, it will sink for sure.") end elseif item.actionid == 4937 then if boatStage <= 1 then if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Hawser) == 1 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You use the hawser to lash up the loose planks. The raft should be seaworthy now.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You use the hawser to lash up the loose planks. The raft should be seaworthy now.") if player:getItemCount(33209) >= 1 then player:removeItem(33209, 1) end player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.BoatStages, 2) else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You see the scattered parts of a wrecked ship. Miraculously the ship telescope survived the wreck it seems still to be intact.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You see the scattered parts of a wrecked ship. Miraculously the ship telescope survived the wreck it seems still to be intact.") end elseif boatStage == 2 then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Witout any points of orientation you will never find your way back. Try to find a way to improve your navigation.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Witout any points of orientation you will never find your way back. Try to find a way to improve your navigation.") elseif boatStage == 3 then player:teleportTo(Position(32187, 32473, 7)) if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline) ~= 3 then @@ -38,4 +38,4 @@ function movements_isle_color_puzzle.onStepIn(creature, item, position, fromPosi end movements_isle_color_puzzle:aid(4936, 4937) -movements_isle_color_puzzle:register() \ No newline at end of file +movements_isle_color_puzzle:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_stepIn.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_stepIn.lua index dc157564b73..a1033c904ca 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_stepIn.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_stepIn.lua @@ -5,22 +5,22 @@ local raxias = { storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.RaxiasTimer, exit = Position(33462, 32159, 7), toPosition = Position(33466, 32156, 8), - bossName = 'Raxias', - bossPos = Position(33466, 32161, 8) + bossName = "Raxias", + bossPos = Position(33466, 32161, 8), } local turtle = { fromPosition = Position(32460, 32928, 7), toPosition = Position(32316, 32701, 7), - storageTimer = GlobalStorage.secretLibrary.SmallIslands.Turtle + storageTimer = GlobalStorage.secretLibrary.SmallIslands.Turtle, } local svargrond = { fromPosition = Position(32119, 31734, 7), - toPosition = Position(32127, 31665, 7) + toPosition = Position(32127, 31665, 7), } -local defaultMessage = 'You have ten minutes to kill and loot this monster, else you will lose that chance and will be kicked out.' +local defaultMessage = "You have ten minutes to kill and loot this monster, else you will lose that chance and will be kicked out." local function resetRoom(position) local spec = Game.getSpectators(position, false, false, 5, 5, 5, 5) @@ -61,7 +61,7 @@ function movements_isle_stepIn.onStepIn(creature, item, position, fromPosition) if Game.getStorageValue(turtle.storageTimer) > os.time() then player:teleportTo(turtle.toPosition) else - player:say('The turtle is hungry... You must feed it.', TALKTYPE_MONSTER_SAY) + player:say("The turtle is hungry... You must feed it.", TALKTYPE_MONSTER_SAY) player:teleportTo(fromPosition, true) end player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) @@ -72,7 +72,7 @@ function movements_isle_stepIn.onStepIn(creature, item, position, fromPosition) if resetRoom(raxias.bossPos) then if player:getStorageValue(raxias.storage) < os.time() then startBattle(player:getId(), raxias.toPosition, raxias.bossName, raxias.bossPos) - player:setStorageValue(raxias.storage, os.time() + 20*60*60) + player:setStorageValue(raxias.storage, os.time() + 20 * 60 * 60) addEvent(function(cid) local p = Player(cid) if p then @@ -80,13 +80,13 @@ function movements_isle_stepIn.onStepIn(creature, item, position, fromPosition) p:teleportTo(raxias.exit) end end - end, 10*1000*60, player:getId()) + end, 10 * 1000 * 60, player:getId()) else - player:sendCancelMessage('You are still exhausted from your last battle.') + player:sendCancelMessage("You are still exhausted from your last battle.") player:teleportTo(fromPosition, true) end else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You must wait. Someone is challenging '.. raxias.bossName ..' now.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You must wait. Someone is challenging " .. raxias.bossName .. " now.") player:teleportTo(fromPosition, true) end end @@ -95,4 +95,4 @@ function movements_isle_stepIn.onStepIn(creature, item, position, fromPosition) end movements_isle_stepIn:aid(4935) -movements_isle_stepIn:register() \ No newline at end of file +movements_isle_stepIn:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua index 42b7f33fd87..95afc9fc41f 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua @@ -1,63 +1,62 @@ -- Mazzinor info start local mazzinorSummons = { - name = 'Wild Knowledge', - eventName = 'mazzinorDeath', + name = "Wild Knowledge", + eventName = "mazzinorDeath", middlePosition = Position(32724, 32720, 10), timing = 25, positions = { [1] = Position(32719, 32718, 10), [2] = Position(32723, 32719, 10), [3] = Position(32728, 32718, 10), - [4] = Position(32724, 32724, 10) - } + [4] = Position(32724, 32724, 10), + }, } local ghuloshSummons = { - name = 'Bone Jaw', - eventName = '', + name = "Bone Jaw", + eventName = "", middlePosition = Position(32756, 32721, 10), timing = 25, positions = { - [1] = Position(32755, 32721, 10) - } + [1] = Position(32755, 32721, 10), + }, } local gorzindelSummons = { - name = 'Mean Minion', - name2 = 'Malicious Minion', - eventName = '', + name = "Mean Minion", + name2 = "Malicious Minion", + eventName = "", middlePosition = Position(32687, 32719, 10), timing = 25, positions = { - [1] = Position(32687, 32717, 10) + [1] = Position(32687, 32717, 10), }, positions2 = { - [1] = Position(32687, 32720, 10) + [1] = Position(32687, 32720, 10), }, tomesPosition = { - [1] = {name = "stolen knowledge of armor", position = Position(32687, 32707, 10)}, - [2] = {name = "stolen knowledge of summoning", position = Position(32698, 32715, 10)}, - [3] = {name = "stolen knowledge of lifesteal", position = Position(32693, 32729, 10)}, - [4] = {name = "stolen knowledge of spells", position = Position(32681, 32729, 10)}, - [5] = {name = "stolen knowledge of healing", position = Position(32676, 32715, 10)} - } + [1] = { name = "stolen knowledge of armor", position = Position(32687, 32707, 10) }, + [2] = { name = "stolen knowledge of summoning", position = Position(32698, 32715, 10) }, + [3] = { name = "stolen knowledge of lifesteal", position = Position(32693, 32729, 10) }, + [4] = { name = "stolen knowledge of spells", position = Position(32681, 32729, 10) }, + [5] = { name = "stolen knowledge of healing", position = Position(32676, 32715, 10) }, + }, } - local lokathmorSummons = { - name = 'Knowledge Raider', - eventName = '', + name = "Knowledge Raider", + eventName = "", middlePosition = Position(32751, 32689, 10), timing = 25, positions = { [1] = Position(32747, 32684, 10), [2] = Position(32755, 32684, 10), [3] = Position(32755, 32694, 10), - [4] = Position(32747, 32694, 10) - } + [4] = Position(32747, 32694, 10), + }, } -local bossNames = {'mazzinor', 'supercharged mazzinor', 'lokathmor', 'ghulosh', 'ghuloshz\' deathgaze', 'gorzindel', 'stolen tome of portals'} +local bossNames = { "mazzinor", "supercharged mazzinor", "lokathmor", "ghulosh", "ghuloshz' deathgaze", "gorzindel", "stolen tome of portals" } local function spawnSummons(k, monsterName, eventName, timing, positionTable, middlePosition, isGorzindel) local spectators = Game.getSpectators(middlePosition, false, false, 12, 12, 12, 12) @@ -87,14 +86,18 @@ local function spawnSummons(k, monsterName, eventName, timing, positionTable, mi if k <= 4 then for i = 1, #positionTable do local sqm = positionTable[i] - if sqm then sqm:sendMagicEffect(CONST_ME_TELEPORT) end + if sqm then + sqm:sendMagicEffect(CONST_ME_TELEPORT) + end end k = k + 1 - addEvent(spawnSummons, 2*1000, k, monsterName, eventName, timing, positionTable, middlePosition, isGorzindel) + addEvent(spawnSummons, 2 * 1000, k, monsterName, eventName, timing, positionTable, middlePosition, isGorzindel) else for i = 1, #positionTable do local monster = Game.createMonster(monsterName, positionTable[i]) - if monster then monster:registerEvent(eventName) end + if monster then + monster:registerEvent(eventName) + end end addEvent(function() spawnSummons(1, monsterName, eventName, timing, positionTable, middlePosition, isGorzindel) @@ -105,18 +108,10 @@ end -- Mazzinor info ending local leverInfo = { - [1] = {bossName = 'Mazzinor', storage = Storage.Quest.U11_80.TheSecretLibrary.Library.MazzinorTime, exit = Position(32616, 32532, 13), - position = Position(32720, 32773, 10), type = "x", bossPosition = Position(32724, 32720, 10), - teleportTo = Position(32724, 32726, 10), fromPosition = Position(32715, 32712, 10), toPosition = Position(32733, 32729, 10)}, - [2] = {bossName = 'Lokathmor', storage = Storage.Quest.U11_80.TheSecretLibrary.Library.LokathmorTime, exit = Position(32467, 32654, 12), - position = Position(32720, 32749, 10), type = "x", bossPosition = Position(32751, 32689, 10), - teleportTo = Position(32750, 32694, 10), fromPosition = Position(32741, 32680, 10), toPosition = Position(32759, 32697, 10)}, - [3] = {bossName = 'Ghulosh', storage = Storage.Quest.U11_80.TheSecretLibrary.Library.GhuloshTime, exit = Position(32659, 32713, 13), - position = Position(32746, 32773, 10), type = "x", bossPosition = Position(32756, 32721, 10), - teleportTo = Position(32755, 32727, 10), fromPosition = Position(32745, 32711, 10), toPosition = Position(32768, 32730, 10)}, - [4] = {bossName = 'Gorzindel', storage = Storage.Quest.U11_80.TheSecretLibrary.Library.GorzindelTime, exit = Position(32660, 32734, 12), - position = Position(32746, 32749, 10), type = "x", bossPosition = Position(32685, 32717, 10), - teleportTo = Position(32687, 32724, 10), fromPosition = Position(32671, 32703, 10), toPosition = Position(32702, 32734, 10)}, + [1] = { bossName = "Mazzinor", storage = Storage.Quest.U11_80.TheSecretLibrary.Library.MazzinorTime, exit = Position(32616, 32532, 13), position = Position(32720, 32773, 10), type = "x", bossPosition = Position(32724, 32720, 10), teleportTo = Position(32724, 32726, 10), fromPosition = Position(32715, 32712, 10), toPosition = Position(32733, 32729, 10) }, + [2] = { bossName = "Lokathmor", storage = Storage.Quest.U11_80.TheSecretLibrary.Library.LokathmorTime, exit = Position(32467, 32654, 12), position = Position(32720, 32749, 10), type = "x", bossPosition = Position(32751, 32689, 10), teleportTo = Position(32750, 32694, 10), fromPosition = Position(32741, 32680, 10), toPosition = Position(32759, 32697, 10) }, + [3] = { bossName = "Ghulosh", storage = Storage.Quest.U11_80.TheSecretLibrary.Library.GhuloshTime, exit = Position(32659, 32713, 13), position = Position(32746, 32773, 10), type = "x", bossPosition = Position(32756, 32721, 10), teleportTo = Position(32755, 32727, 10), fromPosition = Position(32745, 32711, 10), toPosition = Position(32768, 32730, 10) }, + [4] = { bossName = "Gorzindel", storage = Storage.Quest.U11_80.TheSecretLibrary.Library.GorzindelTime, exit = Position(32660, 32734, 12), position = Position(32746, 32749, 10), type = "x", bossPosition = Position(32685, 32717, 10), teleportTo = Position(32687, 32724, 10), fromPosition = Position(32671, 32703, 10), toPosition = Position(32702, 32734, 10) }, } local actions_library_bossesLever = Action() @@ -127,7 +122,7 @@ function actions_library_bossesLever.onUse(player, item, fromPosition, itemEx, t for _, lever in pairs(leverInfo) do if toPosition == lever.position then if doCheckBossRoom(player:getId(), lever.bossName, lever.fromPosition, lever.toPosition) then - if lever.type == 'x' then + if lever.type == "x" then local startPos = lever.position.x + 1 for x = startPos, startPos + 4 do local sqm = Tile(Position(x, lever.position.y, lever.position.z)) @@ -136,7 +131,7 @@ function actions_library_bossesLever.onUse(player, item, fromPosition, itemEx, t if c and c:isPlayer() then table.insert(playersTable, c:getId()) c:teleportTo(lever.teleportTo) - c:setStorageValue(lever.storage, os.time() + 20*60*60) + c:setStorageValue(lever.storage, os.time() + 20 * 60 * 60) end end end @@ -145,30 +140,25 @@ function actions_library_bossesLever.onUse(player, item, fromPosition, itemEx, t local monster = Game.createMonster(lever.bossName, lever.bossPosition) if monster then - if lever.bossName:lower() == 'mazzinor' then - addEvent(spawnSummons, 4*1000, 1, mazzinorSummons.name, mazzinorSummons.eventName, - mazzinorSummons.timing, mazzinorSummons.positions, mazzinorSummons.middlePosition, false) - elseif lever.bossName:lower() == 'lokathmor' then - addEvent(spawnSummons, 4*1000, 1, lokathmorSummons.name, lokathmorSummons.eventName, - lokathmorSummons.timing, lokathmorSummons.positions, lokathmorSummons.middlePosition, false) - elseif lever.bossName:lower() == 'ghulosh' then - addEvent(spawnSummons, 4*1000, 1, ghuloshSummons.name, ghuloshSummons.eventName, - ghuloshSummons.timing, ghuloshSummons.positions, ghuloshSummons.middlePosition, false) - local book = Game.createMonster('The Book of Death', Position(32755, 32716, 10)) + if lever.bossName:lower() == "mazzinor" then + addEvent(spawnSummons, 4 * 1000, 1, mazzinorSummons.name, mazzinorSummons.eventName, mazzinorSummons.timing, mazzinorSummons.positions, mazzinorSummons.middlePosition, false) + elseif lever.bossName:lower() == "lokathmor" then + addEvent(spawnSummons, 4 * 1000, 1, lokathmorSummons.name, lokathmorSummons.eventName, lokathmorSummons.timing, lokathmorSummons.positions, lokathmorSummons.middlePosition, false) + elseif lever.bossName:lower() == "ghulosh" then + addEvent(spawnSummons, 4 * 1000, 1, ghuloshSummons.name, ghuloshSummons.eventName, ghuloshSummons.timing, ghuloshSummons.positions, ghuloshSummons.middlePosition, false) + local book = Game.createMonster("The Book of Death", Position(32755, 32716, 10)) Game.setStorageValue(GlobalStorage.secretLibrary.Library.Ghulosh, 1) - elseif lever.bossName:lower() == 'gorzindel' then - addEvent(spawnSummons, 4*1000, 1, gorzindelSummons.name, gorzindelSummons.eventName, - gorzindelSummons.timing, gorzindelSummons.positions, gorzindelSummons.middlePosition, true) - addEvent(spawnSummons, 4*1000, 1, gorzindelSummons.name2, gorzindelSummons.eventName, - gorzindelSummons.timing, gorzindelSummons.positions2, gorzindelSummons.middlePosition, true) - local tome = Game.createMonster('Stolen Tome of Portals', Position(32688, 32715, 10)) + elseif lever.bossName:lower() == "gorzindel" then + addEvent(spawnSummons, 4 * 1000, 1, gorzindelSummons.name, gorzindelSummons.eventName, gorzindelSummons.timing, gorzindelSummons.positions, gorzindelSummons.middlePosition, true) + addEvent(spawnSummons, 4 * 1000, 1, gorzindelSummons.name2, gorzindelSummons.eventName, gorzindelSummons.timing, gorzindelSummons.positions2, gorzindelSummons.middlePosition, true) + local tome = Game.createMonster("Stolen Tome of Portals", Position(32688, 32715, 10)) for _, k in pairs(gorzindelSummons.tomesPosition) do local monster = Game.createMonster(k.name, k.position) - local minion = Game.createMonster('Malicious Minion', k.position) + local minion = Game.createMonster("Malicious Minion", k.position) end end end - addEvent(kickPlayersAfterTime, 30*60*1000, playersTable, lever.fromPosition, lever.toPosition, lever.exit) + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, lever.fromPosition, lever.toPosition, lever.exit) end end end @@ -177,4 +167,4 @@ function actions_library_bossesLever.onUse(player, item, fromPosition, itemEx, t end actions_library_bossesLever:aid(4950) -actions_library_bossesLever:register() \ No newline at end of file +actions_library_bossesLever:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_parchment.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_parchment.lua index 250b7dda38c..1ffb6414c4c 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_parchment.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_parchment.lua @@ -5,11 +5,11 @@ local function isStuck(mustFree) local c = Tile(center):getTopCreature() if c and c:isMonster() then - if c:getName():lower() == 'lokathmor' and c:getSpeed() == 0 then + if c:getName():lower() == "lokathmor" and c:getSpeed() == 0 then if mustFree then - c:say('THE DISCHARGE OF THE BOOK BREAKS LOKATHMORS STANCE!', TALKTYPE_MONSTER_SAY) + c:say("THE DISCHARGE OF THE BOOK BREAKS LOKATHMORS STANCE!", TALKTYPE_MONSTER_SAY) local cHealth = c:getHealth() - local monster = Game.createMonster('Lokathmor', center, true) + local monster = Game.createMonster("Lokathmor", center, true) c:remove() if monster then monster:addHealth(-(monster:getHealth() - cHealth)) @@ -27,7 +27,7 @@ local function freeRoom() local spectators = Game.getSpectators(center, false, false, 9, 9, 9, 9) for _, p in pairs(spectators) do if p and p:isMonster() then - if p:getName():lower() == 'force field' then + if p:getName():lower() == "force field" then p:remove() end end @@ -41,7 +41,7 @@ local actions_library_parchment = Action() function onUse(player, item, fromPosition, target, toPosition, isHotkey) if toPosition == deskPosition then if isStuck(false) then - player:say('THE DARK KNOWLEDGE PILLS THE BOOK WITH RAW POWER. READY TO BE UNLEASHED!', TALKTYPE_MONSTER_SAY) + player:say("THE DARK KNOWLEDGE PILLS THE BOOK WITH RAW POWER. READY TO BE UNLEASHED!", TALKTYPE_MONSTER_SAY) freeRoom() item:remove(1) end @@ -51,4 +51,4 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey) end actions_library_parchment:id(28488) -actions_library_parchment:register() \ No newline at end of file +actions_library_parchment:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua index 14f79a9bc2c..76e85547951 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua @@ -1,17 +1,17 @@ local info = { stages = { - {p = 75, v = 1}, - {p = 50, v = 2}, - {p = 25, v = 3} + { p = 75, v = 1 }, + { p = 50, v = 2 }, + { p = 25, v = 3 }, }, - stg = GlobalStorage.secretLibrary.Library.Ghulosh + stg = GlobalStorage.secretLibrary.Library.Ghulosh, } local function nextStage(storage) if Game.getStorageValue(storage) < 1 then Game.setStorageValue(storage, 1) end - Game.setStorageValue(storage, Game.getStorageValue(storage)+1) + Game.setStorageValue(storage, Game.getStorageValue(storage) + 1) end local creaturescripts_library_ghulosh = CreatureEvent("ghuloshThink") @@ -27,15 +27,15 @@ function creaturescripts_library_ghulosh.onThink(creature, interval) local position = creature:getPosition() local cHealth = creature:getHealth() - local percentageHealth = (cHealth/creature:getMaxHealth())*100 + local percentageHealth = (cHealth / creature:getMaxHealth()) * 100 if percentageHealth <= stage then - local monster = Game.createMonster('ghulosh\' deathgaze', position, true) + local monster = Game.createMonster("ghulosh' deathgaze", position, true) nextStage(info.stg) creature:remove() if monster then monster:addHealth(-(monster:getHealth() - cHealth)) - monster:say('FEEL MY WRATH!!', TALKTYPE_MONSTER_SAY) + monster:say("FEEL MY WRATH!!", TALKTYPE_MONSTER_SAY) end end end @@ -46,7 +46,7 @@ local function doSpawn(monster, k, position) if k <= 4 then position:sendMagicEffect(CONST_ME_TELEPORT) k = k + 1 - addEvent(doSpawn, 2*1000, monster, k, position) + addEvent(doSpawn, 2 * 1000, monster, k, position) else local monster = Game.createMonster(monster, position) end @@ -57,11 +57,11 @@ local creaturescripts_library_ghulosh = CreatureEvent("ghuloshDeath") function creaturescripts_library_ghulosh.onDeath(creature, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) local cPos = creature:getPosition() - if creature:getName():lower() == 'the book of death' then - Game.createMonster('Concentrated Death', cPos) - elseif creature:getName():lower() == 'concentrated death' then - addEvent(doSpawn, 4*1000, 'The Book of Death', 1, Position(32755, 32716, 10)) + if creature:getName():lower() == "the book of death" then + Game.createMonster("Concentrated Death", cPos) + elseif creature:getName():lower() == "concentrated death" then + addEvent(doSpawn, 4 * 1000, "The Book of Death", 1, Position(32755, 32716, 10)) end end -creaturescripts_library_ghulosh:register() \ No newline at end of file +creaturescripts_library_ghulosh:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_gorzindel.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_gorzindel.lua index e666f7bc803..37d11f35a9a 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_gorzindel.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_gorzindel.lua @@ -29,12 +29,12 @@ function creaturescripts_gorzindel.onDeath(creature, corpse, killer, mostDamageK c:getPosition():sendMagicEffect(CONST_ME_POFF) c:remove() elseif c:getName():lower() == "gorzindel" then - c:unregisterEvent('gorzindelHealth') + c:unregisterEvent("gorzindelHealth") end end end end - end, 1*1000) + end, 1 * 1000) elseif creature:getName():lower() == "stolen tome of portals" then local portal = Game.createItem(1949, 1, cPos) if portal then @@ -45,14 +45,13 @@ function creaturescripts_gorzindel.onDeath(creature, corpse, killer, mostDamageK if sqm then sqm:remove(1) end - end, 10*1000) + end, 10 * 1000) end end end creaturescripts_gorzindel:register() - local creaturescripts_gorzindel = CreatureEvent("gorzindelHealth") function creaturescripts_gorzindel.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) @@ -61,4 +60,4 @@ function creaturescripts_gorzindel.onHealthChange(creature, attacker, primaryDam return primaryDamage, primaryType, secondaryDamage, secondaryType end -creaturescripts_gorzindel:register() \ No newline at end of file +creaturescripts_gorzindel:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_lokathmor.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_lokathmor.lua index 44969d7b485..b01ec8373c5 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_lokathmor.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_lokathmor.lua @@ -9,4 +9,4 @@ function creaturescripts_library_lokathmor.onDeath(creature, corpse, killer, mos end end -creaturescripts_library_lokathmor:register() \ No newline at end of file +creaturescripts_library_lokathmor:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_mazzinor.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_mazzinor.lua index d4e04a194cd..1931906f9bb 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_mazzinor.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_mazzinor.lua @@ -14,14 +14,13 @@ function creaturescripts_library_mazzinor.onDeath(creature, corpse, killer, most if item then item:remove() end - end, 1*1000*60, cPos) + end, 1 * 1000 * 60, cPos) end end end creaturescripts_library_mazzinor:register() - local creaturescripts_library_mazzinor = CreatureEvent("mazzinorHealth") function creaturescripts_library_mazzinor.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) @@ -31,4 +30,4 @@ function creaturescripts_library_mazzinor.onHealthChange(creature, attacker, pri return primaryDamage, primaryType, secondaryDamage, secondaryType end -creaturescripts_library_mazzinor:register() \ No newline at end of file +creaturescripts_library_mazzinor:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_gorzindel.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_gorzindel.lua index 0b946eecfdd..8ecf9f94ecd 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_gorzindel.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_gorzindel.lua @@ -1,9 +1,9 @@ local tomesPosition = { - [1] = {position = Position(32687, 32707, 10), open = true}, - [2] = {position = Position(32698, 32715, 10), open = true}, - [3] = {position = Position(32693, 32729, 10), open = true}, - [4] = {position = Position(32681, 32729, 10), open = true}, - [5] = {position = Position(32676, 32715, 10), open = true} + [1] = { position = Position(32687, 32707, 10), open = true }, + [2] = { position = Position(32698, 32715, 10), open = true }, + [3] = { position = Position(32693, 32729, 10), open = true }, + [4] = { position = Position(32681, 32729, 10), open = true }, + [5] = { position = Position(32676, 32715, 10), open = true }, } local middlePosition = Position(32687, 32719, 10) @@ -27,7 +27,7 @@ function movements_library_gorzindel.onStepIn(creature, item, position, fromPosi p:teleportTo(middlePosition) k.open = true end - end, 10*1000, player:getId()) + end, 10 * 1000, player:getId()) break end end @@ -36,4 +36,4 @@ function movements_library_gorzindel.onStepIn(creature, item, position, fromPosi end movements_library_gorzindel:aid(4952) -movements_library_gorzindel:register() \ No newline at end of file +movements_library_gorzindel:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_mazzinor.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_mazzinor.lua index d9c38d5b109..aadc7528105 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_mazzinor.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_mazzinor.lua @@ -1,6 +1,6 @@ local outfit = createConditionObject(CONDITION_OUTFIT) -setConditionParam(outfit, CONDITION_PARAM_TICKS, 30*1000) -addOutfitCondition(outfit, {lookType = 1065}) +setConditionParam(outfit, CONDITION_PARAM_TICKS, 30 * 1000) +addOutfitCondition(outfit, { lookType = 1065 }) local movements_library_mazzinor = MoveEvent() @@ -18,4 +18,4 @@ function movements_library_mazzinor.onStepIn(creature, item, position, fromPosit end movements_library_mazzinor:aid(4951) -movements_library_mazzinor:register() \ No newline at end of file +movements_library_mazzinor:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_timers.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_timers.lua index 3176f30a353..70c40365f7d 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_timers.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_timers.lua @@ -1,8 +1,8 @@ local timers = { - [1] = {position = Position(32616, 32529, 13), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.MazzinorTime, toPosition = Position(32720, 32770, 10)}, - [2] = {position = Position(32464, 32654, 12), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.LokathmorTime, toPosition = Position(32720, 32746, 10)}, - [3] = {position = Position(32662, 32713, 13), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.GhuloshTime, toPosition = Position(32746, 32770, 10)}, - [4] = {position = Position(32660, 32736, 12), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.GorzindelTime, toPosition = Position(32746, 32746, 10)}, + [1] = { position = Position(32616, 32529, 13), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.MazzinorTime, toPosition = Position(32720, 32770, 10) }, + [2] = { position = Position(32464, 32654, 12), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.LokathmorTime, toPosition = Position(32720, 32746, 10) }, + [3] = { position = Position(32662, 32713, 13), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.GhuloshTime, toPosition = Position(32746, 32770, 10) }, + [4] = { position = Position(32660, 32736, 12), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.GorzindelTime, toPosition = Position(32746, 32746, 10) }, } local movements_library_timers = MoveEvent() @@ -20,7 +20,7 @@ function movements_library_timers.onStepIn(creature, item, position, fromPositio player:teleportTo(k.toPosition) else player:teleportTo(fromPosition, true) - player:sendCancelMessage('You are still exhausted from your last battle.') + player:sendCancelMessage("You are still exhausted from your last battle.") end player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) end @@ -30,4 +30,4 @@ function movements_library_timers.onStepIn(creature, item, position, fromPositio end movements_library_timers:aid(4950) -movements_library_timers:register() \ No newline at end of file +movements_library_timers:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua index d48bc954103..c01ecfe1a36 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua @@ -1,14 +1,23 @@ local transform = { [9110] = 9111, - [9111] = 9110 + [9111] = 9110, } local leverInfo = { - [1] = {bossName = "Brokul", bossPosition = Position(33483, 31437, 15), leverPosition = Position(33522, 31464, 15), - pushPosition = Position(33522, 31465, 15), leverFromPos = Position(33520, 31465, 15), leverToPos = Position(33524, 31465, 15), - storageTimer = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimer, teleportTo = Position(33484, 31446, 15), - globalTimer = GlobalStorage.secretLibrary.LiquidDeath.BrokulTimer, roomFromPosition = Position(33472, 31427, 15), roomToPosition = Position(33496, 31450, 15), - exitPosition = Position(33528, 31464, 14)}, + [1] = { + bossName = "Brokul", + bossPosition = Position(33483, 31437, 15), + leverPosition = Position(33522, 31464, 15), + pushPosition = Position(33522, 31465, 15), + leverFromPos = Position(33520, 31465, 15), + leverToPos = Position(33524, 31465, 15), + storageTimer = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimer, + teleportTo = Position(33484, 31446, 15), + globalTimer = GlobalStorage.secretLibrary.LiquidDeath.BrokulTimer, + roomFromPosition = Position(33472, 31427, 15), + roomToPosition = Position(33496, 31450, 15), + exitPosition = Position(33528, 31464, 14), + }, } local actions_liquid_brokulLever = Action() @@ -32,7 +41,7 @@ function actions_liquid_brokulLever.onUse(player, item, fromPosition, target, to local newPos = Position(i, leverTable.leverFromPos.y, leverTable.leverFromPos.z) local creature = Tile(newPos):getTopCreature() if creature and creature:isPlayer() then - creature:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimer, os.time() + 20*60*60) + creature:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimer, os.time() + 20 * 60 * 60) creature:teleportTo(leverTable.teleportTo, true) creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) table.insert(playersTable, creature:getId()) diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_usableItens.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_usableItens.lua index 9d5d0d07b78..88556ae740b 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_usableItens.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_usableItens.lua @@ -1,28 +1,29 @@ local config = { statues = { - [1] = {position = Position(33598, 31398, 14), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue1}, - [2] = {position = Position(33602, 31439, 13), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue2}, - [3] = {position = Position(33587, 31461, 14), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue3}, - [4] = {position = Position(33588, 31461, 14), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue4}, - [5] = {position = Position(33549, 31459, 14), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue5}, - [6] = {position = Position(33577, 31475, 15), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue6}, - [7] = {position = Position(33612, 31465, 15), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue7}, - [8] = {position = Position(33565, 31423, 13), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue8}, - [9] = {position = Position(33574, 31441, 15), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue9} + [1] = { position = Position(33598, 31398, 14), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue1 }, + [2] = { position = Position(33602, 31439, 13), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue2 }, + [3] = { position = Position(33587, 31461, 14), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue3 }, + [4] = { position = Position(33588, 31461, 14), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue4 }, + [5] = { position = Position(33549, 31459, 14), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue5 }, + [6] = { position = Position(33577, 31475, 15), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue6 }, + [7] = { position = Position(33612, 31465, 15), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue7 }, + [8] = { position = Position(33565, 31423, 13), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue8 }, + [9] = { position = Position(33574, 31441, 15), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue9 }, }, bookInfo = { id = 15475, position = Position(32881, 32435, 8), - storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 3, - message = "The descriptions in this book look like plans detailing the launch of a large-scale assault." + storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, + value = 3, + message = "The descriptions in this book look like plans detailing the launch of a large-scale assault.", }, statueEffect = CONST_ME_THUNDER, - statueMessage = 'The Njey will appreciate your help.', - statueMessage_ = 'You recently fixed that idol.', - statueId = {17240, 17241}, - fixedId = {17239, 17242}, + statueMessage = "The Njey will appreciate your help.", + statueMessage_ = "You recently fixed that idol.", + statueId = { 17240, 17241 }, + fixedId = { 17239, 17242 }, countStatues = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.StatueCount, - maxValue = 9 + maxValue = 9, } local function doRevert(position, id, newId) @@ -47,7 +48,7 @@ local function fixStatue(position, id) position:sendMagicEffect(config.statueEffect) end - addEvent(doRevert, 10*1000, position, id, newId) + addEvent(doRevert, 10 * 1000, position, id, newId) end local actions_liquid_usableItens = Action() @@ -55,7 +56,7 @@ local actions_liquid_usableItens = Action() function actions_liquid_usableItens.onUse(player, item, position, fromPosition, pos, target, toPosition) local b = config.bookInfo - if item:getId() == b.id and item:getPosition() == b.position then + if item:getId() == b.id and item:getPosition() == b.position then if player:getStorageValue(b.storage) == b.value then player:setStorageValue(b.storage, player:getStorageValue(b.storage) + 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, b.message) @@ -85,4 +86,4 @@ function actions_liquid_usableItens.onUse(player, item, position, fromPosition, end actions_liquid_usableItens:aid(4900) -actions_liquid_usableItens:register() \ No newline at end of file +actions_liquid_usableItens:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_bossWay.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_bossWay.lua index 2f205e1f1c2..bf7afd42b14 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_bossWay.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_bossWay.lua @@ -1,12 +1,9 @@ local config = { acessos = { - [1] = {fromPos = Position(33525, 31464, 14), toPos = Position(33525, 31464, 15), - storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 6, - message = "Without the help of other Njey you will probably not make enough of a difference in this battle.", - timer = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimer}, + [1] = { fromPos = Position(33525, 31464, 14), toPos = Position(33525, 31464, 15), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 6, message = "Without the help of other Njey you will probably not make enough of a difference in this battle.", timer = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimer }, }, defaultMessage = "You are not ready to pass yet.", - notime = "You need to wait 20 hours to face this boss again." + notime = "You need to wait 20 hours to face this boss again.", } local movements_liquid_bossWay = MoveEvent() @@ -41,4 +38,4 @@ function movements_liquid_bossWay.onStepIn(creature, item, position, fromPositio end movements_liquid_bossWay:aid(4901) -movements_liquid_bossWay:register() \ No newline at end of file +movements_liquid_bossWay:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_teleportTo.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_teleportTo.lua index d3157603a07..acfd8376a2a 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_teleportTo.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_teleportTo.lua @@ -1,11 +1,11 @@ local config = { teleports = { - [1] = {fromPos = Position(32873, 32512, 7), toPos = Position(32881, 32471, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 2, effect = CONST_ME_WATERSPLASH, achievementName = 'Spectulation'}, - [2] = {fromPos = Position(32881, 32473, 9), toPos = Position(32871, 32513, 7), effect = CONST_ME_WATERSPLASH}, - [3] = {fromPos = Position(33584, 31388, 13), toPos = Position(33584, 31391, 13), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 4, effect = CONST_ME_TELEPORT, message = 'You squeeze through an ancient small passage. There are small symbols carved deep into the coral you cannot read.'}, - [4] = {fromPos = Position(33560, 31395, 13), toPos = Position(33561, 31391, 13), effect = CONST_ME_TELEPORT}, + [1] = { fromPos = Position(32873, 32512, 7), toPos = Position(32881, 32471, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 2, effect = CONST_ME_WATERSPLASH, achievementName = "Spectulation" }, + [2] = { fromPos = Position(32881, 32473, 9), toPos = Position(32871, 32513, 7), effect = CONST_ME_WATERSPLASH }, + [3] = { fromPos = Position(33584, 31388, 13), toPos = Position(33584, 31391, 13), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 4, effect = CONST_ME_TELEPORT, message = "You squeeze through an ancient small passage. There are small symbols carved deep into the coral you cannot read." }, + [4] = { fromPos = Position(33560, 31395, 13), toPos = Position(33561, 31391, 13), effect = CONST_ME_TELEPORT }, }, - defaultMessage = "You are not ready to pass yet." + defaultMessage = "You are not ready to pass yet.", } local movements_liquid_teleportTo = MoveEvent() @@ -50,4 +50,4 @@ function movements_liquid_teleportTo.onStepIn(creature, item, position, fromPosi end movements_liquid_teleportTo:aid(4900) -movements_liquid_teleportTo:register() \ No newline at end of file +movements_liquid_teleportTo:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_crackles.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_crackles.lua index d9fc268d061..cb83c1084eb 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_crackles.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_crackles.lua @@ -13,4 +13,4 @@ function movements_crackles.onStepIn(creature, item, position, fromPosition) end movements_crackles:aid(4910) -movements_crackles:register() \ No newline at end of file +movements_crackles:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_bony_rod.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_bony_rod.lua index e558b3074fa..8b60e49006b 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_bony_rod.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_bony_rod.lua @@ -11,8 +11,8 @@ function actions_museum_bony_rod.onUse(player, item, fromPosition, target, toPos end elseif item.itemid == 28708 then if target.itemid == basin then - item:setAttribute(ITEM_ATTRIBUTE_DURATION, 15*1000) - player:say('Recharging...', TALKTYPE_MONSTER_SAY) + item:setAttribute(ITEM_ATTRIBUTE_DURATION, 15 * 1000) + player:say("Recharging...", TALKTYPE_MONSTER_SAY) else if target:getPosition() == finalBasin and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.FinalBasin) ~= 1 then target:getPosition():sendMagicEffect(CONST_ME_DRAWBLOOD) diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_chests.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_chests.lua index 5eb59f2f0a2..3149d8ea15d 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_chests.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_chests.lua @@ -1,7 +1,7 @@ local chests = { - [4900] = {storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.SampleBlood, reward = 27874}, - [4901] = {storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.BonyRod, reward = 27847}, - [4902] = {storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.BrokenCompass, reward = 25746}, + [4900] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.SampleBlood, reward = 27874 }, + [4901] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.BonyRod, reward = 27847 }, + [4902] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.BrokenCompass, reward = 25746 }, } local actions_museum_chests = Action() @@ -16,9 +16,9 @@ function actions_museum_chests.onUse(player, item, fromPosition, target, toPosit if player:getStorageValue(chest.storage) ~= 1 then player:addItem(chest.reward, 1) player:setStorageValue(chest.storage, 1) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. ItemType(chest.reward):getName():lower() .. '.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a " .. ItemType(chest.reward):getName():lower() .. ".") else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'It is empty.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is empty.") end return true @@ -28,4 +28,4 @@ for uid in pairs(chests) do actions_museum_chests:uid(uid) end -actions_museum_chests:register() \ No newline at end of file +actions_museum_chests:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_doors.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_doors.lua index a204eb844b2..4e51d5c5c6b 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_doors.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_doors.lua @@ -1,21 +1,21 @@ local doors = { - [1] = {doorPosition = Position(33246, 32122, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, nivel = 2}, - [2] = {doorPosition = Position(33208, 32071, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission, nivel = 1}, - [3] = {doorPosition = Position(33208, 32074, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission, nivel = 1}, - [4] = {doorPosition = Position(33341, 32117, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.FinalBasin, nivel = 1}, - [5] = {doorPosition = Position(33344, 32120, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.SkullSample, nivel = 1} + [1] = { doorPosition = Position(33246, 32122, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, nivel = 2 }, + [2] = { doorPosition = Position(33208, 32071, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission, nivel = 1 }, + [3] = { doorPosition = Position(33208, 32074, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission, nivel = 1 }, + [4] = { doorPosition = Position(33341, 32117, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.FinalBasin, nivel = 1 }, + [5] = { doorPosition = Position(33344, 32120, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.SkullSample, nivel = 1 }, } local actions_museum_doors = Action() function actions_museum_doors.onUse(player, item, fromPosition, target, toPosition, isHotkey) for _, p in pairs(doors) do - if (item:getPosition() == p.doorPosition) and not(Tile(item:getPosition()):getTopCreature()) then + if (item:getPosition() == p.doorPosition) and not (Tile(item:getPosition()):getTopCreature()) then if player:getStorageValue(p.storage) >= p.nivel then player:teleportTo(toPosition, true) item:transform(item.itemid + 1) else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'The door seems to be sealed against unwanted intruders.') + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.") end end end @@ -24,4 +24,4 @@ function actions_museum_doors.onUse(player, item, fromPosition, target, toPositi end actions_museum_doors:aid(4905) -actions_museum_doors:register() \ No newline at end of file +actions_museum_doors:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_gems.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_gems.lua index c3e8abecb81..bca9fa38e73 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_gems.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_gems.lua @@ -1,7 +1,7 @@ local basins = { - [1] = {position = Position(33219, 32100, 9), item = 27868, storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.YellowGem}, - [2] = {position = Position(33260, 32084, 9), item = 27867, storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.GreenGem}, - [3] = {position = Position(33318, 32090, 9), item = 27869, storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.RedGem}, + [1] = { position = Position(33219, 32100, 9), item = 27868, storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.YellowGem }, + [2] = { position = Position(33260, 32084, 9), item = 27867, storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.GreenGem }, + [3] = { position = Position(33318, 32090, 9), item = 27869, storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.RedGem }, } local actions_museum_gems = Action() @@ -25,4 +25,3 @@ for _, gem in pairs(basins) do end actions_museum_gems:register() - diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_levers.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_levers.lua index c32ad7f96cc..79af7bf53c9 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_levers.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_levers.lua @@ -4,7 +4,7 @@ local thirdLever = Position(33218, 32096, 10) local transform = { [9110] = 9111, - [9111] = 9110 + [9111] = 9110, } local actions_museum_levers = Action() @@ -13,22 +13,22 @@ function actions_museum_levers.onUse(player, item, fromPosition, target, toPosit if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission) ~= 1 then if item:getPosition() == boneLever then if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) == 3 then - player:say('You don\'t know what to do.', TALKTYPE_MONSTER_SAY) + player:say("You don't know what to do.", TALKTYPE_MONSTER_SAY) player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, 4) elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) == 5 then - if player:getStorageValue('museumTimer') > os.time() then - player:say('back, back, up, right, left', TALKTYPE_MONSTER_SAY) + if player:getStorageValue("museumTimer") > os.time() then + player:say("back, back, up, right, left", TALKTYPE_MONSTER_SAY) player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission, 1) else - player:say('You\'re too late.', TALKTYPE_MONSTER_SAY) + player:say("You're too late.", TALKTYPE_MONSTER_SAY) return true end end elseif item:getPosition() == middleLever then if item.itemid == 9110 then - if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) == 5 and player:getStorageValue('museumTimer') < os.time() then - player:say('As you turn the lever you can heart it ticking. Maybe you should hurry up!', TALKTYPE_MONSTER_SAY) - player:setStorageValue('museumTimer', os.time() + 2*60) + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) == 5 and player:getStorageValue("museumTimer") < os.time() then + player:say("As you turn the lever you can heart it ticking. Maybe you should hurry up!", TALKTYPE_MONSTER_SAY) + player:setStorageValue("museumTimer", os.time() + 2 * 60) item:transform(item.itemid + 1) end end @@ -36,9 +36,9 @@ function actions_museum_levers.onUse(player, item, fromPosition, target, toPosit end if item:getPosition() == thirdLever and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.FinalBasin) ~= 1 then - if player:getStorageValue('takenRod') < os.time() then + if player:getStorageValue("takenRod") < os.time() then player:addItem(28709, 1) - player:setStorageValue('takenRod', os.time() + 2*60) + player:setStorageValue("takenRod", os.time() + 2 * 60) else return true end @@ -52,4 +52,4 @@ function actions_museum_levers.onUse(player, item, fromPosition, target, toPosit end actions_museum_levers:aid(4906) -actions_museum_levers:register() \ No newline at end of file +actions_museum_levers:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_sample_blood.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_sample_blood.lua index 57cae97f827..647e4a5f0e7 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_sample_blood.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_sample_blood.lua @@ -12,4 +12,4 @@ function actions_museum_sample_blood.onUse(player, item, fromPosition, target, t end actions_museum_sample_blood:id(27874) -actions_museum_sample_blood:register() \ No newline at end of file +actions_museum_sample_blood:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/movements_teleportTo.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/movements_teleportTo.lua index 3a6a56825d4..e7f7ee9a08a 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/movements_teleportTo.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/movements_teleportTo.lua @@ -1,6 +1,6 @@ local teleports = { - [1] = {fromPos = Position(33246, 32107, 8), toPos = Position(33246, 32096, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, nivel = 2, nextValue = 3}, - [2] = {fromPos = Position(33246, 32098, 8), toPos = Position(33246, 32109, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, nivel = 2}, + [1] = { fromPos = Position(33246, 32107, 8), toPos = Position(33246, 32096, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, nivel = 2, nextValue = 3 }, + [2] = { fromPos = Position(33246, 32098, 8), toPos = Position(33246, 32109, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, nivel = 2 }, } local lastroom_enter = Position(33344, 32117, 10) @@ -24,7 +24,7 @@ function movements_museum_teleportTo.onStepIn(creature, item, position, fromPosi if item.actionid == 4905 then for _, p in pairs(teleports) do - if (position == p.fromPos) then + if position == p.fromPos then if player:getStorageValue(p.storage) >= p.nivel then player:teleportTo(p.toPos) sendFire(p.toPos) @@ -39,8 +39,7 @@ function movements_museum_teleportTo.onStepIn(creature, item, position, fromPosi elseif item.actionid == 4906 then local hasPermission = false - if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.YellowGem) >= 1 and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.GreenGem) >= 1 - and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.RedGem) >= 1 then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.YellowGem) >= 1 and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.GreenGem) >= 1 and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.RedGem) >= 1 then hasPermission = true end @@ -50,14 +49,14 @@ function movements_museum_teleportTo.onStepIn(creature, item, position, fromPosi elseif item.actionid == 4907 then if position == lastroom_enter then player:teleportTo(Position(33363, 32146, 10)) - elseif position == lastroom_exit and player:getStorageValue('trialTimer') < os.time() then + elseif position == lastroom_exit and player:getStorageValue("trialTimer") < os.time() then player:teleportTo(Position(33336, 32117, 10)) -- Trial else if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) < 6 then - player:setStorageValue('trialTimer', os.time() + 3*60) + player:setStorageValue("trialTimer", os.time() + 3 * 60) player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, 6) - player:say('rkawdmawfjawkjnfjkawnkjnawkdjawkfmalkwmflkmawkfnzxc', TALKTYPE_MONSTER_SAY) + player:say("rkawdmawfjawkjnfjkawnkjnawkdjawkfmalkwmflkmawkfnzxc", TALKTYPE_MONSTER_SAY) end end end @@ -66,4 +65,4 @@ function movements_museum_teleportTo.onStepIn(creature, item, position, fromPosi end movements_museum_teleportTo:aid(4905, 4906, 4907) -movements_museum_teleportTo:register() \ No newline at end of file +movements_museum_teleportTo:register() From a20769a3e030201cc27905ff01a30376b08a7437 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Tue, 15 Oct 2024 08:02:55 -0300 Subject: [PATCH 24/70] more --- .../the_secret_library_quest/library/actions_bossesLever.lua | 2 +- .../library/creaturescripts_ghulosh.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua index 95afc9fc41f..411020dcbe4 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua @@ -56,7 +56,7 @@ local lokathmorSummons = { }, } -local bossNames = { "mazzinor", "supercharged mazzinor", "lokathmor", "ghulosh", "ghuloshz' deathgaze", "gorzindel", "stolen tome of portals" } +local bossNames = { "mazzinor", "supercharged mazzinor", "lokathmor", "ghulosh", "ghuloshz" deathgaze", "gorzindel", "stolen tome of portals" } local function spawnSummons(k, monsterName, eventName, timing, positionTable, middlePosition, isGorzindel) local spectators = Game.getSpectators(middlePosition, false, false, 12, 12, 12, 12) diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua index 76e85547951..8e51816a9e4 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua @@ -30,7 +30,7 @@ function creaturescripts_library_ghulosh.onThink(creature, interval) local percentageHealth = (cHealth / creature:getMaxHealth()) * 100 if percentageHealth <= stage then - local monster = Game.createMonster("ghulosh' deathgaze", position, true) + local monster = Game.createMonster("ghulosh" deathgaze", position, true) nextStage(info.stg) creature:remove() if monster then From fdaad866c1a8437daca14a8e8d3c161c04c387f3 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Tue, 15 Oct 2024 08:03:15 -0300 Subject: [PATCH 25/70] The Secret Library Quest - part 1 --- .../the_secret_library_quest/library/actions_bossesLever.lua | 2 +- .../library/creaturescripts_ghulosh.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua index 95afc9fc41f..411020dcbe4 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua @@ -56,7 +56,7 @@ local lokathmorSummons = { }, } -local bossNames = { "mazzinor", "supercharged mazzinor", "lokathmor", "ghulosh", "ghuloshz' deathgaze", "gorzindel", "stolen tome of portals" } +local bossNames = { "mazzinor", "supercharged mazzinor", "lokathmor", "ghulosh", "ghuloshz" deathgaze", "gorzindel", "stolen tome of portals" } local function spawnSummons(k, monsterName, eventName, timing, positionTable, middlePosition, isGorzindel) local spectators = Game.getSpectators(middlePosition, false, false, 12, 12, 12, 12) diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua index 76e85547951..8e51816a9e4 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua @@ -30,7 +30,7 @@ function creaturescripts_library_ghulosh.onThink(creature, interval) local percentageHealth = (cHealth / creature:getMaxHealth()) * 100 if percentageHealth <= stage then - local monster = Game.createMonster("ghulosh' deathgaze", position, true) + local monster = Game.createMonster("ghulosh" deathgaze", position, true) nextStage(info.stg) creature:remove() if monster then From de8bd5f5734af0fd853952b4c323fd042c7bc0fd Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Tue, 15 Oct 2024 18:38:41 -0300 Subject: [PATCH 26/70] The Secret Library Quest - more --- data-otservbr-global/lib/core/storages.lua | 177 +++++++----------- .../monster/bosses/the_book_of_death.lua | 4 + .../monster/humans/the_flaming_orchid.lua | 126 +++++++++++++ .../the_secret_library/bosses/brokul.lua | 4 + .../the_secret_library/bosses/ghulosh.lua | 2 +- .../the_secret_library/bosses/gorzindel.lua | 2 +- .../bosses/grand_canon_dominus.lua | 2 +- .../bosses/grand_chaplain_gaunder.lua | 2 +- .../bosses/grand_commander_soeren.lua | 2 +- .../bosses/grand_master_oberon.lua | 5 + .../bosses/preceptor_lazare.lua | 2 +- .../the_secret_library/concentrated_death.lua | 4 + .../the_secret_library/dazed_leaf_golem.lua | 2 +- .../quests/the_secret_library/lokathmor.lua | 2 +- .../quests/the_secret_library/mazzinor.lua | 3 +- .../stolen_knowledge_of_armor.lua | 4 + .../stolen_knowledge_of_healing.lua | 5 + .../stolen_knowledge_of_lifesteal.lua | 5 + .../stolen_knowledge_of_spells.lua | 4 + .../stolen_knowledge_of_summoning.lua | 4 + .../the_secret_library/the_blazing_rose.lua | 4 + .../the_diamond_blossom.lua | 4 + .../the_secret_library/the_lily_of_night.lua | 4 + .../creaturescripts/customs/freequests.lua | 4 +- .../creaturescripts_kill.lua | 2 +- .../falcon_bastion/actions_oberonLever.lua | 2 +- .../isles/movements_stepIn.lua | 4 +- .../library/actions_bossesLever.lua | 6 +- .../library/creaturescripts_ghulosh.lua | 4 +- .../liquid_death/actions_brokulLever.lua | 2 +- 30 files changed, 265 insertions(+), 132 deletions(-) create mode 100644 data-otservbr-global/monster/humans/the_flaming_orchid.lua diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index 593b854abdf..56367c8a381 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -2614,127 +2614,82 @@ Storage = { OberonTimer = 46018, OberonHeal = 46019, LastBossMsgInterval = 46020, + OberonSay = 46021, }, Darashia = { - Questline = 46021, - PuzzleSqm = 46022, - FirstChest = 46023, - SecondChest = 46024, - ThirdChest = 46025, - FourthChest = 46026, - RedColor = 46027, - GreenColor = 46028, - BlueColor = 46029, - ColorPuzzle = 46030, - EatenFood = 46031, - FirstTotem = 46032, - SecondTotem = 46033, - ThirdTotem = 46034, - FourthTotem = 46035, - FifthChest = 46036, - ScorpionTimer = 46037, + Questline = 46022, + PuzzleSqm = 46023, + FirstChest = 46024, + SecondChest = 46025, + ThirdChest = 46026, + FourthChest = 46027, + RedColor = 46028, + GreenColor = 46029, + BlueColor = 46030, + ColorPuzzle = 46031, + EatenFood = 46032, + FirstTotem = 46033, + SecondTotem = 46034, + ThirdTotem = 46035, + FourthTotem = 46036, + FifthChest = 46037, + ScorpionTimer = 46038, }, LiquidDeath = { - Questline = 46038, - Statue1 = 46039, - Statue2 = 46040, - Statue3 = 46041, - Statue4 = 46042, - Statue5 = 46043, - Statue6 = 46044, - Statue7 = 46045, - Statue8 = 46046, - Statue9 = 46047, - StatueCount = 46048, - BrokulTimer = 46049, + Questline = 46039, + Statue1 = 46040, + Statue2 = 46041, + Statue3 = 46042, + Statue4 = 46043, + Statue5 = 46044, + Statue6 = 46045, + Statue7 = 46046, + Statue8 = 46047, + Statue9 = 46048, + StatueCount = 46049, + BrokulTimer = 46050, + BrokulTimerGlobal = 46051, }, MoTA = { - Questline = 46050, - LeverPermission = 46051, - SampleBlood = 46052, - BonyRod = 46053, - BrokenCompass = 46054, - Crystal1 = 46055, - Crystal2 = 46056, - Crystal3 = 46057, - Crystal4 = 46058, - Crystal5 = 46059, - Crystal6 = 46060, - Crystal7 = 46061, - Crystal8 = 46062, - YellowGem = 46063, - GreenGem = 46064, - RedGem = 46065, - FinalBasin = 46066, - SkullSample = 46067, + Questline = 46052, + LeverPermission = 46053, + SampleBlood = 46054, + BonyRod = 46055, + BrokenCompass = 46056, + Crystal1 = 46057, + Crystal2 = 46058, + Crystal3 = 46059, + Crystal4 = 46060, + Crystal5 = 46061, + Crystal6 = 46062, + Crystal7 = 46063, + Crystal8 = 46064, + YellowGem = 46065, + GreenGem = 46066, + RedGem = 46067, + FinalBasin = 46068, + SkullSample = 46069, }, SmallIslands = { - Questline = 46068, - Parchment = 46069, - Sapphire = 46070, - Shovel = 46071, - Fishing = 46072, - RaxiasTimer = 46073, - BoatStages = 46074, - Hawser = 46075, - }, - LibraryPermission = 46076, + Questline = 46070, + Parchment = 46071, + Sapphire = 46072, + Shovel = 46073, + Fishing = 46074, + RaxiasTimer = 46075, + BoatStages = 46076, + Hawser = 46077, + Turtle = 46078, + }, + LibraryPermission = 46079, Library = { - Questline = 46077, - MazzinorTimer = 46078, - LokathmorTime = 46079, - GhuloshTime = 46080, - GorzindelTime = 46081, + Questline = 46080, + MazzinorTimer = 46081, + LokathmorTime = 46082, + GhuloshTime = 46083, + GorzindelTime = 46084, + Ghulosh = 46085, }, - - -- previous - TheOrderOfTheFalcon = { - OberonTimer = 50050, - }, - LiquidDeath = 50051, - Mota = 50052, - MotaDoor = 50053, - BasinDoor = 50054, - SkullDoor = 50055, - TheLament = 50056, - GreenTel = 50057, - BlueTel = 50058, - BlackTel = 50059, - PinkTel = 50060, - Peacock = 50061, - HighDry = 50062, - FalconBastionAccess = 50063, - MiniBosses = { - GrandCommanderSoeren = 50065, - PreceptorLazare = 50066, - GrandChaplainGaunder = 50067, - GrandCanonDominus = 50068, - DazedLeafGolem = 50069, - }, - LowerBastionAccess = 50070, - UndergroundBastionAccess = 50071, - OberonAccess = 50072, - ShortcutToBastion = 50073, - FalconBastionChestsTimer = { - Key0909 = 50064, - Coast = 46281, - Island = 46282, - ThroneHall = 46283, - Shortcut = 46284, - LowerBastion = 46285, - UndergroundBastion = 46286, - }, - GhuloshTimer = 46015, - GhuloshKilled = 46016, - GorzindelTimer = 46017, - GorzindelKilled = 46018, - LokathmorTimer = 46019, - LokathmorKilled = 46020, - MazzinorTimer = 46021, - MazzinorKilled = 46022, - ScourgeOfOblivionDoor = 46023, - ScourgeOfOblivionTimer = 46024, - ScourgeOfOblivionKilled = 46025, }, BattleMageOutfits = {}, diff --git a/data-otservbr-global/monster/bosses/the_book_of_death.lua b/data-otservbr-global/monster/bosses/the_book_of_death.lua index 6cea3d844aa..4f2d3288447 100644 --- a/data-otservbr-global/monster/bosses/the_book_of_death.lua +++ b/data-otservbr-global/monster/bosses/the_book_of_death.lua @@ -20,6 +20,10 @@ monster.corpse = 0 monster.speed = 39 monster.manaCost = 0 +monster.events = { + "ghuloshDeath", +} + monster.changeTarget = { interval = 5000, chance = 8, diff --git a/data-otservbr-global/monster/humans/the_flaming_orchid.lua b/data-otservbr-global/monster/humans/the_flaming_orchid.lua new file mode 100644 index 00000000000..3fd64d630ab --- /dev/null +++ b/data-otservbr-global/monster/humans/the_flaming_orchid.lua @@ -0,0 +1,126 @@ +local mType = Game.createMonsterType("The Flaming Orchid") +local monster = {} + +monster.description = "a flaming orchid" +monster.experience = 8500 +monster.outfit = { + lookType = 150, + lookHead = 114, + lookBody = 94, + lookLegs = 78, + lookFeet = 79, + lookAddons = 1, + lookMount = 0, +} + +monster.health = 4000 +monster.maxHealth = 4000 +monster.race = "blood" +monster.corpse = 21987 -- review later +monster.speed = 210 +monster.manaCost = 0 + +monster.events = { + "killingLibrary", +} + +monster.changeTarget = { + interval = 4000, + chance = 10, +} + +monster.strategiesTarget = { + nearest = 100, +} + +monster.flags = { + summonable = false, + attackable = true, + hostile = true, + convinceable = false, + pushable = false, + rewardBoss = false, + illusionable = true, + canPushItems = true, + canPushCreatures = true, + staticAttackChance = 80, + targetDistance = 1, + runHealth = 0, + healthHidden = false, + isBlockable = false, + canWalkOnEnergy = true, + canWalkOnFire = true, + canWalkOnPoison = true, +} + +monster.light = { + level = 0, + color = 0, +} + +monster.voices = { + interval = 2000, + chance = 7, + { text = "I will end your torment. Do not run, little mortal.", yell = true }, + { text = "*SNIFF* *SNIFF* BLOOD! I CAN SMELL YOU, MORTAL!!", yell = true }, +} + +monster.loot = { + { name = "gold coin", chance = 100000, maxCount = 250 }, + { name = "platinum coin", chance = 9240, maxCount = 10 }, + { name = "red gem", chance = 18200 }, + { name = "gold ingot", chance = 29700, maxCount = 5 }, + { name = "assassin star", chance = 29700, maxCount = 13 }, + { name = "demonic essence", chance = 330 }, + { name = "great spirit potion", chance = 330 }, + { name = "soul orb", chance = 19530 }, + { name = "small amethyst", chance = 8310, maxCount = 2 }, + { name = "small amethyst", chance = 8310, maxCount = 2 }, + { name = "ultimate health potion", chance = 700, maxCount = 4 }, + { name = "golden lotus brooch", chance = 19740 }, + { name = "green gem", chance = 15780 }, + { name = "magma coat", chance = 1050 }, + { name = "moonlight rod", chance = 1050 }, + { name = "necrotic rod", chance = 1050 }, + { name = "oriental shoes", chance = 490 }, + { name = "peacock feather fan", chance = 16870 }, +} + +monster.attacks = { + { name = "melee", interval = 2000, chance = 100, minDamage = 0, maxDamage = -25 }, + { name = "death", interval = 2000, chance = 100, minDamage = 0, maxDamage = -300, shootEffect = CONST_ANI_DEATH }, + { name = "Ignite", interval = 2000, chance = 20, range = 7, radius = 1, target = true, shootEffect = CONST_ANI_FIRE }, + { name = "big death wave", interval = 4000, chance = 18, minDamage = 0, maxDamage = -500 }, -- review later + { name = "aggressivelavawave", interval = 5000, chance = 19, minDamage = 0, maxDamage = -200 }, -- review later + { name = "fire", interval = 6000, chance = 20, range = 5, radius = 7, target = true, minDamage = -100, maxDamage = -250, areaEffect = CONST_ME_FIREAREA }, +} + +monster.defenses = { + defense = 55, + armor = 55, + { name = "healing", interval = 2000, chance = 15, minDamage = 50, maxDamage = 280, areaEffect = CONST_ME_MAGIC_BLUE }, + { name = "speed", interval = 2000, chance = 15, speedChange = 320, duration = 5000, areaEffect = CONST_ME_MAGIC_RED }, + { name = "invisible", interval = 1000, chance = 100, duration = 10000, areaEffect = CONST_ME_MAGIC_BLUE }, +} + +monster.elements = { + { type = COMBAT_PHYSICALDAMAGE, percent = 0 }, + { type = COMBAT_ENERGYDAMAGE, percent = 0 }, + { type = COMBAT_EARTHDAMAGE, percent = 0 }, + { type = COMBAT_FIREDAMAGE, percent = 0 }, + { type = COMBAT_LIFEDRAIN, percent = 0 }, + { type = COMBAT_MANADRAIN, percent = 0 }, + { type = COMBAT_DROWNDAMAGE, percent = 0 }, + { type = COMBAT_ICEDAMAGE, percent = 0 }, + { type = COMBAT_HOLYDAMAGE, percent = 0 }, + { type = COMBAT_DEATHDAMAGE, percent = 0 }, +} + +monster.immunities = { + { type = "paralyze", condition = true }, + { type = "outfit", condition = false }, + { type = "invisible", condition = true }, + { type = "bleed", condition = false }, +} + +mType:register(monster) diff --git a/data-otservbr-global/monster/quests/the_secret_library/bosses/brokul.lua b/data-otservbr-global/monster/quests/the_secret_library/bosses/brokul.lua index 727249e61d0..ffe52519e85 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/bosses/brokul.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/bosses/brokul.lua @@ -25,6 +25,10 @@ monster.corpse = 28635 monster.speed = 105 monster.manaCost = 0 +monster.events = { + "killingLibrary", +} + monster.changeTarget = { interval = 1000, chance = 10, diff --git a/data-otservbr-global/monster/quests/the_secret_library/bosses/ghulosh.lua b/data-otservbr-global/monster/quests/the_secret_library/bosses/ghulosh.lua index 09d4abb0935..f9d04e40db4 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/bosses/ghulosh.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/bosses/ghulosh.lua @@ -14,7 +14,7 @@ monster.outfit = { } monster.events = { - "SecretLibraryBossDeath", + "ghuloshThink", } monster.bosstiary = { diff --git a/data-otservbr-global/monster/quests/the_secret_library/bosses/gorzindel.lua b/data-otservbr-global/monster/quests/the_secret_library/bosses/gorzindel.lua index e5a1e3d6424..4d549175bab 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/bosses/gorzindel.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/bosses/gorzindel.lua @@ -14,7 +14,7 @@ monster.outfit = { } monster.events = { - "SecretLibraryBossDeath", + "gorzindelHealth", } monster.bosstiary = { diff --git a/data-otservbr-global/monster/quests/the_secret_library/bosses/grand_canon_dominus.lua b/data-otservbr-global/monster/quests/the_secret_library/bosses/grand_canon_dominus.lua index f6976c6d732..23390f0145f 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/bosses/grand_canon_dominus.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/bosses/grand_canon_dominus.lua @@ -26,7 +26,7 @@ monster.speed = 105 monster.manaCost = 0 monster.events = { - "GrandCanonDominusDeath", + "killingLibrary", } monster.changeTarget = { diff --git a/data-otservbr-global/monster/quests/the_secret_library/bosses/grand_chaplain_gaunder.lua b/data-otservbr-global/monster/quests/the_secret_library/bosses/grand_chaplain_gaunder.lua index a4d42046c58..57589cb7b17 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/bosses/grand_chaplain_gaunder.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/bosses/grand_chaplain_gaunder.lua @@ -26,7 +26,7 @@ monster.speed = 105 monster.manaCost = 0 monster.events = { - "GrandChaplainGaunderDeath", + "killingLibrary", } monster.changeTarget = { diff --git a/data-otservbr-global/monster/quests/the_secret_library/bosses/grand_commander_soeren.lua b/data-otservbr-global/monster/quests/the_secret_library/bosses/grand_commander_soeren.lua index e79984a5317..685b1f10f07 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/bosses/grand_commander_soeren.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/bosses/grand_commander_soeren.lua @@ -26,7 +26,7 @@ monster.speed = 105 monster.manaCost = 0 monster.events = { - "GrandCommanderSoerenDeath", + "killingLibrary", } monster.changeTarget = { diff --git a/data-otservbr-global/monster/quests/the_secret_library/bosses/grand_master_oberon.lua b/data-otservbr-global/monster/quests/the_secret_library/bosses/grand_master_oberon.lua index dc5121d128a..c57bf0815ae 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/bosses/grand_master_oberon.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/bosses/grand_master_oberon.lua @@ -25,6 +25,11 @@ monster.corpse = 28625 monster.speed = 115 monster.manaCost = 0 +monster.events = { + "killingLibrary", + "oberonImmune", +} + monster.changeTarget = { interval = 4000, chance = 10, diff --git a/data-otservbr-global/monster/quests/the_secret_library/bosses/preceptor_lazare.lua b/data-otservbr-global/monster/quests/the_secret_library/bosses/preceptor_lazare.lua index 64dddc6adf2..c9db8d4446c 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/bosses/preceptor_lazare.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/bosses/preceptor_lazare.lua @@ -26,7 +26,7 @@ monster.speed = 105 monster.manaCost = 0 monster.events = { - "PreceptorLazareDeath", + "killingLibrary", } monster.changeTarget = { diff --git a/data-otservbr-global/monster/quests/the_secret_library/concentrated_death.lua b/data-otservbr-global/monster/quests/the_secret_library/concentrated_death.lua index d83987622d8..fb7ce671970 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/concentrated_death.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/concentrated_death.lua @@ -20,6 +20,10 @@ monster.corpse = 28601 monster.speed = 175 monster.manaCost = 0 +monster.events = { + "ghuloshDeath", +} + monster.changeTarget = { interval = 5000, chance = 8, diff --git a/data-otservbr-global/monster/quests/the_secret_library/dazed_leaf_golem.lua b/data-otservbr-global/monster/quests/the_secret_library/dazed_leaf_golem.lua index 06961bae6cd..03c34c04c65 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/dazed_leaf_golem.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/dazed_leaf_golem.lua @@ -21,7 +21,7 @@ monster.speed = 175 monster.manaCost = 0 monster.events = { - "DazedLeafGolemDeath", + "killingLibrary", } monster.changeTarget = { diff --git a/data-otservbr-global/monster/quests/the_secret_library/lokathmor.lua b/data-otservbr-global/monster/quests/the_secret_library/lokathmor.lua index 621717cd277..699f0550d52 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/lokathmor.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/lokathmor.lua @@ -14,7 +14,7 @@ monster.outfit = { } monster.events = { - "SecretLibraryBossDeath", + "lokathmorDeath", } monster.bosstiary = { diff --git a/data-otservbr-global/monster/quests/the_secret_library/mazzinor.lua b/data-otservbr-global/monster/quests/the_secret_library/mazzinor.lua index b5521c45429..f482dfe4b9e 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/mazzinor.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/mazzinor.lua @@ -14,7 +14,8 @@ monster.outfit = { } monster.events = { - "SecretLibraryBossDeath", + "mazzinorDeath", + "mazzinorHealth", } monster.bosstiary = { diff --git a/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_armor.lua b/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_armor.lua index 1905e8a29a9..6397d663071 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_armor.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_armor.lua @@ -20,6 +20,10 @@ monster.corpse = 0 monster.speed = 75 monster.manaCost = 0 +monster.events = { + "gorzindelDeath", +} + monster.changeTarget = { interval = 5000, chance = 8, diff --git a/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_healing.lua b/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_healing.lua index ffe609dc45a..53e3f6f7cdc 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_healing.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_healing.lua @@ -20,6 +20,11 @@ monster.corpse = 0 monster.speed = 75 monster.manaCost = 0 +monster.events = { + "gorzindelDeath", +} + + monster.changeTarget = { interval = 5000, chance = 8, diff --git a/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_lifesteal.lua b/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_lifesteal.lua index ec3ccaefa97..d4973e48f82 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_lifesteal.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_lifesteal.lua @@ -20,6 +20,11 @@ monster.corpse = 0 monster.speed = 75 monster.manaCost = 0 +monster.events = { + "gorzindelDeath", +} + + monster.changeTarget = { interval = 5000, chance = 8, diff --git a/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_spells.lua b/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_spells.lua index 58fff59a202..bdbe4118398 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_spells.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_spells.lua @@ -20,6 +20,10 @@ monster.corpse = 0 monster.speed = 75 monster.manaCost = 0 +monster.events = { + "gorzindelDeath", +} + monster.changeTarget = { interval = 5000, chance = 8, diff --git a/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_summoning.lua b/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_summoning.lua index 87c05596b01..ecd11fc0b46 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_summoning.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_summoning.lua @@ -20,6 +20,10 @@ monster.corpse = 0 monster.speed = 75 monster.manaCost = 0 +monster.events = { + "gorzindelDeath", +} + monster.changeTarget = { interval = 5000, chance = 8, diff --git a/data-otservbr-global/monster/quests/the_secret_library/the_blazing_rose.lua b/data-otservbr-global/monster/quests/the_secret_library/the_blazing_rose.lua index 3eb95e76a26..569c69affe7 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/the_blazing_rose.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/the_blazing_rose.lua @@ -25,6 +25,10 @@ monster.corpse = 28794 monster.speed = 175 monster.manaCost = 0 +monster.events = { + "AsurasMechanic", +} + monster.changeTarget = { interval = 5000, chance = 8, diff --git a/data-otservbr-global/monster/quests/the_secret_library/the_diamond_blossom.lua b/data-otservbr-global/monster/quests/the_secret_library/the_diamond_blossom.lua index 03fc38bffc8..99dd4fd9d33 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/the_diamond_blossom.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/the_diamond_blossom.lua @@ -25,6 +25,10 @@ monster.corpse = 28802 monster.speed = 175 monster.manaCost = 0 +monster.events = { + "AsurasMechanic", +} + monster.changeTarget = { interval = 5000, chance = 8, diff --git a/data-otservbr-global/monster/quests/the_secret_library/the_lily_of_night.lua b/data-otservbr-global/monster/quests/the_secret_library/the_lily_of_night.lua index 9bf43393315..5b147dee5ed 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/the_lily_of_night.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/the_lily_of_night.lua @@ -25,6 +25,10 @@ monster.corpse = 28802 monster.speed = 175 monster.manaCost = 0 +monster.events = { + "AsurasMechanic", +} + monster.changeTarget = { interval = 5000, chance = 8, diff --git a/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua b/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua index 2e4d9f57d82..1cbca17c563 100644 --- a/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua +++ b/data-otservbr-global/scripts/creaturescripts/customs/freequests.lua @@ -328,7 +328,7 @@ local questTable = { { storage = Storage.Quest.U8_6.WrathOfTheEmperor.TeleportAccess.Zizzle, storageValue = 1 }, { storage = Storage.Quest.U8_6.WrathOfTheEmperor.TeleportAccess.Zlak, storageValue = 1 }, - { storage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastionAccess, storageValue = 1 }, + --[[ { storage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastionAccess, storageValue = 1 }, { storage = Storage.Quest.U11_80.TheSecretLibrary.LowerBastionAccess, storageValue = 1 }, { storage = Storage.Quest.U11_80.TheSecretLibrary.UndergroundBastionAccess, storageValue = 1 }, { storage = Storage.Quest.U11_80.TheSecretLibrary.ShortcutToBastion, storageValue = 1 }, @@ -341,7 +341,7 @@ local questTable = { { storage = Storage.Quest.U11_80.TheSecretLibrary.MiniBosses.GrandCanonDominus, storageValue = 1 }, { storage = Storage.Quest.U11_80.TheSecretLibrary.MiniBosses.GrandChaplainGaunder, storageValue = 1 }, { storage = Storage.Quest.U11_80.TheSecretLibrary.MiniBosses.GrandCommanderSoeren, storageValue = 1 }, - { storage = Storage.Quest.U11_80.TheSecretLibrary.MiniBosses.DazedLeafGolem, storageValue = 1 }, + { storage = Storage.Quest.U11_80.TheSecretLibrary.MiniBosses.DazedLeafGolem, storageValue = 1 }, ]] { storage = Storage.Quest.U7_4.DjinnWar.EfreetFaction.DoorToLamp, storageValue = 1 }, { storage = Storage.Quest.U7_4.DjinnWar.EfreetFaction.DoorToMaridTerritory, storageValue = 1 }, diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua index 9924b14933b..1d3ff90798c 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua @@ -16,7 +16,7 @@ function creaturescripts_library_bosses.onKill(player, creature) ["preceptor lazare"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 2 }, ["grand chaplain gaunder"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 3 }, ["grand canon dominus"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 4 }, - ["dazzled leaf golem"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 5 }, + ["dazed leaf golem"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 5 }, ["grand master oberon"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 6, achievements = { "Millennial Falcon", "Master Debater" }, lastBoss = true }, ["brokul"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 7 }, ["the flaming orchid"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.Asuras.flammingOrchid, value = 1 }, diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_oberonLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_oberonLever.lua index 5578096c0ad..59d0d65519d 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_oberonLever.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_oberonLever.lua @@ -23,7 +23,7 @@ function actions_falcon_oberon_lever.onUse(player, item, fromPosition, itemEx, t if oberon then oberon:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonHeal, 0) end - Game.setStorageValue(GlobalStorage.secretLibrary.FalconBastion.OberonSay, -1) + Game.setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonSay, -1) Game.createNpc("Oberon's Spite", Position(33363, 31321, 9)) Game.createNpc("Oberon's Ire", Position(33368, 31321, 9)) Game.createNpc("Oberon's Bile", Position(33363, 31317, 9)) diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_stepIn.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_stepIn.lua index a1033c904ca..24e6580bf62 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_stepIn.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_stepIn.lua @@ -12,7 +12,7 @@ local raxias = { local turtle = { fromPosition = Position(32460, 32928, 7), toPosition = Position(32316, 32701, 7), - storageTimer = GlobalStorage.secretLibrary.SmallIslands.Turtle, + storageTimer = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Turtle, } local svargrond = { @@ -29,11 +29,13 @@ local function resetRoom(position) return false end end + for _, c in pairs(spec) do if c then c:remove() end end + return true end diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua index 411020dcbe4..7e574e51f08 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua @@ -56,13 +56,12 @@ local lokathmorSummons = { }, } -local bossNames = { "mazzinor", "supercharged mazzinor", "lokathmor", "ghulosh", "ghuloshz" deathgaze", "gorzindel", "stolen tome of portals" } +local bossNames = { "mazzinor", "supercharged mazzinor", "lokathmor", "ghulosh", "ghuloshz' deathgaze", "gorzindel", "stolen tome of portals" } local function spawnSummons(k, monsterName, eventName, timing, positionTable, middlePosition, isGorzindel) local spectators = Game.getSpectators(middlePosition, false, false, 12, 12, 12, 12) local hasPlayer = false - -- It must block spawn flooding for _, c in pairs(spectators) do if c and c:isPlayer() then hasPlayer = true @@ -105,7 +104,6 @@ local function spawnSummons(k, monsterName, eventName, timing, positionTable, mi end end end --- Mazzinor info ending local leverInfo = { [1] = { bossName = "Mazzinor", storage = Storage.Quest.U11_80.TheSecretLibrary.Library.MazzinorTime, exit = Position(32616, 32532, 13), position = Position(32720, 32773, 10), type = "x", bossPosition = Position(32724, 32720, 10), teleportTo = Position(32724, 32726, 10), fromPosition = Position(32715, 32712, 10), toPosition = Position(32733, 32729, 10) }, @@ -147,7 +145,7 @@ function actions_library_bossesLever.onUse(player, item, fromPosition, itemEx, t elseif lever.bossName:lower() == "ghulosh" then addEvent(spawnSummons, 4 * 1000, 1, ghuloshSummons.name, ghuloshSummons.eventName, ghuloshSummons.timing, ghuloshSummons.positions, ghuloshSummons.middlePosition, false) local book = Game.createMonster("The Book of Death", Position(32755, 32716, 10)) - Game.setStorageValue(GlobalStorage.secretLibrary.Library.Ghulosh, 1) + Game.setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Library.Ghulosh, 1) elseif lever.bossName:lower() == "gorzindel" then addEvent(spawnSummons, 4 * 1000, 1, gorzindelSummons.name, gorzindelSummons.eventName, gorzindelSummons.timing, gorzindelSummons.positions, gorzindelSummons.middlePosition, true) addEvent(spawnSummons, 4 * 1000, 1, gorzindelSummons.name2, gorzindelSummons.eventName, gorzindelSummons.timing, gorzindelSummons.positions2, gorzindelSummons.middlePosition, true) diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua index 8e51816a9e4..649217a86f5 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua @@ -4,7 +4,7 @@ local info = { { p = 50, v = 2 }, { p = 25, v = 3 }, }, - stg = GlobalStorage.secretLibrary.Library.Ghulosh, + stg = Storage.Quest.U11_80.TheSecretLibrary.Library.Ghulosh, } local function nextStage(storage) @@ -30,7 +30,7 @@ function creaturescripts_library_ghulosh.onThink(creature, interval) local percentageHealth = (cHealth / creature:getMaxHealth()) * 100 if percentageHealth <= stage then - local monster = Game.createMonster("ghulosh" deathgaze", position, true) + local monster = Game.createMonster("ghulosh' deathgaze", position, true) nextStage(info.stg) creature:remove() if monster then diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua index c01ecfe1a36..3e0aa67ad4e 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua @@ -13,7 +13,7 @@ local leverInfo = { leverToPos = Position(33524, 31465, 15), storageTimer = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimer, teleportTo = Position(33484, 31446, 15), - globalTimer = GlobalStorage.secretLibrary.LiquidDeath.BrokulTimer, + globalTimer = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimerGlobal, roomFromPosition = Position(33472, 31427, 15), roomToPosition = Position(33496, 31450, 15), exitPosition = Position(33528, 31464, 14), From 1be924da9cde434063a0ca07119bc6d759222216 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 15 Oct 2024 21:39:39 +0000 Subject: [PATCH 27/70] Lua code format - (Stylua) --- .../stolen_knowledge_of_healing.lua | 1 - .../stolen_knowledge_of_lifesteal.lua | 1 - data-otservbr-global/npc/dedoras.lua | 82 ++++++++----------- 3 files changed, 33 insertions(+), 51 deletions(-) diff --git a/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_healing.lua b/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_healing.lua index 53e3f6f7cdc..84c63db20ce 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_healing.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_healing.lua @@ -24,7 +24,6 @@ monster.events = { "gorzindelDeath", } - monster.changeTarget = { interval = 5000, chance = 8, diff --git a/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_lifesteal.lua b/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_lifesteal.lua index d4973e48f82..f93849fbbde 100644 --- a/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_lifesteal.lua +++ b/data-otservbr-global/monster/quests/the_secret_library/stolen_knowledge_of_lifesteal.lua @@ -24,7 +24,6 @@ monster.events = { "gorzindelDeath", } - monster.changeTarget = { interval = 5000, chance = 8, diff --git a/data-otservbr-global/npc/dedoras.lua b/data-otservbr-global/npc/dedoras.lua index ea0e42b9e0d..16e35fed00b 100644 --- a/data-otservbr-global/npc/dedoras.lua +++ b/data-otservbr-global/npc/dedoras.lua @@ -169,20 +169,16 @@ keywordHandler:addKeyword( "So I have to look elsewhere to handle this new {threat}.", } } ) -keywordHandler:addKeyword( - { "background" }, - StdModule.say, - { - npcHandler = npcHandler, - text = { - "The goodbreaker was created in ancient times, when the war between the gods and their minions was on its height. Its creation took aeons and incredible sacrifices. ...", - "Each part had to be crafted perfectly, to emulate the gods, so it would share 'the same place' with them. ...", - "Mere mortals can not even perceive it in his whole but only recognize the part of it that is the physical representation in our world. ...", - "If it was meant to be used as an actual weapon, as the ultimate threat, or if Zathroth was just tempted to use his knowledge in the ultimate way - to create something that could undo himself - we don't know. ...", - "However in the end even Zathroth deemed it too much of a threat but instead of destroying the contraption once and for all, it was {disassembled} and hidden away.", - }, - } -) +keywordHandler:addKeyword({ "background" }, StdModule.say, { + npcHandler = npcHandler, + text = { + "The goodbreaker was created in ancient times, when the war between the gods and their minions was on its height. Its creation took aeons and incredible sacrifices. ...", + "Each part had to be crafted perfectly, to emulate the gods, so it would share 'the same place' with them. ...", + "Mere mortals can not even perceive it in his whole but only recognize the part of it that is the physical representation in our world. ...", + "If it was meant to be used as an actual weapon, as the ultimate threat, or if Zathroth was just tempted to use his knowledge in the ultimate way - to create something that could undo himself - we don't know. ...", + "However in the end even Zathroth deemed it too much of a threat but instead of destroying the contraption once and for all, it was {disassembled} and hidden away.", + }, +}) keywordHandler:addKeyword( { "parts" }, StdModule.say, @@ -192,33 +188,25 @@ keywordHandler:addKeyword( "The only thing they are still lacking is the knowledge to assemble and operate the {godbreaker}.", } } ) -keywordHandler:addKeyword( - { "godbreaker" }, - StdModule.say, - { - npcHandler = npcHandler, - text = { - "The godbreaker is a complex artifact. Incantation woven into incantation. The powers bound into it are so immense that the slightest mishandling could prove disastrous. ...", - "o figure out how it works, let alone how it can be operated safely, could require several centuries of tireless study. And even then this information would be only partial. ...", - "Yet the creation and operation of the godbreaker is just the kind of forbidden {knowledge} Zathroth values most, so it was compiled and stored.", - }, - } -) +keywordHandler:addKeyword({ "godbreaker" }, StdModule.say, { + npcHandler = npcHandler, + text = { + "The godbreaker is a complex artifact. Incantation woven into incantation. The powers bound into it are so immense that the slightest mishandling could prove disastrous. ...", + "o figure out how it works, let alone how it can be operated safely, could require several centuries of tireless study. And even then this information would be only partial. ...", + "Yet the creation and operation of the godbreaker is just the kind of forbidden {knowledge} Zathroth values most, so it was compiled and stored.", + }, +}) keywordHandler:addKeyword({ "knowledge" }, StdModule.say, { npcHandler = npcHandler, text = { "Of course the dangers of such knowledge were obvious. It was hidden in a sacred place devoted to Zathroth and dangerous knowledge. ...", "The hidden library, the forbidden hoard, the shrouded trove of knowledge or the veiled hoard of forbidden knowledge, the place has many names in many {myths}.", } }) -keywordHandler:addKeyword( - { "myths" }, - StdModule.say, - { - npcHandler = npcHandler, - text = { - "The myths agree that the place is well hidden, extremely guarded and contains some of the most powerful pieces of knowledge in this world and probably beyond. ...", - "However the knowledge about the godbreaker now poses a threat to all existence. In the hands of Variphor it can cause disaster in previously unknown ways. The gods themselves are in {peril}.", - }, - } -) +keywordHandler:addKeyword({ "myths" }, StdModule.say, { + npcHandler = npcHandler, + text = { + "The myths agree that the place is well hidden, extremely guarded and contains some of the most powerful pieces of knowledge in this world and probably beyond. ...", + "However the knowledge about the godbreaker now poses a threat to all existence. In the hands of Variphor it can cause disaster in previously unknown ways. The gods themselves are in {peril}.", + }, +}) keywordHandler:addKeyword({ "peril" }, StdModule.say, { npcHandler = npcHandler, text = { "Regardless of the dangers, the cult of Zathroth refused to destroy the knowledge of the godbreaker for good. ...", "They {value} dangerous knowledge that much, that they are unable to part from it, even when faced with the utter destruction of creation.", @@ -236,18 +224,14 @@ keywordHandler:addKeyword({ "reach" }, StdModule.say, { npcHandler = npcHandler, "I'd recommend to follow the few leads me and my associates could gather so far. ...", "Old myths, some {rumors} about old texts and other pieces of knowledge that I could use to figure out where to locate the hidden library and how to enter it.", } }) -keywordHandler:addKeyword( - { "rumors" }, - StdModule.say, - { - npcHandler = npcHandler, - text = { - "Hints about the shrouded hoard are numerous, though most are general mentions in texts that deal with Zathroth. But there are other sources. ...", - "Like texts about ancient liturgies of Zathroth and historical documents that might give us clues. I already compiled everything of value from the sources that were openly available. ...", - "To gather the more {obscure} parts of knowledge, however, I'll need your help.", - }, - } -) +keywordHandler:addKeyword({ "rumors" }, StdModule.say, { + npcHandler = npcHandler, + text = { + "Hints about the shrouded hoard are numerous, though most are general mentions in texts that deal with Zathroth. But there are other sources. ...", + "Like texts about ancient liturgies of Zathroth and historical documents that might give us clues. I already compiled everything of value from the sources that were openly available. ...", + "To gather the more {obscure} parts of knowledge, however, I'll need your help.", + }, +}) npcHandler:setMessage(MESSAGE_GREET, "Greetings seekers of knowledge. You seem to be just the person I'm {looking} for.") npcHandler:setMessage(MESSAGE_WALKAWAY, "Well, bye then.") From 0e08c513bbd443e76b5c42a316e05c30d7588a91 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Wed, 16 Oct 2024 07:54:21 -0300 Subject: [PATCH 28/70] The Secret Library Quest - more --- data/events/scripts/player.lua | 12 ++++++++++-- data/scripts/actions/items/foods.lua | 8 ++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/data/events/scripts/player.lua b/data/events/scripts/player.lua index ec1a92f3528..ab3ba840435 100644 --- a/data/events/scripts/player.lua +++ b/data/events/scripts/player.lua @@ -371,9 +371,17 @@ end function Player:onItemMoved(item, count, fromPosition, toPosition, fromCylinder, toCylinder) if IsRunningGlobalDatapack() then + -- The Secret Library Quest + if toPosition == Position(32460, 32928, 7) and item.itemid == 3578 then + toPosition:sendMagicEffect(CONST_ME_HEARTS) + self:say('You feed the turtle, now you may pass.', TALKTYPE_MONSTER_SAY) + Game.setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Turtle, os.time() + 10*60) + item:remove(1) + end + -- Cults of Tibia begin - local frompos = Position(33023, 31904, 14) -- Checagem - local topos = Position(33052, 31932, 15) -- Checagem + local frompos = Position(33023, 31904, 14) + local topos = Position(33052, 31932, 15) local removeItem = false if self:getPosition():isInRange(frompos, topos) and item:getId() == 23729 then local tile = Tile(toPosition) diff --git a/data/scripts/actions/items/foods.lua b/data/scripts/actions/items/foods.lua index 4a8072d163e..56c287443bc 100644 --- a/data/scripts/actions/items/foods.lua +++ b/data/scripts/actions/items/foods.lua @@ -136,6 +136,14 @@ function food.onUse(player, item, fromPosition, target, toPosition, isHotkey) return true end + -- The Secret Library Quest + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.eatenFood) ~= 1 then + if player:getPosition():isInRange(Position(32961, 32280, 10), Position(32964, 32286, 10)) then + player:say('Fames est optimus coquus', TALKTYPE_MONSTER_SAY) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.eatenFood, 1) + end + end + player:feed(itemFood[1] * 12) player:say(itemFood[2], TALKTYPE_MONSTER_SAY) player:updateSupplyTracker(item) From 2cd367c1e89fb3bc71fb5732bc040308625f3afa Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 16 Oct 2024 10:55:19 +0000 Subject: [PATCH 29/70] Lua code format - (Stylua) --- data/events/scripts/player.lua | 4 ++-- data/scripts/actions/items/foods.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/events/scripts/player.lua b/data/events/scripts/player.lua index ab3ba840435..6ee35f548d0 100644 --- a/data/events/scripts/player.lua +++ b/data/events/scripts/player.lua @@ -374,8 +374,8 @@ function Player:onItemMoved(item, count, fromPosition, toPosition, fromCylinder, -- The Secret Library Quest if toPosition == Position(32460, 32928, 7) and item.itemid == 3578 then toPosition:sendMagicEffect(CONST_ME_HEARTS) - self:say('You feed the turtle, now you may pass.', TALKTYPE_MONSTER_SAY) - Game.setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Turtle, os.time() + 10*60) + self:say("You feed the turtle, now you may pass.", TALKTYPE_MONSTER_SAY) + Game.setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Turtle, os.time() + 10 * 60) item:remove(1) end diff --git a/data/scripts/actions/items/foods.lua b/data/scripts/actions/items/foods.lua index 56c287443bc..9c91d0da6c2 100644 --- a/data/scripts/actions/items/foods.lua +++ b/data/scripts/actions/items/foods.lua @@ -139,7 +139,7 @@ function food.onUse(player, item, fromPosition, target, toPosition, isHotkey) -- The Secret Library Quest if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.eatenFood) ~= 1 then if player:getPosition():isInRange(Position(32961, 32280, 10), Position(32964, 32286, 10)) then - player:say('Fames est optimus coquus', TALKTYPE_MONSTER_SAY) + player:say("Fames est optimus coquus", TALKTYPE_MONSTER_SAY) player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.eatenFood, 1) end end From 48c4de2c9f46f7624c3979bf874f4b9de89650e5 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Wed, 16 Oct 2024 10:22:54 -0300 Subject: [PATCH 30/70] The Secret Library Quest - more --- .../actions_bony_rod.lua | 0 .../actions_chests.lua | 0 .../actions_doors.lua | 12 ++++---- .../actions_gems.lua | 0 .../actions_levers.lua | 0 .../actions_sample_blood.lua | 0 .../movements_teleportTo.lua | 6 ++-- .../actions_chests.lua | 0 .../actions_telescope.lua | 0 .../movements_boat_puzzle.lua | 2 ++ .../movements_stepIn.lua | 0 .../actions_bossesLever.lua | 1 - .../actions_parchment.lua | 0 .../creaturescripts_ghulosh.lua | 0 .../creaturescripts_gorzindel.lua | 0 .../creaturescripts_lokathmor.lua | 0 .../creaturescripts_mazzinor.lua | 0 .../movements_gorzindel.lua | 0 .../movements_mazzinor.lua | 0 .../movements_timers.lua | 0 .../liquid_death/movements_bossWay.lua | 16 +++++------ .../actions_bonefiddle.lua | 0 .../actions_chests.lua | 0 .../actions_doors.lua | 10 +++---- .../actions_fragrance.lua | 0 .../actions_keys.lua | 0 .../actions_mirror.lua | 4 +-- .../creaturescripts_asuras_mechanic.lua | 0 .../movements_elemental_portals.lua | 4 ++- .../actions_doors.lua | 28 +++++++++---------- .../actions_oberonLever.lua | 0 .../movements_bossEntrance.lua | 0 .../actions_chests.lua | 0 .../actions_doors.lua | 20 ++++++------- .../actions_totems.lua | 0 .../movements_color_puzzle.lua | 0 .../movements_teleportTo.lua | 6 ++++ 37 files changed, 59 insertions(+), 50 deletions(-) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{museum => bursting_at_the_seams_museum}/actions_bony_rod.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{museum => bursting_at_the_seams_museum}/actions_chests.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{museum => bursting_at_the_seams_museum}/actions_doors.lua (66%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{museum => bursting_at_the_seams_museum}/actions_gems.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{museum => bursting_at_the_seams_museum}/actions_levers.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{museum => bursting_at_the_seams_museum}/actions_sample_blood.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{museum => bursting_at_the_seams_museum}/movements_teleportTo.lua (93%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{isles => high_and_dry_isles}/actions_chests.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{isles => high_and_dry_isles}/actions_telescope.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{isles => high_and_dry_isles}/movements_boat_puzzle.lua (99%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{isles => high_and_dry_isles}/movements_stepIn.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{library => library_area}/actions_bossesLever.lua (99%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{library => library_area}/actions_parchment.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{library => library_area}/creaturescripts_ghulosh.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{library => library_area}/creaturescripts_gorzindel.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{library => library_area}/creaturescripts_lokathmor.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{library => library_area}/creaturescripts_mazzinor.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{library => library_area}/movements_gorzindel.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{library => library_area}/movements_mazzinor.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{library => library_area}/movements_timers.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{asuras => the_lament_asuras}/actions_bonefiddle.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{asuras => the_lament_asuras}/actions_chests.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{asuras => the_lament_asuras}/actions_doors.lua (72%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{asuras => the_lament_asuras}/actions_fragrance.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{asuras => the_lament_asuras}/actions_keys.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{asuras => the_lament_asuras}/actions_mirror.lua (85%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{asuras => the_lament_asuras}/creaturescripts_asuras_mechanic.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{asuras => the_lament_asuras}/movements_elemental_portals.lua (99%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{falcon_bastion => the_order_of_the_falcon}/actions_doors.lua (66%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{falcon_bastion => the_order_of_the_falcon}/actions_oberonLever.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{falcon_bastion => the_order_of_the_falcon}/movements_bossEntrance.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{deep_desert => the_parth_of_defiances_desert}/actions_chests.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{deep_desert => the_parth_of_defiances_desert}/actions_doors.lua (66%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{deep_desert => the_parth_of_defiances_desert}/actions_totems.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{deep_desert => the_parth_of_defiances_desert}/movements_color_puzzle.lua (100%) rename data-otservbr-global/scripts/quests/the_secret_library_quest/{deep_desert => the_parth_of_defiances_desert}/movements_teleportTo.lua (99%) diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_bony_rod.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_bony_rod.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_bony_rod.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_bony_rod.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_chests.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_chests.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_chests.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_chests.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_doors.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_doors.lua similarity index 66% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_doors.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_doors.lua index 4e51d5c5c6b..0da0faaec0f 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_doors.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_doors.lua @@ -1,9 +1,9 @@ local doors = { - [1] = { doorPosition = Position(33246, 32122, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, nivel = 2 }, - [2] = { doorPosition = Position(33208, 32071, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission, nivel = 1 }, - [3] = { doorPosition = Position(33208, 32074, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission, nivel = 1 }, - [4] = { doorPosition = Position(33341, 32117, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.FinalBasin, nivel = 1 }, - [5] = { doorPosition = Position(33344, 32120, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.SkullSample, nivel = 1 }, + [1] = { doorPosition = Position(33246, 32122, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, storage_value = 2 }, + [2] = { doorPosition = Position(33208, 32071, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission, storage_value = 1 }, + [3] = { doorPosition = Position(33208, 32074, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission, storage_value = 1 }, + [4] = { doorPosition = Position(33341, 32117, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.FinalBasin, storage_value = 1 }, + [5] = { doorPosition = Position(33344, 32120, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.SkullSample, storage_value = 1 }, } local actions_museum_doors = Action() @@ -11,7 +11,7 @@ local actions_museum_doors = Action() function actions_museum_doors.onUse(player, item, fromPosition, target, toPosition, isHotkey) for _, p in pairs(doors) do if (item:getPosition() == p.doorPosition) and not (Tile(item:getPosition()):getTopCreature()) then - if player:getStorageValue(p.storage) >= p.nivel then + if player:getStorageValue(p.storage) >= p.storage_value then player:teleportTo(toPosition, true) item:transform(item.itemid + 1) else diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_gems.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_gems.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_gems.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_gems.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_levers.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_levers.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_levers.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_levers.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_sample_blood.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_sample_blood.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/museum/actions_sample_blood.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_sample_blood.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/movements_teleportTo.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/movements_teleportTo.lua similarity index 93% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/museum/movements_teleportTo.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/movements_teleportTo.lua index e7f7ee9a08a..1c180da3c92 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/museum/movements_teleportTo.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/movements_teleportTo.lua @@ -1,6 +1,6 @@ local teleports = { - [1] = { fromPos = Position(33246, 32107, 8), toPos = Position(33246, 32096, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, nivel = 2, nextValue = 3 }, - [2] = { fromPos = Position(33246, 32098, 8), toPos = Position(33246, 32109, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, nivel = 2 }, + [1] = { fromPos = Position(33246, 32107, 8), toPos = Position(33246, 32096, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, storage_value = 2, nextValue = 3 }, + [2] = { fromPos = Position(33246, 32098, 8), toPos = Position(33246, 32109, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, storage_value = 2 }, } local lastroom_enter = Position(33344, 32117, 10) @@ -25,7 +25,7 @@ function movements_museum_teleportTo.onStepIn(creature, item, position, fromPosi if item.actionid == 4905 then for _, p in pairs(teleports) do if position == p.fromPos then - if player:getStorageValue(p.storage) >= p.nivel then + if player:getStorageValue(p.storage) >= p.storage_value then player:teleportTo(p.toPos) sendFire(p.toPos) if p.nextValue and player:getStorageValue(p.storage) < p.nextValue then diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_chests.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/high_and_dry_isles/actions_chests.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_chests.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/high_and_dry_isles/actions_chests.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_telescope.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/high_and_dry_isles/actions_telescope.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/isles/actions_telescope.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/high_and_dry_isles/actions_telescope.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_boat_puzzle.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/high_and_dry_isles/movements_boat_puzzle.lua similarity index 99% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_boat_puzzle.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/high_and_dry_isles/movements_boat_puzzle.lua index 573776cc699..c3ab2a814d8 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_boat_puzzle.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/high_and_dry_isles/movements_boat_puzzle.lua @@ -4,8 +4,10 @@ function movements_isle_color_puzzle.onStepIn(creature, item, position, fromPosi if not creature:isPlayer() then return false end + local player = Player(creature:getId()) local boatStage = player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.BoatStages) + if item.actionid == 4936 then if boatStage < 1 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You see the scattered parts of a wrecked ship. Miraculously the ship telescope survived the wreckm it seems still to be intact.") diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_stepIn.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/high_and_dry_isles/movements_stepIn.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/isles/movements_stepIn.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/high_and_dry_isles/movements_stepIn.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/actions_bossesLever.lua similarity index 99% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/actions_bossesLever.lua index 7e574e51f08..fb52d5d03dc 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_bossesLever.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/actions_bossesLever.lua @@ -1,4 +1,3 @@ --- Mazzinor info start local mazzinorSummons = { name = "Wild Knowledge", eventName = "mazzinorDeath", diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_parchment.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/actions_parchment.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/library/actions_parchment.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/actions_parchment.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/creaturescripts_ghulosh.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_ghulosh.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/creaturescripts_ghulosh.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_gorzindel.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/creaturescripts_gorzindel.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_gorzindel.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/creaturescripts_gorzindel.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_lokathmor.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/creaturescripts_lokathmor.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_lokathmor.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/creaturescripts_lokathmor.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_mazzinor.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/creaturescripts_mazzinor.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/library/creaturescripts_mazzinor.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/creaturescripts_mazzinor.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_gorzindel.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/movements_gorzindel.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_gorzindel.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/movements_gorzindel.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_mazzinor.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/movements_mazzinor.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_mazzinor.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/movements_mazzinor.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_timers.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/movements_timers.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/library/movements_timers.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/movements_timers.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_bossWay.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_bossWay.lua index bf7afd42b14..becc6a05cb7 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_bossWay.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_bossWay.lua @@ -1,5 +1,5 @@ local config = { - acessos = { + accesses = { [1] = { fromPos = Position(33525, 31464, 14), toPos = Position(33525, 31464, 15), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 6, message = "Without the help of other Njey you will probably not make enough of a difference in this battle.", timer = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimer }, }, defaultMessage = "You are not ready to pass yet.", @@ -16,18 +16,18 @@ function movements_liquid_bossWay.onStepIn(creature, item, position, fromPositio local player = Player(creature:getId()) if player then - local acessos = config.acessos - for i = 1, #acessos do - if acessos[i].fromPos == position then - if player:getStorageValue(acessos[i].storage) < acessos[i].value then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, acessos[i].message) + local accesses = config.accesses + for i = 1, #accesses do + if accesses[i].fromPos == position then + if player:getStorageValue(accesses[i].storage) < accesses[i].value then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, accesses[i].message) player:teleportTo(fromPosition, true) else - if player:getStorageValue(acessos[i].timer) > os.time() then + if player:getStorageValue(accesses[i].timer) > os.time() then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, config.notime) player:teleportTo(fromPosition, true) else - player:teleportTo(acessos[i].toPos, true) + player:teleportTo(accesses[i].toPos, true) end end end diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_bonefiddle.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_bonefiddle.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_bonefiddle.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_bonefiddle.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_chests.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_chests.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_chests.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_chests.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_doors.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_doors.lua similarity index 72% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_doors.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_doors.lua index 28f232d1034..5170e52955d 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_doors.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_doors.lua @@ -1,6 +1,6 @@ local doors = { - [1] = { doorPosition = Position(32962, 32674, 2), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.FlammingOrchid, nivel = 1, level = 250 }, - [2] = { doorPosition = Position(32959, 32679, 2), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, nivel = 1 }, + [1] = { doorPosition = Position(32962, 32674, 2), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.FlammingOrchid, storage_value = 1, value = 250 }, + [2] = { doorPosition = Position(32959, 32679, 2), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, storage_value = 1 }, } local actions_asura_doors = Action() @@ -8,12 +8,12 @@ local actions_asura_doors = Action() function actions_asura_doors.onUse(player, item, fromPosition, target, toPosition, isHotkey) for _, p in pairs(doors) do if (item:getPosition() == p.doorPosition) and not (Tile(item:getPosition()):getTopCreature()) then - if player:getStorageValue(p.storage) >= p.nivel then - if p.level and player:getLevel() >= p.level then + if player:getStorageValue(p.storage) >= p.storage_value then + if p.value and player:getvalue() >= p.value then player:teleportTo(toPosition, true) item:transform(item.itemid + 1) else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You do not have enough level.") + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You do not have enough value.") end else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.") diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_fragrance.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_fragrance.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_fragrance.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_fragrance.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_keys.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_keys.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_keys.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_keys.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_mirror.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_mirror.lua similarity index 85% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_mirror.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_mirror.lua index 448152746f2..24319493ceb 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/actions_mirror.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_mirror.lua @@ -4,11 +4,11 @@ local actions_asura_mirror = Action() function actions_asura_mirror.onUse(player, item, fromPosition, itemEx, toPosition) if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.FlammingOrchid) >= 1 and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) >= 1 then - if player:getLevel() >= 250 then + if player:getvalue() >= 250 then player:teleportTo(goPos) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) else - player:sendCancelMessage("You do not have enough level.") + player:sendCancelMessage("You do not have enough value.") end else player:sendCancelMessage("You do not have permission.") diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/creaturescripts_asuras_mechanic.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/creaturescripts_asuras_mechanic.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/creaturescripts_asuras_mechanic.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/creaturescripts_asuras_mechanic.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/movements_elemental_portals.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/movements_elemental_portals.lua similarity index 99% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/movements_elemental_portals.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/movements_elemental_portals.lua index 1e3b7f9f09b..ac2509adb94 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/asuras/movements_elemental_portals.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/movements_elemental_portals.lua @@ -67,7 +67,7 @@ function movements_asura_elemental_portals.onStepIn(creature, item, position, fr end player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) end - -- for bosses!! + for _, k in pairs(entrances) do if position == k.position then if k.storage then @@ -105,6 +105,7 @@ function movements_asura_elemental_portals.onStepIn(creature, item, position, fr player:setStorageValue(quest, 6) end end + for _, k in pairs(exites) do if position == k.position then player:teleportTo(k.toPosition) @@ -112,6 +113,7 @@ function movements_asura_elemental_portals.onStepIn(creature, item, position, fr end end end + return true end diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_doors.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_doors.lua similarity index 66% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_doors.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_doors.lua index f56002172a1..9ea613e2d29 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_doors.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_doors.lua @@ -1,26 +1,26 @@ local doors = { - [1] = { doorPosition = Position(33376, 31323, 2), nivel = -1 }, - [2] = { doorPosition = Position(33376, 31335, 3), nivel = 1 }, - [3] = { doorPosition = Position(33376, 31349, 4), nivel = 2 }, - [4] = { doorPosition = Position(33363, 31346, 7), nivel = 4 }, -- última porta!! + [1] = { doorPosition = Position(33376, 31323, 2), value = -1 }, + [2] = { doorPosition = Position(33376, 31335, 3), value = 1 }, + [3] = { doorPosition = Position(33376, 31349, 4), value = 2 }, + [4] = { doorPosition = Position(33363, 31346, 7), value = 4 }, } local boats = { - [1] = { boatPosition = Position(33373, 31309, 7), nivel = 3, toPosition = Position(33382, 31292, 7), message = "A small island emerges out of the mist as you row towards a tiny light inside a dark, forehoding chapel." }, - [2] = { boatPosition = Position(33381, 31294, 7), nivel = 3, toPosition = Position(33374, 31309, 7), message = "Your heart lightens as you return from the gloomy isle." }, - [3] = { boatPosition = Position(33344, 31348, 7), nivel = 3, toPosition = Position(33326, 31352, 7) }, - [4] = { boatPosition = Position(33328, 31352, 7), nivel = 3, toPosition = Position(33346, 31348, 7) }, + [1] = { boatPosition = Position(33373, 31309, 7), value = 3, toPosition = Position(33382, 31292, 7), message = "A small island emerges out of the mist as you row towards a tiny light inside a dark, forehoding chapel." }, + [2] = { boatPosition = Position(33381, 31294, 7), value = 3, toPosition = Position(33374, 31309, 7), message = "Your heart lightens as you return from the gloomy isle." }, + [3] = { boatPosition = Position(33344, 31348, 7), value = 3, toPosition = Position(33326, 31352, 7) }, + [4] = { boatPosition = Position(33328, 31352, 7), value = 3, toPosition = Position(33346, 31348, 7) }, } local actions_falcon_doors = Action() function actions_falcon_doors.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if item:getActionId() == 4920 then -- Portas!! + if item:getActionId() == 4920 then for _, p in pairs(doors) do local door = p.doorPosition - local nivel = p.nivel + local value = p.value if (item:getPosition() == door) and not (Tile(item:getPosition()):getTopCreature()) then - if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses) >= nivel then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses) >= value then player:teleportTo(toPosition, true) item:transform(item.itemid + 1) else @@ -28,14 +28,14 @@ function actions_falcon_doors.onUse(player, item, fromPosition, target, toPositi end end end - elseif item:getActionId() == 4921 then -- Barcos!! + elseif item:getActionId() == 4921 then for _, p in pairs(boats) do local boat = p.boatPosition - local nivel = p.nivel + local value = p.value local toPos = p.toPosition local message = p.message if item:getPosition() == boat then - if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses) >= nivel then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses) >= value then player:teleportTo(toPos, true) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) if message then diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_oberonLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_oberonLever.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/actions_oberonLever.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_oberonLever.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/movements_bossEntrance.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/movements_bossEntrance.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/falcon_bastion/movements_bossEntrance.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/movements_bossEntrance.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_chests.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/actions_chests.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_chests.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/actions_chests.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_doors.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/actions_doors.lua similarity index 66% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_doors.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/actions_doors.lua index af6f490e1d2..9ac1f98e62b 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_doors.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/actions_doors.lua @@ -1,13 +1,13 @@ local doors = { - [1] = { doorPosition = Position(32963, 32319, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, nivel = 40 }, - [2] = { doorPosition = Position(32955, 32304, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, nivel = 40 }, - [3] = { doorPosition = Position(32984, 32314, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.SecondChest, nivel = 1 }, - [4] = { doorPosition = Position(32968, 32324, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.SecondChest, nivel = 1 }, - [5] = { doorPosition = Position(32978, 32290, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.EatenFood, nivel = 1 }, - [6] = { doorPosition = Position(32963, 32297, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, nivel = 7 }, - [7] = { doorPosition = Position(32963, 32299, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, nivel = 7 }, - [8] = { doorPosition = Position(32963, 32301, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, nivel = 7 }, - [9] = { doorPosition = Position(32963, 32303, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, nivel = 7 }, + [1] = { doorPosition = Position(32963, 32319, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, value = 40 }, + [2] = { doorPosition = Position(32955, 32304, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, value = 40 }, + [3] = { doorPosition = Position(32984, 32314, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.SecondChest, value = 1 }, + [4] = { doorPosition = Position(32968, 32324, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.SecondChest, value = 1 }, + [5] = { doorPosition = Position(32978, 32290, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.EatenFood, value = 1 }, + [6] = { doorPosition = Position(32963, 32297, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 7 }, + [7] = { doorPosition = Position(32963, 32299, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 7 }, + [8] = { doorPosition = Position(32963, 32301, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 7 }, + [9] = { doorPosition = Position(32963, 32303, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 7 }, } local actions_desert_doors = Action() @@ -15,7 +15,7 @@ local actions_desert_doors = Action() function actions_desert_doors.onUse(player, item, fromPosition, target, toPosition, isHotkey) for _, p in pairs(doors) do if (item:getPosition() == p.doorPosition) and not (Tile(item:getPosition()):getTopCreature()) and isInArray({ 8361, 8355, 20450 }, item.itemid) then - if player:getStorageValue(p.storage) >= p.nivel then + if player:getStorageValue(p.storage) >= p.value then player:teleportTo(toPosition, true) item:transform(item.itemid + 1) else diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_totems.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/actions_totems.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/actions_totems.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/actions_totems.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_color_puzzle.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_color_puzzle.lua similarity index 100% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_color_puzzle.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_color_puzzle.lua diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_teleportTo.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_teleportTo.lua similarity index 99% rename from data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_teleportTo.lua rename to data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_teleportTo.lua index 3852f47a5cc..9081f1442ff 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/deep_desert/movements_teleportTo.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_teleportTo.lua @@ -74,16 +74,19 @@ end local function resetRoom(position, name) local spec = Game.getSpectators(position, false, false, 5, 5, 5, 5) + for _, c in pairs(spec) do if c and c:isPlayer() then return false end end + for _, c in pairs(spec) do if c and c:getName():lower() == name then c:remove() end end + return true end @@ -93,7 +96,9 @@ function movements_desert_teleportTo.onStepIn(creature, item, position, fromPosi if not creature:isPlayer() then return false end + local player = Player(creature:getId()) + if player then if item.actionid == 4930 then if position == lastTeleport then @@ -164,6 +169,7 @@ function movements_desert_teleportTo.onStepIn(creature, item, position, fromPosi end end end + return true end From ed9add2db3b316974e5f86cddc57ffdcec5a8c09 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 16 Oct 2024 13:23:54 +0000 Subject: [PATCH 31/70] Lua code format - (Stylua) --- .../the_lament_asuras/movements_elemental_portals.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/movements_elemental_portals.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/movements_elemental_portals.lua index ac2509adb94..fda5f918e3e 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/movements_elemental_portals.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/movements_elemental_portals.lua @@ -113,7 +113,7 @@ function movements_asura_elemental_portals.onStepIn(creature, item, position, fr end end end - + return true end From ec0ec389ea5cbdba8f9327a1260e9d64cd897461 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Wed, 16 Oct 2024 10:30:33 -0300 Subject: [PATCH 32/70] The Secret Library Quest - more --- .../bursting_at_the_seams_museum/actions_doors.lua | 12 ++++++------ .../movements_teleportTo.lua | 6 +++--- .../the_lament_asuras/actions_doors.lua | 10 +++++----- .../the_lament_asuras/actions_mirror.lua | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_doors.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_doors.lua index 0da0faaec0f..acebff7a338 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_doors.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_doors.lua @@ -1,9 +1,9 @@ local doors = { - [1] = { doorPosition = Position(33246, 32122, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, storage_value = 2 }, - [2] = { doorPosition = Position(33208, 32071, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission, storage_value = 1 }, - [3] = { doorPosition = Position(33208, 32074, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission, storage_value = 1 }, - [4] = { doorPosition = Position(33341, 32117, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.FinalBasin, storage_value = 1 }, - [5] = { doorPosition = Position(33344, 32120, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.SkullSample, storage_value = 1 }, + [1] = { doorPosition = Position(33246, 32122, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, value = 2 }, + [2] = { doorPosition = Position(33208, 32071, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission, value = 1 }, + [3] = { doorPosition = Position(33208, 32074, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission, value = 1 }, + [4] = { doorPosition = Position(33341, 32117, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.FinalBasin, value = 1 }, + [5] = { doorPosition = Position(33344, 32120, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.SkullSample, value = 1 }, } local actions_museum_doors = Action() @@ -11,7 +11,7 @@ local actions_museum_doors = Action() function actions_museum_doors.onUse(player, item, fromPosition, target, toPosition, isHotkey) for _, p in pairs(doors) do if (item:getPosition() == p.doorPosition) and not (Tile(item:getPosition()):getTopCreature()) then - if player:getStorageValue(p.storage) >= p.storage_value then + if player:getStorageValue(p.storage) >= p.value then player:teleportTo(toPosition, true) item:transform(item.itemid + 1) else diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/movements_teleportTo.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/movements_teleportTo.lua index 1c180da3c92..acf793f22fb 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/movements_teleportTo.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/movements_teleportTo.lua @@ -1,6 +1,6 @@ local teleports = { - [1] = { fromPos = Position(33246, 32107, 8), toPos = Position(33246, 32096, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, storage_value = 2, nextValue = 3 }, - [2] = { fromPos = Position(33246, 32098, 8), toPos = Position(33246, 32109, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, storage_value = 2 }, + [1] = { fromPos = Position(33246, 32107, 8), toPos = Position(33246, 32096, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, value = 2, nextValue = 3 }, + [2] = { fromPos = Position(33246, 32098, 8), toPos = Position(33246, 32109, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, value = 2 }, } local lastroom_enter = Position(33344, 32117, 10) @@ -25,7 +25,7 @@ function movements_museum_teleportTo.onStepIn(creature, item, position, fromPosi if item.actionid == 4905 then for _, p in pairs(teleports) do if position == p.fromPos then - if player:getStorageValue(p.storage) >= p.storage_value then + if player:getStorageValue(p.storage) >= p.value then player:teleportTo(p.toPos) sendFire(p.toPos) if p.nextValue and player:getStorageValue(p.storage) < p.nextValue then diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_doors.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_doors.lua index 5170e52955d..51307a3b35c 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_doors.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_doors.lua @@ -1,6 +1,6 @@ local doors = { - [1] = { doorPosition = Position(32962, 32674, 2), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.FlammingOrchid, storage_value = 1, value = 250 }, - [2] = { doorPosition = Position(32959, 32679, 2), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, storage_value = 1 }, + [1] = { doorPosition = Position(32962, 32674, 2), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.FlammingOrchid, value = 1, level = 250 }, + [2] = { doorPosition = Position(32959, 32679, 2), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, value = 1 }, } local actions_asura_doors = Action() @@ -8,12 +8,12 @@ local actions_asura_doors = Action() function actions_asura_doors.onUse(player, item, fromPosition, target, toPosition, isHotkey) for _, p in pairs(doors) do if (item:getPosition() == p.doorPosition) and not (Tile(item:getPosition()):getTopCreature()) then - if player:getStorageValue(p.storage) >= p.storage_value then - if p.value and player:getvalue() >= p.value then + if player:getStoragelevel(p.storage) >= p.value then + if p.level and player:getLevel() >= p.level then player:teleportTo(toPosition, true) item:transform(item.itemid + 1) else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You do not have enough value.") + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You do not have enough level.") end else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.") diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_mirror.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_mirror.lua index 24319493ceb..448152746f2 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_mirror.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_mirror.lua @@ -4,11 +4,11 @@ local actions_asura_mirror = Action() function actions_asura_mirror.onUse(player, item, fromPosition, itemEx, toPosition) if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.FlammingOrchid) >= 1 and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) >= 1 then - if player:getvalue() >= 250 then + if player:getLevel() >= 250 then player:teleportTo(goPos) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) else - player:sendCancelMessage("You do not have enough value.") + player:sendCancelMessage("You do not have enough level.") end else player:sendCancelMessage("You do not have permission.") From 30de131c47cc08a03aaa1cc8bffae9eeaf7150cb Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Wed, 16 Oct 2024 10:51:39 -0300 Subject: [PATCH 33/70] The Secret Library - quest log --- data-otservbr-global/lib/core/quests.lua | 69 ++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/data-otservbr-global/lib/core/quests.lua b/data-otservbr-global/lib/core/quests.lua index 81f2c71e41f..097e8e623f6 100644 --- a/data-otservbr-global/lib/core/quests.lua +++ b/data-otservbr-global/lib/core/quests.lua @@ -6533,5 +6533,74 @@ if not Quests then }, }, }, + [49] = { + name = "The Secret Library", startstorageid = Storage.Quest.U11_80.TheSecretLibrary.Questlog, startstoragevalue = 1, + missions = { + [1] = { + name = "High and Dry", storageid = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, startvalue = 1, endvalue = 3, + states = { + [1] = "Dedoras asked for you to talk to Charles, he knows about a small island.", + [2] = "You got stucked on this island. You must discover how to leave.", + [3] = "You successfully built a raft and used the starts to navigate your way through the waves. At least you found something of interest on the deserted island.", + + }, + }, + [2] = { + name = "Liquid Death", storageid = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, startvalue = 1, endvalue = 7, + states = { + [1] = "Dedoras has sent you to Spectulus in the Edron Academy. Rumors of strange fishmen in the Tiquanda region may be connected to some of the research the scholar conducted.", + [2] = "Spectulus asked you to check out the rumors of strange fishmen in the jungles of northern Tiquanda. A small sunken temple is said to be overrun by strange fish-like creatures.", + [3] = "You found a sunken temple deep in the Tiquanda jungle. Spectulus will help you enter the vortex at the entrance. Find out what happened there and take care of the fish-like aggressors...", + [4] = "Parte IV", + [5] = "Parte V", + [6] = "Parte VI", + [7] = "Brokul has been defeated and now you can talk with Spectulus or Dedoras what you found about the fishmen.", + }, + }, + [3] = { + name = "Asuri - The Lament", storageid = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, startvalue = 1, endvalue = 6, + states = { + [1] = "Go to Asuri Palace in Port Hope.", + [2] = "You were able to assemble an instrument with the objects found. That should work for something.", + [3] = "You must talk with the dead girl's mother, Gail, at Port Hope.", + [4] = "With a heavy heart you used a piece of ebony as well as the skull and hair of an unfortunate maiden to create a bone fiddle. By playing the Peacock Ballad you should be able to open the viollet portal.", + [5] = "You may enter the viollet portal. Check if there is something useful there.", + [6] = "In a secret room of the Asura Palace you discovered an old writing desk that contains an ancient map. This must be a hint to the secret library you are searching for.", + }, + }, + [4] = { + name = "The Order of the Falcon", storageid = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, startvalue = 1, endvalue = 2, + states = { + [1] = "It is said that an ancient order of knights once resided in Edron. The knights disappeared a long time ago but their abandoned outpost is still there. The place may yet hold some surprises.", + [2] = "You defeated Grand Master Oberon in mortal combat. The Falcon Order may have lost its glory a long time ago but you are just getting started.", + }, + }, + [5] = { + name = "The Path of Defiances", storageid = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, startvalue = 1, endvalue = 8, + states = { + [1] = "Go to Darashia and find out about the mysterious statue.", + [2] = "After you have been swallowed by a sand vortex you have entered a hidden desert area. A voice of unknown origin has informed you that you will have to face some challenges.", -- entrou + [3] = "Parte III", -- passou do labirinto + [4] = "Parte IV", -- abriu primeiro bau + [5] = "Parte V", -- abriu segundo bau + [6] = "Parte VI", -- fez puzzle + [7] = "Parte VII", -- abriu terceiro bau + [8] = "You have found a book page in a chest. It seems to contain very useful information, but you are not capable to read it. At this point you have to speak with an expert.", -- entrou na sala do quarto bau + }, + }, + [6] = { + name = "The Veiled Hoard of Zathroth", storageid = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, startvalue = 1, endvalue = 7, + states = { + [1] = "Dedoras told you where to search for leads to the Veiled Hoard: the museum in Thais, a fishmen temple in Tiquanda, an order fortress in Edron, the Asuri Palace and a deserted isle.", + [2] = "You talked with Gareth and now you may pass trougth the door.", + [3] = "Parte III", + [4] = "Parte IV", + [5] = "Parte V", + [6] = "You successfully entered the Veiled Hoard of Zathroth. However, countless secret and vast knowledge still lie ahead.", + [7] = "You have reported Gareth about the enigmatic inscription you have found in the chamber of doom. He was able to decipher it for you and referred to Dedoras in Cormaya for further assistance.", + }, + }, + } + }, } end From f2e6d49587402e4bf3df82172dfe7a6a985c8622 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 16 Oct 2024 13:52:35 +0000 Subject: [PATCH 34/70] Lua code format - (Stylua) --- data-otservbr-global/lib/core/quests.lua | 37 ++++++++++++++++++------ 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/data-otservbr-global/lib/core/quests.lua b/data-otservbr-global/lib/core/quests.lua index 097e8e623f6..31bba5dbed4 100644 --- a/data-otservbr-global/lib/core/quests.lua +++ b/data-otservbr-global/lib/core/quests.lua @@ -6534,19 +6534,26 @@ if not Quests then }, }, [49] = { - name = "The Secret Library", startstorageid = Storage.Quest.U11_80.TheSecretLibrary.Questlog, startstoragevalue = 1, + name = "The Secret Library", + startstorageid = Storage.Quest.U11_80.TheSecretLibrary.Questlog, + startstoragevalue = 1, missions = { [1] = { - name = "High and Dry", storageid = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, startvalue = 1, endvalue = 3, + name = "High and Dry", + storageid = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, + startvalue = 1, + endvalue = 3, states = { [1] = "Dedoras asked for you to talk to Charles, he knows about a small island.", [2] = "You got stucked on this island. You must discover how to leave.", [3] = "You successfully built a raft and used the starts to navigate your way through the waves. At least you found something of interest on the deserted island.", - }, }, [2] = { - name = "Liquid Death", storageid = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, startvalue = 1, endvalue = 7, + name = "Liquid Death", + storageid = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, + startvalue = 1, + endvalue = 7, states = { [1] = "Dedoras has sent you to Spectulus in the Edron Academy. Rumors of strange fishmen in the Tiquanda region may be connected to some of the research the scholar conducted.", [2] = "Spectulus asked you to check out the rumors of strange fishmen in the jungles of northern Tiquanda. A small sunken temple is said to be overrun by strange fish-like creatures.", @@ -6558,7 +6565,10 @@ if not Quests then }, }, [3] = { - name = "Asuri - The Lament", storageid = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, startvalue = 1, endvalue = 6, + name = "Asuri - The Lament", + storageid = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, + startvalue = 1, + endvalue = 6, states = { [1] = "Go to Asuri Palace in Port Hope.", [2] = "You were able to assemble an instrument with the objects found. That should work for something.", @@ -6569,14 +6579,20 @@ if not Quests then }, }, [4] = { - name = "The Order of the Falcon", storageid = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, startvalue = 1, endvalue = 2, + name = "The Order of the Falcon", + storageid = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, + startvalue = 1, + endvalue = 2, states = { [1] = "It is said that an ancient order of knights once resided in Edron. The knights disappeared a long time ago but their abandoned outpost is still there. The place may yet hold some surprises.", [2] = "You defeated Grand Master Oberon in mortal combat. The Falcon Order may have lost its glory a long time ago but you are just getting started.", }, }, [5] = { - name = "The Path of Defiances", storageid = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, startvalue = 1, endvalue = 8, + name = "The Path of Defiances", + storageid = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, + startvalue = 1, + endvalue = 8, states = { [1] = "Go to Darashia and find out about the mysterious statue.", [2] = "After you have been swallowed by a sand vortex you have entered a hidden desert area. A voice of unknown origin has informed you that you will have to face some challenges.", -- entrou @@ -6589,7 +6605,10 @@ if not Quests then }, }, [6] = { - name = "The Veiled Hoard of Zathroth", storageid = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, startvalue = 1, endvalue = 7, + name = "The Veiled Hoard of Zathroth", + storageid = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, + startvalue = 1, + endvalue = 7, states = { [1] = "Dedoras told you where to search for leads to the Veiled Hoard: the museum in Thais, a fishmen temple in Tiquanda, an order fortress in Edron, the Asuri Palace and a deserted isle.", [2] = "You talked with Gareth and now you may pass trougth the door.", @@ -6600,7 +6619,7 @@ if not Quests then [7] = "You have reported Gareth about the enigmatic inscription you have found in the chamber of doom. He was able to decipher it for you and referred to Dedoras in Cormaya for further assistance.", }, }, - } + }, }, } end From ffa8595e169b2737c26f692a5b5f9ab37690b14d Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Wed, 16 Oct 2024 10:54:03 -0300 Subject: [PATCH 35/70] Update quests.lua --- data-otservbr-global/lib/core/quests.lua | 26 ++++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/data-otservbr-global/lib/core/quests.lua b/data-otservbr-global/lib/core/quests.lua index 31bba5dbed4..bb582c55d07 100644 --- a/data-otservbr-global/lib/core/quests.lua +++ b/data-otservbr-global/lib/core/quests.lua @@ -6558,9 +6558,9 @@ if not Quests then [1] = "Dedoras has sent you to Spectulus in the Edron Academy. Rumors of strange fishmen in the Tiquanda region may be connected to some of the research the scholar conducted.", [2] = "Spectulus asked you to check out the rumors of strange fishmen in the jungles of northern Tiquanda. A small sunken temple is said to be overrun by strange fish-like creatures.", [3] = "You found a sunken temple deep in the Tiquanda jungle. Spectulus will help you enter the vortex at the entrance. Find out what happened there and take care of the fish-like aggressors...", - [4] = "Parte IV", - [5] = "Parte V", - [6] = "Parte VI", + [4] = "Part IV", + [5] = "Part V", + [6] = "Part VI", [7] = "Brokul has been defeated and now you can talk with Spectulus or Dedoras what you found about the fishmen.", }, }, @@ -6595,13 +6595,13 @@ if not Quests then endvalue = 8, states = { [1] = "Go to Darashia and find out about the mysterious statue.", - [2] = "After you have been swallowed by a sand vortex you have entered a hidden desert area. A voice of unknown origin has informed you that you will have to face some challenges.", -- entrou - [3] = "Parte III", -- passou do labirinto - [4] = "Parte IV", -- abriu primeiro bau - [5] = "Parte V", -- abriu segundo bau - [6] = "Parte VI", -- fez puzzle - [7] = "Parte VII", -- abriu terceiro bau - [8] = "You have found a book page in a chest. It seems to contain very useful information, but you are not capable to read it. At this point you have to speak with an expert.", -- entrou na sala do quarto bau + [2] = "After you have been swallowed by a sand vortex you have entered a hidden desert area. A voice of unknown origin has informed you that you will have to face some challenges.", + [3] = "Part III", + [4] = "Part IV", + [5] = "Part V", + [6] = "Part VI", + [7] = "Part VII", + [8] = "You have found a book page in a chest. It seems to contain very useful information, but you are not capable to read it. At this point you have to speak with an expert.", }, }, [6] = { @@ -6612,9 +6612,9 @@ if not Quests then states = { [1] = "Dedoras told you where to search for leads to the Veiled Hoard: the museum in Thais, a fishmen temple in Tiquanda, an order fortress in Edron, the Asuri Palace and a deserted isle.", [2] = "You talked with Gareth and now you may pass trougth the door.", - [3] = "Parte III", - [4] = "Parte IV", - [5] = "Parte V", + [3] = "Part III", + [4] = "Part IV", + [5] = "Part V", [6] = "You successfully entered the Veiled Hoard of Zathroth. However, countless secret and vast knowledge still lie ahead.", [7] = "You have reported Gareth about the enigmatic inscription you have found in the chamber of doom. He was able to decipher it for you and referred to Dedoras in Cormaya for further assistance.", }, From a8221f55c794aa0efee97c814f0410b484618dc5 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Wed, 16 Oct 2024 11:33:47 -0300 Subject: [PATCH 36/70] Update quests.lua --- data-otservbr-global/lib/core/quests.lua | 46 +++++++++++++----------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/data-otservbr-global/lib/core/quests.lua b/data-otservbr-global/lib/core/quests.lua index bb582c55d07..7dbb5833e55 100644 --- a/data-otservbr-global/lib/core/quests.lua +++ b/data-otservbr-global/lib/core/quests.lua @@ -6535,14 +6535,15 @@ if not Quests then }, [49] = { name = "The Secret Library", - startstorageid = Storage.Quest.U11_80.TheSecretLibrary.Questlog, - startstoragevalue = 1, + startStorageId = Storage.Quest.U11_80.TheSecretLibrary.Questlog, + startStorageValue = 1, missions = { [1] = { name = "High and Dry", - storageid = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, - startvalue = 1, - endvalue = 3, + storageId = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, + missionId = 10451, + startValue = 1, + endValue = 3, states = { [1] = "Dedoras asked for you to talk to Charles, he knows about a small island.", [2] = "You got stucked on this island. You must discover how to leave.", @@ -6551,9 +6552,10 @@ if not Quests then }, [2] = { name = "Liquid Death", - storageid = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, - startvalue = 1, - endvalue = 7, + storageId = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, + missionId = 10452, + startValue = 1, + endValue = 7, states = { [1] = "Dedoras has sent you to Spectulus in the Edron Academy. Rumors of strange fishmen in the Tiquanda region may be connected to some of the research the scholar conducted.", [2] = "Spectulus asked you to check out the rumors of strange fishmen in the jungles of northern Tiquanda. A small sunken temple is said to be overrun by strange fish-like creatures.", @@ -6566,9 +6568,10 @@ if not Quests then }, [3] = { name = "Asuri - The Lament", - storageid = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, - startvalue = 1, - endvalue = 6, + storageId = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, + missionId = 10453, + startValue = 1, + endValue = 6, states = { [1] = "Go to Asuri Palace in Port Hope.", [2] = "You were able to assemble an instrument with the objects found. That should work for something.", @@ -6580,9 +6583,10 @@ if not Quests then }, [4] = { name = "The Order of the Falcon", - storageid = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, - startvalue = 1, - endvalue = 2, + storageId = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, + missionId = 10454, + startValue = 1, + endValue = 2, states = { [1] = "It is said that an ancient order of knights once resided in Edron. The knights disappeared a long time ago but their abandoned outpost is still there. The place may yet hold some surprises.", [2] = "You defeated Grand Master Oberon in mortal combat. The Falcon Order may have lost its glory a long time ago but you are just getting started.", @@ -6590,9 +6594,10 @@ if not Quests then }, [5] = { name = "The Path of Defiances", - storageid = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, - startvalue = 1, - endvalue = 8, + storageId = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, + missionId = 10455, + startValue = 1, + endValue = 8, states = { [1] = "Go to Darashia and find out about the mysterious statue.", [2] = "After you have been swallowed by a sand vortex you have entered a hidden desert area. A voice of unknown origin has informed you that you will have to face some challenges.", @@ -6606,9 +6611,10 @@ if not Quests then }, [6] = { name = "The Veiled Hoard of Zathroth", - storageid = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, - startvalue = 1, - endvalue = 7, + storageId = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, + missionId = 10456, + startValue = 1, + endValue = 7, states = { [1] = "Dedoras told you where to search for leads to the Veiled Hoard: the museum in Thais, a fishmen temple in Tiquanda, an order fortress in Edron, the Asuri Palace and a deserted isle.", [2] = "You talked with Gareth and now you may pass trougth the door.", From 603f55b772daab0dd631fd0fd540d8b8e70167b1 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Wed, 16 Oct 2024 15:06:27 -0300 Subject: [PATCH 37/70] @omarcopires good --- data/scripts/actions/items/foods.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/data/scripts/actions/items/foods.lua b/data/scripts/actions/items/foods.lua index 9c91d0da6c2..f9cf4842b98 100644 --- a/data/scripts/actions/items/foods.lua +++ b/data/scripts/actions/items/foods.lua @@ -136,11 +136,13 @@ function food.onUse(player, item, fromPosition, target, toPosition, isHotkey) return true end - -- The Secret Library Quest - if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.eatenFood) ~= 1 then - if player:getPosition():isInRange(Position(32961, 32280, 10), Position(32964, 32286, 10)) then - player:say("Fames est optimus coquus", TALKTYPE_MONSTER_SAY) - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.eatenFood, 1) + if IsRunningGlobalDatapack() then + -- The Secret Library Quest + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.eatenFood) ~= 1 then + if player:getPosition():isInRange(Position(32961, 32280, 10), Position(32964, 32286, 10)) then + player:say("Fames est optimus coquus", TALKTYPE_MONSTER_SAY) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.eatenFood, 1) + end end end From b1ff27af0641039440979e793892bee4ad420399 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Wed, 16 Oct 2024 20:09:30 -0300 Subject: [PATCH 38/70] The Secret Library Quest - Liquid Death --- data-otservbr-global/lib/core/quests.lua | 3 +- data-otservbr-global/npc/dedoras.lua | 66 +++++---- data-otservbr-global/npc/spectulus.lua | 30 ++++- .../creaturescripts_kill.lua | 2 +- .../liquid_death/actions_brokulLever.lua | 125 ++++++++++++------ .../liquid_death/actions_usableItens.lua | 8 +- .../liquid_death/movements_teleportTo.lua | 2 +- data-otservbr-global/startup/tables/item.lua | 20 +++ data-otservbr-global/startup/tables/lever.lua | 7 + 9 files changed, 187 insertions(+), 76 deletions(-) diff --git a/data-otservbr-global/lib/core/quests.lua b/data-otservbr-global/lib/core/quests.lua index 7dbb5833e55..e7b1001bbf1 100644 --- a/data-otservbr-global/lib/core/quests.lua +++ b/data-otservbr-global/lib/core/quests.lua @@ -6555,7 +6555,7 @@ if not Quests then storageId = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, missionId = 10452, startValue = 1, - endValue = 7, + endValue = 8, states = { [1] = "Dedoras has sent you to Spectulus in the Edron Academy. Rumors of strange fishmen in the Tiquanda region may be connected to some of the research the scholar conducted.", [2] = "Spectulus asked you to check out the rumors of strange fishmen in the jungles of northern Tiquanda. A small sunken temple is said to be overrun by strange fish-like creatures.", @@ -6564,6 +6564,7 @@ if not Quests then [5] = "Part V", [6] = "Part VI", [7] = "Brokul has been defeated and now you can talk with Spectulus or Dedoras what you found about the fishmen.", + [8] = "Congratulations you completed this mission.", }, }, [3] = { diff --git a/data-otservbr-global/npc/dedoras.lua b/data-otservbr-global/npc/dedoras.lua index 16e35fed00b..370f2f90322 100644 --- a/data-otservbr-global/npc/dedoras.lua +++ b/data-otservbr-global/npc/dedoras.lua @@ -96,42 +96,50 @@ local function creatureSayCallback(npc, creature, type, message) "I gathered some lore on my own, but I desperately need more information that you might provide me. ...", "My leads are the {museum} in thais, something strange in the darashian {desert}, rumors about {fishmen}, an ancient {order}, the mysterious {asuri}, or a lost {isle}?", }, npc, creature) - npcHandler:setTopic(playerId, 2) - elseif npcHandler:getTopic(playerId) == 2 then - if MsgContains(message, "museum") then - npcHandler:say("I have heard that it was recently planned to expand the Museum of Tibian Arts. In the course of these activities unexpected difficulties occurred.", npc, creature) - startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, 1) - elseif MsgContains(message, "desert") then - npcHandler:say("There are rumors of a mysterious statue in the desert next to Darashia. Nobody really knows the meaning of it.", npc, creature) - startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, 1) - elseif MsgContains(message, "fishmen") then + elseif MsgContains(message, "museum") then + npcHandler:say("I have heard that it was recently planned to expand the Museum of Tibian Arts. In the course of these activities unexpected difficulties occurred.", npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, 1) + elseif MsgContains(message, "desert") then + npcHandler:say("There are rumors of a mysterious statue in the desert next to Darashia. Nobody really knows the meaning of it.", npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, 1) + elseif MsgContains(message, "fishmen") then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline) == 7 then + npcHandler:say("You brought incredible news. This book proves an invaluable clue!", npc, creature) + local currentStorage = player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission) + if currentStorage < 0 then + currentStorage = 0 + end + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission, currentStorage + 1) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, 8) + elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline) < 1 then npcHandler:say({ "Sightings of strange fishmen in Tiquanda are stirring up the region. You should be careful when investigating this. ...", "As far as I know a scholar in Edron already dealt with fish-like creatures before.", }, npc, creature) startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, 1) - elseif MsgContains(message, "order") then - npcHandler:say({ - "Our world has seen many noble knights and orders throughout the centuries. Most of them vanished a long time ago but only few under such mysterious circumstances as the Order of the Falcon. ...", - "This noble alliance of honourable knights once resided in Edron to serve the king. Legend has it they vanished practically over night. Rumor has it their disappearance is connected to a forbidden book.", - }, npc, creature) - startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, 1) - elseif MsgContains(message, "asuri") then - npcHandler:say({ - "There's a beautiful but very dangerous palace in the Tiquandan jungle. The young women who live there are actually demons and they are luring unsuspecting mortals in there. ...", - "A lucky survivor told me about a portal at the very top of the palace that may lead to another asuri hideout.", - }, npc, creature) - startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, 1) - elseif MsgContains(message, "isle") then - npcHandler:say("Talk to Captain Charles in Port Hope. He told me that he once ran ashore on a small island where he discovered a small ruin. The architecture was like nothing he had seen before.", npc, creature) - startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, 1) end - elseif MsgContains(message, "progress") and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.libraryPermission) < 1 then + elseif MsgContains(message, "order") then npcHandler:say({ - "About what of your mission s do you want to report? The {museum}, the darashian {desert}, the rumors about strange {fishmen}, the ancient {order}, the mysterious {asuri}, or the lost {isle}? ...", - "Or shall me {check} how much information we acquired?", + "Our world has seen many noble knights and orders throughout the centuries. Most of them vanished a long time ago but only few under such mysterious circumstances as the Order of the Falcon. ...", + "This noble alliance of honourable knights once resided in Edron to serve the king. Legend has it they vanished practically over night. Rumor has it their disappearance is connected to a forbidden book.", }, npc, creature) - npcHandler:setTopic(playerId, 3) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, 1) + elseif MsgContains(message, "asuri") then + npcHandler:say({ + "There's a beautiful but very dangerous palace in the Tiquandan jungle. The young women who live there are actually demons and they are luring unsuspecting mortals in there. ...", + "A lucky survivor told me about a portal at the very top of the palace that may lead to another asuri hideout.", + }, npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, 1) + elseif MsgContains(message, "isle") then + npcHandler:say("Talk to Captain Charles in Port Hope. He told me that he once ran ashore on a small island where he discovered a small ruin. The architecture was like nothing he had seen before.", npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, 1) + elseif MsgContains(message, "progress") then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission) < 6 then + npcHandler:say({ + "About what of your mission s do you want to report? The {museum}, the darashian {desert}, the rumors about strange {fishmen}, the ancient {order}, the mysterious {asuri}, or the lost {isle}? ...", + "Or shall me {check} how much information we acquired?", + }, npc, creature) + end elseif npcHandler:getTopic(playerId) == 3 then if MsgContains(message, "check") then if isQuestDone(player:getId()) then @@ -140,7 +148,7 @@ local function creatureSayCallback(npc, creature, type, message) "There, use an ordinary scythe on the right of the two monuments, while concentrating on this glyph here and chant the words: Chamek Athra Thull Zathroth ...", "Hurry now my friend. Time is of essence!", }, npc, creature) - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.libraryPermission, 1) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission, 1) player:addAchievement("Battle Mage") player:addOutfit(1069, 1) player:addOutfit(1070, 1) diff --git a/data-otservbr-global/npc/spectulus.lua b/data-otservbr-global/npc/spectulus.lua index 2c741fe2288..6bed2acf958 100644 --- a/data-otservbr-global/npc/spectulus.lua +++ b/data-otservbr-global/npc/spectulus.lua @@ -424,13 +424,39 @@ local function creatureSayCallback(npc, creature, type, message) "Are you willing to help me?", }, npc, creature) npcHandler:setTopic(playerId, 25) - elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 25 then + elseif MsgContains(message, "yes") then if npcHandler:getTopic(playerId) == 25 then npcHandler:say("Excellent, excellent. The rumours pointed to the north of Tiquanda, a sunken temple probably half drowned in water. Return to me if you find anything interesting!", npc, creature) - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath, 1) + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline) < 1 then + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, 1) + end npcHandler:setTopic(playerId, 0) end end + + if MsgContains(message, "njey") then + npcHandler:say({ + "Mh? Ah, yes yes. 'Njey' is the native-language term for a very old race of undersea creatures which ...", + "...hm, wait - only a select few of my colleagues even bothered studying their culture. They are a mere fantasy to the common man - is there anything of importance you want to tell me?", + }, npc, creature) + npcHandler:setTopic(playerId, 26) + elseif MsgContains(message, "yes") then + if npcHandler:getTopic(playerId) == 26 then + npcHandler:say({ + "Well, if you really want to delve into this - I could use some help. So you have found my machine on that island? And you found the notes with the coordinates? Then you can find the entrance! ...", + "Just look for a large staircase with sprawling steps. There is an unpassable stream there that will prevent you from venturing further on. But fear not, you can indeed travel down there - with these small enhancements I created. ...", + "I will put this under your footgear. Here you go. And this in your nose. There. And there will be no further problems for you down there. Except- ah, well you'll find out yourself soon enough, won't you?", + }, npc, creature) + npcHandler:setTopic(playerId, 34) + elseif npcHandler:getTopic(playerId) == 34 then + npcHandler:say("Then off you go! I'm sorry that I cannot offer you any further help but I'm sure you will find support along your way. And - be careful. The sea can appear pitch black down there.", npc, creature) + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline) < 4 then + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, 4) + end + npcHandler:setTopic(playerId, 0) + end + end + return true end diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua index 1d3ff90798c..d0024cbd5f4 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua @@ -2,7 +2,7 @@ local defaultTime = 20 local creaturescripts_library_bosses = CreatureEvent("killingLibrary") -function creaturescripts_library_bosses.onKill(player, creature) +function creaturescripts_library_bosses.onDeath(player, creature) if not player:isPlayer() then return true end diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua index 3e0aa67ad4e..48b22de37be 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua @@ -1,6 +1,6 @@ local transform = { - [9110] = 9111, - [9111] = 9110, + [2772] = 2773, + [2773] = 2772, } local leverInfo = { @@ -20,45 +20,94 @@ local leverInfo = { }, } +local function clearBossRoom(fromPos, toPos) + local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) + for _, spec in pairs(spectators) do + if not spec:isPlayer() then + spec:remove() + end + end +end + +local function isBossInRoom(fromPos, toPos, bossName) + local hasBoss = false + local hasPlayers = false + local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) + + for _, spec in pairs(spectators) do + if spec:isPlayer() then + hasPlayers = true + elseif spec:isMonster() and spec:getName():lower() == bossName:lower() then + hasBoss = true + end + end + + return hasBoss, hasPlayers +end + local actions_liquid_brokulLever = Action() function actions_liquid_brokulLever.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if not player then - return true - end - - local playersTable = {} - local iPos = item:getPosition() - local pPos = player:getPosition() - - if item.itemid == 9110 then - for i = 1, #leverInfo do - if iPos == leverInfo[i].leverPosition then - local leverTable = leverInfo[i] - if pPos == leverTable.pushPosition then - if doCheckBossRoom(player:getId(), leverTable.bossName, leverTable.roomFromPosition, leverTable.roomToPosition) then - for i = leverTable.leverFromPos.x, leverTable.leverToPos.x do - local newPos = Position(i, leverTable.leverFromPos.y, leverTable.leverFromPos.z) - local creature = Tile(newPos):getTopCreature() - if creature and creature:isPlayer() then - creature:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimer, os.time() + 20 * 60 * 60) - creature:teleportTo(leverTable.teleportTo, true) - creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - table.insert(playersTable, creature:getId()) - end - end - local monster = Game.createMonster(leverTable.bossName, leverTable.bossPosition) - addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, leverTable.roomFromPosition, leverTable.roomToPosition, leverTable.exitPosition) - end - end - end - end - end - - item:transform(transform[item.itemid]) - - return true + if not player then + return true + end + + local playersTable = {} + local iPos = item:getPosition() + local pPos = player:getPosition() + + if item.itemid == 2772 then + for i = 1, #leverInfo do + if iPos == leverInfo[i].leverPosition then + local leverTable = leverInfo[i] + if pPos == leverTable.pushPosition then + local hasBoss, hasPlayers = isBossInRoom(leverTable.roomFromPosition, leverTable.roomToPosition, leverTable.bossName) + + if hasPlayers then + player:sendCancelMessage("The room is already occupied by other players.") + return true + elseif hasBoss then + clearBossRoom(leverTable.roomFromPosition, leverTable.roomToPosition) + end + + local playerCount = 0 + for i = leverTable.leverFromPos.x, leverTable.leverToPos.x do + local newPos = Position(i, leverTable.leverFromPos.y, leverTable.leverFromPos.z) + local creature = Tile(newPos):getTopCreature() + if creature and creature:isPlayer() then + if creature:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline) >= 6 then + playerCount = playerCount + 1 + table.insert(playersTable, creature:getId()) + else + creature:sendCancelMessage("You are not qualified to face the boss.") + end + end + end + + if playerCount < 5 then + player:sendCancelMessage("You need 5 qualified players for this challenge.") + return true + end + + for _, playerId in ipairs(playersTable) do + local creature = Creature(playerId) + if creature then + creature:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimer, os.time() + 20 * 60 * 60) + creature:teleportTo(leverTable.teleportTo, true) + creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + end + + local monster = Game.createMonster(leverTable.bossName, leverTable.bossPosition) + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, leverTable.roomFromPosition, leverTable.roomToPosition, leverTable.exitPosition) + end + end + end + end + + item:transform(transform[item.itemid]) + return true end actions_liquid_brokulLever:aid(4901) -actions_liquid_brokulLever:register() +actions_liquid_brokulLever:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_usableItens.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_usableItens.lua index 88556ae740b..168e841886a 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_usableItens.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_usableItens.lua @@ -11,17 +11,17 @@ local config = { [9] = { position = Position(33574, 31441, 15), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Statue9 }, }, bookInfo = { - id = 15475, + id = 14072, position = Position(32881, 32435, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, - value = 3, + value = 2, message = "The descriptions in this book look like plans detailing the launch of a large-scale assault.", }, statueEffect = CONST_ME_THUNDER, statueMessage = "The Njey will appreciate your help.", statueMessage_ = "You recently fixed that idol.", - statueId = { 17240, 17241 }, - fixedId = { 17239, 17242 }, + statueId = { 15895, 15896 }, + fixedId = { 15894, 15897 }, countStatues = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.StatueCount, maxValue = 9, } diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_teleportTo.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_teleportTo.lua index acfd8376a2a..f313bf3cdd9 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_teleportTo.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/movements_teleportTo.lua @@ -1,6 +1,6 @@ local config = { teleports = { - [1] = { fromPos = Position(32873, 32512, 7), toPos = Position(32881, 32471, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 2, effect = CONST_ME_WATERSPLASH, achievementName = "Spectulation" }, + [1] = { fromPos = Position(32871, 32510, 7), toPos = Position(32881, 32471, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 1, effect = CONST_ME_WATERSPLASH, achievementName = "Spectulation" }, [2] = { fromPos = Position(32881, 32473, 9), toPos = Position(32871, 32513, 7), effect = CONST_ME_WATERSPLASH }, [3] = { fromPos = Position(33584, 31388, 13), toPos = Position(33584, 31391, 13), storage = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 4, effect = CONST_ME_TELEPORT, message = "You squeeze through an ancient small passage. There are small symbols carved deep into the coral you cannot read." }, [4] = { fromPos = Position(33560, 31395, 13), toPos = Position(33561, 31391, 13), effect = CONST_ME_TELEPORT }, diff --git a/data-otservbr-global/startup/tables/item.lua b/data-otservbr-global/startup/tables/item.lua index ec411bca1d7..d1a4b16988b 100644 --- a/data-otservbr-global/startup/tables/item.lua +++ b/data-otservbr-global/startup/tables/item.lua @@ -556,6 +556,26 @@ ItemAction = { { x = 32994, y = 32442, z = 11 }, }, }, + -- The Secret Library Quest + [4900] = { + itemId = false, + itemPos = { + { x = 32871, y = 32510, z = 7 }, + { x = 32881, y = 32473, z = 9 }, + { x = 32881, y = 32435, z = 8 }, + { x = 33584, y = 31388, z = 13 }, + { x = 33560, y = 31395, z = 13 }, + { x = 33598, y = 31398, z = 14 }, + { x = 33602, y = 31439, z = 13 }, + { x = 33587, y = 31461, z = 14 }, + { x = 33588, y = 31461, z = 14 }, + { x = 33549, y = 31459, z = 14 }, + { x = 33577, y = 31475, z = 15 }, + { x = 33612, y = 31465, z = 15 }, + { x = 33565, y = 31423, z = 13 }, + { x = 33574, y = 31441, z = 15 }, + }, + }, -- Cults of Tibia Quest [5522] = { itemId = 25687, diff --git a/data-otservbr-global/startup/tables/lever.lua b/data-otservbr-global/startup/tables/lever.lua index 82cccc5c7d5..94a040a955d 100644 --- a/data-otservbr-global/startup/tables/lever.lua +++ b/data-otservbr-global/startup/tables/lever.lua @@ -15,6 +15,13 @@ LeverAction = { { x = 32972, y = 32412, z = 11 }, }, }, + -- The Secret Library Quest + [4901] = { + itemId = 2772, + itemPos = { + { x = 33522, y = 31464, z = 15 }, + }, + }, -- Cults of Tibia Quest [5500] = { itemId = 8911, From e7a633deab25f0064abfa81fcff429f7db1a40b2 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 16 Oct 2024 23:10:28 +0000 Subject: [PATCH 39/70] Lua code format - (Stylua) --- .../liquid_death/actions_brokulLever.lua | 158 +++++++++--------- 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua index 48b22de37be..2cab34c6e48 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua @@ -21,93 +21,93 @@ local leverInfo = { } local function clearBossRoom(fromPos, toPos) - local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) - for _, spec in pairs(spectators) do - if not spec:isPlayer() then - spec:remove() - end - end + local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) + for _, spec in pairs(spectators) do + if not spec:isPlayer() then + spec:remove() + end + end end local function isBossInRoom(fromPos, toPos, bossName) - local hasBoss = false - local hasPlayers = false - local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) - - for _, spec in pairs(spectators) do - if spec:isPlayer() then - hasPlayers = true - elseif spec:isMonster() and spec:getName():lower() == bossName:lower() then - hasBoss = true - end - end - - return hasBoss, hasPlayers + local hasBoss = false + local hasPlayers = false + local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) + + for _, spec in pairs(spectators) do + if spec:isPlayer() then + hasPlayers = true + elseif spec:isMonster() and spec:getName():lower() == bossName:lower() then + hasBoss = true + end + end + + return hasBoss, hasPlayers end local actions_liquid_brokulLever = Action() function actions_liquid_brokulLever.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if not player then - return true - end - - local playersTable = {} - local iPos = item:getPosition() - local pPos = player:getPosition() - - if item.itemid == 2772 then - for i = 1, #leverInfo do - if iPos == leverInfo[i].leverPosition then - local leverTable = leverInfo[i] - if pPos == leverTable.pushPosition then - local hasBoss, hasPlayers = isBossInRoom(leverTable.roomFromPosition, leverTable.roomToPosition, leverTable.bossName) - - if hasPlayers then - player:sendCancelMessage("The room is already occupied by other players.") - return true - elseif hasBoss then - clearBossRoom(leverTable.roomFromPosition, leverTable.roomToPosition) - end - - local playerCount = 0 - for i = leverTable.leverFromPos.x, leverTable.leverToPos.x do - local newPos = Position(i, leverTable.leverFromPos.y, leverTable.leverFromPos.z) - local creature = Tile(newPos):getTopCreature() - if creature and creature:isPlayer() then - if creature:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline) >= 6 then - playerCount = playerCount + 1 - table.insert(playersTable, creature:getId()) - else - creature:sendCancelMessage("You are not qualified to face the boss.") - end - end - end - - if playerCount < 5 then - player:sendCancelMessage("You need 5 qualified players for this challenge.") - return true - end - - for _, playerId in ipairs(playersTable) do - local creature = Creature(playerId) - if creature then - creature:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimer, os.time() + 20 * 60 * 60) - creature:teleportTo(leverTable.teleportTo, true) - creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - end - - local monster = Game.createMonster(leverTable.bossName, leverTable.bossPosition) - addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, leverTable.roomFromPosition, leverTable.roomToPosition, leverTable.exitPosition) - end - end - end - end - - item:transform(transform[item.itemid]) - return true + if not player then + return true + end + + local playersTable = {} + local iPos = item:getPosition() + local pPos = player:getPosition() + + if item.itemid == 2772 then + for i = 1, #leverInfo do + if iPos == leverInfo[i].leverPosition then + local leverTable = leverInfo[i] + if pPos == leverTable.pushPosition then + local hasBoss, hasPlayers = isBossInRoom(leverTable.roomFromPosition, leverTable.roomToPosition, leverTable.bossName) + + if hasPlayers then + player:sendCancelMessage("The room is already occupied by other players.") + return true + elseif hasBoss then + clearBossRoom(leverTable.roomFromPosition, leverTable.roomToPosition) + end + + local playerCount = 0 + for i = leverTable.leverFromPos.x, leverTable.leverToPos.x do + local newPos = Position(i, leverTable.leverFromPos.y, leverTable.leverFromPos.z) + local creature = Tile(newPos):getTopCreature() + if creature and creature:isPlayer() then + if creature:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline) >= 6 then + playerCount = playerCount + 1 + table.insert(playersTable, creature:getId()) + else + creature:sendCancelMessage("You are not qualified to face the boss.") + end + end + end + + if playerCount < 5 then + player:sendCancelMessage("You need 5 qualified players for this challenge.") + return true + end + + for _, playerId in ipairs(playersTable) do + local creature = Creature(playerId) + if creature then + creature:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimer, os.time() + 20 * 60 * 60) + creature:teleportTo(leverTable.teleportTo, true) + creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + end + end + + local monster = Game.createMonster(leverTable.bossName, leverTable.bossPosition) + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, leverTable.roomFromPosition, leverTable.roomToPosition, leverTable.exitPosition) + end + end + end + end + + item:transform(transform[item.itemid]) + return true end actions_liquid_brokulLever:aid(4901) -actions_liquid_brokulLever:register() \ No newline at end of file +actions_liquid_brokulLever:register() From 381d00fccc2f0db9a6a7f43e9e064c1b6e8f3f00 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:49:06 -0300 Subject: [PATCH 40/70] The Secret Library Quest - Bursting at the Seams --- data-otservbr-global/lib/core/quests.lua | 5 +- data-otservbr-global/lib/core/storages.lua | 3 ++ data-otservbr-global/npc/dedoras.lua | 17 ++++++- data-otservbr-global/npc/gareth.lua | 36 ++++++------- .../scripts/lib/register_actions.lua | 50 +++++++++++++++++++ .../actions_bony_rod.lua | 1 + .../actions_chests.lua | 31 ------------ .../actions_levers.lua | 12 ++--- .../movements_teleportTo.lua | 5 +- data-otservbr-global/startup/tables/chest.lua | 22 ++++++++ data-otservbr-global/startup/tables/item.lua | 25 ++++++++++ data-otservbr-global/startup/tables/lever.lua | 7 +++ .../startup/tables/teleport.lua | 19 +++++++ 13 files changed, 169 insertions(+), 64 deletions(-) delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_chests.lua diff --git a/data-otservbr-global/lib/core/quests.lua b/data-otservbr-global/lib/core/quests.lua index e7b1001bbf1..27c9185bc7e 100644 --- a/data-otservbr-global/lib/core/quests.lua +++ b/data-otservbr-global/lib/core/quests.lua @@ -6611,11 +6611,11 @@ if not Quests then }, }, [6] = { - name = "The Veiled Hoard of Zathroth", + name = "Bursting at the Seams", storageId = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, missionId = 10456, startValue = 1, - endValue = 7, + endValue = 8, states = { [1] = "Dedoras told you where to search for leads to the Veiled Hoard: the museum in Thais, a fishmen temple in Tiquanda, an order fortress in Edron, the Asuri Palace and a deserted isle.", [2] = "You talked with Gareth and now you may pass trougth the door.", @@ -6624,6 +6624,7 @@ if not Quests then [5] = "Part V", [6] = "You successfully entered the Veiled Hoard of Zathroth. However, countless secret and vast knowledge still lie ahead.", [7] = "You have reported Gareth about the enigmatic inscription you have found in the chamber of doom. He was able to decipher it for you and referred to Dedoras in Cormaya for further assistance.", + [8] = "Congratulations you completed this mission.", }, }, }, diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index 56367c8a381..eff1f96e779 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -2669,6 +2669,9 @@ Storage = { RedGem = 46067, FinalBasin = 46068, SkullSample = 46069, + TakenRod = 46070, + TrialTimer = 46071, + MuseumTimer = 46071, }, SmallIslands = { Questline = 46070, diff --git a/data-otservbr-global/npc/dedoras.lua b/data-otservbr-global/npc/dedoras.lua index 370f2f90322..3459b5713c9 100644 --- a/data-otservbr-global/npc/dedoras.lua +++ b/data-otservbr-global/npc/dedoras.lua @@ -97,8 +97,21 @@ local function creatureSayCallback(npc, creature, type, message) "My leads are the {museum} in thais, something strange in the darashian {desert}, rumors about {fishmen}, an ancient {order}, the mysterious {asuri}, or a lost {isle}?", }, npc, creature) elseif MsgContains(message, "museum") then - npcHandler:say("I have heard that it was recently planned to expand the Museum of Tibian Arts. In the course of these activities unexpected difficulties occurred.", npc, creature) - startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, 1) + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) == 7 then + npcHandler:say({ + "This is ...", + "An astonishing find to say the least! I'm certain it will help the efforts of accessing the library a lot!", + }, npc, creature) + local currentStorage = player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission) + if currentStorage < 0 then + currentStorage = 0 + end + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission, currentStorage + 1) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, 8) + elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) < 1 then + npcHandler:say("I have heard that it was recently planned to expand the Museum of Tibian Arts. In the course of these activities unexpected difficulties occurred.", npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, 1) + end elseif MsgContains(message, "desert") then npcHandler:say("There are rumors of a mysterious statue in the desert next to Darashia. Nobody really knows the meaning of it.", npc, creature) startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, 1) diff --git a/data-otservbr-global/npc/gareth.lua b/data-otservbr-global/npc/gareth.lua index 8103681f094..5f783c04cba 100644 --- a/data-otservbr-global/npc/gareth.lua +++ b/data-otservbr-global/npc/gareth.lua @@ -127,9 +127,17 @@ local function creatureSayCallback(npc, creature, type, message) npcHandler:setTopic(playerId, 0) end - if MsgContains(message, "extension") and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath) == 11 then - if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath) == 11 then - npcHandler:say("It is planned to extend the MOTA. But this will take time, because our workers have faced a little problem.", npc, creature) + if MsgContains(message, "extension") then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) == 6 then + npcHandler:say({ + "You have found an inscription I would like to translate for you. The tibianus cipher was used: ...", + "Those who are accorded the honour to visit this exclusive place will smash their blindness and face the truth. ...", + "Astonishingly, Dedoras from Cormaya has recently asked me for these kinds of inscriptions. For sure he is able to bring light into the darkness. You should visit him. ", + }, npc, creature) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, 7) + npcHandler:setTopic(playerId, 0) + elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) == 1 then + npcHandler:say("It is planned to extend the MOTA. But this will take time, because our workers have faced a little {problem}.", npc, creature) npcHandler:setTopic(playerId, 11) end elseif MsgContains(message, "problem") and npcHandler:getTopic(playerId) == 11 then @@ -143,30 +151,18 @@ local function creatureSayCallback(npc, creature, type, message) elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 12 then if npcHandler:getTopic(playerId) == 12 then npcHandler:say("You are a true patron of the arts! I have opened the construction site for you. Start your work right now!", npc, creature) - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Mota, 1) - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath, 12) - npcHandler:setTopic(playerId, 13) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, 2) + npcHandler:setTopic(playerId, 0) end end - if MsgContains(message, "bone") and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Mota) == 2 then + if MsgContains(message, "bone") and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) == 4 then npcHandler:say({ "Hmm, interesting. Several years ago I have read some books dealing with strange locking mechanisms. I think what you have found here is a bone lever of category 3. ...", "Normally this is not used because it is not secure. The production failed and the lever can always be activated as follows: back, back, up, right, left. Just have a try, it should work.", }, npc, creature) - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Mota, 3) - npcHandler:setTopic(playerId, 14) - end - - if MsgContains(message, "extension") and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Mota) == 11 then - npcHandler:say({ - "You have found an inscription I would like to translate for you. The tibianus cipher was used: ...", - "Those who are accorded the honour to visit this exclusive place will smash their blindness and face the truth. ...", - "Astonishingly, Dedoras from Cormaya has recently asked me for these kinds of inscriptions. For sure he is able to bring light into the darkness. You should visit him. ", - }, npc, creature) - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Mota, 12) - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.TheLament, 1) - npcHandler:setTopic(playerId, 15) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, 5) + npcHandler:setTopic(playerId, 0) end return true diff --git a/data-otservbr-global/scripts/lib/register_actions.lua b/data-otservbr-global/scripts/lib/register_actions.lua index ebb77654882..5ca7bb7c2cd 100644 --- a/data-otservbr-global/scripts/lib/register_actions.lua +++ b/data-otservbr-global/scripts/lib/register_actions.lua @@ -58,6 +58,22 @@ local lava = { Position(32813, 32333, 11), } +local secret_library = { + crystals = { + [1] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Crystal1, position = Position(33216, 32108, 9) }, + [2] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Crystal2, position = Position(33242, 32100, 9) }, + [3] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Crystal3, position = Position(33226, 32103, 9) }, + [4] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Crystal4, position = Position(33236, 32084, 9) }, + [5] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Crystal5, position = Position(33260, 32103, 9) }, + [6] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Crystal6, position = Position(33260, 32103, 9) }, + [7] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Crystal7, position = Position(33260, 32103, 9) }, + [8] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Crystal8, position = Position(33260, 32103, 9) } + }, + timer = "tsl_crystaltimer", + exhaustMessage = "Digging crystal is exhausting. You're still weary from your last prospect.", + items = {27867,27868,27869} +} + local function revertItem(position, itemId, transformId) local item = Tile(position):getItemById(itemId) if item then @@ -504,6 +520,23 @@ function onUsePick(player, item, fromPosition, target, toPosition, isHotkey) end end + -- The Secret Library Quest + local tPos = toPosition + for _, j in pairs(secret_library.crystals) do + if tPos == j.position then + if player:getStorageValue(j.storage) < os.time() then + local r = math.random(1,3) + local item_id = secret_library.items[r] + player:addItem(item_id, 1) + player:say("You have found a " .. ItemType(item_id):getName() .. ".", TALKTYPE_MONSTER_SAY) + player:setStorageValue(j.storage, os.time() + 2*60) + else + player:say(secret_library.exhaustMessage, TALKTYPE_MONSTER_SAY) + end + return true + end + end + -- The Rookie Guard Quest - Mission 09: Rock 'n Troll -- Path: data\scripts\actions\quests\the_rookie_guard\mission09_rock_troll.lua -- Damage tunnel pillars @@ -971,6 +1004,23 @@ function onUseKitchenKnife(player, item, fromPosition, target, toPosition, isHot return false end + -- The Secret Library Quest + local tPos = toPosition + for _, j in pairs(secret_library.crystals) do + if tPos == j.position then + if player:getStorageValue(j.storage) < os.time() then + local r = math.random(1,3) + local item_id = secret_library.items[r] + player:addItem(item_id, 1) + player:say("You have found a " .. ItemType(item_id):getName() .. ".", TALKTYPE_MONSTER_SAY) + player:setStorageValue(j.storage, os.time() + 2*60) + else + player:say(secret_library.exhaustMessage, TALKTYPE_MONSTER_SAY) + end + return true + end + end + local targetId = target:getId() --The Ice Islands Quest - Cure the Dogs diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_bony_rod.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_bony_rod.lua index 8b60e49006b..56b8bd51eef 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_bony_rod.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_bony_rod.lua @@ -7,6 +7,7 @@ function actions_museum_bony_rod.onUse(player, item, fromPosition, target, toPos if item.itemid == 28709 then if target.itemid == 27847 then item:remove(1) + target:remove(1) player:addItem(28708, 1) end elseif item.itemid == 28708 then diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_chests.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_chests.lua deleted file mode 100644 index 3149d8ea15d..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_chests.lua +++ /dev/null @@ -1,31 +0,0 @@ -local chests = { - [4900] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.SampleBlood, reward = 27874 }, - [4901] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.BonyRod, reward = 27847 }, - [4902] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.BrokenCompass, reward = 25746 }, -} - -local actions_museum_chests = Action() - -function actions_museum_chests.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local chest = chests[item.uid] - - if not chests[item.uid] then - return true - end - - if player:getStorageValue(chest.storage) ~= 1 then - player:addItem(chest.reward, 1) - player:setStorageValue(chest.storage, 1) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a " .. ItemType(chest.reward):getName():lower() .. ".") - else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is empty.") - end - - return true -end - -for uid in pairs(chests) do - actions_museum_chests:uid(uid) -end - -actions_museum_chests:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_levers.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_levers.lua index 79af7bf53c9..83b2be616a8 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_levers.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/actions_levers.lua @@ -10,13 +10,13 @@ local transform = { local actions_museum_levers = Action() function actions_museum_levers.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission) ~= 1 then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission) ~= 6 then if item:getPosition() == boneLever then if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) == 3 then player:say("You don't know what to do.", TALKTYPE_MONSTER_SAY) player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, 4) elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) == 5 then - if player:getStorageValue("museumTimer") > os.time() then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.MuseumTimer) > os.time() then player:say("back, back, up, right, left", TALKTYPE_MONSTER_SAY) player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.LeverPermission, 1) else @@ -26,9 +26,9 @@ function actions_museum_levers.onUse(player, item, fromPosition, target, toPosit end elseif item:getPosition() == middleLever then if item.itemid == 9110 then - if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) == 5 and player:getStorageValue("museumTimer") < os.time() then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) == 5 and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.MuseumTimer) < os.time() then player:say("As you turn the lever you can heart it ticking. Maybe you should hurry up!", TALKTYPE_MONSTER_SAY) - player:setStorageValue("museumTimer", os.time() + 2 * 60) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.MuseumTimer, os.time() + 2 * 60) item:transform(item.itemid + 1) end end @@ -36,9 +36,9 @@ function actions_museum_levers.onUse(player, item, fromPosition, target, toPosit end if item:getPosition() == thirdLever and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.FinalBasin) ~= 1 then - if player:getStorageValue("takenRod") < os.time() then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.TakenRod) < os.time() then player:addItem(28709, 1) - player:setStorageValue("takenRod", os.time() + 2 * 60) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.TakenRod, os.time() + 2 * 60) else return true end diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/movements_teleportTo.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/movements_teleportTo.lua index acf793f22fb..367698c8dc3 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/movements_teleportTo.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/bursting_at_the_seams_museum/movements_teleportTo.lua @@ -49,12 +49,11 @@ function movements_museum_teleportTo.onStepIn(creature, item, position, fromPosi elseif item.actionid == 4907 then if position == lastroom_enter then player:teleportTo(Position(33363, 32146, 10)) - elseif position == lastroom_exit and player:getStorageValue("trialTimer") < os.time() then + elseif position == lastroom_exit and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.TrialTimer) < os.time() then player:teleportTo(Position(33336, 32117, 10)) - -- Trial else if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) < 6 then - player:setStorageValue("trialTimer", os.time() + 3 * 60) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.TrialTimer, os.time() + 3 * 60) player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, 6) player:say("rkawdmawfjawkjnfjkawnkjnawkdjawkfmalkwmflkmawkfnzxc", TALKTYPE_MONSTER_SAY) end diff --git a/data-otservbr-global/startup/tables/chest.lua b/data-otservbr-global/startup/tables/chest.lua index d8bea5fa1ae..ca1c465ebef 100644 --- a/data-otservbr-global/startup/tables/chest.lua +++ b/data-otservbr-global/startup/tables/chest.lua @@ -2655,6 +2655,28 @@ ChestUnique = { weight = 8.00, questName = "PetrifiedScreamQuest", }, + -- The Secret Library Quest + [6314] = { + itemId = 2472, + itemPos = { x = 33231, y = 32017, z = 8 }, + reward = { { 27874, 1 } }, + weight = 1.00, + storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.SampleBlood, + }, + [6315] = { + itemId = 2472, + itemPos = { x = 33212, y = 32081, z = 9 }, + reward = { { 27847, 1 } }, + weight = 2.00, + storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.BonyRod, + }, + [6316] = { + itemId = 2472, + itemPos = { x = 33342, y = 32120, z = 10 }, + reward = { { 25746, 1 } }, + weight = 2.00, + storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.BrokenCompass, + }, -- Reward of others scrips files (varied rewards) -- The First dragon Quest -- Treasure chests (data\scripts\actions\quests\first_dragon\treasure_chests.lua) diff --git a/data-otservbr-global/startup/tables/item.lua b/data-otservbr-global/startup/tables/item.lua index d1a4b16988b..73106d0f3be 100644 --- a/data-otservbr-global/startup/tables/item.lua +++ b/data-otservbr-global/startup/tables/item.lua @@ -576,6 +576,31 @@ ItemAction = { { x = 33574, y = 31441, z = 15 }, }, }, + [4905] = { + itemId = false, + itemPos = { + { x = 33246, y = 32122, z = 8 }, + { x = 33208, y = 32071, z = 8 }, + { x = 33208, y = 32074, z = 8 }, + { x = 33341, y = 32117, z = 10 }, + { x = 33344, y = 32120, z = 10 }, + }, + }, + [4906] = { + itemId = false, + itemPos = { + { x = 33204, y = 32069, z = 8 }, + }, + }, + [4907] = { + itemId = false, + itemPos = { + { x = 33354, y = 32135, z = 10 }, + { x = 33354, y = 32136, z = 10 }, + { x = 33353, y = 32135, z = 10 }, + { x = 33353, y = 32136, z = 10 }, + }, + }, -- Cults of Tibia Quest [5522] = { itemId = 25687, diff --git a/data-otservbr-global/startup/tables/lever.lua b/data-otservbr-global/startup/tables/lever.lua index 94a040a955d..39648ba45d2 100644 --- a/data-otservbr-global/startup/tables/lever.lua +++ b/data-otservbr-global/startup/tables/lever.lua @@ -22,6 +22,13 @@ LeverAction = { { x = 33522, y = 31464, z = 15 }, }, }, + [4906] = { + itemId = false, + itemPos = { + { x = 33251, y = 32039, z = 8 }, + { x = 33218, y = 32096, z = 10 }, + }, + }, -- Cults of Tibia Quest [5500] = { itemId = 8911, diff --git a/data-otservbr-global/startup/tables/teleport.lua b/data-otservbr-global/startup/tables/teleport.lua index ab761d9a4a7..94a7d57e822 100644 --- a/data-otservbr-global/startup/tables/teleport.lua +++ b/data-otservbr-global/startup/tables/teleport.lua @@ -9,6 +9,25 @@ TeleportAction = { { x = 32210, y = 32292, z = 6 }, }, }, + -- The Secret Library Quest + [4905] = { + itemId = 25054, + itemPos = { + { x = 33246, y = 32107, z = 8 }, + { x = 33246, y = 32098, z = 8 }, + }, + }, + [4906] = { + itemId = 1949, + itemPos = { + { x = 33288, y = 32106, z = 9 }, + { x = 33288, y = 32107, z = 9 }, + { x = 33287, y = 32106, z = 9 }, + { x = 33287, y = 32107, z = 9 }, + { x = 33286, y = 32106, z = 9 }, + { x = 33286, y = 32107, z = 9 }, + }, + }, -- Cults of Tibia Quest [5517] = { itemId = 1949, From 34f041108e3d0d7d3c41567992803fac12254378 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 17 Oct 2024 18:50:11 +0000 Subject: [PATCH 41/70] Lua code format - (Stylua) --- .../scripts/lib/register_actions.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/data-otservbr-global/scripts/lib/register_actions.lua b/data-otservbr-global/scripts/lib/register_actions.lua index 5ca7bb7c2cd..553695371cf 100644 --- a/data-otservbr-global/scripts/lib/register_actions.lua +++ b/data-otservbr-global/scripts/lib/register_actions.lua @@ -67,11 +67,11 @@ local secret_library = { [5] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Crystal5, position = Position(33260, 32103, 9) }, [6] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Crystal6, position = Position(33260, 32103, 9) }, [7] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Crystal7, position = Position(33260, 32103, 9) }, - [8] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Crystal8, position = Position(33260, 32103, 9) } + [8] = { storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Crystal8, position = Position(33260, 32103, 9) }, }, timer = "tsl_crystaltimer", exhaustMessage = "Digging crystal is exhausting. You're still weary from your last prospect.", - items = {27867,27868,27869} + items = { 27867, 27868, 27869 }, } local function revertItem(position, itemId, transformId) @@ -525,11 +525,11 @@ function onUsePick(player, item, fromPosition, target, toPosition, isHotkey) for _, j in pairs(secret_library.crystals) do if tPos == j.position then if player:getStorageValue(j.storage) < os.time() then - local r = math.random(1,3) + local r = math.random(1, 3) local item_id = secret_library.items[r] player:addItem(item_id, 1) player:say("You have found a " .. ItemType(item_id):getName() .. ".", TALKTYPE_MONSTER_SAY) - player:setStorageValue(j.storage, os.time() + 2*60) + player:setStorageValue(j.storage, os.time() + 2 * 60) else player:say(secret_library.exhaustMessage, TALKTYPE_MONSTER_SAY) end @@ -1009,11 +1009,11 @@ function onUseKitchenKnife(player, item, fromPosition, target, toPosition, isHot for _, j in pairs(secret_library.crystals) do if tPos == j.position then if player:getStorageValue(j.storage) < os.time() then - local r = math.random(1,3) + local r = math.random(1, 3) local item_id = secret_library.items[r] player:addItem(item_id, 1) player:say("You have found a " .. ItemType(item_id):getName() .. ".", TALKTYPE_MONSTER_SAY) - player:setStorageValue(j.storage, os.time() + 2*60) + player:setStorageValue(j.storage, os.time() + 2 * 60) else player:say(secret_library.exhaustMessage, TALKTYPE_MONSTER_SAY) end From 21e6adcaa7cde27a6bf9f54b5671f792b70869ae Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Sat, 19 Oct 2024 12:41:37 -0300 Subject: [PATCH 42/70] The Secret Library Quest - The Lament --- data-otservbr-global/lib/core/quests.lua | 3 +- data-otservbr-global/lib/core/storages.lua | 3 +- data-otservbr-global/npc/dedoras.lua | 21 ++- data-otservbr-global/npc/gail.lua | 7 +- .../the_lament_asuras/actions_bonefiddle.lua | 2 +- .../the_lament_asuras/actions_chests.lua | 38 ----- .../the_lament_asuras/actions_doors.lua | 4 +- .../the_lament_asuras/actions_fragrance.lua | 2 +- .../the_lament_asuras/actions_keys.lua | 2 +- .../creaturescripts_asuras_mechanic.lua | 2 +- .../movements_elemental_portals.lua | 151 +++++++++++------- data-otservbr-global/startup/tables/chest.lua | 63 ++++++++ data-otservbr-global/startup/tables/item.lua | 35 ++++ data/items/items.xml | 1 + 14 files changed, 222 insertions(+), 112 deletions(-) delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_chests.lua diff --git a/data-otservbr-global/lib/core/quests.lua b/data-otservbr-global/lib/core/quests.lua index 27c9185bc7e..487ad1b8e22 100644 --- a/data-otservbr-global/lib/core/quests.lua +++ b/data-otservbr-global/lib/core/quests.lua @@ -6572,7 +6572,7 @@ if not Quests then storageId = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, missionId = 10453, startValue = 1, - endValue = 6, + endValue = 7, states = { [1] = "Go to Asuri Palace in Port Hope.", [2] = "You were able to assemble an instrument with the objects found. That should work for something.", @@ -6580,6 +6580,7 @@ if not Quests then [4] = "With a heavy heart you used a piece of ebony as well as the skull and hair of an unfortunate maiden to create a bone fiddle. By playing the Peacock Ballad you should be able to open the viollet portal.", [5] = "You may enter the viollet portal. Check if there is something useful there.", [6] = "In a secret room of the Asura Palace you discovered an old writing desk that contains an ancient map. This must be a hint to the secret library you are searching for.", + [7] = "Congratulations you completed this mission.", }, }, [4] = { diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index eff1f96e779..ae82273769e 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -2594,7 +2594,7 @@ Storage = { Questlog = 46001, Asuras = { Questline = 46002, - flammingOrchid = 46003, + FlammingOrchid = 46003, SkeletonNotes = 46004, StrandHair = 46005, LotusKey = 46006, @@ -2607,6 +2607,7 @@ Storage = { DiamondTimer = 46013, BlazingTimer = 46014, DarkTimer = 46015, + Fragrance = 46016, }, FalconBastion = { Questline = 46016, diff --git a/data-otservbr-global/npc/dedoras.lua b/data-otservbr-global/npc/dedoras.lua index 3459b5713c9..b6f8053f8f0 100644 --- a/data-otservbr-global/npc/dedoras.lua +++ b/data-otservbr-global/npc/dedoras.lua @@ -138,11 +138,22 @@ local function creatureSayCallback(npc, creature, type, message) }, npc, creature) startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, 1) elseif MsgContains(message, "asuri") then - npcHandler:say({ - "There's a beautiful but very dangerous palace in the Tiquandan jungle. The young women who live there are actually demons and they are luring unsuspecting mortals in there. ...", - "A lucky survivor told me about a portal at the very top of the palace that may lead to another asuri hideout.", - }, npc, creature) - startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, 1) + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) == 6 then + npcHandler:say("This is incredible! Thank you so much for digging out that hint!", npc, creature) + local currentStorage = player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission) + if currentStorage < 0 then + currentStorage = 0 + end + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission, currentStorage + 1) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, 7) + elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) < 1 then + npcHandler:say({ + "There's a beautiful but very dangerous palace in the Tiquandan jungle. The young women who live there are actually demons and they are luring unsuspecting mortals in there. ...", + "A lucky survivor told me about a portal at the very top of the palace that may lead to another asuri hideout.", + }, npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, 1) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Asuras.FlammingOrchid, 1) + end elseif MsgContains(message, "isle") then npcHandler:say("Talk to Captain Charles in Port Hope. He told me that he once ran ashore on a small island where he discovered a small ruin. The architecture was like nothing he had seen before.", npc, creature) startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, 1) diff --git a/data-otservbr-global/npc/gail.lua b/data-otservbr-global/npc/gail.lua index d1e77115c31..e0b6062908b 100644 --- a/data-otservbr-global/npc/gail.lua +++ b/data-otservbr-global/npc/gail.lua @@ -76,10 +76,9 @@ local function creatureSayCallback(npc, creature, type, message) return false end - if MsgContains(message, "daughter") and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Peacock) == 1 then - npcHandler:say({ "I always feared that I lost her. And yet, all those years, I still had a gleam of hope. I'm devastated to learn about her fate - but at least I have certainty now. Thank you for telling me." }, npc, creature) - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Peacock, 2) - npcHandler:setTopic(playerId, 1) + if MsgContains(message, "daughter") and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) == 3 then + npcHandler:say("I always feared that I lost her. And yet, all those years, I still had a gleam of hope. I'm devastated to learn about her fate - but at least I have certainty now. Thank you for telling me.", npc, creature) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, 4) npcHandler:setTopic(playerId, 1) end diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_bonefiddle.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_bonefiddle.lua index 42e81e13f29..1a4ff13266b 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_bonefiddle.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_bonefiddle.lua @@ -3,7 +3,7 @@ local actions_asura_bonefiddle = Action() function actions_asura_bonefiddle.onUse(player, item, fromPosition, target, toPosition, isHotkey) if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) < 2 then if item.itemid == 28491 then - if target.itemid == 28490 then + if target.itemid == 28489 then item:remove(1) target:remove(1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You attach the ebony wood to the skull. This should meet the requirements of a fingerboard.") diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_chests.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_chests.lua deleted file mode 100644 index a17b35d7b80..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_chests.lua +++ /dev/null @@ -1,38 +0,0 @@ -local chests = { - [4910] = { storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.StrandHair, reward = 28490 }, - [4911] = { storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.SkeletonNotes, reward = 28518, message = "You have discovered a skeleton. It seems to hold an old letter and its skull is missing." }, - [4912] = { storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.EyeKey, reward = 28477 }, - [4913] = { storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.ScribbledNotes, reward = 28515 }, - [4914] = { storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.LotusKey, reward = 28476 }, - [4915] = { storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.PeacockBallad, reward = 28710 }, - [4916] = { storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.BlackSkull, reward = 28489 }, - [4917] = { storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.EbonyPiece, reward = 28491 }, - [4918] = { storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.SilverChimes, reward = 28494, message = "You see silver chimes dangling on the dragon statue in this room." }, -} - -local actions_asura_chests = Action() - -function actions_asura_chests.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local chest = chests[item.uid] - if not chests[item.uid] then - return true - end - if player:getStorageValue(chest.storage) ~= 1 then - player:addItem(chest.reward, 1) - player:setStorageValue(chest.storage, 1) - if not chest.message then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a " .. ItemType(chest.reward):getName():lower() .. ".") - else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, chest.message) - end - else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is empty.") - end - return true -end - -for uid in pairs(chests) do - actions_asura_chests:uid(uid) -end - -actions_asura_chests:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_doors.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_doors.lua index 51307a3b35c..6b4ee88eb63 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_doors.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_doors.lua @@ -8,8 +8,8 @@ local actions_asura_doors = Action() function actions_asura_doors.onUse(player, item, fromPosition, target, toPosition, isHotkey) for _, p in pairs(doors) do if (item:getPosition() == p.doorPosition) and not (Tile(item:getPosition()):getTopCreature()) then - if player:getStoragelevel(p.storage) >= p.value then - if p.level and player:getLevel() >= p.level then + if player:getStorageValue(p.storage) >= p.value then + if not p.level or (p.level and player:getLevel() >= p.level) then player:teleportTo(toPosition, true) item:transform(item.itemid + 1) else diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_fragrance.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_fragrance.lua index c97010268dd..e8630e36887 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_fragrance.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_fragrance.lua @@ -2,7 +2,7 @@ local actions_asura_fragrance = Action() function actions_asura_fragrance.onUse(player, item, fromPosition, target, toPosition, isHotkey) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Hmmmm, what an infatuating fragrance!") - player:setStorageValue("fragrance", os.time() + 10 * 60) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Fragrance, os.time() + 10 * 60) item:remove(1) return true diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_keys.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_keys.lua index 96715bf213f..a259ca202ea 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_keys.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/actions_keys.lua @@ -3,7 +3,7 @@ local doors = { [2] = { key = 28477, position = Position(32864, 32810, 9) }, } -local locked = 23874 +local locked = 23873 local opened = 23877 local function revert(position) diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/creaturescripts_asuras_mechanic.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/creaturescripts_asuras_mechanic.lua index ed1038ba9c9..d569a8806f2 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/creaturescripts_asuras_mechanic.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/creaturescripts_asuras_mechanic.lua @@ -36,7 +36,7 @@ function creaturescripts_asuras_mechanic.onHealthChange(creature, attacker, prim return primaryDamage, primaryType, secondaryDamage, secondaryType end elseif creature:getName():lower() == "the lily of night" then - if attacker:getStorageValue("fragrance") > os.time() then + if attacker:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Fragrance) > os.time() then return primaryDamage, primaryType, secondaryDamage, secondaryType end end diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/movements_elemental_portals.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/movements_elemental_portals.lua index fda5f918e3e..c6462b41750 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/movements_elemental_portals.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/movements_elemental_portals.lua @@ -1,62 +1,108 @@ ---[[ -4914 = leaving -4915 = entering ---]] - local entrances = { - [1] = { position = Position(32858, 32795, 11), storage = false, toPosition = Position(32889, 32772, 9) }, - [2] = { position = Position(32857, 32766, 10), fromPos = Position(32856, 32740, 11), toPos = Position(32868, 32752, 11), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.DiamondTimer, exit = Position(32857, 32768, 10), toPosition = Position(32881, 32789, 11), bossName = "The Diamond Blossom", bossPos = Position(32881, 32792, 11) }, - [3] = { position = Position(32817, 32777, 11), fromPos = Position(32875, 32786, 11), toPos = Position(32887, 32798, 11), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.DarkTimer, exit = Position(32817, 32779, 11), toPosition = Position(32862, 32743, 11), bossName = "The Lily of Night", bossPos = Position(32862, 32746, 11) }, - [4] = { position = Position(32854, 32737, 10), fromPos = Position(32856, 32768, 11), toPos = Position(32868, 32780, 11), storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.BlazingTimer, exit = Position(32854, 32739, 10), toPosition = Position(32862, 32771, 11), bossName = "The Blazing Rose", bossPos = Position(32862, 32774, 11) }, + [1] = { position = Position(32860, 32798, 11), storage = false, toPosition = Position(32887, 32772, 9) }, + [2] = { + position = Position(32858, 32766, 10), + toPosition = Position(32882, 32791, 11), + fromPos = Position(32877, 32790, 11), + toPos = Position(32887, 32800, 11), + exit = Position(32858, 32767, 10), + storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.DiamondTimer, + bossName = "the diamond blossom", + bossPos = Position(32882, 32795, 11) + }, + [3] = { + position = Position(32818, 32780, 11), + toPosition = Position(32857, 32740, 11), + fromPos = Position(32852, 32739, 11), + toPos = Position(32862, 32749, 11), + exit = Position(32818, 32781, 11), + storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.DarkTimer, + bossName = "the lily of night", + bossPos = Position(32857, 32744, 11) + }, + [4] = { + position = Position(32854, 32737, 10), + toPosition = Position(32860, 32770, 11), + fromPos = Position(32855, 32769, 11), + toPos = Position(32865, 32779, 11), + exit = Position(32854, 32738, 10), + storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.BlazingTimer, + bossName = "the blazing rose", + bossPos = Position(32860, 32774, 11) + }, } - -local exites = { - [1] = { position = Position(32862, 32741, 11), toPosition = Position(32817, 32779, 11) }, - [2] = { position = Position(32862, 32769, 11), toPosition = Position(32854, 32739, 10) }, - [3] = { position = Position(32881, 32787, 11), toPosition = Position(32857, 32768, 10) }, - [4] = { position = Position(32887, 32772, 9), toPosition = Position(32858, 32797, 11) }, - [5] = { position = Position(32880, 32828, 11), toPosition = Position(32810, 32765, 10) }, +local exits = { + [1] = { position = Position(32857, 32739, 11), toPosition = Position(32818, 32781, 11) }, + [2] = { position = Position(32860, 32769, 11), toPosition = Position(32854, 32738, 10) }, + [3] = { position = Position(32882, 32790, 11), toPosition = Position(32858, 32767, 10) }, + [4] = { position = Position(32886, 32772, 9), toPosition = Position(32860, 32799, 11) }, + [5] = { position = Position(32881, 32829, 11), toPosition = Position(32809, 32765, 10) }, } - local defaultMessage = "You have ten minutes to kill and loot this monster, else you will lose that chance and will be kicked out." +local purplePosition = Position(32808, 32765, 10) +local quest = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline +local toPosition_l = Position(32881, 32828, 11) +local hiddenMap1 = Position(32881, 32820, 11) +local hiddenMap2 = Position(32882, 32820, 11) -local function resetRoom(position) - local spec = Game.getSpectators(position, false, false, 5, 5, 5, 5) - for _, c in pairs(spec) do - if c and c:isPlayer() then - return false - end - end - for _, c in pairs(spec) do - if c then - c:remove() - end - end - return true +local function isPlayerInRoom(fromPos, toPos) + 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 creatures = tile:getCreatures() + for _, creature in pairs(creatures) do + if creature:isPlayer() then + return true + end + end + end + end + end + end + return false +end + +local 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:isMonster() then + spec:remove() + end + end end local function startBattle(pid, position, b_name, middle) local player = Player(pid) if player then - player:teleportTo(position) + player:teleportTo(position, true) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) player:say(defaultMessage, TALKTYPE_MONSTER_SAY) local monster = Game.createMonster(b_name, middle) end end -local purplePosition = Position(32808, 32765, 10) -local quest = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline -local toPosition_l = Position(32880, 32826, 11) -local hiddenMap = Position(32881, 32819, 11) +local function expelPlayerFromRoom(cid, fromPos, toPos, exitPos) + local player = Player(cid) + if player then + if player:getPosition():isInRange(fromPos, toPos) then + player:teleportTo(exitPos) + exitPos:sendMagicEffect(CONST_ME_TELEPORT) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") + end + end +end local movements_asura_elemental_portals = MoveEvent() function movements_asura_elemental_portals.onStepIn(creature, item, position, fromPosition) + local player = Player(creature:getId()) + if not creature:isPlayer() then return false end - local player = Player(creature:getId()) + if item.actionid == 4915 then if position == purplePosition then if player:getStorageValue(quest) >= 5 then @@ -66,29 +112,21 @@ function movements_asura_elemental_portals.onStepIn(creature, item, position, fr player:teleportTo(fromPosition, true) end player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true end - for _, k in pairs(entrances) do if position == k.position then + if isPlayerInRoom(k.fromPos, k.toPos) then + return true + end + clearBossRoom(k.fromPos, k.toPos, k.exit) if k.storage then - if resetRoom(k.bossPos) then - if player:getStorageValue(k.storage) < os.time() then - player:setStorageValue(k.storage, os.time() + 20 * 60 * 60) - startBattle(player:getId(), k.toPosition, k.bossName, k.bossPos) - addEvent(function(cid) - local p = Player(cid) - if p then - if p:getPosition():isInRange(k.fromPos, k.toPos) then - p:teleportTo(k.exit) - end - end - end, 10 * 1000 * 60, player:getId()) - else - player:sendCancelMessage("You are still exhausted from your last battle.") - player:teleportTo(fromPosition, true) - end + if player:getStorageValue(k.storage) < os.time() then + startBattle(player:getId(), k.toPosition, k.bossName, k.bossPos) + addEvent(expelPlayerFromRoom, 6000000, player:getId(), k.fromPos, k.toPos, k.exit) + player:setStorageValue(k.storage, os.time() + (20 * 3600)) else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You must wait. Someone is challenging " .. k.bossName .. " now.") + player:sendCancelMessage("You are still exhausted from your last battle.") player:teleportTo(fromPosition, true) end else @@ -98,15 +136,14 @@ function movements_asura_elemental_portals.onStepIn(creature, item, position, fr end end elseif item.actionid == 4914 then - if position == hiddenMap then + if position == hiddenMap1 or hiddenMap2 then if player:getStorageValue(quest) == 5 then player:addItem(28908, 1) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have discovered an old writing desk that contains an ancient map.") player:setStorageValue(quest, 6) end end - - for _, k in pairs(exites) do + for _, k in pairs(exits) do if position == k.position then player:teleportTo(k.toPosition) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) diff --git a/data-otservbr-global/startup/tables/chest.lua b/data-otservbr-global/startup/tables/chest.lua index ca1c465ebef..cff17d3665c 100644 --- a/data-otservbr-global/startup/tables/chest.lua +++ b/data-otservbr-global/startup/tables/chest.lua @@ -2677,6 +2677,69 @@ ChestUnique = { weight = 2.00, storage = Storage.Quest.U11_80.TheSecretLibrary.MoTA.BrokenCompass, }, + [6317] = { + itemId = 28517, + itemPos = { x = 32826, y = 32772, z = 10 }, + reward = { { 28518, 1 } }, + weight = 1.00, + storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.SkeletonNotes, + }, + [6318] = { + itemId = 28522, + itemPos = { x = 32828, y = 32772, z = 10 }, + reward = { { 28490, 1 } }, + weight = 1.00, + storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.StrandHair, + }, + [6319] = { + itemId = 1992, + itemPos = { x = 32874, y = 32760, z = 10 }, + reward = { { 28476, 1 } }, + weight = 1.00, + storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.LotusKey, + }, + [6320] = { + itemId = 27490, + itemPos = { x = 32836, y = 32820, z = 10 }, + reward = { { 28477, 1 } }, + weight = 1.00, + storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.EyeKey, + }, + [6321] = { + itemId = 6560, + itemPos = { x = 32872, y = 32817, z = 10 }, + reward = { { 28515, 1 } }, + weight = 1.00, + storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.ScribbledNotes, + }, + [6322] = { + itemId = 4077, + itemPos = { x = 32877, y = 32795, z = 11 }, + reward = { { 28491, 1 } }, + weight = 9.00, + storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.EbonyPiece, + }, + [6323] = { + itemId = 23741, + itemPos = { x = 32833, y = 32759, z = 11 }, + reward = { { 28710, 1 } }, + weight = 1.00, + storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.PeacockBallad, + }, + [6324] = { + itemId = 9794, + itemPos = { x = 32890, y = 32768, z = 9 }, + reward = { { 28494, 1 } }, + weight = 3.00, + storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.SilverChimes, + }, + [6325] = { + itemId = 23741, + itemPos = { x = 32852, y = 32744, z = 11 }, + reward = { { 28489, 1 } }, + weight = 20.00, + storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.BlackSkull, + }, -- Reward of others scrips files (varied rewards) -- The First dragon Quest -- Treasure chests (data\scripts\actions\quests\first_dragon\treasure_chests.lua) diff --git a/data-otservbr-global/startup/tables/item.lua b/data-otservbr-global/startup/tables/item.lua index 73106d0f3be..88d556fba64 100644 --- a/data-otservbr-global/startup/tables/item.lua +++ b/data-otservbr-global/startup/tables/item.lua @@ -601,6 +601,41 @@ ItemAction = { { x = 33353, y = 32136, z = 10 }, }, }, + [4910] = { + itemId = 28906, + itemPos = { + { x = 32953, y = 32669, z = 7 }, + }, + }, + [4911] = { + itemId = false, + itemPos = { + { x = 32962, y = 32674, z = 2 }, + { x = 32959, y = 32679, z = 2 }, + }, + }, + [4914] = { -- saida + itemId = false, + itemPos = { + { x = 32886, y = 32772, z = 9 }, + { x = 32882, y = 32790, z = 11 }, + { x = 32857, y = 32739, z = 11 }, + { x = 32860, y = 32769, z = 11 }, + { x = 32881, y = 32829, z = 11 }, + { x = 32881, y = 32820, z = 11 }, + { x = 32882, y = 32820, z = 11 }, + }, + }, + [4915] = { -- entrada + itemId = false, + itemPos = { + { x = 32860, y = 32798, z = 11 }, + { x = 32858, y = 32766, z = 10 }, + { x = 32818, y = 32780, z = 11 }, + { x = 32854, y = 32737, z = 10 }, + { x = 32808, y = 32765, z = 10 }, + }, + }, -- Cults of Tibia Quest [5522] = { itemId = 25687, diff --git a/data/items/items.xml b/data/items/items.xml index f6d18b8d69e..8b7d417c859 100644 --- a/data/items/items.xml +++ b/data/items/items.xml @@ -53154,6 +53154,7 @@ hands of its owner. Granted by TibiaRoyal.com"/> + From 1db20bac0498b07f5b83766be0aa61ef816890cb Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Sat, 19 Oct 2024 15:42:37 +0000 Subject: [PATCH 43/70] Lua code format - (Stylua) --- .../movements_elemental_portals.lua | 130 +++++++++--------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/movements_elemental_portals.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/movements_elemental_portals.lua index c6462b41750..8776ee64ba3 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/movements_elemental_portals.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_lament_asuras/movements_elemental_portals.lua @@ -1,42 +1,42 @@ local entrances = { - [1] = { position = Position(32860, 32798, 11), storage = false, toPosition = Position(32887, 32772, 9) }, - [2] = { - position = Position(32858, 32766, 10), + [1] = { position = Position(32860, 32798, 11), storage = false, toPosition = Position(32887, 32772, 9) }, + [2] = { + position = Position(32858, 32766, 10), toPosition = Position(32882, 32791, 11), - fromPos = Position(32877, 32790, 11), - toPos = Position(32887, 32800, 11), - exit = Position(32858, 32767, 10), - storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.DiamondTimer, - bossName = "the diamond blossom", - bossPos = Position(32882, 32795, 11) - }, - [3] = { - position = Position(32818, 32780, 11), - toPosition = Position(32857, 32740, 11), - fromPos = Position(32852, 32739, 11), - toPos = Position(32862, 32749, 11), - exit = Position(32818, 32781, 11), - storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.DarkTimer, - bossName = "the lily of night", - bossPos = Position(32857, 32744, 11) - }, - [4] = { - position = Position(32854, 32737, 10), - toPosition = Position(32860, 32770, 11), - fromPos = Position(32855, 32769, 11), - toPos = Position(32865, 32779, 11), - exit = Position(32854, 32738, 10), - storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.BlazingTimer, - bossName = "the blazing rose", - bossPos = Position(32860, 32774, 11) - }, + fromPos = Position(32877, 32790, 11), + toPos = Position(32887, 32800, 11), + exit = Position(32858, 32767, 10), + storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.DiamondTimer, + bossName = "the diamond blossom", + bossPos = Position(32882, 32795, 11), + }, + [3] = { + position = Position(32818, 32780, 11), + toPosition = Position(32857, 32740, 11), + fromPos = Position(32852, 32739, 11), + toPos = Position(32862, 32749, 11), + exit = Position(32818, 32781, 11), + storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.DarkTimer, + bossName = "the lily of night", + bossPos = Position(32857, 32744, 11), + }, + [4] = { + position = Position(32854, 32737, 10), + toPosition = Position(32860, 32770, 11), + fromPos = Position(32855, 32769, 11), + toPos = Position(32865, 32779, 11), + exit = Position(32854, 32738, 10), + storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.BlazingTimer, + bossName = "the blazing rose", + bossPos = Position(32860, 32774, 11), + }, } local exits = { - [1] = { position = Position(32857, 32739, 11), toPosition = Position(32818, 32781, 11) }, - [2] = { position = Position(32860, 32769, 11), toPosition = Position(32854, 32738, 10) }, - [3] = { position = Position(32882, 32790, 11), toPosition = Position(32858, 32767, 10) }, - [4] = { position = Position(32886, 32772, 9), toPosition = Position(32860, 32799, 11) }, - [5] = { position = Position(32881, 32829, 11), toPosition = Position(32809, 32765, 10) }, + [1] = { position = Position(32857, 32739, 11), toPosition = Position(32818, 32781, 11) }, + [2] = { position = Position(32860, 32769, 11), toPosition = Position(32854, 32738, 10) }, + [3] = { position = Position(32882, 32790, 11), toPosition = Position(32858, 32767, 10) }, + [4] = { position = Position(32886, 32772, 9), toPosition = Position(32860, 32799, 11) }, + [5] = { position = Position(32881, 32829, 11), toPosition = Position(32809, 32765, 10) }, } local defaultMessage = "You have ten minutes to kill and loot this monster, else you will lose that chance and will be kicked out." local purplePosition = Position(32808, 32765, 10) @@ -46,31 +46,31 @@ local hiddenMap1 = Position(32881, 32820, 11) local hiddenMap2 = Position(32882, 32820, 11) local function isPlayerInRoom(fromPos, toPos) - 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 creatures = tile:getCreatures() - for _, creature in pairs(creatures) do - if creature:isPlayer() then - return true - end - end - end - end - end - end - return 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 creatures = tile:getCreatures() + for _, creature in pairs(creatures) do + if creature:isPlayer() then + return true + end + end + end + end + end + end + return false end local 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:isMonster() then - spec:remove() - end - end + local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) + for _, spec in pairs(spectators) do + if spec:isMonster() then + spec:remove() + end + end end local function startBattle(pid, position, b_name, middle) @@ -84,14 +84,14 @@ local function startBattle(pid, position, b_name, middle) end local function expelPlayerFromRoom(cid, fromPos, toPos, exitPos) - local player = Player(cid) - if player then - if player:getPosition():isInRange(fromPos, toPos) then - player:teleportTo(exitPos) - exitPos:sendMagicEffect(CONST_ME_TELEPORT) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") - end - end + local player = Player(cid) + if player then + if player:getPosition():isInRange(fromPos, toPos) then + player:teleportTo(exitPos) + exitPos:sendMagicEffect(CONST_ME_TELEPORT) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You took too long, the battle has ended.") + end + end end local movements_asura_elemental_portals = MoveEvent() From e3b54962922abcf4be0bb24266d92c022fa6d1d6 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Tue, 22 Oct 2024 07:21:05 -0300 Subject: [PATCH 44/70] The Secret Library Quest - The Order of the Falcon --- data-otservbr-global/lib/core/quests.lua | 3 +- data-otservbr-global/lib/core/storages.lua | 9 ++ .../{humans => bosses}/the_flaming_orchid.lua | 0 data-otservbr-global/npc/dedoras.lua | 34 ++++---- .../roshamuul_quest/actions_mixture.lua | 1 + .../creaturescripts_kill.lua | 84 +++++++++---------- .../the_order_of_the_falcon/actions_doors.lua | 30 +++++-- .../actions_entrance.lua | 28 +++++++ .../actions_oberonLever.lua | 16 ++-- .../movements_bossEntrance.lua | 6 +- data-otservbr-global/startup/tables/chest.lua | 24 +++--- data-otservbr-global/startup/tables/item.lua | 33 +++++++- data-otservbr-global/startup/tables/lever.lua | 6 ++ .../world/otservbr-monster.xml | 22 ++++- 14 files changed, 197 insertions(+), 99 deletions(-) rename data-otservbr-global/monster/{humans => bosses}/the_flaming_orchid.lua (100%) create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_entrance.lua diff --git a/data-otservbr-global/lib/core/quests.lua b/data-otservbr-global/lib/core/quests.lua index 487ad1b8e22..f4f620642b5 100644 --- a/data-otservbr-global/lib/core/quests.lua +++ b/data-otservbr-global/lib/core/quests.lua @@ -6588,10 +6588,11 @@ if not Quests then storageId = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, missionId = 10454, startValue = 1, - endValue = 2, + endValue = 3, states = { [1] = "It is said that an ancient order of knights once resided in Edron. The knights disappeared a long time ago but their abandoned outpost is still there. The place may yet hold some surprises.", [2] = "You defeated Grand Master Oberon in mortal combat. The Falcon Order may have lost its glory a long time ago but you are just getting started.", + [3] = "Congratulations you completed this mission.", }, }, [5] = { diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index ae82273769e..decd9de6b74 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -2616,6 +2616,15 @@ Storage = { OberonHeal = 46019, LastBossMsgInterval = 46020, OberonSay = 46021, + ChestsTimer = { + Coast = 46022, + Island = 46023, + ThroneHall = 46024, + Shortcut = 46026, + LowerBastion = 46027, + UndergroundBastion = 46028, + Key0909 = 46029, + }, }, Darashia = { Questline = 46022, diff --git a/data-otservbr-global/monster/humans/the_flaming_orchid.lua b/data-otservbr-global/monster/bosses/the_flaming_orchid.lua similarity index 100% rename from data-otservbr-global/monster/humans/the_flaming_orchid.lua rename to data-otservbr-global/monster/bosses/the_flaming_orchid.lua diff --git a/data-otservbr-global/npc/dedoras.lua b/data-otservbr-global/npc/dedoras.lua index b6f8053f8f0..ee2d426b57a 100644 --- a/data-otservbr-global/npc/dedoras.lua +++ b/data-otservbr-global/npc/dedoras.lua @@ -91,6 +91,11 @@ local function creatureSayCallback(npc, creature, type, message) return false end + local currentStorage = player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission) + if currentStorage < 0 then + currentStorage = 0 + end + if MsgContains(message, "search") then npcHandler:say({ "I gathered some lore on my own, but I desperately need more information that you might provide me. ...", @@ -102,10 +107,6 @@ local function creatureSayCallback(npc, creature, type, message) "This is ...", "An astonishing find to say the least! I'm certain it will help the efforts of accessing the library a lot!", }, npc, creature) - local currentStorage = player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission) - if currentStorage < 0 then - currentStorage = 0 - end startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission, currentStorage + 1) startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, 8) elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline) < 1 then @@ -118,10 +119,6 @@ local function creatureSayCallback(npc, creature, type, message) elseif MsgContains(message, "fishmen") then if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline) == 7 then npcHandler:say("You brought incredible news. This book proves an invaluable clue!", npc, creature) - local currentStorage = player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission) - if currentStorage < 0 then - currentStorage = 0 - end startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission, currentStorage + 1) startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, 8) elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline) < 1 then @@ -132,18 +129,20 @@ local function creatureSayCallback(npc, creature, type, message) startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, 1) end elseif MsgContains(message, "order") then - npcHandler:say({ - "Our world has seen many noble knights and orders throughout the centuries. Most of them vanished a long time ago but only few under such mysterious circumstances as the Order of the Falcon. ...", - "This noble alliance of honourable knights once resided in Edron to serve the king. Legend has it they vanished practically over night. Rumor has it their disappearance is connected to a forbidden book.", - }, npc, creature) - startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, 1) + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline) == 2 then + npcHandler:say("You brought incredible news. This book proves an invaluable clue!", npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission, currentStorage + 1) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, 3) + elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline) < 1 then + npcHandler:say({ + "Our world has seen many noble knights and orders throughout the centuries. Most of them vanished a long time ago but only few under such mysterious circumstances as the Order of the Falcon. ...", + "This noble alliance of honourable knights once resided in Edron to serve the king. Legend has it they vanished practically over night. Rumor has it their disappearance is connected to a forbidden book.", + }, npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, 1) + end elseif MsgContains(message, "asuri") then if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) == 6 then npcHandler:say("This is incredible! Thank you so much for digging out that hint!", npc, creature) - local currentStorage = player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission) - if currentStorage < 0 then - currentStorage = 0 - end startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission, currentStorage + 1) startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, 7) elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline) < 1 then @@ -152,7 +151,6 @@ local function creatureSayCallback(npc, creature, type, message) "A lucky survivor told me about a portal at the very top of the palace that may lead to another asuri hideout.", }, npc, creature) startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, 1) - startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Asuras.FlammingOrchid, 1) end elseif MsgContains(message, "isle") then npcHandler:say("Talk to Captain Charles in Port Hope. He told me that he once ran ashore on a small island where he discovered a small ruin. The architecture was like nothing he had seen before.", npc, creature) diff --git a/data-otservbr-global/scripts/quests/roshamuul_quest/actions_mixture.lua b/data-otservbr-global/scripts/quests/roshamuul_quest/actions_mixture.lua index 9ba1ecf88cb..cb2e30d97c8 100644 --- a/data-otservbr-global/scripts/quests/roshamuul_quest/actions_mixture.lua +++ b/data-otservbr-global/scripts/quests/roshamuul_quest/actions_mixture.lua @@ -4,6 +4,7 @@ local buckets = { } local lowerRoshamuulMixtune = Action() + function lowerRoshamuulMixtune.onUse(player, item, fromPosition, target, toPosition, isHotkey) if (target == nil) or not target:isItem() then return false diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua index d0024cbd5f4..9f1fae8c931 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua @@ -2,50 +2,46 @@ local defaultTime = 20 local creaturescripts_library_bosses = CreatureEvent("killingLibrary") -function creaturescripts_library_bosses.onDeath(player, creature) - if not player:isPlayer() then - return true - end - - if not creature:isMonster() or creature:getMaster() then - return true - end - - local monsterStorages = { - ["grand commander soeren"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 1 }, - ["preceptor lazare"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 2 }, - ["grand chaplain gaunder"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 3 }, - ["grand canon dominus"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 4 }, - ["dazed leaf golem"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 5 }, - ["grand master oberon"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.killingBosses, value = 6, achievements = { "Millennial Falcon", "Master Debater" }, lastBoss = true }, - ["brokul"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 7 }, - ["the flaming orchid"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.Asuras.flammingOrchid, value = 1 }, - } - - local monsterName = creature:getName():lower() - local monsterStorage = monsterStorages[monsterName] - - if monsterStorage then - for playerid, damage in pairs(creature:getDamageMap()) do - local p = Player(playerid) - if p then - if p:getStorageValue(monsterStorage.stg) < monsterStorage.value then - p:setStorageValue(monsterStorage.stg, monsterStorage.value) - end - if monsterStorage.achievements then - for i = 1, #monsterStorage.achievements do - p:addAchievement(monsterStorage.achievements[i]) - end - end - if monsterStorage.lastBoss then - if p:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline) < 2 then - p:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, 2) - end - end - end - end - end - return true +function creaturescripts_library_bosses.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified) + if not creature:isMonster() or creature:getMaster() then + return true + end + + local monsterStorages = { + ["grand commander soeren"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 1 }, + ["preceptor lazare"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 2 }, + ["grand chaplain gaunder"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 3 }, + ["grand canon dominus"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 4 }, + ["dazed leaf golem"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 5 }, + ["grand master oberon"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 6, achievements = { "Millennial Falcon", "Master Debater" }, lastBoss = true }, + ["brokul"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 7 }, + ["the flaming orchid"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.Asuras.FlammingOrchid, value = 1 }, + } + + local monsterName = creature:getName():lower() + local monsterStorage = monsterStorages[monsterName] + + if monsterStorage then + for playerid, damage in pairs(creature:getDamageMap()) do + local p = Player(playerid) + if p then + if p:getStorageValue(monsterStorage.stg) < monsterStorage.value then + p:setStorageValue(monsterStorage.stg, monsterStorage.value) + end + if monsterStorage.achievements then + for i = 1, #monsterStorage.achievements do + p:addAchievement(monsterStorage.achievements[i]) + end + end + if monsterStorage.lastBoss then + if p:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline) < 2 then + p:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, 2) + end + end + end + end + end + return true end creaturescripts_library_bosses:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_doors.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_doors.lua index 9ea613e2d29..179fa89fb37 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_doors.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_doors.lua @@ -1,15 +1,31 @@ local doors = { - [1] = { doorPosition = Position(33376, 31323, 2), value = -1 }, - [2] = { doorPosition = Position(33376, 31335, 3), value = 1 }, + [1] = { doorPosition = Position(33376, 31335, 3), value = 1 }, + [2] = { doorPosition = Position(33371, 31349, 4), value = 2 }, [3] = { doorPosition = Position(33376, 31349, 4), value = 2 }, - [4] = { doorPosition = Position(33363, 31346, 7), value = 4 }, + [4] = { doorPosition = Position(33375, 31346, 5), value = 2 }, + [5] = { doorPosition = Position(33363, 31346, 7), value = 4 }, + [6] = { doorPosition = Position(33366, 31343, 7), value = 4 }, } local boats = { - [1] = { boatPosition = Position(33373, 31309, 7), value = 3, toPosition = Position(33382, 31292, 7), message = "A small island emerges out of the mist as you row towards a tiny light inside a dark, forehoding chapel." }, - [2] = { boatPosition = Position(33381, 31294, 7), value = 3, toPosition = Position(33374, 31309, 7), message = "Your heart lightens as you return from the gloomy isle." }, - [3] = { boatPosition = Position(33344, 31348, 7), value = 3, toPosition = Position(33326, 31352, 7) }, - [4] = { boatPosition = Position(33328, 31352, 7), value = 3, toPosition = Position(33346, 31348, 7) }, + [1] = { + boatPosition = Position(33373, 31309, 7), value = 3, + toPosition = Position(33382, 31292, 7), + message = "A small island emerges out of the mist as you row towards a tiny light inside a dark, forehoding chapel." + }, + [2] = { + boatPosition = Position(33382, 31294, 7), value = 3, + toPosition = Position(33374, 31310, 7), + message = "Your heart lightens as you return from the gloomy isle." + }, + [3] = { + boatPosition = Position(33344, 31348, 7), value = 3, + toPosition = Position(33326, 31352, 7) + }, + [4] = { + boatPosition = Position(33328, 31352, 7), value = 3, + toPosition = Position(33346, 31348, 7) + }, } local actions_falcon_doors = Action() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_entrance.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_entrance.lua new file mode 100644 index 00000000000..dfb93dd84ad --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_entrance.lua @@ -0,0 +1,28 @@ +local actions_entrance = Action() + +function actions_entrance.onUse(player, item, fromPosition, target, toPosition, isHotkey) + if (target == nil) or not target:isItem() then + return false + end + + local currentTime = os.date("*t") + local currentMinute = currentTime.min + + local isNightTime = (currentMinute >= 45 or currentMinute < 15) + + if isNightTime then + if target:getPosition() == Position(33201, 31763, 1) then + player:teleportTo(Position(33356, 31309, 4), true) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Once more you mix the chalk with a drop of your blood and a bit of water and renew the symbol on the floor...") + item:transform(2873, 0) + end + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only use this entrance during the night.") + end + + return true +end + +actions_entrance:id(28468) +actions_entrance:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_oberonLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_oberonLever.lua index 59d0d65519d..c6e6841f714 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_oberonLever.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_oberonLever.lua @@ -5,15 +5,15 @@ function actions_falcon_oberon_lever.onUse(player, item, fromPosition, itemEx, t local playersTable = {} local fromPosition_ = Position(33356, 31311, 9) local toPosition_ = Position(33376, 31328, 9) - local exitPosition = Position(33297, 31286, 9) + local exitPosition = Position(33297, 31285, 9) if item:getId() == 2772 then if doCheckBossRoom(player:getId(), bossName, fromPosition_, toPosition_) then - for i = 33358, 33362, 1 do - local newpos = Position(i, 31342, 9) + for i = 33362, 33366, 1 do + local newpos = Position(i, 31344, 9) local nplayer = Tile(newpos):getTopCreature() if nplayer and nplayer:isPlayer() then - nplayer:teleportTo(Position(33365, 31323, 9), true) + nplayer:teleportTo(Position(33364, 31322, 9), true) nplayer:getPosition():sendMagicEffect(CONST_ME_TELEPORT) table.insert(playersTable, nplayer:getId()) nplayer:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonTimer, os.time() + 20 * 60 * 60) @@ -24,10 +24,10 @@ function actions_falcon_oberon_lever.onUse(player, item, fromPosition, itemEx, t oberon:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonHeal, 0) end Game.setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonSay, -1) - Game.createNpc("Oberon's Spite", Position(33363, 31321, 9)) - Game.createNpc("Oberon's Ire", Position(33368, 31321, 9)) - Game.createNpc("Oberon's Bile", Position(33363, 31317, 9)) - Game.createNpc("Oberon's Hate", Position(33368, 31317, 9)) + Game.createNpc("Oberon's Spite", Position(33361, 31320, 9)) + Game.createNpc("Oberon's Ire", Position(33367, 31320, 9)) + Game.createNpc("Oberon's Bile", Position(33361, 31316, 9)) + Game.createNpc("Oberon's Hate", Position(33367, 31316, 9)) addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, fromPosition_, toPosition_, exitPosition) end end diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/movements_bossEntrance.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/movements_bossEntrance.lua index 6e4c94edc39..0f000b94e7c 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/movements_bossEntrance.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/movements_bossEntrance.lua @@ -1,6 +1,6 @@ local config = { entrance = Position(33310, 31325, 8), - exit = Position(33330, 31334, 9), + exit = Position(33329, 31333, 9), } local movements_falcon_bossEntrance = MoveEvent() @@ -29,7 +29,7 @@ function movements_falcon_bossEntrance.onStepIn(creature, item, position, fromPo local blockedPositions = { Position(33328, 31352, 7), Position(33373, 31309, 7), - Position(33381, 31294, 7), + Position(33382, 31294, 7), Position(33344, 31348, 7), } if creature then @@ -37,7 +37,7 @@ function movements_falcon_bossEntrance.onStepIn(creature, item, position, fromPo return true else if creature:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonTimer) <= os.time() then - creature:teleportTo(Position(33359, 31340, 9), true) + creature:teleportTo(Position(33363, 31341, 9), true) else creature:teleportTo(fromPosition, true) creature:sendCancelMessage("You are still exhausted from your last battle.") diff --git a/data-otservbr-global/startup/tables/chest.lua b/data-otservbr-global/startup/tables/chest.lua index cff17d3665c..ef4f0cea1b0 100644 --- a/data-otservbr-global/startup/tables/chest.lua +++ b/data-otservbr-global/startup/tables/chest.lua @@ -181,15 +181,14 @@ ChestUnique = { reward = { { 2970, 1 } }, storage = Storage.Quest.Key.ID3899, }, - --[[ [5012] = { + -- The Secret Library Quest + [5012] = { isKey = true, itemId = 23740, itemPos = { x = 33377, y = 31321, z = 1 }, reward = { { 2969, 1 } }, storage = Storage.Quest.Key.ID0909, - timerStorage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastionChestsTimer.Key0909, - time = 24, -- hour - }, ]] + }, -- Bear Room Quest (rookgaard) key 4601 [5013] = { isKey = true, @@ -1080,12 +1079,13 @@ ChestUnique = { weight = 15.00, storage = Storage.Quest.U8_54.TomesOfKnowledge.TopTower, }, - --[[[6105] = { + -- The Secret Library Quest + [6105] = { itemId = 23741, itemPos = { x = 33352, y = 31318, z = 7 }, randomReward = { { 9081, 1 }, { 28821, 1 }, { 28823, 1 }, { 9058, 1 }, { 6299, 1 }, { 3052, 1 }, { 3035, 10 } }, reward = { { nil, nil } }, - timerStorage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastionChestsTimer.Coast, + timerStorage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.ChestsTimer.Coast, time = 24, -- hour }, [6106] = { @@ -1093,7 +1093,7 @@ ChestUnique = { itemPos = { x = 33384, y = 31285, z = 7 }, randomReward = { { 9081, 1 }, { 28821, 1 }, { 28823, 1 }, { 9058, 1 }, { 6299, 1 }, { 3052, 1 }, { 3035, 10 } }, reward = { { nil, nil } }, - timerStorage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastionChestsTimer.Island, + timerStorage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.ChestsTimer.Island, time = 24, -- hour }, [6107] = { @@ -1101,7 +1101,7 @@ ChestUnique = { itemPos = { x = 33366, y = 31323, z = 5 }, randomReward = { { 9081, 1 }, { 28821, 1 }, { 28823, 1 }, { 9058, 1 }, { 6299, 1 }, { 3052, 1 }, { 3035, 10 } }, reward = { { nil, nil } }, - timerStorage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastionChestsTimer.ThroneHall, + timerStorage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.ChestsTimer.ThroneHall, time = 24, -- hour }, [6108] = { @@ -1109,7 +1109,7 @@ ChestUnique = { itemPos = { x = 33374, y = 31340, z = 4 }, randomReward = { { 9081, 1 }, { 28821, 1 }, { 28823, 1 }, { 9058, 1 }, { 6299, 1 }, { 3052, 1 }, { 3035, 10 } }, reward = { { nil, nil } }, - timerStorage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastionChestsTimer.Shortcut, + timerStorage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.ChestsTimer.Shortcut, time = 24, -- hour }, [6109] = { @@ -1117,7 +1117,7 @@ ChestUnique = { itemPos = { x = 33324, y = 31268, z = 8 }, randomReward = { { 9081, 1 }, { 28821, 1 }, { 28823, 1 }, { 9058, 1 }, { 6299, 1 }, { 3052, 1 }, { 3035, 10 } }, reward = { { nil, nil } }, - timerStorage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastionChestsTimer.LowerBastion, + timerStorage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.ChestsTimer.LowerBastion, time = 24, -- hour }, [6110] = { @@ -1125,9 +1125,9 @@ ChestUnique = { itemPos = { x = 33308, y = 31304, z = 9 }, randomReward = { { 9081, 1 }, { 28821, 1 }, { 28823, 1 }, { 9058, 1 }, { 6299, 1 }, { 3052, 1 }, { 3035, 10 } }, reward = { { nil, nil } }, - timerStorage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastionChestsTimer.UndergroundBastion, + timerStorage = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.ChestsTimer.UndergroundBastion, time = 24, -- hour - }, ]] + }, -- Blood Herb Quest [6111] = { useKV = true, diff --git a/data-otservbr-global/startup/tables/item.lua b/data-otservbr-global/startup/tables/item.lua index 88d556fba64..2a2fecc7ec2 100644 --- a/data-otservbr-global/startup/tables/item.lua +++ b/data-otservbr-global/startup/tables/item.lua @@ -614,7 +614,7 @@ ItemAction = { { x = 32959, y = 32679, z = 2 }, }, }, - [4914] = { -- saida + [4914] = { itemId = false, itemPos = { { x = 32886, y = 32772, z = 9 }, @@ -626,7 +626,7 @@ ItemAction = { { x = 32882, y = 32820, z = 11 }, }, }, - [4915] = { -- entrada + [4915] = { itemId = false, itemPos = { { x = 32860, y = 32798, z = 11 }, @@ -636,6 +636,35 @@ ItemAction = { { x = 32808, y = 32765, z = 10 }, }, }, + [4920] = { + itemId = false, + itemPos = { + { x = 33376, y = 31335, z = 3 }, + { x = 33371, y = 31349, z = 4 }, + { x = 33376, y = 31349, z = 4 }, + { x = 33375, y = 31346, z = 5 }, + { x = 33363, y = 31346, z = 7 }, + { x = 33366, y = 31343, z = 7 }, + { x = 33310, y = 31325, z = 8 }, + { x = 33329, y = 31333, z = 9 }, + }, + }, + [4921] = { + itemId = false, + itemPos = { + { x = 33373, y = 31309, z = 7 }, + { x = 33382, y = 31294, z = 7 }, + { x = 33344, y = 31348, z = 7 }, + { x = 33328, y = 31352, z = 7 }, + { x = 33298, y = 31287, z = 9 }, + { x = 33297, y = 31287, z = 9 }, + { x = 33296, y = 31287, z = 9 }, + { x = 33296, y = 31288, z = 9 }, + { x = 33298, y = 31288, z = 9 }, + { x = 33298, y = 31289, z = 9 }, + { x = 33297, y = 31289, z = 9 }, + }, + }, -- Cults of Tibia Quest [5522] = { itemId = 25687, diff --git a/data-otservbr-global/startup/tables/lever.lua b/data-otservbr-global/startup/tables/lever.lua index 39648ba45d2..e7db97ab859 100644 --- a/data-otservbr-global/startup/tables/lever.lua +++ b/data-otservbr-global/startup/tables/lever.lua @@ -29,6 +29,12 @@ LeverAction = { { x = 33218, y = 32096, z = 10 }, }, }, + [4922] = { + itemId = 2772, + itemPos = { + { x = 33364, y = 31343, z = 9 }, + }, + }, -- Cults of Tibia Quest [5500] = { itemId = 8911, diff --git a/data-otservbr-global/world/otservbr-monster.xml b/data-otservbr-global/world/otservbr-monster.xml index 80c5f5d4ff3..424e4210b80 100644 --- a/data-otservbr-global/world/otservbr-monster.xml +++ b/data-otservbr-global/world/otservbr-monster.xml @@ -1780,6 +1780,9 @@ + + + @@ -2116,6 +2119,9 @@ + + + @@ -3314,12 +3320,15 @@ - - + + + + + @@ -9595,6 +9604,7 @@ + @@ -14604,6 +14614,9 @@ + + + @@ -51892,8 +51905,9 @@ - - + + + From e8db3b365a3e9df1fed9b0f967c235c206e08369 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 22 Oct 2024 10:22:14 +0000 Subject: [PATCH 45/70] Lua code format - (Stylua) --- .../creaturescripts_kill.lua | 78 +++++++++---------- .../the_order_of_the_falcon/actions_doors.lua | 22 +++--- .../actions_entrance.lua | 34 ++++---- 3 files changed, 69 insertions(+), 65 deletions(-) diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua index 9f1fae8c931..5a3bde3b049 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/creaturescripts_kill.lua @@ -3,45 +3,45 @@ local defaultTime = 20 local creaturescripts_library_bosses = CreatureEvent("killingLibrary") function creaturescripts_library_bosses.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified) - if not creature:isMonster() or creature:getMaster() then - return true - end - - local monsterStorages = { - ["grand commander soeren"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 1 }, - ["preceptor lazare"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 2 }, - ["grand chaplain gaunder"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 3 }, - ["grand canon dominus"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 4 }, - ["dazed leaf golem"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 5 }, - ["grand master oberon"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 6, achievements = { "Millennial Falcon", "Master Debater" }, lastBoss = true }, - ["brokul"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 7 }, - ["the flaming orchid"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.Asuras.FlammingOrchid, value = 1 }, - } - - local monsterName = creature:getName():lower() - local monsterStorage = monsterStorages[monsterName] - - if monsterStorage then - for playerid, damage in pairs(creature:getDamageMap()) do - local p = Player(playerid) - if p then - if p:getStorageValue(monsterStorage.stg) < monsterStorage.value then - p:setStorageValue(monsterStorage.stg, monsterStorage.value) - end - if monsterStorage.achievements then - for i = 1, #monsterStorage.achievements do - p:addAchievement(monsterStorage.achievements[i]) - end - end - if monsterStorage.lastBoss then - if p:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline) < 2 then - p:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, 2) - end - end - end - end - end - return true + if not creature:isMonster() or creature:getMaster() then + return true + end + + local monsterStorages = { + ["grand commander soeren"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 1 }, + ["preceptor lazare"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 2 }, + ["grand chaplain gaunder"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 3 }, + ["grand canon dominus"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 4 }, + ["dazed leaf golem"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 5 }, + ["grand master oberon"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.KillingBosses, value = 6, achievements = { "Millennial Falcon", "Master Debater" }, lastBoss = true }, + ["brokul"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 7 }, + ["the flaming orchid"] = { stg = Storage.Quest.U11_80.TheSecretLibrary.Asuras.FlammingOrchid, value = 1 }, + } + + local monsterName = creature:getName():lower() + local monsterStorage = monsterStorages[monsterName] + + if monsterStorage then + for playerid, damage in pairs(creature:getDamageMap()) do + local p = Player(playerid) + if p then + if p:getStorageValue(monsterStorage.stg) < monsterStorage.value then + p:setStorageValue(monsterStorage.stg, monsterStorage.value) + end + if monsterStorage.achievements then + for i = 1, #monsterStorage.achievements do + p:addAchievement(monsterStorage.achievements[i]) + end + end + if monsterStorage.lastBoss then + if p:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline) < 2 then + p:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, 2) + end + end + end + end + end + return true end creaturescripts_library_bosses:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_doors.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_doors.lua index 179fa89fb37..34a56f1d74e 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_doors.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_doors.lua @@ -9,22 +9,26 @@ local doors = { local boats = { [1] = { - boatPosition = Position(33373, 31309, 7), value = 3, - toPosition = Position(33382, 31292, 7), - message = "A small island emerges out of the mist as you row towards a tiny light inside a dark, forehoding chapel." + boatPosition = Position(33373, 31309, 7), + value = 3, + toPosition = Position(33382, 31292, 7), + message = "A small island emerges out of the mist as you row towards a tiny light inside a dark, forehoding chapel.", }, [2] = { - boatPosition = Position(33382, 31294, 7), value = 3, + boatPosition = Position(33382, 31294, 7), + value = 3, toPosition = Position(33374, 31310, 7), - message = "Your heart lightens as you return from the gloomy isle." + message = "Your heart lightens as you return from the gloomy isle.", }, [3] = { - boatPosition = Position(33344, 31348, 7), value = 3, - toPosition = Position(33326, 31352, 7) + boatPosition = Position(33344, 31348, 7), + value = 3, + toPosition = Position(33326, 31352, 7), }, [4] = { - boatPosition = Position(33328, 31352, 7), value = 3, - toPosition = Position(33346, 31348, 7) + boatPosition = Position(33328, 31352, 7), + value = 3, + toPosition = Position(33346, 31348, 7), }, } diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_entrance.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_entrance.lua index dfb93dd84ad..d7601f9ba68 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_entrance.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_entrance.lua @@ -1,27 +1,27 @@ local actions_entrance = Action() function actions_entrance.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if (target == nil) or not target:isItem() then - return false - end + if (target == nil) or not target:isItem() then + return false + end - local currentTime = os.date("*t") - local currentMinute = currentTime.min + local currentTime = os.date("*t") + local currentMinute = currentTime.min - local isNightTime = (currentMinute >= 45 or currentMinute < 15) + local isNightTime = (currentMinute >= 45 or currentMinute < 15) - if isNightTime then - if target:getPosition() == Position(33201, 31763, 1) then - player:teleportTo(Position(33356, 31309, 4), true) - player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Once more you mix the chalk with a drop of your blood and a bit of water and renew the symbol on the floor...") - item:transform(2873, 0) - end - else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only use this entrance during the night.") - end + if isNightTime then + if target:getPosition() == Position(33201, 31763, 1) then + player:teleportTo(Position(33356, 31309, 4), true) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Once more you mix the chalk with a drop of your blood and a bit of water and renew the symbol on the floor...") + item:transform(2873, 0) + end + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can only use this entrance during the night.") + end - return true + return true end actions_entrance:id(28468) From e2a842c43c16f80741d5eb74143dedcb64f9403e Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Tue, 22 Oct 2024 12:17:01 -0300 Subject: [PATCH 46/70] The Secret Library Quest - The Path of Defiances --- data-otservbr-global/lib/core/quests.lua | 3 +- data-otservbr-global/npc/dedoras.lua | 10 +- .../actions_doors.lua | 6 +- .../movements_sacrifice_foods.lua | 126 ++++++++++++++++++ .../movements_teleportTo.lua | 32 +++-- data-otservbr-global/startup/tables/item.lua | 89 +++++++++++++ data/scripts/actions/items/foods.lua | 10 -- 7 files changed, 249 insertions(+), 27 deletions(-) create mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_sacrifice_foods.lua diff --git a/data-otservbr-global/lib/core/quests.lua b/data-otservbr-global/lib/core/quests.lua index f4f620642b5..8e8bef47a61 100644 --- a/data-otservbr-global/lib/core/quests.lua +++ b/data-otservbr-global/lib/core/quests.lua @@ -6600,7 +6600,7 @@ if not Quests then storageId = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, missionId = 10455, startValue = 1, - endValue = 8, + endValue = 9, states = { [1] = "Go to Darashia and find out about the mysterious statue.", [2] = "After you have been swallowed by a sand vortex you have entered a hidden desert area. A voice of unknown origin has informed you that you will have to face some challenges.", @@ -6610,6 +6610,7 @@ if not Quests then [6] = "Part VI", [7] = "Part VII", [8] = "You have found a book page in a chest. It seems to contain very useful information, but you are not capable to read it. At this point you have to speak with an expert.", + [9] = "Congratulations you completed this mission.", }, }, [6] = { diff --git a/data-otservbr-global/npc/dedoras.lua b/data-otservbr-global/npc/dedoras.lua index ee2d426b57a..87e2712298b 100644 --- a/data-otservbr-global/npc/dedoras.lua +++ b/data-otservbr-global/npc/dedoras.lua @@ -114,8 +114,14 @@ local function creatureSayCallback(npc, creature, type, message) startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, 1) end elseif MsgContains(message, "desert") then - npcHandler:say("There are rumors of a mysterious statue in the desert next to Darashia. Nobody really knows the meaning of it.", npc, creature) - startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, 1) + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline) == 8 then + npcHandler:say("That's simply a scientific sensation. It will provide me with lots of much needed knowledge!", npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission, currentStorage + 1) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, 9) + elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline) < 1 then + npcHandler:say("There are rumors of a mysterious statue in the desert next to Darashia. Nobody really knows the meaning of it.", npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, 1) + end elseif MsgContains(message, "fishmen") then if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline) == 7 then npcHandler:say("You brought incredible news. This book proves an invaluable clue!", npc, creature) diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/actions_doors.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/actions_doors.lua index 9ac1f98e62b..be148a3c40e 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/actions_doors.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/actions_doors.lua @@ -1,9 +1,9 @@ local doors = { - [1] = { doorPosition = Position(32963, 32319, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, value = 40 }, + [1] = { doorPosition = Position(32963, 32319, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, value = 39 }, [2] = { doorPosition = Position(32955, 32304, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, value = 40 }, - [3] = { doorPosition = Position(32984, 32314, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.SecondChest, value = 1 }, + [3] = { doorPosition = Position(32984, 32314, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.FirstChest, value = 1 }, [4] = { doorPosition = Position(32968, 32324, 9), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.SecondChest, value = 1 }, - [5] = { doorPosition = Position(32978, 32290, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.EatenFood, value = 1 }, + [5] = { doorPosition = Position(32978, 32290, 10), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.EatenFood, value = 4 }, [6] = { doorPosition = Position(32963, 32297, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 7 }, [7] = { doorPosition = Position(32963, 32299, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 7 }, [8] = { doorPosition = Position(32963, 32301, 8), storage = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 7 }, diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_sacrifice_foods.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_sacrifice_foods.lua new file mode 100644 index 00000000000..8780106bd29 --- /dev/null +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_sacrifice_foods.lua @@ -0,0 +1,126 @@ +local foods = { + 3606, 3250, 3577, 21145, 21144, 21143, 3578, 3579, 23535, 23545, 3580, 3581, 3582, + 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 904, 3593, 3594, 3595, + 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3607, 3723, 3724, 3725, 3726, 3727, 3728, + 3729, 3730, 3731, 3732, 5096, 20310, 5678, 6125, 6277, 6278, 6392, 6393, 6500, 6541, + 6542, 6543, 6544, 6545, 6569, 6574, 7158, 7159, 229, 7373, 7374, 7375, 7376, 7377, + 836, 841, 901, 169, 8010, 8011, 8012, 8013, 8014, 8015, 8016, 8017, 8019, 8177, 8197, + 9537, 10329, 10453, 10219, 11459, 11460, 11461, 11462, 11681, 11682, 11683, 12310, + 13992, 14084, 14085, 14681, 15795, 16103, 17457, 17820, 17821, 21146, 22187, 22185, + 24382, 24383, 24396, 24948, 25692, 30198, 30202, 31560, 32069, 37530, 37531, 37532, 37533 +} + +local pillars = { + { position = Position(32963, 32280, 10), itemPosition = Position(32961, 32280, 10) }, + { position = Position(32963, 32282, 10), itemPosition = Position(32961, 32282, 10) }, + { position = Position(32963, 32284, 10), itemPosition = Position(32961, 32284, 10) }, + { position = Position(32963, 32286, 10), itemPosition = Position(32961, 32286, 10) } +} + +local storageValue = Storage.Quest.U11_80.TheSecretLibrary.Darashia.EatenFood +local transformTime = 5 * 60 * 1000 + +local perimeter1Min = Position(32964, 32278, 10) +local perimeter1Max = Position(32966, 32290, 10) + +local perimeter2Min = Position(32961, 32288, 10) +local perimeter2Max = Position(32963, 32290, 10) + +local function isFood(itemid) + for _, foodid in ipairs(foods) do + if foodid == itemid then + return true + end + end + return false +end + +local function findPlayerInPerimeter() + -- Verificar ambos os perímetros + for x = perimeter1Min.x, perimeter1Max.x do + for y = perimeter1Min.y, perimeter1Max.y do + local tile = Tile(Position(x, y, perimeter1Min.z)) + if tile then + local player = tile:getTopCreature() + if player and player:isPlayer() then + return player + end + end + end + end + for x = perimeter2Min.x, perimeter2Max.x do + for y = perimeter2Min.y, perimeter2Max.y do + local tile = Tile(Position(x, y, perimeter2Min.z)) + if tile then + local player = tile:getTopCreature() + if player and player:isPlayer() then + return player + end + end + end + end + return nil +end + +local foodSacrifice = MoveEvent() + +function foodSacrifice.onAddItem(moveitem, tileitem, position) + if not isFood(moveitem.itemid) then + return true + end + + for _, pillar in ipairs(pillars) do + if position == pillar.position and tileitem:getActionId() == 4932 then + + local itemToTransform = Tile(pillar.itemPosition):getItemById(27987) + if itemToTransform then + -- Transformar item 27987 em 27989 + itemToTransform:transform(27989) + + -- Remover o item de comida e adicionar o item 24490 em seu lugar + local foodPosition = moveitem:getPosition() + moveitem:remove() + Game.createItem(24490, 1, foodPosition) + + addEvent(function() + local revertedTile = Tile(pillar.itemPosition) + if revertedTile then + local itemToRevert = revertedTile:getItemById(27989) + if itemToRevert then + itemToRevert:transform(27987) + end + end + -- Reverter o item 24490 de volta (remover) + local revertFoodItem = Tile(foodPosition):getItemById(24490) + if revertFoodItem then + revertFoodItem:remove() + end + end, transformTime) + + local player = findPlayerInPerimeter() + if player then + local currentProgress = player:getStorageValue(storageValue) + if currentProgress < 0 then + currentProgress = 0 + end + if currentProgress < 4 then + player:setStorageValue(storageValue, currentProgress + 1) + end + if player:getStorageValue(storageValue) == 4 then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Questlog) < 6 then + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, 6) + end + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have completed the food offering ritual!") + end + end + + return true + end + end + end + return true +end + +foodSacrifice:type("additem") +foodSacrifice:aid(4932) +foodSacrifice:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_teleportTo.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_teleportTo.lua index 9081f1442ff..74965104861 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_teleportTo.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_teleportTo.lua @@ -104,7 +104,6 @@ function movements_desert_teleportTo.onStepIn(creature, item, position, fromPosi if position == lastTeleport then if resetRoom(scorpionPosition, bossName) then if player:getStorageValue(scorpionTimer) < os.time() then - player:setStorageValue(scorpionTimer, os.time() + 20 * 60 * 60) startBattle(player:getId(), Position(32958, 32309, 8), bossName, scorpionPosition) addEvent(function(cid) local p = Player(cid) @@ -114,6 +113,12 @@ function movements_desert_teleportTo.onStepIn(creature, item, position, fromPosi end end end, 5 * 1000 * 60, player:getId()) + addEvent(function(cid) + local p = Player(cid) + if p then + p:setStorageValue(scorpionTimer, os.time() + 20 * 60 * 60) + end + end, 1000, player:getId()) else player:sendCancelMessage("You are still exhausted from your last battle.") player:teleportTo(fromPosition, true) @@ -142,20 +147,25 @@ function movements_desert_teleportTo.onStepIn(creature, item, position, fromPosi end end elseif item.actionid == 4931 then - for _, k in pairs(puzzle) do - if position == k.position then - if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm) < #puzzle then - if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm) == k.value then - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm) + 1) + local tileItem = Tile(position):getItemById(item.itemid) + if tileItem and (tileItem:getId() == 231 or tileItem:getId() == 28318 or tileItem:getId() == 28319 or tileItem:getId() == 28320 or tileItem:getId() == 28322 or tileItem:getId() == 28323) then + for _, k in pairs(puzzle) do + if position == k.position then + local currentStep = player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm) + if currentStep == -1 then + currentStep = 0 + end + if currentStep == k.value - 1 then + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, currentStep + 1) player:getPosition():sendMagicEffect(CONST_ME_SOUND_WHITE) + + if currentStep + 1 == #puzzle then + player:say("Access granted!", TALKTYPE_MONSTER_SAY) + end else - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, 1) + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, 0) player:getPosition():sendMagicEffect(CONST_ME_SOUND_RED) end - elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm) == #puzzle then - player:say("Access granted!", TALKTYPE_MONSTER_SAY) - player:getPosition():sendMagicEffect(CONST_ME_SOUND_WHITE) - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm, player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.PuzzleSqm) + 1) end end end diff --git a/data-otservbr-global/startup/tables/item.lua b/data-otservbr-global/startup/tables/item.lua index 2a2fecc7ec2..c2a08b54e21 100644 --- a/data-otservbr-global/startup/tables/item.lua +++ b/data-otservbr-global/startup/tables/item.lua @@ -665,6 +665,95 @@ ItemAction = { { x = 33297, y = 31289, z = 9 }, }, }, + [4930] = { + itemId = false, + itemPos = { + { x = 33110, y = 32385, z = 7 }, + { x = 32958, y = 32322, z = 8 }, + { x = 32955, y = 32288, z = 10 }, + { x = 32942, y = 32283, z = 10 }, + { x = 32945, y = 32313, z = 8 }, + { x = 32963, y = 32319, z = 9 }, + { x = 32955, y = 32304, z = 9 }, + { x = 32984, y = 32314, z = 9 }, + { x = 32968, y = 32324, z = 9 }, + { x = 32978, y = 32290, z = 10 }, + { x = 32963, y = 32297, z = 8 }, + { x = 32963, y = 32299, z = 8 }, + { x = 32963, y = 32301, z = 8 }, + { x = 32963, y = 32303, z = 8 }, + { x = 32963, y = 32312, z = 8 }, + }, + }, + [4931] = { + itemId = false, + itemPos = { + { x = 32965, y = 32310, z = 9 }, + { x = 32965, y = 32309, z = 9 }, + { x = 32964, y = 32309, z = 9 }, + { x = 32963, y = 32309, z = 9 }, + { x = 32962, y = 32309, z = 9 }, + { x = 32961, y = 32309, z = 9 }, + { x = 32960, y = 32309, z = 9 }, + { x = 32959, y = 32309, z = 9 }, + { x = 32959, y = 32310, z = 9 }, + { x = 32959, y = 32311, z = 9 }, + { x = 32958, y = 32311, z = 9 }, + { x = 32957, y = 32311, z = 9 }, + { x = 32956, y = 32311, z = 9 }, + { x = 32956, y = 32310, z = 9 }, + { x = 32955, y = 32310, z = 9 }, + { x = 32954, y = 32310, z = 9 }, + { x = 32953, y = 32310, z = 9 }, + { x = 32953, y = 32311, z = 9 }, + { x = 32953, y = 32312, z = 9 }, + { x = 32953, y = 32313, z = 9 }, + { x = 32953, y = 32314, z = 9 }, + { x = 32954, y = 32314, z = 9 }, + { x = 32955, y = 32314, z = 9 }, + { x = 32956, y = 32314, z = 9 }, + { x = 32956, y = 32315, z = 9 }, + { x = 32956, y = 32316, z = 9 }, + { x = 32956, y = 32317, z = 9 }, + { x = 32957, y = 32317, z = 9 }, + { x = 32957, y = 32318, z = 9 }, + { x = 32957, y = 32319, z = 9 }, + { x = 32958, y = 32319, z = 9 }, + { x = 32959, y = 32319, z = 9 }, + { x = 32960, y = 32319, z = 9 }, + { x = 32960, y = 32318, z = 9 }, + { x = 32960, y = 32317, z = 9 }, + { x = 32961, y = 32317, z = 9 }, + { x = 32962, y = 32317, z = 9 }, + { x = 32962, y = 32318, z = 9 }, + { x = 32962, y = 32319, z = 9 }, + { x = 32970, y = 32314, z = 9 }, + { x = 32980, y = 32308, z = 9 }, + { x = 32955, y = 32282, z = 10 }, + { x = 32983, y = 32289, z = 10 }, + { x = 32944, y = 32309, z = 8 }, + + }, + }, + [4932] = { + itemId = false, + itemPos = { + { x = 32974, y = 32296, z = 9 }, + { x = 32967, y = 32319, z = 9 }, + { x = 32963, y = 32280, z = 10 }, + { x = 32963, y = 32282, z = 10 }, + { x = 32963, y = 32284, z = 10 }, + { x = 32963, y = 32286, z = 10 }, + }, + }, + [4933] = { + itemId = false, + itemPos = { + { x = 32945, y = 32288, z = 10 }, + { x = 32948, y = 32288, z = 10 }, + { x = 32951, y = 32288, z = 10 }, + }, + }, -- Cults of Tibia Quest [5522] = { itemId = 25687, diff --git a/data/scripts/actions/items/foods.lua b/data/scripts/actions/items/foods.lua index f9cf4842b98..4a8072d163e 100644 --- a/data/scripts/actions/items/foods.lua +++ b/data/scripts/actions/items/foods.lua @@ -136,16 +136,6 @@ function food.onUse(player, item, fromPosition, target, toPosition, isHotkey) return true end - if IsRunningGlobalDatapack() then - -- The Secret Library Quest - if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.eatenFood) ~= 1 then - if player:getPosition():isInRange(Position(32961, 32280, 10), Position(32964, 32286, 10)) then - player:say("Fames est optimus coquus", TALKTYPE_MONSTER_SAY) - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.eatenFood, 1) - end - end - end - player:feed(itemFood[1] * 12) player:say(itemFood[2], TALKTYPE_MONSTER_SAY) player:updateSupplyTracker(item) From cd8a1c848ec9050aca763a5395be870ab0a81c37 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 22 Oct 2024 15:18:12 +0000 Subject: [PATCH 47/70] Lua code format - (Stylua) --- .../movements_sacrifice_foods.lua | 295 ++++++++++++------ .../movements_teleportTo.lua | 10 +- data-otservbr-global/startup/tables/item.lua | 1 - 3 files changed, 208 insertions(+), 98 deletions(-) diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_sacrifice_foods.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_sacrifice_foods.lua index 8780106bd29..df06751adcd 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_sacrifice_foods.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_sacrifice_foods.lua @@ -1,20 +1,132 @@ local foods = { - 3606, 3250, 3577, 21145, 21144, 21143, 3578, 3579, 23535, 23545, 3580, 3581, 3582, - 3583, 3584, 3585, 3586, 3587, 3588, 3589, 3590, 3591, 3592, 904, 3593, 3594, 3595, - 3596, 3597, 3598, 3599, 3600, 3601, 3602, 3607, 3723, 3724, 3725, 3726, 3727, 3728, - 3729, 3730, 3731, 3732, 5096, 20310, 5678, 6125, 6277, 6278, 6392, 6393, 6500, 6541, - 6542, 6543, 6544, 6545, 6569, 6574, 7158, 7159, 229, 7373, 7374, 7375, 7376, 7377, - 836, 841, 901, 169, 8010, 8011, 8012, 8013, 8014, 8015, 8016, 8017, 8019, 8177, 8197, - 9537, 10329, 10453, 10219, 11459, 11460, 11461, 11462, 11681, 11682, 11683, 12310, - 13992, 14084, 14085, 14681, 15795, 16103, 17457, 17820, 17821, 21146, 22187, 22185, - 24382, 24383, 24396, 24948, 25692, 30198, 30202, 31560, 32069, 37530, 37531, 37532, 37533 + 3606, + 3250, + 3577, + 21145, + 21144, + 21143, + 3578, + 3579, + 23535, + 23545, + 3580, + 3581, + 3582, + 3583, + 3584, + 3585, + 3586, + 3587, + 3588, + 3589, + 3590, + 3591, + 3592, + 904, + 3593, + 3594, + 3595, + 3596, + 3597, + 3598, + 3599, + 3600, + 3601, + 3602, + 3607, + 3723, + 3724, + 3725, + 3726, + 3727, + 3728, + 3729, + 3730, + 3731, + 3732, + 5096, + 20310, + 5678, + 6125, + 6277, + 6278, + 6392, + 6393, + 6500, + 6541, + 6542, + 6543, + 6544, + 6545, + 6569, + 6574, + 7158, + 7159, + 229, + 7373, + 7374, + 7375, + 7376, + 7377, + 836, + 841, + 901, + 169, + 8010, + 8011, + 8012, + 8013, + 8014, + 8015, + 8016, + 8017, + 8019, + 8177, + 8197, + 9537, + 10329, + 10453, + 10219, + 11459, + 11460, + 11461, + 11462, + 11681, + 11682, + 11683, + 12310, + 13992, + 14084, + 14085, + 14681, + 15795, + 16103, + 17457, + 17820, + 17821, + 21146, + 22187, + 22185, + 24382, + 24383, + 24396, + 24948, + 25692, + 30198, + 30202, + 31560, + 32069, + 37530, + 37531, + 37532, + 37533, } local pillars = { - { position = Position(32963, 32280, 10), itemPosition = Position(32961, 32280, 10) }, - { position = Position(32963, 32282, 10), itemPosition = Position(32961, 32282, 10) }, - { position = Position(32963, 32284, 10), itemPosition = Position(32961, 32284, 10) }, - { position = Position(32963, 32286, 10), itemPosition = Position(32961, 32286, 10) } + { position = Position(32963, 32280, 10), itemPosition = Position(32961, 32280, 10) }, + { position = Position(32963, 32282, 10), itemPosition = Position(32961, 32282, 10) }, + { position = Position(32963, 32284, 10), itemPosition = Position(32961, 32284, 10) }, + { position = Position(32963, 32286, 10), itemPosition = Position(32961, 32286, 10) }, } local storageValue = Storage.Quest.U11_80.TheSecretLibrary.Darashia.EatenFood @@ -27,98 +139,97 @@ local perimeter2Min = Position(32961, 32288, 10) local perimeter2Max = Position(32963, 32290, 10) local function isFood(itemid) - for _, foodid in ipairs(foods) do - if foodid == itemid then - return true - end - end - return false + for _, foodid in ipairs(foods) do + if foodid == itemid then + return true + end + end + return false end local function findPlayerInPerimeter() - -- Verificar ambos os perímetros - for x = perimeter1Min.x, perimeter1Max.x do - for y = perimeter1Min.y, perimeter1Max.y do - local tile = Tile(Position(x, y, perimeter1Min.z)) - if tile then - local player = tile:getTopCreature() - if player and player:isPlayer() then - return player - end - end - end - end - for x = perimeter2Min.x, perimeter2Max.x do - for y = perimeter2Min.y, perimeter2Max.y do - local tile = Tile(Position(x, y, perimeter2Min.z)) - if tile then - local player = tile:getTopCreature() - if player and player:isPlayer() then - return player - end - end - end - end - return nil + -- Verificar ambos os perímetros + for x = perimeter1Min.x, perimeter1Max.x do + for y = perimeter1Min.y, perimeter1Max.y do + local tile = Tile(Position(x, y, perimeter1Min.z)) + if tile then + local player = tile:getTopCreature() + if player and player:isPlayer() then + return player + end + end + end + end + for x = perimeter2Min.x, perimeter2Max.x do + for y = perimeter2Min.y, perimeter2Max.y do + local tile = Tile(Position(x, y, perimeter2Min.z)) + if tile then + local player = tile:getTopCreature() + if player and player:isPlayer() then + return player + end + end + end + end + return nil end local foodSacrifice = MoveEvent() function foodSacrifice.onAddItem(moveitem, tileitem, position) - if not isFood(moveitem.itemid) then - return true - end + if not isFood(moveitem.itemid) then + return true + end - for _, pillar in ipairs(pillars) do - if position == pillar.position and tileitem:getActionId() == 4932 then + for _, pillar in ipairs(pillars) do + if position == pillar.position and tileitem:getActionId() == 4932 then + local itemToTransform = Tile(pillar.itemPosition):getItemById(27987) + if itemToTransform then + -- Transformar item 27987 em 27989 + itemToTransform:transform(27989) - local itemToTransform = Tile(pillar.itemPosition):getItemById(27987) - if itemToTransform then - -- Transformar item 27987 em 27989 - itemToTransform:transform(27989) + -- Remover o item de comida e adicionar o item 24490 em seu lugar + local foodPosition = moveitem:getPosition() + moveitem:remove() + Game.createItem(24490, 1, foodPosition) - -- Remover o item de comida e adicionar o item 24490 em seu lugar - local foodPosition = moveitem:getPosition() - moveitem:remove() - Game.createItem(24490, 1, foodPosition) + addEvent(function() + local revertedTile = Tile(pillar.itemPosition) + if revertedTile then + local itemToRevert = revertedTile:getItemById(27989) + if itemToRevert then + itemToRevert:transform(27987) + end + end + -- Reverter o item 24490 de volta (remover) + local revertFoodItem = Tile(foodPosition):getItemById(24490) + if revertFoodItem then + revertFoodItem:remove() + end + end, transformTime) - addEvent(function() - local revertedTile = Tile(pillar.itemPosition) - if revertedTile then - local itemToRevert = revertedTile:getItemById(27989) - if itemToRevert then - itemToRevert:transform(27987) - end - end - -- Reverter o item 24490 de volta (remover) - local revertFoodItem = Tile(foodPosition):getItemById(24490) - if revertFoodItem then - revertFoodItem:remove() - end - end, transformTime) + local player = findPlayerInPerimeter() + if player then + local currentProgress = player:getStorageValue(storageValue) + if currentProgress < 0 then + currentProgress = 0 + end + if currentProgress < 4 then + player:setStorageValue(storageValue, currentProgress + 1) + end + if player:getStorageValue(storageValue) == 4 then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Questlog) < 6 then + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, 6) + end + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have completed the food offering ritual!") + end + end - local player = findPlayerInPerimeter() - if player then - local currentProgress = player:getStorageValue(storageValue) - if currentProgress < 0 then - currentProgress = 0 - end - if currentProgress < 4 then - player:setStorageValue(storageValue, currentProgress + 1) - end - if player:getStorageValue(storageValue) == 4 then - if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Questlog) < 6 then - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, 6) - end - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have completed the food offering ritual!") - end - end - - return true - end - end - end - return true + return true + end + end + end + return true end foodSacrifice:type("additem") diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_teleportTo.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_teleportTo.lua index 74965104861..905dcd0e743 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_teleportTo.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_parth_of_defiances_desert/movements_teleportTo.lua @@ -114,11 +114,11 @@ function movements_desert_teleportTo.onStepIn(creature, item, position, fromPosi end end, 5 * 1000 * 60, player:getId()) addEvent(function(cid) - local p = Player(cid) - if p then - p:setStorageValue(scorpionTimer, os.time() + 20 * 60 * 60) - end - end, 1000, player:getId()) + local p = Player(cid) + if p then + p:setStorageValue(scorpionTimer, os.time() + 20 * 60 * 60) + end + end, 1000, player:getId()) else player:sendCancelMessage("You are still exhausted from your last battle.") player:teleportTo(fromPosition, true) diff --git a/data-otservbr-global/startup/tables/item.lua b/data-otservbr-global/startup/tables/item.lua index c2a08b54e21..fb4c20428d1 100644 --- a/data-otservbr-global/startup/tables/item.lua +++ b/data-otservbr-global/startup/tables/item.lua @@ -732,7 +732,6 @@ ItemAction = { { x = 32955, y = 32282, z = 10 }, { x = 32983, y = 32289, z = 10 }, { x = 32944, y = 32309, z = 8 }, - }, }, [4932] = { From f3fa6efbf26f62810260371d25bfbc3598541473 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Tue, 22 Oct 2024 17:28:37 -0300 Subject: [PATCH 48/70] The Secret Library Quest - High and Dry --- data-otservbr-global/lib/core/quests.lua | 3 +- data-otservbr-global/npc/charles.lua | 95 ++++++++++++++----- data-otservbr-global/npc/dedoras.lua | 10 +- .../high_and_dry_isles/actions_chests.lua | 37 -------- .../movements_boat_puzzle.lua | 6 +- data-otservbr-global/startup/tables/chest.lua | 35 +++++++ data-otservbr-global/startup/tables/item.lua | 32 +++++++ 7 files changed, 151 insertions(+), 67 deletions(-) delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/high_and_dry_isles/actions_chests.lua diff --git a/data-otservbr-global/lib/core/quests.lua b/data-otservbr-global/lib/core/quests.lua index 8e8bef47a61..19b5a058986 100644 --- a/data-otservbr-global/lib/core/quests.lua +++ b/data-otservbr-global/lib/core/quests.lua @@ -6543,11 +6543,12 @@ if not Quests then storageId = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, missionId = 10451, startValue = 1, - endValue = 3, + endValue = 4, states = { [1] = "Dedoras asked for you to talk to Charles, he knows about a small island.", [2] = "You got stucked on this island. You must discover how to leave.", [3] = "You successfully built a raft and used the starts to navigate your way through the waves. At least you found something of interest on the deserted island.", + [4] = "Congratulations you completed this mission.", }, }, [2] = { diff --git a/data-otservbr-global/npc/charles.lua b/data-otservbr-global/npc/charles.lua index 46a6a15ca5c..a7cbb91fb08 100644 --- a/data-otservbr-global/npc/charles.lua +++ b/data-otservbr-global/npc/charles.lua @@ -56,35 +56,79 @@ npcType.onCloseChannel = function(npc, creature) npcHandler:onCloseChannel(npc, creature) end --- Travel -local function addTravelKeyword(keyword, cost, destination, condition) - if condition then - keywordHandler:addKeyword({ keyword }, StdModule.say, { npcHandler = npcHandler, text = "I'm sorry but I don't sail there." }, condition) +local shortcuts = { + ["thais"] = {price = 100, position = Position(32310, 32210, 6)}, + ["edron"] = {price = 90, position = Position(33173, 31764, 6)}, + ["liberty bay"] = {price = 20, position = Position(32285, 32891, 6)}, + ["yalahar"] = {price = 200, position = Position(32816, 31272, 6)} +} + +local isles = { + [1] = {isMission = true, position = Position(32031, 32463, 7)}, + [2] = {isMission = false, position = Position(33454, 32160, 7)}, + [3] = {isMission = false, position = Position(32112, 31745, 7)}, + [4] = {isMission = false, position = Position(32457, 32937, 7)} +} + +local function creatureSayCallback(npc, creature, type, message) + local player = Player(creature) + local playerId = player:getId() + + if not npcHandler:checkInteraction(npc, creature) then + return false end - local travelKeyword = keywordHandler:addKeyword({ keyword }, StdModule.say, { npcHandler = npcHandler, text = "Do you seek a passage to " .. keyword:titleCase() .. " for |TRAVELCOST|?", cost = cost, discount = "postman" }) - travelKeyword:addChildKeyword({ "yes" }, StdModule.travel, { npcHandler = npcHandler, premium = false, cost = cost, discount = "postman", destination = destination }) - travelKeyword:addChildKeyword({ "no" }, StdModule.say, { npcHandler = npcHandler, text = "We would like to serve you some time.", reset = true }) + if MsgContains(message, "shortcut") and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline) >= 1 then + npcHandler:say({ + "This passage is shorter and costs less gold - but on the other hand it is also a bit riskier. On this route there are frequent tempests and the severe winds may blow a passenger over board. ...", + "Few ship captains would sail this route. But if you want to take the risk, I can bring you to Thais, Edron, Liberty Bay or Yalahar for less gold than usual. Interested?", + }, npc, creature) + npcHandler:setTopic(playerId, 5) + elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 5 then + npcHandler:say("Do you seek a shortcut passage to {Thais} for 100 gold, to {Edron} for 90 gold, to {Liberty Bay} for 20 gold or to {Yalahar} for 200 gold?", npc, creature) + npcHandler:setTopic(playerId, 6) + elseif npcHandler:getTopic(playerId) == 6 then + local travelTo = shortcuts[message:lower()] + if travelTo then + if player:removeMoney(travelTo.price) then + local r = math.random(1, #isles) + local chance = math.random(1, 10) + if chance <= 3 then + player:teleportTo(travelTo.position) + else + player:teleportTo(isles[r].position) + if isles[r].isMission and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline) < 2 then + player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, 2) + end + end + npcHandler:say("Set the sails and good luck to us!", npc, creature) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + return true + else + npcHandler:say("You don't have enough money.", npc, creature) + end + end + else + local function addTravelKeyword(keyword, cost, destination, condition) + if condition then + keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = "I'm sorry but I don't sail there."}, condition) + end + local travelKeyword = keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = "Do you seek a passage to " .. keyword:titleCase() .. " for |TRAVELCOST|?", cost = cost, discount = "postman"}) + travelKeyword:addChildKeyword({"yes"}, StdModule.travel, {npcHandler = npcHandler, premium = false, cost = cost, discount = "postman", destination = destination}) + travelKeyword:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, text = "We would like to serve you some time.", reset = true}) + end + addTravelKeyword("edron", 150, Position(33173, 31764, 6)) + addTravelKeyword("venore", 160, Position(32954, 32022, 6)) + addTravelKeyword("yalahar", 260, Position(32816, 31272, 6), function(player) return player:getStorageValue(Storage.Quest.U8_4.InServiceOfYalahar.SearoutesAroundYalahar.PortHope) ~= 1 and player:getStorageValue(Storage.Quest.U8_4.InServiceOfYalahar.SearoutesAroundYalahar.TownsCounter) < 5 end) + addTravelKeyword("ankrahmun", 110, Position(33092, 32883, 6)) + addTravelKeyword("darashia", 180, Position(33289, 32480, 6)) + addTravelKeyword("thais", 160, Position(32310, 32210, 6)) + addTravelKeyword("liberty bay", 50, Position(32285, 32892, 6)) + addTravelKeyword("carlin", 120, Position(32387, 31820, 6)) + end end -addTravelKeyword("edron", 150, Position(33173, 31764, 6)) -addTravelKeyword("venore", 160, Position(32954, 32022, 6)) -addTravelKeyword("yalahar", 260, Position(32816, 31272, 6), function(player) - return player:getStorageValue(Storage.Quest.U8_4.InServiceOfYalahar.SearoutesAroundYalahar.PortHope) ~= 1 and player:getStorageValue(Storage.Quest.U8_4.InServiceOfYalahar.SearoutesAroundYalahar.TownsCounter) < 5 -end) -addTravelKeyword("ankrahmun", 110, Position(33092, 32883, 6)) -addTravelKeyword("darashia", 180, Position(33289, 32480, 6)) -addTravelKeyword("thais", 160, Position(32310, 32210, 6)) -addTravelKeyword("liberty bay", 50, Position(32285, 32892, 6)) -addTravelKeyword("carlin", 120, Position(32387, 31820, 6)) -addTravelKeyword("shortcut", 100, Position(32029, 32466, 7), function(player) - return player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.PinkTel) == 2 and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.Mota) == 12 -end) - --- Kick keywordHandler:addKeyword({ "kick" }, StdModule.kick, { npcHandler = npcHandler, destination = { Position(32535, 32792, 6), Position(32536, 32778, 6) } }) - --- Basic keywordHandler:addKeyword({ "sail" }, StdModule.say, { npcHandler = npcHandler, text = "Where do you want to go - {Thais}, {Darashia}, {Venore}, {Liberty Bay}, {Ankrahmun}, {Yalahar} or {Edron?}" }) keywordHandler:addKeyword({ "passage" }, StdModule.say, { npcHandler = npcHandler, text = "Where do you want to go - {Thais}, {Darashia}, {Venore}, {Liberty Bay}, {Ankrahmun}, {Yalahar} or {Edron?}" }) keywordHandler:addKeyword({ "job" }, StdModule.say, { npcHandler = npcHandler, text = "Im the captain of the Poodle, the proudest ship on all oceans." }) @@ -96,6 +140,9 @@ keywordHandler:addKeyword({ "svargrond" }, StdModule.say, { npcHandler = npcHand npcHandler:setMessage(MESSAGE_GREET, "Ahoy. Where can I sail you today?") npcHandler:setMessage(MESSAGE_FAREWELL, "Bye.") npcHandler:setMessage(MESSAGE_WALKAWAY, "Bye.") + +npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) + npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true) -- npcType registering the npcConfig table diff --git a/data-otservbr-global/npc/dedoras.lua b/data-otservbr-global/npc/dedoras.lua index 87e2712298b..e1a73f6d5bd 100644 --- a/data-otservbr-global/npc/dedoras.lua +++ b/data-otservbr-global/npc/dedoras.lua @@ -159,8 +159,14 @@ local function creatureSayCallback(npc, creature, type, message) startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, 1) end elseif MsgContains(message, "isle") then - npcHandler:say("Talk to Captain Charles in Port Hope. He told me that he once ran ashore on a small island where he discovered a small ruin. The architecture was like nothing he had seen before.", npc, creature) - startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, 1) + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline) == 3 then + npcHandler:say("Thank you so much for your efforts to provide this valuable piece of the puzzle!", npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission, currentStorage + 1) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, 4) + elseif player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline) < 1 then + npcHandler:say("Talk to Captain Charles in Port Hope. He told me that he once ran ashore on a small island where he discovered a small ruin. The architecture was like nothing he had seen before.", npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, 1) + end elseif MsgContains(message, "progress") then if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission) < 6 then npcHandler:say({ diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/high_and_dry_isles/actions_chests.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/high_and_dry_isles/actions_chests.lua deleted file mode 100644 index aafc676b172..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/high_and_dry_isles/actions_chests.lua +++ /dev/null @@ -1,37 +0,0 @@ -local chests = { - [4920] = { storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Parchment, reward = 28650, amount = 1 }, - [4921] = { storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Sapphire, reward = 675, amount = 2 }, - [4922] = { storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Fishing, reward = 3483, amount = 1 }, - [4923] = { storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Shovel, reward = 3457, amount = 1 }, - [4925] = { storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Hawser, reward = 28707, amount = 1 }, -} - -local actions_isles_chests = Action() - -function actions_isles_chests.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local chest = chests[item.uid] - if not chests[item.uid] then - return true - end - - local article = "a" - - if player:getStorageValue(chest.storage) ~= 1 then - player:addItem(chest.reward, chest.amount) - player:setStorageValue(chest.storage, 1) - if chest.amount > 1 then - article = "" .. chest.amount - end - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("You have found %s %s.", article, ItemType(chest.reward):getName():lower())) - else - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is empty.") - end - - return true -end - -for uid in pairs(chests) do - actions_isles_chests:uid(uid) -end - -actions_isles_chests:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/high_and_dry_isles/movements_boat_puzzle.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/high_and_dry_isles/movements_boat_puzzle.lua index c3ab2a814d8..1e5ac1e9466 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/high_and_dry_isles/movements_boat_puzzle.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/high_and_dry_isles/movements_boat_puzzle.lua @@ -19,8 +19,8 @@ function movements_isle_color_puzzle.onStepIn(creature, item, position, fromPosi if boatStage <= 1 then if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Hawser) == 1 then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You use the hawser to lash up the loose planks. The raft should be seaworthy now.") - if player:getItemCount(33209) >= 1 then - player:removeItem(33209, 1) + if player:getItemCount(28707) >= 1 then + player:removeItem(28707, 1) end player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.BoatStages, 2) else @@ -30,7 +30,7 @@ function movements_isle_color_puzzle.onStepIn(creature, item, position, fromPosi player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Witout any points of orientation you will never find your way back. Try to find a way to improve your navigation.") elseif boatStage == 3 then player:teleportTo(Position(32187, 32473, 7)) - if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline) ~= 3 then + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline) < 3 then player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, 3) end end diff --git a/data-otservbr-global/startup/tables/chest.lua b/data-otservbr-global/startup/tables/chest.lua index ef4f0cea1b0..46116c9505c 100644 --- a/data-otservbr-global/startup/tables/chest.lua +++ b/data-otservbr-global/startup/tables/chest.lua @@ -2740,6 +2740,41 @@ ChestUnique = { weight = 20.00, storage = Storage.Quest.U11_80.TheSecretLibrary.Asuras.BlackSkull, }, + [6326] = { + itemId = 28828, + itemPos = { x = 32013, y = 32447, z = 8 }, + reward = { { 28650, 1 } }, + weight = 2.00, + storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Parchment, + }, + [6327] = { + itemId = 2523, + itemPos = { x = 32096, y = 31757, z = 8 }, + reward = { { 675, 2 } }, + weight = 1.00, + storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Sapphire, + }, + [6328] = { + itemId = 4242, + itemPos = { x = 32460, y = 32934, z = 8 }, + reward = { { 3483, 1 } }, + weight = 9.00, + storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Fishing, + }, + [6329] = { + itemId = 6560, + itemPos = { x = 32460, y = 32940, z = 7 }, + reward = { { 3457, 1 } }, + weight = 35.00, + storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Shovel, + }, + [6330] = { + itemId = 5951, + itemPos = {x = 32025, y = 32469, z = 7}, + reward = { { 28707, 1 } }, + weight = 6.00, + storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Hawser, + }, -- Reward of others scrips files (varied rewards) -- The First dragon Quest -- Treasure chests (data\scripts\actions\quests\first_dragon\treasure_chests.lua) diff --git a/data-otservbr-global/startup/tables/item.lua b/data-otservbr-global/startup/tables/item.lua index fb4c20428d1..93cc770ea80 100644 --- a/data-otservbr-global/startup/tables/item.lua +++ b/data-otservbr-global/startup/tables/item.lua @@ -753,6 +753,38 @@ ItemAction = { { x = 32951, y = 32288, z = 10 }, }, }, + [4935] = { + itemId = false, + itemPos = { + { x = 33464, y = 32157, z = 7 }, + { x = 32019, y = 32470, z = 7 }, + { x = 32460, y = 32928, z = 7 }, + { x = 32119, y = 31734, z = 7 }, + }, + }, + [4936] = { + itemId = false, + itemPos = { + { x = 32026, y = 32468, z = 7 }, + { x = 32025, y = 32468, z = 7 }, + { x = 32024, y = 32468, z = 7 }, + { x = 32018, y = 32467, z = 7 }, + { x = 32017, y = 32467, z = 7 }, + { x = 32023, y = 32468, z = 7 }, + { x = 32022, y = 32468, z = 7 }, + { x = 32021, y = 32468, z = 7 }, + { x = 32019, y = 32468, z = 7 }, + { x = 32020, y = 32468, z = 7 }, + { x = 32018, y = 32468, z = 7 }, + }, + }, + [4937] = { + itemId = false, + itemPos = { + {x = 32034, y = 32456, z = 7}, + {x = 32034, y = 32457, z = 7} + }, + }, -- Cults of Tibia Quest [5522] = { itemId = 25687, From 152c02ef25f117d5e229a09d7eb51909e38cd339 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 22 Oct 2024 20:29:45 +0000 Subject: [PATCH 49/70] Lua code format - (Stylua) --- data-otservbr-global/npc/charles.lua | 28 ++++++++++--------- data-otservbr-global/startup/tables/chest.lua | 2 +- data-otservbr-global/startup/tables/item.lua | 4 +-- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/data-otservbr-global/npc/charles.lua b/data-otservbr-global/npc/charles.lua index a7cbb91fb08..3eb9fe2b82c 100644 --- a/data-otservbr-global/npc/charles.lua +++ b/data-otservbr-global/npc/charles.lua @@ -57,17 +57,17 @@ npcType.onCloseChannel = function(npc, creature) end local shortcuts = { - ["thais"] = {price = 100, position = Position(32310, 32210, 6)}, - ["edron"] = {price = 90, position = Position(33173, 31764, 6)}, - ["liberty bay"] = {price = 20, position = Position(32285, 32891, 6)}, - ["yalahar"] = {price = 200, position = Position(32816, 31272, 6)} + ["thais"] = { price = 100, position = Position(32310, 32210, 6) }, + ["edron"] = { price = 90, position = Position(33173, 31764, 6) }, + ["liberty bay"] = { price = 20, position = Position(32285, 32891, 6) }, + ["yalahar"] = { price = 200, position = Position(32816, 31272, 6) }, } local isles = { - [1] = {isMission = true, position = Position(32031, 32463, 7)}, - [2] = {isMission = false, position = Position(33454, 32160, 7)}, - [3] = {isMission = false, position = Position(32112, 31745, 7)}, - [4] = {isMission = false, position = Position(32457, 32937, 7)} + [1] = { isMission = true, position = Position(32031, 32463, 7) }, + [2] = { isMission = false, position = Position(33454, 32160, 7) }, + [3] = { isMission = false, position = Position(32112, 31745, 7) }, + [4] = { isMission = false, position = Position(32457, 32937, 7) }, } local function creatureSayCallback(npc, creature, type, message) @@ -111,15 +111,17 @@ local function creatureSayCallback(npc, creature, type, message) else local function addTravelKeyword(keyword, cost, destination, condition) if condition then - keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = "I'm sorry but I don't sail there."}, condition) + keywordHandler:addKeyword({ keyword }, StdModule.say, { npcHandler = npcHandler, text = "I'm sorry but I don't sail there." }, condition) end - local travelKeyword = keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = "Do you seek a passage to " .. keyword:titleCase() .. " for |TRAVELCOST|?", cost = cost, discount = "postman"}) - travelKeyword:addChildKeyword({"yes"}, StdModule.travel, {npcHandler = npcHandler, premium = false, cost = cost, discount = "postman", destination = destination}) - travelKeyword:addChildKeyword({"no"}, StdModule.say, {npcHandler = npcHandler, text = "We would like to serve you some time.", reset = true}) + local travelKeyword = keywordHandler:addKeyword({ keyword }, StdModule.say, { npcHandler = npcHandler, text = "Do you seek a passage to " .. keyword:titleCase() .. " for |TRAVELCOST|?", cost = cost, discount = "postman" }) + travelKeyword:addChildKeyword({ "yes" }, StdModule.travel, { npcHandler = npcHandler, premium = false, cost = cost, discount = "postman", destination = destination }) + travelKeyword:addChildKeyword({ "no" }, StdModule.say, { npcHandler = npcHandler, text = "We would like to serve you some time.", reset = true }) end addTravelKeyword("edron", 150, Position(33173, 31764, 6)) addTravelKeyword("venore", 160, Position(32954, 32022, 6)) - addTravelKeyword("yalahar", 260, Position(32816, 31272, 6), function(player) return player:getStorageValue(Storage.Quest.U8_4.InServiceOfYalahar.SearoutesAroundYalahar.PortHope) ~= 1 and player:getStorageValue(Storage.Quest.U8_4.InServiceOfYalahar.SearoutesAroundYalahar.TownsCounter) < 5 end) + addTravelKeyword("yalahar", 260, Position(32816, 31272, 6), function(player) + return player:getStorageValue(Storage.Quest.U8_4.InServiceOfYalahar.SearoutesAroundYalahar.PortHope) ~= 1 and player:getStorageValue(Storage.Quest.U8_4.InServiceOfYalahar.SearoutesAroundYalahar.TownsCounter) < 5 + end) addTravelKeyword("ankrahmun", 110, Position(33092, 32883, 6)) addTravelKeyword("darashia", 180, Position(33289, 32480, 6)) addTravelKeyword("thais", 160, Position(32310, 32210, 6)) diff --git a/data-otservbr-global/startup/tables/chest.lua b/data-otservbr-global/startup/tables/chest.lua index 46116c9505c..c1f15358825 100644 --- a/data-otservbr-global/startup/tables/chest.lua +++ b/data-otservbr-global/startup/tables/chest.lua @@ -2770,7 +2770,7 @@ ChestUnique = { }, [6330] = { itemId = 5951, - itemPos = {x = 32025, y = 32469, z = 7}, + itemPos = { x = 32025, y = 32469, z = 7 }, reward = { { 28707, 1 } }, weight = 6.00, storage = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Hawser, diff --git a/data-otservbr-global/startup/tables/item.lua b/data-otservbr-global/startup/tables/item.lua index 93cc770ea80..a91032df195 100644 --- a/data-otservbr-global/startup/tables/item.lua +++ b/data-otservbr-global/startup/tables/item.lua @@ -781,8 +781,8 @@ ItemAction = { [4937] = { itemId = false, itemPos = { - {x = 32034, y = 32456, z = 7}, - {x = 32034, y = 32457, z = 7} + { x = 32034, y = 32456, z = 7 }, + { x = 32034, y = 32457, z = 7 }, }, }, -- Cults of Tibia Quest From 1e174c07813a25e98517fab0a8fb3c8d0323eebe Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Tue, 22 Oct 2024 17:48:11 -0300 Subject: [PATCH 50/70] The Secret Library Quest - The Veiled Hoard of Zathroth --- data-otservbr-global/npc/dedoras.lua | 46 ++++++++++--------- .../scripts/lib/register_actions.lua | 11 ++++- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/data-otservbr-global/npc/dedoras.lua b/data-otservbr-global/npc/dedoras.lua index e1a73f6d5bd..76bb10712dd 100644 --- a/data-otservbr-global/npc/dedoras.lua +++ b/data-otservbr-global/npc/dedoras.lua @@ -51,12 +51,12 @@ npcType.onCloseChannel = function(npc, creature) end local quests = { - [1] = { stg = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, value = 3 }, - [2] = { stg = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 7 }, - [3] = { stg = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, value = 6 }, - [4] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, value = 2 }, - [5] = { stg = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 8 }, - [6] = { stg = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, value = 7 }, + [1] = { stg = Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Questline, value = 4 }, + [2] = { stg = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline, value = 8 }, + [3] = { stg = Storage.Quest.U11_80.TheSecretLibrary.Asuras.Questline, value = 7 }, + [4] = { stg = Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.Questline, value = 3 }, + [5] = { stg = Storage.Quest.U11_80.TheSecretLibrary.Darashia.Questline, value = 9 }, + [6] = { stg = Storage.Quest.U11_80.TheSecretLibrary.MoTA.Questline, value = 8 }, } local function startMission(pid, storage, value) @@ -174,22 +174,24 @@ local function creatureSayCallback(npc, creature, type, message) "Or shall me {check} how much information we acquired?", }, npc, creature) end - elseif npcHandler:getTopic(playerId) == 3 then - if MsgContains(message, "check") then - if isQuestDone(player:getId()) then - npcHandler:say({ - "As I told you: To enter the veiled library, travel to the white raven monastery on the Isle of Kings and enter its main altar room. ...", - "There, use an ordinary scythe on the right of the two monuments, while concentrating on this glyph here and chant the words: Chamek Athra Thull Zathroth ...", - "Hurry now my friend. Time is of essence!", - }, npc, creature) - player:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission, 1) - player:addAchievement("Battle Mage") - player:addOutfit(1069, 1) - player:addOutfit(1070, 1) - npcHandler:setTopic(playerId, 1) - else - npcHandler:say("You're still searching for informations.", npc, creature) - end + elseif MsgContains(message, "check") then + if isQuestDone(player:getId()) and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission) == 6 then + npcHandler:say({ + "Marvellous! With this information combined we have all that's needed! ...", + "So let me see. ...", + "Hmm, interesting. And we shouldn't forget about the chant! Yes, excellent! ...", + "So listen: To enter the veiled library, travel to the white raven monastery on the Isle of Kings and enter its main altar room. ...", + "There, use an ordinary scythe on the right of the two monuments, while concentrating on this glyph here and chant the words: Chamek Athra Thull Zathroth ...", + "Oh, and one other thing. For your efforts I want to reward you with one of my old outfits, back from my adventuring days. May it suit you well! ...", + "Hurry now my friend. Time is of essence!", + }, npc, creature) + player:addOutfit(1069, 0) + player:addOutfit(1070, 0) + player:addAchievement("Battle Mage") + startMission(player:getId(), Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission, 7) + npcHandler:setTopic(playerId, 0) + else + npcHandler:say("You're still searching for informations.", npc, creature) end end diff --git a/data-otservbr-global/scripts/lib/register_actions.lua b/data-otservbr-global/scripts/lib/register_actions.lua index 553695371cf..9e4a5b38af1 100644 --- a/data-otservbr-global/scripts/lib/register_actions.lua +++ b/data-otservbr-global/scripts/lib/register_actions.lua @@ -990,12 +990,19 @@ function onUseScythe(player, item, fromPosition, target, toPosition, isHotkey) target:decay() Game.createItem(30975, 1, toPosition) return true - -- The secret library + -- The Secret Library Quest elseif toPosition == Position(32177, 31925, 7) then - player:teleportTo({ x = 32515, y = 32535, z = 12 }) + if player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission) == 7 then + player:teleportTo({ x = 32515, y = 32535, z = 12 }) + player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + else + Position(32177, 31925, 7):sendMagicEffect(CONST_ME_POFF) + end else return false end + + return onDestroyItem(player, item, fromPosition, target, toPosition, isHotkey) end From bb5ccba141670fca3c4e7e93425da23c50033133 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 22 Oct 2024 20:49:21 +0000 Subject: [PATCH 51/70] Lua code format - (Stylua) --- data-otservbr-global/scripts/lib/register_actions.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/data-otservbr-global/scripts/lib/register_actions.lua b/data-otservbr-global/scripts/lib/register_actions.lua index 9e4a5b38af1..a65de89e017 100644 --- a/data-otservbr-global/scripts/lib/register_actions.lua +++ b/data-otservbr-global/scripts/lib/register_actions.lua @@ -1002,7 +1002,6 @@ function onUseScythe(player, item, fromPosition, target, toPosition, isHotkey) return false end - return onDestroyItem(player, item, fromPosition, target, toPosition, isHotkey) end From a9c2c82d1a9a876d93c8d18940a276ca7518ffa8 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Tue, 22 Oct 2024 20:03:25 -0300 Subject: [PATCH 52/70] =?UTF-8?q?The=20Secret=20Library=20Quest=20-=20The?= =?UTF-8?q?=20Secret=20Library:=20Bosses=20-=201=C2=BA=20Part?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data-otservbr-global/lib/core/storages.lua | 6 ++--- .../library_area/actions_bossesLever.lua | 10 +++---- .../library_area/movements_timers.lua | 14 ++++++---- .../movements_crackles.lua | 16 ----------- data-otservbr-global/startup/tables/item.lua | 27 +++++++++++++++++++ 5 files changed, 44 insertions(+), 29 deletions(-) delete mode 100644 data-otservbr-global/scripts/quests/the_secret_library_quest/movements_crackles.lua diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index decd9de6b74..4adea30a924 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -2698,9 +2698,9 @@ Storage = { Library = { Questline = 46080, MazzinorTimer = 46081, - LokathmorTime = 46082, - GhuloshTime = 46083, - GorzindelTime = 46084, + LokathmorTimer = 46082, + GhuloshTimer = 46083, + GorzindelTimer = 46084, Ghulosh = 46085, }, }, diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/actions_bossesLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/actions_bossesLever.lua index fb52d5d03dc..6f579ea8e07 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/actions_bossesLever.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/actions_bossesLever.lua @@ -105,10 +105,10 @@ local function spawnSummons(k, monsterName, eventName, timing, positionTable, mi end local leverInfo = { - [1] = { bossName = "Mazzinor", storage = Storage.Quest.U11_80.TheSecretLibrary.Library.MazzinorTime, exit = Position(32616, 32532, 13), position = Position(32720, 32773, 10), type = "x", bossPosition = Position(32724, 32720, 10), teleportTo = Position(32724, 32726, 10), fromPosition = Position(32715, 32712, 10), toPosition = Position(32733, 32729, 10) }, - [2] = { bossName = "Lokathmor", storage = Storage.Quest.U11_80.TheSecretLibrary.Library.LokathmorTime, exit = Position(32467, 32654, 12), position = Position(32720, 32749, 10), type = "x", bossPosition = Position(32751, 32689, 10), teleportTo = Position(32750, 32694, 10), fromPosition = Position(32741, 32680, 10), toPosition = Position(32759, 32697, 10) }, - [3] = { bossName = "Ghulosh", storage = Storage.Quest.U11_80.TheSecretLibrary.Library.GhuloshTime, exit = Position(32659, 32713, 13), position = Position(32746, 32773, 10), type = "x", bossPosition = Position(32756, 32721, 10), teleportTo = Position(32755, 32727, 10), fromPosition = Position(32745, 32711, 10), toPosition = Position(32768, 32730, 10) }, - [4] = { bossName = "Gorzindel", storage = Storage.Quest.U11_80.TheSecretLibrary.Library.GorzindelTime, exit = Position(32660, 32734, 12), position = Position(32746, 32749, 10), type = "x", bossPosition = Position(32685, 32717, 10), teleportTo = Position(32687, 32724, 10), fromPosition = Position(32671, 32703, 10), toPosition = Position(32702, 32734, 10) }, + [1] = { bossName = "Mazzinor", storage = Storage.Quest.U11_80.TheSecretLibrary.Library.MazzinorTimer, exit = Position(32616, 32532, 13), position = Position(32720, 32773, 10), type = "x", bossPosition = Position(32724, 32720, 10), teleportTo = Position(32724, 32726, 10), fromPosition = Position(32715, 32712, 10), toPosition = Position(32733, 32729, 10) }, + [2] = { bossName = "Lokathmor", storage = Storage.Quest.U11_80.TheSecretLibrary.Library.LokathmorTimer, exit = Position(32467, 32654, 12), position = Position(32720, 32749, 10), type = "x", bossPosition = Position(32751, 32689, 10), teleportTo = Position(32750, 32694, 10), fromPosition = Position(32741, 32680, 10), toPosition = Position(32759, 32697, 10) }, + [3] = { bossName = "Ghulosh", storage = Storage.Quest.U11_80.TheSecretLibrary.Library.GhuloshTimer, exit = Position(32659, 32713, 13), position = Position(32746, 32773, 10), type = "x", bossPosition = Position(32756, 32721, 10), teleportTo = Position(32755, 32727, 10), fromPosition = Position(32745, 32711, 10), toPosition = Position(32768, 32730, 10) }, + [4] = { bossName = "Gorzindel", storage = Storage.Quest.U11_80.TheSecretLibrary.Library.GorzindelTimer, exit = Position(32660, 32734, 12), position = Position(32746, 32749, 10), type = "x", bossPosition = Position(32685, 32717, 10), teleportTo = Position(32687, 32724, 10), fromPosition = Position(32671, 32703, 10), toPosition = Position(32702, 32734, 10) }, } local actions_library_bossesLever = Action() @@ -118,7 +118,7 @@ function actions_library_bossesLever.onUse(player, item, fromPosition, itemEx, t for _, lever in pairs(leverInfo) do if toPosition == lever.position then - if doCheckBossRoom(player:getId(), lever.bossName, lever.fromPosition, lever.toPosition) then + if player:doCheckBossRoom(lever.bossName, lever.fromPosition, lever.toPosition) then if lever.type == "x" then local startPos = lever.position.x + 1 for x = startPos, startPos + 4 do diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/movements_timers.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/movements_timers.lua index 70c40365f7d..8a6f6f9a134 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/movements_timers.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/library_area/movements_timers.lua @@ -1,8 +1,12 @@ local timers = { - [1] = { position = Position(32616, 32529, 13), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.MazzinorTime, toPosition = Position(32720, 32770, 10) }, - [2] = { position = Position(32464, 32654, 12), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.LokathmorTime, toPosition = Position(32720, 32746, 10) }, - [3] = { position = Position(32662, 32713, 13), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.GhuloshTime, toPosition = Position(32746, 32770, 10) }, - [4] = { position = Position(32660, 32736, 12), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.GorzindelTime, toPosition = Position(32746, 32746, 10) }, + [1] = { position = Position(32616, 32529, 13), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.MazzinorTimer, toPosition = Position(32720, 32770, 10) }, + [2] = { position = Position(32464, 32654, 12), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.LokathmorTimer, toPosition = Position(32720, 32746, 10) }, + [3] = { position = Position(32662, 32713, 13), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.GhuloshTimer, toPosition = Position(32746, 32770, 10) }, + [4] = { position = Position(32660, 32736, 12), timer = Storage.Quest.U11_80.TheSecretLibrary.Library.GorzindelTimer, toPosition = Position(32746, 32746, 10) }, + [5] = { position = Position(32750, 32696, 10), toPosition = Position(32466, 32652, 12) }, + [6] = { position = Position(32755, 32729, 10), toPosition = Position(32664, 32711, 13) }, + [7] = { position = Position(32687, 32726, 10), toPosition = Position(32662, 32734, 12) }, + [8] = { position = Position(32724, 32728, 10), toPosition = Position(32618, 32527, 13) }, } local movements_library_timers = MoveEvent() @@ -16,7 +20,7 @@ function movements_library_timers.onStepIn(creature, item, position, fromPositio for _, k in pairs(timers) do if position == k.position then - if player:getStorageValue(k.timer) <= os.time() then + if not k.timer or player:getStorageValue(k.timer) <= os.time() then player:teleportTo(k.toPosition) else player:teleportTo(fromPosition, true) diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_crackles.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_crackles.lua deleted file mode 100644 index cb83c1084eb..00000000000 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/movements_crackles.lua +++ /dev/null @@ -1,16 +0,0 @@ -local movements_crackles = MoveEvent() - -function movements_crackles.onStepIn(creature, item, position, fromPosition) - if not creature:isPlayer() then - return false - end - - local player = Player(creature:getId()) - - player:teleportTo(Position(player:getPosition().x, player:getPosition().y, player:getPosition().z + 1)) - - return true -end - -movements_crackles:aid(4910) -movements_crackles:register() diff --git a/data-otservbr-global/startup/tables/item.lua b/data-otservbr-global/startup/tables/item.lua index a91032df195..5868efcd31b 100644 --- a/data-otservbr-global/startup/tables/item.lua +++ b/data-otservbr-global/startup/tables/item.lua @@ -785,6 +785,33 @@ ItemAction = { { x = 32034, y = 32457, z = 7 }, }, }, + [4950] = { + itemId = false, + itemPos = { + { x = 32616, y = 32529, z = 13 }, + { x = 32464, y = 32654, z = 12 }, + { x = 32662, y = 32713, z = 13 }, + { x = 32660, y = 32736, z = 12 }, + { x = 32720, y = 32773, z = 10 }, + { x = 32720, y = 32749, z = 10 }, + { x = 32746, y = 32773, z = 10 }, + { x = 32746, y = 32749, z = 10 }, + { x = 32750, y = 32696, z = 10 }, + { x = 32755, y = 32729, z = 10 }, + { x = 32687, y = 32726, z = 10 }, + { x = 32724, y = 32728, z = 10 }, + }, + }, + [4952] = { + itemId = false, + itemPos = { + { x = 32687, y = 32707, z = 10 }, + { x = 32698, y = 32715, z = 10 }, + { x = 32693, y = 32729, z = 10 }, + { x = 32681, y = 32729, z = 10 }, + { x = 32676, y = 32715, z = 10 }, + }, + }, -- Cults of Tibia Quest [5522] = { itemId = 25687, From 9af8d535246053b774d7d899620da11be4c2266f Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Tue, 22 Oct 2024 20:35:38 -0300 Subject: [PATCH 53/70] The Secret Library Quest - Addons and more --- data-otservbr-global/lib/core/storages.lua | 160 +++++++++--------- .../monster/bosses/the_flaming_orchid.lua | 8 +- data-otservbr-global/npc/dedoras.lua | 29 ++++ 3 files changed, 114 insertions(+), 83 deletions(-) diff --git a/data-otservbr-global/lib/core/storages.lua b/data-otservbr-global/lib/core/storages.lua index 4adea30a924..4529c64f583 100644 --- a/data-otservbr-global/lib/core/storages.lua +++ b/data-otservbr-global/lib/core/storages.lua @@ -2610,16 +2610,16 @@ Storage = { Fragrance = 46016, }, FalconBastion = { - Questline = 46016, - KillingBosses = 46017, - OberonTimer = 46018, - OberonHeal = 46019, - LastBossMsgInterval = 46020, - OberonSay = 46021, + Questline = 46017, + KillingBosses = 46018, + OberonTimer = 46019, + OberonHeal = 46020, + LastBossMsgInterval = 46021, + OberonSay = 46022, ChestsTimer = { - Coast = 46022, - Island = 46023, - ThroneHall = 46024, + Coast = 46023, + Island = 46024, + ThroneHall = 46025, Shortcut = 46026, LowerBastion = 46027, UndergroundBastion = 46028, @@ -2627,85 +2627,87 @@ Storage = { }, }, Darashia = { - Questline = 46022, - PuzzleSqm = 46023, - FirstChest = 46024, - SecondChest = 46025, - ThirdChest = 46026, - FourthChest = 46027, - RedColor = 46028, - GreenColor = 46029, - BlueColor = 46030, - ColorPuzzle = 46031, - EatenFood = 46032, - FirstTotem = 46033, - SecondTotem = 46034, - ThirdTotem = 46035, - FourthTotem = 46036, - FifthChest = 46037, - ScorpionTimer = 46038, + Questline = 46030, + PuzzleSqm = 46031, + FirstChest = 46032, + SecondChest = 46033, + ThirdChest = 46034, + FourthChest = 46035, + RedColor = 46036, + GreenColor = 46037, + BlueColor = 46038, + ColorPuzzle = 46039, + EatenFood = 46040, + FirstTotem = 46041, + SecondTotem = 46042, + ThirdTotem = 46043, + FourthTotem = 46044, + FifthChest = 46045, + ScorpionTimer = 46046, }, LiquidDeath = { - Questline = 46039, - Statue1 = 46040, - Statue2 = 46041, - Statue3 = 46042, - Statue4 = 46043, - Statue5 = 46044, - Statue6 = 46045, - Statue7 = 46046, - Statue8 = 46047, - Statue9 = 46048, - StatueCount = 46049, - BrokulTimer = 46050, - BrokulTimerGlobal = 46051, + Questline = 46047, + Statue1 = 46048, + Statue2 = 46049, + Statue3 = 46050, + Statue4 = 46051, + Statue5 = 46052, + Statue6 = 46053, + Statue7 = 46054, + Statue8 = 46055, + Statue9 = 46056, + StatueCount = 46057, + BrokulTimer = 46058, + BrokulTimerGlobal = 46059, }, MoTA = { - Questline = 46052, - LeverPermission = 46053, - SampleBlood = 46054, - BonyRod = 46055, - BrokenCompass = 46056, - Crystal1 = 46057, - Crystal2 = 46058, - Crystal3 = 46059, - Crystal4 = 46060, - Crystal5 = 46061, - Crystal6 = 46062, - Crystal7 = 46063, - Crystal8 = 46064, - YellowGem = 46065, - GreenGem = 46066, - RedGem = 46067, - FinalBasin = 46068, - SkullSample = 46069, - TakenRod = 46070, - TrialTimer = 46071, - MuseumTimer = 46071, + Questline = 46060, + LeverPermission = 46061, + SampleBlood = 46062, + BonyRod = 46063, + BrokenCompass = 46064, + Crystal1 = 46065, + Crystal2 = 46066, + Crystal3 = 46067, + Crystal4 = 46068, + Crystal5 = 46069, + Crystal6 = 46070, + Crystal7 = 46071, + Crystal8 = 46072, + YellowGem = 46073, + GreenGem = 46074, + RedGem = 46075, + FinalBasin = 46076, + SkullSample = 46077, + TakenRod = 46078, + TrialTimer = 46079, + MuseumTimer = 46080, }, SmallIslands = { - Questline = 46070, - Parchment = 46071, - Sapphire = 46072, - Shovel = 46073, - Fishing = 46074, - RaxiasTimer = 46075, - BoatStages = 46076, - Hawser = 46077, - Turtle = 46078, - }, - LibraryPermission = 46079, + Questline = 46081, + Parchment = 46082, + Sapphire = 46083, + Shovel = 46084, + Fishing = 46085, + RaxiasTimer = 46086, + BoatStages = 46087, + Hawser = 46088, + Turtle = 46089, + }, + LibraryPermission = 46090, Library = { - Questline = 46080, - MazzinorTimer = 46081, - LokathmorTimer = 46082, - GhuloshTimer = 46083, - GorzindelTimer = 46084, - Ghulosh = 46085, + Questline = 46091, + MazzinorTimer = 46092, + LokathmorTimer = 46093, + GhuloshTimer = 46094, + GorzindelTimer = 46095, + Ghulosh = 46096, }, }, - - BattleMageOutfits = {}, + BattleMageOutfits = { + Addon1 = 46097, + Addon2 = 46098, + }, DiscovererOutfits = {}, MeasuringTibia = {}, }, diff --git a/data-otservbr-global/monster/bosses/the_flaming_orchid.lua b/data-otservbr-global/monster/bosses/the_flaming_orchid.lua index 3fd64d630ab..4ab6508475e 100644 --- a/data-otservbr-global/monster/bosses/the_flaming_orchid.lua +++ b/data-otservbr-global/monster/bosses/the_flaming_orchid.lua @@ -68,7 +68,7 @@ monster.voices = { monster.loot = { { name = "gold coin", chance = 100000, maxCount = 250 }, { name = "platinum coin", chance = 9240, maxCount = 10 }, - { name = "red gem", chance = 18200 }, + { id = 3039, chance = 18200 }, -- red gem { name = "gold ingot", chance = 29700, maxCount = 5 }, { name = "assassin star", chance = 29700, maxCount = 13 }, { name = "demonic essence", chance = 330 }, @@ -88,17 +88,17 @@ monster.loot = { monster.attacks = { { name = "melee", interval = 2000, chance = 100, minDamage = 0, maxDamage = -25 }, - { name = "death", interval = 2000, chance = 100, minDamage = 0, maxDamage = -300, shootEffect = CONST_ANI_DEATH }, + { name = "combat", interval = 1000, chance = 10, type = COMBAT_DEATHDAMAGE, minDamage = -400, maxDamage = -700, range = 7, effect = CONST_ANI_DEATH, target = true }, { name = "Ignite", interval = 2000, chance = 20, range = 7, radius = 1, target = true, shootEffect = CONST_ANI_FIRE }, { name = "big death wave", interval = 4000, chance = 18, minDamage = 0, maxDamage = -500 }, -- review later { name = "aggressivelavawave", interval = 5000, chance = 19, minDamage = 0, maxDamage = -200 }, -- review later - { name = "fire", interval = 6000, chance = 20, range = 5, radius = 7, target = true, minDamage = -100, maxDamage = -250, areaEffect = CONST_ME_FIREAREA }, + { name = "combat", interval = 6000, chance = 20, type = COMBAT_FIREDAMAGE, range = 5, radius = 7, target = true, minDamage = -100, maxDamage = -250, shootEffect = CONST_ANI_FIRE, effect = CONST_ME_FIREAREA, target = false }, } monster.defenses = { defense = 55, armor = 55, - { name = "healing", interval = 2000, chance = 15, minDamage = 50, maxDamage = 280, areaEffect = CONST_ME_MAGIC_BLUE }, + { name = "combat", interval = 2000, chance = 15, type = COMBAT_HEALING, minDamage = 50, maxDamage = 280, effect = CONST_ME_MAGIC_BLUE, target = false }, { name = "speed", interval = 2000, chance = 15, speedChange = 320, duration = 5000, areaEffect = CONST_ME_MAGIC_RED }, { name = "invisible", interval = 1000, chance = 100, duration = 10000, areaEffect = CONST_ME_MAGIC_BLUE }, } diff --git a/data-otservbr-global/npc/dedoras.lua b/data-otservbr-global/npc/dedoras.lua index 76bb10712dd..1e77480a4b9 100644 --- a/data-otservbr-global/npc/dedoras.lua +++ b/data-otservbr-global/npc/dedoras.lua @@ -195,6 +195,35 @@ local function creatureSayCallback(npc, creature, type, message) end end + if MsgContains(message, "addon") and player:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LibraryPermission) == 7 then + npcHandler:say("Are you interested in one or two addons to your battle mage outfit?", npc, creature) + npcHandler:setTopic(playerId, 1) + elseif MsgContains(message, "book") and npcHandler:getTopic(playerId) == 3 then + if player:getStorageValue(Storage.Quest.U11_80.BattleMageOutfits.Addon1) < 1 and player:getItemCount(28792) > 5 then + player:removeItem(28792, 5) + player:addOutfit(1069, 1) + player:addOutfit(1070, 1) + npcHandler:say("Very good! You gained the first addon to the battle mage outfit.", npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.BattleMageOutfits.Addon1, 1) + npcHandler:setTopic(playerId, 0) + elseif player:getStorageValue(Storage.Quest.U11_80.BattleMageOutfits.Addon2) < 1 and player:getItemCount(28793) > 20 then + player:removeItem(28793, 20) + player:addOutfit(1069, 2) + player:addOutfit(1070, 2) + npcHandler:say("Very good! You gained the second addon to the battle mage outfit.", npc, creature) + startMission(player:getId(), Storage.Quest.U11_80.BattleMageOutfits.Addon2, 1) + npcHandler:setTopic(playerId, 0) + end + elseif MsgContains(message, "yes") then + if npcHandler:getTopic(playerId) == 1 then + npcHandler:say("I provide two addons. For the first one I need you to bring me five sturdy books. For the second addon you need twenty epaulettes. Do you want one of these addons?", npc, creature) + npcHandler:setTopic(playerId, 2) + elseif npcHandler:getTopic(playerId) == 2 then + npcHandler:say("What do you have for me: the sturdy books or the epaulettes?", npc, creature) + npcHandler:setTopic(playerId, 3) + end + end + return true end From 8d842ddf52a95d154181204518845738dcc483b0 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Wed, 23 Oct 2024 06:17:58 -0300 Subject: [PATCH 54/70] Update door_quest.lua --- .../startup/tables/door_quest.lua | 44 ------------------- 1 file changed, 44 deletions(-) diff --git a/data-otservbr-global/startup/tables/door_quest.lua b/data-otservbr-global/startup/tables/door_quest.lua index 61395a4726d..374f3c9a61f 100644 --- a/data-otservbr-global/startup/tables/door_quest.lua +++ b/data-otservbr-global/startup/tables/door_quest.lua @@ -70,26 +70,6 @@ QuestDoorAction = { { x = 33569, y = 31951, z = 14 }, }, }, - -- Secret library quest door - --[[[Storage.TheSecretLibrary.Mota] = { - itemId = false, - itemPos = { - { x = 33208, y = 32071, z = 8 }, - { x = 33246, y = 32122, z = 8 }, - }, - }, - [Storage.TheSecretLibrary.MotaDoor] = { - itemId = false, - itemPos = { { x = 33208, y = 32074, z = 8 } }, - }, - [Storage.TheSecretLibrary.BasinDoor] = { - itemId = false, - itemPos = { { x = 33341, y = 32117, z = 10 } }, - }, - [Storage.TheSecretLibrary.SkullDoor] = { - itemId = false, - itemPos = { { x = 33344, y = 32120, z = 10 } }, - }, ]] -- Koshei the deathless quest door [Storage.Quest.U8_1.KosheiTheDeathless.RewardDoor] = { itemId = false, @@ -796,30 +776,6 @@ QuestDoorAction = { { x = 32012, y = 31565, z = 7 }, }, }, - -- Secret library quest door - --[[ [Storage.Quest.U11_80.TheSecretLibrary.MiniBosses.PreceptorLazare] = { - itemId = 6260, - itemPos = { { x = 33376, y = 31335, z = 3 } }, - }, - [Storage.Quest.U11_80.TheSecretLibrary.LowerBastionAccess] = { - itemId = 6260, - itemPos = { - { x = 33371, y = 31349, z = 4 }, - { x = 33375, y = 31346, z = 5 }, - }, - }, - [Storage.Quest.U11_80.TheSecretLibrary.UndergroundBastionAccess] = { - itemId = false, - itemPos = { - { x = 33366, y = 31343, z = 7 }, - { x = 33363, y = 31346, z = 7 }, - { x = 32191, y = 31823, z = 8 }, - }, - }, - [Storage.Quest.U11_80.TheSecretLibrary.ScourgeOfOblivionDoor] = { - itemId = false, - itemPos = { { x = 32480, y = 32591, z = 15 } }, - }, ]] [Storage.Quest.U12_20.GraveDanger.Bosses.KingZelosDoor] = { itemId = false, itemPos = { { x = 32173, y = 31922, z = 8 } }, From 4b57c4e08928fc215517bca575209c34aec8dbda Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Wed, 23 Oct 2024 12:47:15 -0300 Subject: [PATCH 55/70] Ferumbras Ascension - Levers --- .../actions_ferumbras_lever.lua | 164 ++++++++---------- .../ferumbras_ascension/actions_mazoran.lua | 135 ++++---------- .../ferumbras_ascension/actions_plagirath.lua | 130 ++++---------- .../ferumbras_ascension/actions_rat_lever.lua | 119 ++++--------- .../ferumbras_ascension/actions_shulgrax.lua | 135 ++++---------- .../ferumbras_ascension/actions_tarbaz.lua | 132 ++++---------- .../actions_the_shatterer_lever.lua | 127 ++++---------- .../actions_the_shatterer_levers.lua | 41 +++-- .../ferumbras_ascension/actions_zamulosh.lua | 155 ++++------------- 9 files changed, 342 insertions(+), 796 deletions(-) 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 80c82795673..a32ae4340bf 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,113 +1,91 @@ +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} +} + local config = { - boss = { - name = "Ferumbras Mortal Shell", - position = Position(33392, 31473, 14), - }, + centerRoom = Position(33392, 31473, 14), + BossPosition = 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), + Position(33269, 31477, 14), + Position(33269, 31478, 14), + Position(33269, 31479, 14), + Position(33269, 31480, 14), + Position(33269, 31481, 14), + Position(33270, 31477, 14), + Position(33270, 31478, 14), + Position(33270, 31479, 14), + Position(33270, 31480, 14), + Position(33270, 31481, 14), + Position(33271, 31477, 14), + Position(33271, 31478, 14), + Position(33271, 31479, 14), + Position(33271, 31480, 14), + Position(33271, 31481, 14) }, - exit = Position(33319, 32318, 13), - centerRoom = Position(33392, 31473, 14), - summonName = "Rift Fragment", - maxSummon = 3, + newPosition = Position(33392, 31479, 14) } local leverFerumbras = Action() function leverFerumbras.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local cooldownTime = player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasMortalShellTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage("You must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - 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 - - 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 .. ".") + local playersTable = {} + if item.itemid == 8911 then + if player:getPosition() ~= Position(33270, 31477, 14) then + item:transform(8912) 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 - - Game.createMonster(config.boss.name, config.boss.position, true, true) - for b = 1, config.maxSummon do - local xrand = math.random(-5, 5) - local yrand = math.random(-5, 5) - local position = Position(config.boss.position.x + xrand, config.boss.position.y + yrand, config.boss.position.z) - Game.createMonster(config.summonName, position) end - if item.itemid == 8911 then - 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 -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 + if doCheckBossRoom(player:getId(), "Ascending Ferumbras", Position(33379, 31460, 14), Position(33405, 31485, 14)) then + Game.createMonster("Ascending Ferumbras", config.BossPosition, true, true) + for b = 1,10 do + local xrand = math.random(-10, 10) + local yrand = math.random(-10, 10) + local position = Position(33392 + xrand, 31473 + yrand, 14) + if Game.createMonster("rift invader", position) then + end + end + for x = 33269, 33271 do + for y = 31477, 31481 do + local playerTile = Tile(Position(x, y, 14)):getTopCreature() + if playerTile and playerTile:isPlayer() then + playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) + playerTile:teleportTo(config.newPosition) + playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + playerTile:setStorageValue(Storage.FerumbrasAscension.FerumbrasTimer, os.time() + 60 * 60 * 20 * 24) + table.insert(playersTable, playerTile:getId()) end end end + Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Crystals.AllCrystals, 0) + Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasEssence, 0) + for _, crystal in pairs(crystals) do + local pos = crystal.crystalPosition + local stg = crystal.globalStorage + local sqm = Tile(pos) + if sqm then + local item = sqm:getItemById(17586) + if item then + item:transform(17580) + end + end + Game.setStorageValue(stg, 0) + end + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(33379, 31460, 14), Position(33405, 31485, 14), Position(33319, 32318, 13)) + item:transform(8912) end + elseif item.itemid == 8912 then + item:transform(8911) end - return monstersRemoved + return true end leverFerumbras:uid(1021) -leverFerumbras:register() +leverFerumbras:register() \ No newline at end of file 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 7edf91121fd..fca741dfd17 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua @@ -1,119 +1,58 @@ local config = { - boss = { - name = "Mazoran", - position = Position(33584, 32689, 14), - }, - timeToDefeat = 17 * 60, -- 17 minutes in seconds + centerRoom = Position(33584, 32689, 14), + BossPosition = Position(33584, 32689, 14), 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), + Position(33593, 32644, 14), + Position(33593, 32645, 14), + Position(33593, 32646, 14), + Position(33593, 32647, 14), + Position(33593, 32648, 14) }, - exit = Position(33319, 32318, 13), + newPosition = Position(33585, 32693, 14) } local leverMazoran = Action() function leverMazoran.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.MazoranTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + if item.itemid == 8911 then + if player:getPosition() ~= Position(33593, 32644, 14) then + item:transform(8912) 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 - - 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) - - addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) - if item.itemid == 8911 then - item:transform(8912) - else + local playersTable = {} + if doCheckBossRoom(player:getId(), "Mazoran", Position(33572, 32679, 14), Position(33599, 32701, 14)) then + local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15) + for i = 1, #specs do + spec = specs[i] + if spec:isPlayer() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting with Mazoran.") + return true + end + end + Game.createMonster("Mazoran", config.BossPosition, true, true) + for y = 32644, 32648 do + local playerTile = Tile(Position(33593, y, 14)):getTopCreature() + if playerTile and playerTile:isPlayer() then + playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) + playerTile:teleportTo(config.newPosition) + playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + playerTile:setStorageValue(Storage.FerumbrasAscension.MazoranTimer, os.time() + os.time() + 60 * 60 * 2 * 24) + table.insert(playersTable, playerTile:getId()) + end + end + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(33572, 32679, 14), Position(33599, 32701, 14), Position(33319, 32318, 13)) + item:transform(8912) + end + elseif item.itemid == 8912 then 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 -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 -end leverMazoran:uid(1025) -leverMazoran:register() +leverMazoran:register() \ No newline at end of file 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 a3ed6fd05d3..2cc68052073 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua @@ -1,119 +1,57 @@ local config = { - boss = { - name = "Plagirath", - position = Position(33172, 31501, 13), - }, - timeToDefeat = 17 * 60, -- 17 minutes in seconds + centerRoom = Position(33172, 31501, 13), + BossPosition = Position(33172, 31501, 13), 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), + Position(33229, 31500, 13), + Position(33229, 31501, 13), + Position(33229, 31502, 13), + Position(33229, 31503, 13), + Position(33229, 31504, 13) }, - exit = Position(33319, 32318, 13), + newPosition = Position(33173, 31504, 13) } local leverPlagirath = Action() function leverPlagirath.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 .. ".") + if item.itemid == 8911 then + if player:getPosition() ~= Position(33229, 31500, 13) then + item:transform(8912) return true end - - local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.PlagirathTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + end + if item.itemid == 8911 then + if Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.PlagirathTimer) >= 1 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to wait a while, recently someone challenge Plagirath.") return true end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true + local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15) + for i = 1, #specs do + spec = specs[i] + if spec:isPlayer() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting with Plagirath.") + return true + end end - - table.insert(players, creature) - end - - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) - return true + Game.createMonster("Plagirath", config.BossPosition, true, true) + for y = 31500, 31504 do + local playerTile = Tile(Position(33229, y, 13)):getTopCreature() + if playerTile and playerTile:isPlayer() then + playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) + playerTile:teleportTo(config.newPosition) + playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + playerTile:setStorageValue(Storage.FerumbrasAscension.PlagirathTimer, os.time() + 60 * 60 * 24 * 2) + end 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 - - 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) - - addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) - - if item.itemid == 8911 then + Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.PlagirathTimer, 1) + addEvent(clearForgotten, 30 * 60 * 1000, Position(33159, 31491, 13), Position(33185, 31513, 13), Position(33319, 32318, 13), Storage.Quest.U10_90.FerumbrasAscension.PlagirathTimer) item:transform(8912) - else + elseif item.itemid == 8912 then 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 -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 -end - leverPlagirath:uid(1022) leverPlagirath:register() 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 13ef7bb84e2..434ffdf1776 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,102 +1,57 @@ local config = { - boss = { - name = "The Lord of The Lice", - position = Position(33220, 31460, 12), - }, - timeToDefeat = 17 * 60, -- 17 minutes in seconds + centerRoom = Position(33215, 31456, 12), + BossPosition = Position(33220, 31460, 12), 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), + Position(33197, 31475, 11), + Position(33198, 31475, 11), + Position(33199, 31475, 11), + Position(33200, 31475, 11), + Position(33201, 31475, 11) }, - exit = Position(33319, 32318, 13), + newPosition = Position(33215, 31470, 12) } 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 - - 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 .. ".") + if item.itemid == 8911 then + if player:getPosition() ~= Position(33201, 31475, 11) then + item:transform(8912) 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 - Game.createMonster(config.boss.name, config.boss.position) - - 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 - - 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 -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 + local playersTable = {} + if doCheckBossRoom(player:getId(), "The Lord of the Lice", Position(33187, 31429, 12), Position(33242, 31487, 12)) then + local specs, spec = Game.getSpectators(config.centerRoom, false, false, 30, 30, 30, 30) + for i = 1, #specs do + spec = specs[i] + if spec:isPlayer() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting with The Lord of The Lice.") + return true + end + end + Game.createMonster("the lord of the lice", config.BossPosition, true, true) + for x = 33197, 33201 do + local playerTile = Tile(Position(x, 31475, 11)):getTopCreature() + if playerTile and playerTile:isPlayer() then + playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) + playerTile:teleportTo(config.newPosition) + playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + playerTile:setStorageValue(Storage.FerumbrasAscension.TheLordOfTheLiceTimer, os.time() + 60 * 60 * 2 * 24) + table.insert(playersTable, playerTile:getId()) end end + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(33187, 31429, 12), Position(33242, 31487, 12), Position(33319, 32318, 13)) + item:transform(8912) end + elseif item.itemid == 8912 then + item:transform(8911) end - return bossRemoved + + return true end ferumbrasAscendantRatLever:uid(1030) -ferumbrasAscendantRatLever:register() +ferumbrasAscendantRatLever:register() \ No newline at end of file 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 61f7bc205ec..1e029ab47f2 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua @@ -1,118 +1,55 @@ local config = { - boss = { - name = "Shulgrax", - position = Position(33485, 32786, 13), - }, - timeToDefeat = 17 * 60, -- 17 minutes in seconds + centerRoom = Position(33485, 32786, 13), + BossPosition = Position(33485, 32786, 13), 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), + Position(33434, 32785, 13), + Position(33434, 32786, 13), + Position(33434, 32787, 13), + Position(33434, 32788, 13), + Position(33434, 32789, 13) }, - exit = Position(33319, 32318, 13), + newPosition = Position(33485, 32790, 13) } local leverShulgrax = Action() function leverShulgrax.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ShulgraxTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + if item.itemid == 8911 then + if player:getPosition() ~= Position(33434, 32785, 13) then + item:transform(8912) 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 - - 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) - - 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 - - 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 -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 + local playersTable = {} + if doCheckBossRoom(player:getId(), "Shulgrax", Position(33473, 32776, 13), Position(33496, 32798, 13)) then + local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15) + for i = 1, #specs do + spec = specs[i] + if spec:isPlayer() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting with Shulgrax.") + return true end end + Game.createMonster("Shulgrax", config.BossPosition, true, true) + for y = 32785, 32789 do + local playerTile = Tile(Position(33434, y, 13)):getTopCreature() + if playerTile and playerTile:isPlayer() then + playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) + playerTile:teleportTo(config.newPosition) + playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + playerTile:setStorageValue(Storage.FerumbrasAscension.ShulgraxTimer, os.time() + 60 * 60 * 2 * 24) + table.insert(playersTable, playerTile:getId()) + end + end + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(33473, 32776, 13), Position(33496, 32798, 13), Position(33319, 32318, 13)) + item:transform(8912) end + elseif item.itemid == 8912 then + item:transform(8911) end - return monstersRemoved + + return true 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 fbfc4574903..bee69146c4a 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua @@ -1,118 +1,48 @@ 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), + centerRoom = Position(33459, 32844, 11), + BossPosition = Position(33459, 32844, 11), + newPosition = Position(33459, 32848, 11) } local leverTarbaz = Action() function leverTarbaz.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TarbazTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + if item.itemid == 8911 then + if player:getPosition() ~= Position(33418, 32849, 11) then + item:transform(8912) 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 - - 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) - - 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 - - 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 -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 + local playersTable = {} + if doCheckBossRoom(player:getId(), "Tarbaz", Position(33446, 32833, 11), Position(33515, 32875, 12)) then + local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15) + for i = 1, #specs do + spec = specs[i] + if spec:isPlayer() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting with Tarbaz.") + return true end end + Game.createMonster("Tarbaz", config.BossPosition, true, true) + for y = 32849, 32853 do + local playerTile = Tile(Position(33418, y, 11)):getTopCreature() + if playerTile and playerTile:isPlayer() then + playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) + playerTile:teleportTo(config.newPosition) + playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + playerTile:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TarbazTimer, os.time() + 60 * 60 * 2 * 24) + table.insert(playersTable, playerTile:getId()) + end + end + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(33446, 32833, 11), Position(33515, 32875, 12), Position(33319, 32318, 13)) + item:transform(8912) end + elseif item.itemid == 8912 then + item:transform(8911) end - return monstersRemoved + + return true 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 221a4bdc850..bcacf042627 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,112 +1,57 @@ 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, + BossPosition = Position(33406, 32418, 14), + playerPositions = { + Position(33403, 32465, 13), + Position(33404, 32465, 13), + Position(33405, 32465, 13), + Position(33406, 32465, 13), + Position(33407, 32465, 13) }, + newPosition = Position(33398, 32414, 14) } local ferumbrasAscendantTheShattererLever = Action() function ferumbrasAscendantTheShattererLever.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local spectators = Game.getSpectators(config.centerRoom, false, false, 30, 30, 30, 30) - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting with The Shatterer.") + if item.itemid == 8912 then + if player:getPosition() ~= Position(33403, 32465, 13) then + item:transform(8911) 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 + if item.itemid == 8912 then + local playersTable = {} + if doCheckBossRoom(player:getId(), "The Shatterer", Position(33377, 32390, 14), Position(33446, 32447, 14)) then + local specs, spec = Game.getSpectators(config.centerRoom, false, false, 30, 30, 30, 30) + for i = 1, #specs do + spec = specs[i] + if spec:isPlayer() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting with The Shatterer.") + return true + end + end + Game.createMonster("The Shatterer", config.BossPosition, true, true) + for x = 33403, 33407 do + local playerTile = Tile(Position(x, 32465, 13)):getTopCreature() + if playerTile and playerTile:isPlayer() then + playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) + playerTile:teleportTo(config.newPosition) + playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + playerTile:setStorageValue(Storage.FerumbrasAscension.TheShattererTimer, os.time() + 60 * 60 * 2 * 24) + table.insert(playersTable, playerTile:getId()) + end + end + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(33377, 32390, 14), Position(33446, 32447, 14), Position(33319, 32318, 13)) + item:transform(8911) 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 - - Game.createMonster(config.boss.name, config.boss.position, true, true) - - for _, participant in pairs(players) do - participant:setStorageValue(config.storage.lever, 0) - participant:setStorageValue(config.storage.timer, 1) - end - - addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit, config.storage.timer) - - if item.itemid == 8911 then + elseif item.itemid == 8911 then 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 -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 -end ferumbrasAscendantTheShattererLever:uid(1029) ferumbrasAscendantTheShattererLever:register() diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_the_shatterer_levers.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_the_shatterer_levers.lua index b7e7916ebdf..b8fb7e2acbe 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_the_shatterer_levers.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_the_shatterer_levers.lua @@ -39,11 +39,13 @@ local chains = { } local ferumbrasAscendantTheShattererLevers = Action() + function ferumbrasAscendantTheShattererLevers.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShatterer) >= 1 then - player:sendCancelMessage("You cannot use this lever again.") + if player:getStorageValue(Storage.FerumbrasAscension.TheShatterer) >= 1 then + player:sendCancelMessage('You cannot use this lever again.') return true end + if item.itemid == 8911 then item:transform(8912) if item:getPosition() == Position(33385, 32410, 14) then @@ -52,13 +54,13 @@ function ferumbrasAscendantTheShattererLevers.onUse(player, item, fromPosition, local bla = Tile(chain.position):getItemById(chain.itemid) if bla then bla:remove() - Game.createMonster("Fury", { x = player:getPosition().x + math.random(-3, 3), y = player:getPosition().y + math.random(-3, 3), z = player:getPosition().z }) + Game.createMonster("Fury", { x=player:getPosition().x+math.random(-3, 3), y=player:getPosition().y+math.random(-3, 3), z=player:getPosition().z }) end end - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever, math.max(player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever), 0) + 1) - if player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) >= 4 then + Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever, Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) + 1) + if Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) >= 4 then local boss = Tile(Position(33406, 32418, 14)):getTopCreature() - if boss and boss:getName():lower() == "the shatterer" then + if boss:getName():lower() == 'the shatterer' then boss:teleportTo(Position(33400, 32415, 14)) boss:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true @@ -70,13 +72,13 @@ function ferumbrasAscendantTheShattererLevers.onUse(player, item, fromPosition, local bla = Tile(chain.position):getItemById(chain.itemid) if bla then bla:remove() - Game.createMonster("Destroyer", { x = player:getPosition().x + math.random(-3, 3), y = player:getPosition().y + math.random(-3, 3), z = player:getPosition().z }) + Game.createMonster("Destroyer", { x=player:getPosition().x+math.random(-3, 3), y=player:getPosition().y+math.random(-3, 3), z=player:getPosition().z }) end end - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever, math.max(player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever), 0) + 1) - if player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) >= 4 then + Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever, Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) + 1) + if Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) >= 4 then local boss = Tile(Position(33406, 32418, 14)):getTopCreature() - if boss and boss:getName():lower() == "the shatterer" then + if boss:getName():lower() == 'the shatterer' then boss:teleportTo(Position(33400, 32415, 14)) boss:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true @@ -90,10 +92,10 @@ function ferumbrasAscendantTheShattererLevers.onUse(player, item, fromPosition, bla:remove() end end - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever, math.max(player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever), 0) + 1) - if player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) >= 4 then + Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever, Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) + 1) + if Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) >= 4 then local boss = Tile(Position(33406, 32418, 14)):getTopCreature() - if boss and boss:getName():lower() == "the shatterer" then + if boss:getName():lower() == 'the shatterer' then boss:teleportTo(Position(33400, 32415, 14)) boss:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true @@ -107,23 +109,24 @@ function ferumbrasAscendantTheShattererLevers.onUse(player, item, fromPosition, bla:remove() end end - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever, math.max(player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever), 0) + 1) - if player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) >= 4 then + Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever, Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) + 1) + if Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) >= 4 then local boss = Tile(Position(33406, 32418, 14)):getTopCreature() - if boss and boss:getName():lower() == "the shatterer" then + if boss:getName():lower() == 'the shatterer' then boss:teleportTo(Position(33400, 32415, 14)) boss:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true end end end - player:say("CLICK", TALKTYPE_MONSTER_SAY, false, nil, toPosition) + player:say('CLICK', TALKTYPE_MONSTER_SAY, false, nil, toPosition) elseif item.itemid == 8912 then - player:sendCancelMessage("Sorry, not possible.") + player:sendCancelMessage('Sorry, not possible.') return true end + return true end ferumbrasAscendantTheShattererLevers:uid(1031, 1032, 1033, 1034) -ferumbrasAscendantTheShattererLevers:register() +ferumbrasAscendantTheShattererLevers:register() \ No newline at end of file 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 8ba9fe077b0..358f10d6532 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua @@ -1,137 +1,58 @@ 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 }, - { pos = Position(33680, 32742, 11), teleport = Position(33644, 32760, 11), effect = CONST_ME_TELEPORT }, - { pos = Position(33680, 32743, 11), teleport = Position(33644, 32760, 11), effect = CONST_ME_TELEPORT }, - { pos = Position(33680, 32744, 11), teleport = Position(33644, 32760, 11), effect = CONST_ME_TELEPORT }, - { pos = Position(33680, 32745, 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 = { + centerRoom = Position(33643, 32756, 11), + BossPosition = Position(33643, 32756, 11), + newPosition = Position(33644, 32760, 11), + zamuloshSummons = { Position(33642, 32756, 11), Position(33642, 32756, 11), Position(33642, 32756, 11), Position(33644, 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 players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) +function onUse(player, item, fromPosition, target, toPosition, isHotkey) + if item.itemid == 8911 then + if player:getPosition() ~= Position(33680, 32741, 11) then + item:transform(8912) 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 - - 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) - - 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 - - addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) - if item.itemid == 8911 then + local playersTable = {} + if doCheckBossRoom(player:getId(), "Zamulosh", Position(33634, 32749, 11), Position(33654, 32765, 11)) then + local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15) + for i = 1, #specs do + spec = specs[i] + if spec:isPlayer() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting with Zamulosh.") + return true + end + end + Game.createMonster("Zamulosh", config.BossPosition, true, true) + for d = 1, #config.zamuloshSummons do + Game.createMonster('Zamulosh3', config.zamuloshSummons[d], true, true) + end + for y = 32741, 32745 do + local playerTile = Tile(Position(33680, y, 11)):getTopCreature() + if playerTile and playerTile:isPlayer() then + playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) + playerTile:teleportTo(config.newPosition) + playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + playerTile:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ZamuloshTimer, os.time() + 60 * 60 * 2 * 24) + table.insert(playersTable, playerTile:getId()) + end + end + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(33634, 32749, 11), Position(33654, 32765, 11), Position(33319, 32318, 13)) item:transform(8912) - else + end + elseif item.itemid == 8912 then 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 -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 -end - leverZamulosh:uid(1026) -leverZamulosh:register() +leverZamulosh:register() \ No newline at end of file From e11647147c9e0936b1546b345c9466c536f2dcc6 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 23 Oct 2024 15:48:23 +0000 Subject: [PATCH 56/70] Lua code format - (Stylua) --- .../actions_ferumbras_lever.lua | 24 +++++++++---------- .../ferumbras_ascension/actions_mazoran.lua | 7 +++--- .../ferumbras_ascension/actions_plagirath.lua | 4 ++-- .../ferumbras_ascension/actions_rat_lever.lua | 6 ++--- .../ferumbras_ascension/actions_shulgrax.lua | 4 ++-- .../ferumbras_ascension/actions_tarbaz.lua | 2 +- .../actions_the_shatterer_lever.lua | 5 ++-- .../actions_the_shatterer_levers.lua | 20 ++++++++-------- .../ferumbras_ascension/actions_zamulosh.lua | 12 +++++----- 9 files changed, 41 insertions(+), 43 deletions(-) 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 a32ae4340bf..a1bf90a99df 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,12 +1,12 @@ 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 config = { @@ -27,9 +27,9 @@ local config = { Position(33271, 31478, 14), Position(33271, 31479, 14), Position(33271, 31480, 14), - Position(33271, 31481, 14) + Position(33271, 31481, 14), }, - newPosition = Position(33392, 31479, 14) + newPosition = Position(33392, 31479, 14), } local leverFerumbras = Action() @@ -45,7 +45,7 @@ function leverFerumbras.onUse(player, item, fromPosition, target, toPosition, is if item.itemid == 8911 then if doCheckBossRoom(player:getId(), "Ascending Ferumbras", Position(33379, 31460, 14), Position(33405, 31485, 14)) then Game.createMonster("Ascending Ferumbras", config.BossPosition, true, true) - for b = 1,10 do + for b = 1, 10 do local xrand = math.random(-10, 10) local yrand = math.random(-10, 10) local position = Position(33392 + xrand, 31473 + yrand, 14) @@ -88,4 +88,4 @@ function leverFerumbras.onUse(player, item, fromPosition, target, toPosition, is end leverFerumbras:uid(1021) -leverFerumbras:register() \ No newline at end of file +leverFerumbras:register() 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 fca741dfd17..8e3cfd24de2 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua @@ -6,9 +6,9 @@ local config = { Position(33593, 32645, 14), Position(33593, 32646, 14), Position(33593, 32647, 14), - Position(33593, 32648, 14) + Position(33593, 32648, 14), }, - newPosition = Position(33585, 32693, 14) + newPosition = Position(33585, 32693, 14), } local leverMazoran = Action() @@ -53,6 +53,5 @@ function leverMazoran.onUse(player, item, fromPosition, target, toPosition, isHo return true end - leverMazoran:uid(1025) -leverMazoran:register() \ No newline at end of file +leverMazoran:register() 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 2cc68052073..dc1cd545a4e 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua @@ -6,9 +6,9 @@ local config = { Position(33229, 31501, 13), Position(33229, 31502, 13), Position(33229, 31503, 13), - Position(33229, 31504, 13) + Position(33229, 31504, 13), }, - newPosition = Position(33173, 31504, 13) + newPosition = Position(33173, 31504, 13), } local leverPlagirath = Action() 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 434ffdf1776..16c9d51b7eb 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 @@ -6,9 +6,9 @@ local config = { Position(33198, 31475, 11), Position(33199, 31475, 11), Position(33200, 31475, 11), - Position(33201, 31475, 11) + Position(33201, 31475, 11), }, - newPosition = Position(33215, 31470, 12) + newPosition = Position(33215, 31470, 12), } local ferumbrasAscendantRatLever = Action() @@ -54,4 +54,4 @@ function ferumbrasAscendantRatLever.onUse(player, item, fromPosition, target, to end ferumbrasAscendantRatLever:uid(1030) -ferumbrasAscendantRatLever:register() \ No newline at end of file +ferumbrasAscendantRatLever: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 1e029ab47f2..af27acbf29f 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua @@ -6,9 +6,9 @@ local config = { Position(33434, 32786, 13), Position(33434, 32787, 13), Position(33434, 32788, 13), - Position(33434, 32789, 13) + Position(33434, 32789, 13), }, - newPosition = Position(33485, 32790, 13) + newPosition = Position(33485, 32790, 13), } local leverShulgrax = Action() 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 bee69146c4a..b9ce4798e00 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua @@ -1,7 +1,7 @@ local config = { centerRoom = Position(33459, 32844, 11), BossPosition = Position(33459, 32844, 11), - newPosition = Position(33459, 32848, 11) + newPosition = Position(33459, 32848, 11), } local leverTarbaz = Action() 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 bcacf042627..e5280f3ac48 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 @@ -6,9 +6,9 @@ local config = { Position(33404, 32465, 13), Position(33405, 32465, 13), Position(33406, 32465, 13), - Position(33407, 32465, 13) + Position(33407, 32465, 13), }, - newPosition = Position(33398, 32414, 14) + newPosition = Position(33398, 32414, 14), } local ferumbrasAscendantTheShattererLever = Action() @@ -52,6 +52,5 @@ function ferumbrasAscendantTheShattererLever.onUse(player, item, fromPosition, t return true end - ferumbrasAscendantTheShattererLever:uid(1029) ferumbrasAscendantTheShattererLever:register() diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_the_shatterer_levers.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_the_shatterer_levers.lua index b8fb7e2acbe..ee16550a4a5 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_the_shatterer_levers.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_the_shatterer_levers.lua @@ -42,7 +42,7 @@ local ferumbrasAscendantTheShattererLevers = Action() function ferumbrasAscendantTheShattererLevers.onUse(player, item, fromPosition, target, toPosition, isHotkey) if player:getStorageValue(Storage.FerumbrasAscension.TheShatterer) >= 1 then - player:sendCancelMessage('You cannot use this lever again.') + player:sendCancelMessage("You cannot use this lever again.") return true end @@ -54,13 +54,13 @@ function ferumbrasAscendantTheShattererLevers.onUse(player, item, fromPosition, local bla = Tile(chain.position):getItemById(chain.itemid) if bla then bla:remove() - Game.createMonster("Fury", { x=player:getPosition().x+math.random(-3, 3), y=player:getPosition().y+math.random(-3, 3), z=player:getPosition().z }) + Game.createMonster("Fury", { x = player:getPosition().x + math.random(-3, 3), y = player:getPosition().y + math.random(-3, 3), z = player:getPosition().z }) end end Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever, Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) + 1) if Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) >= 4 then local boss = Tile(Position(33406, 32418, 14)):getTopCreature() - if boss:getName():lower() == 'the shatterer' then + if boss:getName():lower() == "the shatterer" then boss:teleportTo(Position(33400, 32415, 14)) boss:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true @@ -72,13 +72,13 @@ function ferumbrasAscendantTheShattererLevers.onUse(player, item, fromPosition, local bla = Tile(chain.position):getItemById(chain.itemid) if bla then bla:remove() - Game.createMonster("Destroyer", { x=player:getPosition().x+math.random(-3, 3), y=player:getPosition().y+math.random(-3, 3), z=player:getPosition().z }) + Game.createMonster("Destroyer", { x = player:getPosition().x + math.random(-3, 3), y = player:getPosition().y + math.random(-3, 3), z = player:getPosition().z }) end end Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever, Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) + 1) if Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) >= 4 then local boss = Tile(Position(33406, 32418, 14)):getTopCreature() - if boss:getName():lower() == 'the shatterer' then + if boss:getName():lower() == "the shatterer" then boss:teleportTo(Position(33400, 32415, 14)) boss:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true @@ -95,7 +95,7 @@ function ferumbrasAscendantTheShattererLevers.onUse(player, item, fromPosition, Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever, Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) + 1) if Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) >= 4 then local boss = Tile(Position(33406, 32418, 14)):getTopCreature() - if boss:getName():lower() == 'the shatterer' then + if boss:getName():lower() == "the shatterer" then boss:teleportTo(Position(33400, 32415, 14)) boss:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true @@ -112,16 +112,16 @@ function ferumbrasAscendantTheShattererLevers.onUse(player, item, fromPosition, Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever, Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) + 1) if Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererLever) >= 4 then local boss = Tile(Position(33406, 32418, 14)):getTopCreature() - if boss:getName():lower() == 'the shatterer' then + if boss:getName():lower() == "the shatterer" then boss:teleportTo(Position(33400, 32415, 14)) boss:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true end end end - player:say('CLICK', TALKTYPE_MONSTER_SAY, false, nil, toPosition) + player:say("CLICK", TALKTYPE_MONSTER_SAY, false, nil, toPosition) elseif item.itemid == 8912 then - player:sendCancelMessage('Sorry, not possible.') + player:sendCancelMessage("Sorry, not possible.") return true end @@ -129,4 +129,4 @@ function ferumbrasAscendantTheShattererLevers.onUse(player, item, fromPosition, end ferumbrasAscendantTheShattererLevers:uid(1031, 1032, 1033, 1034) -ferumbrasAscendantTheShattererLevers:register() \ No newline at end of file +ferumbrasAscendantTheShattererLevers:register() 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 358f10d6532..03ac5b8308c 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua @@ -8,8 +8,8 @@ local config = { Position(33642, 32756, 11), Position(33644, 32756, 11), Position(33644, 32756, 11), - Position(33644, 32756, 11) - } + Position(33644, 32756, 11), + }, } function onUse(player, item, fromPosition, target, toPosition, isHotkey) @@ -32,7 +32,7 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey) end Game.createMonster("Zamulosh", config.BossPosition, true, true) for d = 1, #config.zamuloshSummons do - Game.createMonster('Zamulosh3', config.zamuloshSummons[d], true, true) + Game.createMonster("Zamulosh3", config.zamuloshSummons[d], true, true) end for y = 32741, 32745 do local playerTile = Tile(Position(33680, y, 11)):getTopCreature() @@ -44,8 +44,8 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey) table.insert(playersTable, playerTile:getId()) end end - addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(33634, 32749, 11), Position(33654, 32765, 11), Position(33319, 32318, 13)) - item:transform(8912) + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(33634, 32749, 11), Position(33654, 32765, 11), Position(33319, 32318, 13)) + item:transform(8912) end elseif item.itemid == 8912 then item:transform(8911) @@ -55,4 +55,4 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey) end leverZamulosh:uid(1026) -leverZamulosh:register() \ No newline at end of file +leverZamulosh:register() From 6955154219e729bc2dcf504c77a1ade5d94cd985 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Wed, 23 Oct 2024 12:50:37 -0300 Subject: [PATCH 57/70] Update actions_zamulosh.lua --- .../scripts/quests/ferumbras_ascension/actions_zamulosh.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 358f10d6532..9072e9cc4cc 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua @@ -12,7 +12,9 @@ local config = { } } -function onUse(player, item, fromPosition, target, toPosition, isHotkey) +local leverZamulosh = Action() + +function leverZamulosh.onUse(player, item, fromPosition, target, toPosition, isHotkey) if item.itemid == 8911 then if player:getPosition() ~= Position(33680, 32741, 11) then item:transform(8912) From 64ff86dc61326ed1670ea7b7285adac8caa673bf Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:02:59 -0300 Subject: [PATCH 58/70] Ferumbras Ascension - Levers - final --- .../quests/ferumbras_ascension/actions_ferumbras_lever.lua | 4 ++-- .../scripts/quests/ferumbras_ascension/actions_mazoran.lua | 4 ++-- .../scripts/quests/ferumbras_ascension/actions_plagirath.lua | 2 +- .../scripts/quests/ferumbras_ascension/actions_rat_lever.lua | 4 ++-- .../scripts/quests/ferumbras_ascension/actions_shulgrax.lua | 4 ++-- .../scripts/quests/ferumbras_ascension/actions_tarbaz.lua | 2 +- .../ferumbras_ascension/actions_the_shatterer_lever.lua | 4 ++-- .../ferumbras_ascension/actions_the_shatterer_levers.lua | 2 +- .../scripts/quests/ferumbras_ascension/actions_zamulosh.lua | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) 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 a1bf90a99df..9dabbb4f18c 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 @@ -43,7 +43,7 @@ function leverFerumbras.onUse(player, item, fromPosition, target, toPosition, is end end if item.itemid == 8911 then - if doCheckBossRoom(player:getId(), "Ascending Ferumbras", Position(33379, 31460, 14), Position(33405, 31485, 14)) then + if player:doCheckBossRoom("Ascending Ferumbras", Position(33379, 31460, 14), Position(33405, 31485, 14)) then Game.createMonster("Ascending Ferumbras", config.BossPosition, true, true) for b = 1, 10 do local xrand = math.random(-10, 10) @@ -59,7 +59,7 @@ function leverFerumbras.onUse(player, item, fromPosition, target, toPosition, is playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) playerTile:teleportTo(config.newPosition) playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - playerTile:setStorageValue(Storage.FerumbrasAscension.FerumbrasTimer, os.time() + 60 * 60 * 20 * 24) + playerTile:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasTimer, os.time() + 60 * 60 * 20 * 24) table.insert(playersTable, playerTile:getId()) end end 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 8e3cfd24de2..aa564b94fd6 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_mazoran.lua @@ -23,7 +23,7 @@ function leverMazoran.onUse(player, item, fromPosition, target, toPosition, isHo if item.itemid == 8911 then local playersTable = {} - if doCheckBossRoom(player:getId(), "Mazoran", Position(33572, 32679, 14), Position(33599, 32701, 14)) then + if player:doCheckBossRoom("Mazoran", Position(33572, 32679, 14), Position(33599, 32701, 14)) then local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15) for i = 1, #specs do spec = specs[i] @@ -39,7 +39,7 @@ function leverMazoran.onUse(player, item, fromPosition, target, toPosition, isHo playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) playerTile:teleportTo(config.newPosition) playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - playerTile:setStorageValue(Storage.FerumbrasAscension.MazoranTimer, os.time() + os.time() + 60 * 60 * 2 * 24) + playerTile:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.MazoranTimer, os.time() + os.time() + 60 * 60 * 2 * 24) table.insert(playersTable, playerTile:getId()) end end 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 dc1cd545a4e..82d5535f8e6 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_plagirath.lua @@ -40,7 +40,7 @@ function leverPlagirath.onUse(player, item, fromPosition, target, toPosition, is playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) playerTile:teleportTo(config.newPosition) playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - playerTile:setStorageValue(Storage.FerumbrasAscension.PlagirathTimer, os.time() + 60 * 60 * 24 * 2) + playerTile:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.PlagirathTimer, os.time() + 60 * 60 * 24 * 2) end end Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.PlagirathTimer, 1) 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 16c9d51b7eb..e9592b71585 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 @@ -23,7 +23,7 @@ function ferumbrasAscendantRatLever.onUse(player, item, fromPosition, target, to if item.itemid == 8911 then local playersTable = {} - if doCheckBossRoom(player:getId(), "The Lord of the Lice", Position(33187, 31429, 12), Position(33242, 31487, 12)) then + if player:doCheckBossRoom("The Lord of the Lice", Position(33187, 31429, 12), Position(33242, 31487, 12)) then local specs, spec = Game.getSpectators(config.centerRoom, false, false, 30, 30, 30, 30) for i = 1, #specs do spec = specs[i] @@ -39,7 +39,7 @@ function ferumbrasAscendantRatLever.onUse(player, item, fromPosition, target, to playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) playerTile:teleportTo(config.newPosition) playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - playerTile:setStorageValue(Storage.FerumbrasAscension.TheLordOfTheLiceTimer, os.time() + 60 * 60 * 2 * 24) + playerTile:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheLordOfTheLiceTimer, os.time() + 60 * 60 * 2 * 24) table.insert(playersTable, playerTile:getId()) end end 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 af27acbf29f..2b1792a9261 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_shulgrax.lua @@ -22,7 +22,7 @@ function leverShulgrax.onUse(player, item, fromPosition, target, toPosition, isH end if item.itemid == 8911 then local playersTable = {} - if doCheckBossRoom(player:getId(), "Shulgrax", Position(33473, 32776, 13), Position(33496, 32798, 13)) then + if player:doCheckBossRoom("Shulgrax", Position(33473, 32776, 13), Position(33496, 32798, 13)) then local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15) for i = 1, #specs do spec = specs[i] @@ -38,7 +38,7 @@ function leverShulgrax.onUse(player, item, fromPosition, target, toPosition, isH playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) playerTile:teleportTo(config.newPosition) playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - playerTile:setStorageValue(Storage.FerumbrasAscension.ShulgraxTimer, os.time() + 60 * 60 * 2 * 24) + playerTile:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.ShulgraxTimer, os.time() + 60 * 60 * 2 * 24) table.insert(playersTable, playerTile:getId()) end end 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 b9ce4798e00..7423b8f3820 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_tarbaz.lua @@ -15,7 +15,7 @@ function leverTarbaz.onUse(player, item, fromPosition, target, toPosition, isHot end if item.itemid == 8911 then local playersTable = {} - if doCheckBossRoom(player:getId(), "Tarbaz", Position(33446, 32833, 11), Position(33515, 32875, 12)) then + if player:doCheckBossRoom("Tarbaz", Position(33446, 32833, 11), Position(33515, 32875, 12)) then local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15) for i = 1, #specs do spec = specs[i] 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 e5280f3ac48..9e061a2f4a4 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 @@ -22,7 +22,7 @@ function ferumbrasAscendantTheShattererLever.onUse(player, item, fromPosition, t end if item.itemid == 8912 then local playersTable = {} - if doCheckBossRoom(player:getId(), "The Shatterer", Position(33377, 32390, 14), Position(33446, 32447, 14)) then + if player:doCheckBossRoom("The Shatterer", Position(33377, 32390, 14), Position(33446, 32447, 14)) then local specs, spec = Game.getSpectators(config.centerRoom, false, false, 30, 30, 30, 30) for i = 1, #specs do spec = specs[i] @@ -38,7 +38,7 @@ function ferumbrasAscendantTheShattererLever.onUse(player, item, fromPosition, t playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) playerTile:teleportTo(config.newPosition) playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - playerTile:setStorageValue(Storage.FerumbrasAscension.TheShattererTimer, os.time() + 60 * 60 * 2 * 24) + playerTile:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererTimer, os.time() + 60 * 60 * 2 * 24) table.insert(playersTable, playerTile:getId()) end end diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_the_shatterer_levers.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_the_shatterer_levers.lua index ee16550a4a5..3189947919b 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_the_shatterer_levers.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_the_shatterer_levers.lua @@ -41,7 +41,7 @@ local chains = { local ferumbrasAscendantTheShattererLevers = Action() function ferumbrasAscendantTheShattererLevers.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if player:getStorageValue(Storage.FerumbrasAscension.TheShatterer) >= 1 then + if player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShatterer) >= 1 then player:sendCancelMessage("You cannot use this lever again.") return true end 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 baad7958cfa..fc3e34a8219 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_zamulosh.lua @@ -23,7 +23,7 @@ function leverZamulosh.onUse(player, item, fromPosition, target, toPosition, isH end if item.itemid == 8911 then local playersTable = {} - if doCheckBossRoom(player:getId(), "Zamulosh", Position(33634, 32749, 11), Position(33654, 32765, 11)) then + if player:doCheckBossRoom("Zamulosh", Position(33634, 32749, 11), Position(33654, 32765, 11)) then local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15) for i = 1, #specs do spec = specs[i] From 2e48c05b5070225dfd2806a0e733cbd7bcad9327 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:08:54 -0300 Subject: [PATCH 59/70] Update actions_ragiaz.lua --- .../ferumbras_ascension/actions_ragiaz.lua | 152 +++++------------- 1 file changed, 40 insertions(+), 112 deletions(-) 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 e23cf2889f2..e120edcff52 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua @@ -1,130 +1,58 @@ local config = { - 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), + centerRoom = Position(33481, 32334, 13), + BossPosition = Position(33481, 32334, 13), + newPosition = Position(33482, 32339, 13), + deathDragons = { + Position(33476, 32331, 13), + Position(33476, 32340, 13), + Position(33487, 32340, 13), + Position(33488, 32331, 13) + } } local leverRagiaz = Action() function leverRagiaz.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.RagiazTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + if item.itemid == 8911 then + if player:getPosition() ~= Position(33456, 32356, 13) then + item:transform(8912) 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 - - 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) - - for i = 1, #config.monsters do - 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) - if item.itemid == 8911 then - 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 -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 + local playersTable = {} + if player:doCheckBossRoom("Ragiaz", Position(33472, 32323, 13), Position(33493, 32347, 13)) then + local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15) + for i = 1, #specs do + spec = specs[i] + if spec:isPlayer() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting with Ragiaz.") + return true end end + Game.createMonster("Ragiaz", config.BossPosition, true, true) + for d = 1, #config.deathDragons do + Game.createMonster('Death Dragon', config.deathDragons[d], true, true) + end + for x = 33456, 33460 do + local playerTile = Tile(Position(x, 32356, 13)):getTopCreature() + if playerTile and playerTile:isPlayer() then + playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) + playerTile:teleportTo(config.newPosition) + playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + playerTile:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.RagiazTimer, os.time() + 60 * 60 * 2 * 24) + table.insert(playersTable, playerTile:getId()) + end + end + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(33472, 32323, 13), Position(33493, 32347, 13), Position(33319, 32318, 13)) + item:transform(8912) end + elseif item.itemid == 8912 then + item:transform(8911) end - return monstersRemoved + + return true end leverRagiaz:uid(1023) From c432996c47efaf9fcf6593bf4bcfa0e5c952f516 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 23 Oct 2024 16:10:06 +0000 Subject: [PATCH 60/70] Lua code format - (Stylua) --- .../scripts/quests/ferumbras_ascension/actions_ragiaz.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 e120edcff52..e63df82d82d 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_ragiaz.lua @@ -6,8 +6,8 @@ local config = { Position(33476, 32331, 13), Position(33476, 32340, 13), Position(33487, 32340, 13), - Position(33488, 32331, 13) - } + Position(33488, 32331, 13), + }, } local leverRagiaz = Action() @@ -33,7 +33,7 @@ function leverRagiaz.onUse(player, item, fromPosition, target, toPosition, isHot end Game.createMonster("Ragiaz", config.BossPosition, true, true) for d = 1, #config.deathDragons do - Game.createMonster('Death Dragon', config.deathDragons[d], true, true) + Game.createMonster("Death Dragon", config.deathDragons[d], true, true) end for x = 33456, 33460 do local playerTile = Tile(Position(x, 32356, 13)):getTopCreature() From d7d1e7c99d6010a03696902756bc9cb05490c5e3 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:14:58 -0300 Subject: [PATCH 61/70] Update actions_razzagorn.lua --- .../ferumbras_ascension/actions_razzagorn.lua | 129 ++++-------------- 1 file changed, 30 insertions(+), 99 deletions(-) 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 6083111c026..d9bf8eb2ab0 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua @@ -1,119 +1,50 @@ local config = { - boss = { - name = "Razzagorn", - position = Position(33422, 32467, 14), - }, - 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 }, - { pos = Position(33389, 32455, 14), teleport = Position(33419, 32467, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(33390, 32455, 14), teleport = Position(33419, 32467, 14), effect = CONST_ME_TELEPORT }, - }, - specPos = { - from = Position(33407, 32453, 14), - to = Position(33439, 32481, 14), - }, - exit = Position(33319, 32318, 13), + centerRoom = Position(33422, 32467, 14), + BossPosition = Position(33422, 32467, 14), + newPosition = Position(33419, 32467, 14) } local leverRazzagorn = Action() function leverRazzagorn.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 .. ".") + if item.itemid == 8911 then + if player:getPosition() ~= Position(33386, 32455, 14) then + item:transform(8912) return true end - - local cooldownTime = creature:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.RazzagornTime) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + end + if item.itemid == 8911 then + if Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.RazzagornTimer) >= 1 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to wait a while, recently someone challenge Razzagorn.") return true end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true + local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15) + for i = 1, #specs do + spec = specs[i] + if spec:isPlayer() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting with Razzagorn.") + return true + end end - - table.insert(players, creature) - end - - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) - return true + Game.createMonster("Razzagorn", config.BossPosition, true, true) + for x = 33386, 33390 do + local playerTile = Tile(Position(x, 32455, 14)):getTopCreature() + if playerTile and playerTile:isPlayer() then + playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) + playerTile:teleportTo(config.newPosition) + playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + playerTile:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.RazzagornTimer, os.time() + 60 * 60 * 2 * 24) + end 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 - - 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) - - addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) - - if item.itemid == 8911 then + Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.RazzagornTimer, 1) + addEvent(clearForgotten, 30 * 60 * 1000, Position(33408, 32454, 14), Position(33440, 32480, 14), Position(33319, 32318, 13), Storage.Quest.U10_90.FerumbrasAscension.RazzagornTimer) item:transform(8912) - else + elseif item.itemid == 8912 then 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 -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 -end - leverRazzagorn:uid(1024) -leverRazzagorn:register() +leverRazzagorn:register() \ No newline at end of file From ccc3c49a8c089ffb0dcf561a007cc8e75183c24f Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 23 Oct 2024 16:16:10 +0000 Subject: [PATCH 62/70] Lua code format - (Stylua) --- .../scripts/quests/ferumbras_ascension/actions_razzagorn.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 d9bf8eb2ab0..fe5b4e06ed9 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/actions_razzagorn.lua @@ -1,7 +1,7 @@ local config = { centerRoom = Position(33422, 32467, 14), BossPosition = Position(33422, 32467, 14), - newPosition = Position(33419, 32467, 14) + newPosition = Position(33419, 32467, 14), } local leverRazzagorn = Action() @@ -47,4 +47,4 @@ function leverRazzagorn.onUse(player, item, fromPosition, target, toPosition, is end leverRazzagorn:uid(1024) -leverRazzagorn:register() \ No newline at end of file +leverRazzagorn:register() From 7621cacdbf6497d753a8ec76e7b6446df829df62 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:38:55 -0300 Subject: [PATCH 63/70] Forgotten Knowledge Quest - new levers --- .../actions_dragonking_zyrtarch.lua | 148 ++++----------- .../actions_frozen_horror.lua | 170 +++++------------- .../actions_lady_tenebris.lua | 137 +++----------- .../forgotten_knowledge/actions_lloyd.lua | 144 ++++----------- .../actions_the_last_lore_keeper.lua | 156 ++++------------ .../actions_the_thorn_knight.lua | 138 +++----------- .../actions_the_time_guardian.lua | 141 ++++----------- 7 files changed, 224 insertions(+), 810 deletions(-) diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_dragonking_zyrtarch.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_dragonking_zyrtarch.lua index 88bca44d699..f25571b13df 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_dragonking_zyrtarch.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_dragonking_zyrtarch.lua @@ -1,130 +1,52 @@ local config = { - boss = { - name = "soul of dragonking zyrtarch", - position = Position(33359, 31182, 12), - }, - requiredLevel = 250, - timeToDefeat = 15 * 60, - playerPositions = { - { pos = Position(33391, 31178, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, - { pos = Position(33391, 31179, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, - { pos = Position(33391, 31180, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, - { pos = Position(33391, 31181, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, - { pos = Position(33391, 31182, 10), teleport = Position(33359, 31186, 10), effect = CONST_ME_TELEPORT }, - }, - monsters = { - { name = "soulcatcher", pos = Position(33352, 31187, 10) }, - { name = "soulcatcher", pos = Position(33363, 31187, 10) }, - { name = "soulcatcher", pos = Position(33353, 31176, 10) }, - { name = "soulcatcher", pos = Position(33363, 31176, 10) }, - { name = "dragonking zyrtarch", pos = Position(33357, 31182, 10) }, - }, - specPos = { - from = Position(33348, 31172, 10), - to = Position(33368, 31190, 12), - }, - exit = Position(33407, 31172, 10), + bossPosition = Position(33357, 31182, 10), + newPosition = Position(33359, 31186, 10), + soulPosition = Position(33359, 31182, 12) +} + +local monsters = { + {position = Position(33352, 31187, 10)}, + {position = Position(33363, 31187, 10)}, + {position = Position(33353, 31176, 10)}, + {position = Position(33363, 31176, 10)} } local leverZyrtarch = Action() function leverZyrtarch.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.DragonkingKilled) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + if item.itemid == 8911 then + if player:getPosition() ~= Position(33391, 31178, 10) then + item:transform(8912) 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 - - 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) - for _, monster in pairs(config.monsters) do - Game.createMonster(monster.name, monster.pos) - end - - 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 - - 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 -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 + local playersTable = {} + if player:doCheckBossRoom("Dragonking Zyrtarch", Position(33348, 31172, 10), Position(33368, 31190, 12)) then + for d = 1, #monsters do + Game.createMonster('soulcatcher', monsters[d].position, true, true) + end + Game.createMonster("dragonking zyrtarch", config.bossPosition, true, true) + Game.createMonster("soul of dragonking zyrtarch", config.soulPosition, true, true) + for y = 31178, 31182 do + local playerTile = Tile(Position(33391, y, 10)):getTopCreature() + if playerTile and playerTile:isPlayer() then + playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) + playerTile:teleportTo(config.newPosition) + playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + playerTile:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.DragonkingTimer, os.time() + 20 * 60 * 60) + table.insert(playersTable, playerTile:getId()) end end + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(33348, 31172, 10), Position(33368, 31190, 12), Position(33407, 31172, 10)) + item:transform(8912) end + elseif item.itemid == 8912 then + item:transform(8911) end - return monstersRemoved + + return true end leverZyrtarch:position(Position(33391, 31177, 10)) -leverZyrtarch:register() +leverZyrtarch:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua index b6db83cb8bb..dacfd92f0f9 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua @@ -1,145 +1,59 @@ -local eggPos = Position(32269, 31084, 14) local config = { - boss = { - name = "Melting Frozen Horror", - createFunction = function() - Game.createMonster("dragon egg", eggPos, true, true) - - local eggCreature = Tile(eggPos):getTopCreature() - if eggCreature then - eggCreature:setHealth(1) - else - print("Error: No dragon egg found at eggPos.") - end - - return Game.createMonster("solid frozen horror", Position(32269, 31091, 14), true, true) - end, - }, - requiredLevel = 250, - timeToDefeat = 15 * 60, - playerPositions = { - { pos = Position(32302, 31088, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32302, 31089, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32302, 31090, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32302, 31091, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32302, 31092, 14), teleport = Position(32271, 31097, 14), effect = CONST_ME_TELEPORT }, - }, - monsters = { - { name = "icicle", pos = Position(32266, 31084, 14) }, - { name = "icicle", pos = Position(32272, 31084, 14) }, - { name = "melting frozen horror", pos = Position(32267, 31071, 14) }, - }, - specPos = { - from = Position(32257, 31080, 14), - to = Position(32280, 31102, 14), - }, - exit = Position(32271, 31097, 14), + centerRoom = Position(32269, 31091, 14), + BossPosition = Position(32269, 31091, 14), + newPosition = Position(32271, 31097, 14) } -local leverMeltingFrozenHorror = Action() - -function leverMeltingFrozenHorror.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) +local monsters = { + {monster = 'icicle', pos = Position(32266, 31084, 14)}, + {monster = 'icicle', pos = Position(32272, 31084, 14)}, + {monster = 'dragon egg', pos = Position(32269, 31084, 14)}, + {monster = 'melting frozen horror', pos = Position(32267, 31071, 14)} +} - for i = 1, #config.playerPositions do - local pos = config.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() +local leverZyrtarch = Action() - if not creature or not creature:isPlayer() then - player:sendCancelMessage("You need " .. #config.playerPositions .. " players to challenge " .. config.boss.name .. ".") +function leverZyrtarch.onUse(player, item, fromPosition, target, toPosition, isHotkey) + if item.itemid == 8911 then + if player:getPosition() ~= Position(32302, 31088, 14) then + item:transform(8912) return true end - - local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.HorrorKilled) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") + end + if item.itemid == 8911 then + if Game.getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.HorrorTimer) >= 1 then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to wait a while, recently someone challenge Frozen Horror.") return true end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true + local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15) + for i = 1, #specs do + spec = specs[i] + if spec:isPlayer() then + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting with Frozen Horror.") + return true + end end - - table.insert(players, creature) - end - - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) - return true + for n = 1, #monsters do + Game.createMonster(monsters[n].monster, monsters[n].pos, true, 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 - - 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 - - if config.boss.createFunction then - config.boss.createFunction() - else - Game.createMonster(config.boss.name, config.boss.position) - end - - for _, monster in pairs(config.monsters) do - Game.createMonster(monster.name, monster.pos) - end - - addEvent(clearBossRoom, config.timeToDefeat * 1000, config.specPos.from, config.specPos.to, config.exit) - - if item.itemid == 8911 then + Game.createMonster("solid frozen horror", config.BossPosition, true, true) + for y = 31088, 31092 do + local playerTile = Tile(Position(32302, y, 14)):getTopCreature() + if playerTile and playerTile:isPlayer() then + playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) + playerTile:teleportTo(config.newPosition) + playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + playerTile:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.HorrorTimer, os.stime() + 20 * 60 * 60) + end + end + Game.setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.HorrorTimer, 1) + addEvent(clearForgotten, 30 * 60 * 1000, Position(32264, 31070, 14), Position(32284, 31104, 14), Position(32319, 31091, 14), Storage.Quest.U11_02.ForgottenKnowledge.HorrorTimer) item:transform(8912) - else + elseif item.itemid == 8912 then 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 -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 -end - -leverMeltingFrozenHorror:position(Position(32302, 31087, 14)) -leverMeltingFrozenHorror:register() +leverZyrtarch:position(Position(33391, 31177, 10)) +leverZyrtarch:register() diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lady_tenebris.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lady_tenebris.lua index 67348e45803..80ae371c11d 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lady_tenebris.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lady_tenebris.lua @@ -1,128 +1,43 @@ local config = { - boss = { - name = "Lady Tenebris", - position = Position(32912, 31599, 14), - }, - requiredLevel = 250, - timeToDefeat = 15 * 60, - playerPositions = { - { pos = Position(32902, 31623, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32902, 31624, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32902, 31625, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32902, 31626, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32902, 31627, 14), teleport = Position(32911, 31603, 14), effect = CONST_ME_TELEPORT }, - }, - monsters = { - { name = "shadow tentacle", pos = Position(32910, 31599, 14) }, - { name = "shadow tentacle", pos = Position(32912, 31597, 14) }, - { name = "shadow tentacle", pos = Position(32914, 31599, 14) }, - }, - specPos = { - from = Position(32899, 31587, 14), - to = Position(32923, 31612, 14), - }, - exit = Position(32902, 31629, 14), + centerRoom = Position(32912, 31599, 14), + bossPosition = Position(32912, 31599, 14), + newPosition = Position(32911, 31603, 14) } local leverLadyTenebris = Action() function leverLadyTenebris.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LadyTenebrisKilled) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + if item.itemid == 8911 then + if player:getPosition() ~= Position(32902, 31623, 14) then 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 - - 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) - for _, monster in pairs(config.monsters) do - Game.createMonster(monster.name, monster.pos) - end - - 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 - - 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 -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 + local playersTable = {} + if player:doCheckBossRoom("Lady Tenebris", Position(32902, 31589, 14), Position(32924, 31610, 14)) then + for d = 1, 6 do + Game.createMonster('shadow tentacle', Position(math.random(32909, 32914), math.random(31596, 31601), 14), true, true) + end + Game.createMonster("lady tenebris", config.bossPosition, true, true) + for y = 31623, 31627 do + local playerTile = Tile(Position(32902, y, 14)):getTopCreature() + if playerTile and playerTile:isPlayer() then + playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) + playerTile:teleportTo(config.newPosition) + playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + playerTile:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LadyTenebrisTimer, os.time() + 20 * 60 * 60) + table.insert(playersTable, playerTile:getId()) end end + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(32902, 31589, 14), Position(32924, 31610, 14), Position(32919, 31639, 14)) + item:transform(8912) end + elseif item.itemid == 8912 then + item:transform(8911) end - return monstersRemoved + + return true end leverLadyTenebris:position(Position(32902, 31622, 14)) -leverLadyTenebris:register() +leverLadyTenebris:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lloyd.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lloyd.lua index 70e849261b5..8ffcf010078 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lloyd.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lloyd.lua @@ -1,128 +1,50 @@ local config = { - boss = { - name = "Lloyd", - position = Position(32799, 32827, 14), - }, - requiredLevel = 250, - timeToDefeat = 10 * 60, - playerPositions = { - { pos = Position(32759, 32868, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32759, 32869, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32759, 32870, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32759, 32871, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32759, 32872, 14), teleport = Position(32800, 32831, 14), effect = CONST_ME_TELEPORT }, - }, - monsters = { - { name = "cosmic energy prism a invu", pos = Position(32801, 32827, 14) }, - { name = "cosmic energy prism b invu", pos = Position(32798, 32827, 14) }, - { name = "cosmic energy prism c invu", pos = Position(32803, 32826, 14) }, - { name = "cosmic energy prism d invu", pos = Position(32796, 32826, 14) }, - }, - specPos = { - from = Position(32785, 32813, 14), - to = Position(32812, 32838, 14), - }, - exit = Position(32815, 32873, 13), + centerRoom = Position(32799, 32832, 14), + bossPosition = Position(32799, 32827, 14), + newPosition = Position(32800, 32831, 14) +} + +local monsters = { + {cosmic = 'cosmic energy prism a', pos = Position(32801, 32827, 14)}, + {cosmic = 'cosmic energy prism b', pos = Position(32798, 32827, 14)}, + {cosmic = 'cosmic energy prism c', pos = Position(32803, 32826, 14)}, + {cosmic = 'cosmic energy prism d', pos = Position(32796, 32826, 14)} } local leverLloyd = Action() function leverLloyd.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LloydKilled) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + if item.itemid == 8911 then + if player:getPosition() ~= Position(32759, 32868, 14) then + item:transform(8912) 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 - - 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) - for _, monster in pairs(config.monsters) do - Game.createMonster(monster.name, monster.pos) - end - - 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 - - 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 -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 + local playersTable = {} + if player:doCheckBossRoom(player:getId(), "Lloyd", Position(32785, 32814, 14), Position(32812, 32838, 14)) then + for n = 1, #monsters do + Game.createMonster(monsters[n].cosmic, monsters[n].pos, true, true) + end + Game.createMonster("lloyd", config.bossPosition, true, true) + for y = 32868, 32872 do + local playerTile = Tile(Position(32759, y, 14)):getTopCreature() + if playerTile and playerTile:isPlayer() then + playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) + playerTile:teleportTo(config.newPosition) + playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + playerTile:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LloydTimer, os.time() + 20 * 60 * 60) + table.insert(playersTable, playerTile:getId()) end end + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(32785, 32814, 14), Position(32812, 32838, 14), Position(32815, 32873, 13)) + item:transform(8912) end + elseif item.itemid == 8912 then + item:transform(8911) end - return monstersRemoved + + return true end leverLloyd:position(Position(32759, 32867, 14)) diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_last_lore_keeper.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_last_lore_keeper.lua index 4c8eff54ca3..f908b599692 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_last_lore_keeper.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_last_lore_keeper.lua @@ -1,142 +1,50 @@ local config = { - boss = { - name = "The Last Lore Keeper", - position = Position(31987, 32839, 14), - }, - requiredLevel = 250, - timeToDefeat = 17 * 60, - playerPositions = { - { pos = Position(32018, 32844, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32019, 32844, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32020, 32844, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32018, 32845, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32019, 32845, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32020, 32845, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32018, 32846, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32019, 32846, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32020, 32846, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32018, 32847, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32019, 32847, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32020, 32847, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32018, 32848, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32019, 32848, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32020, 32848, 14), teleport = Position(31984, 32851, 14), effect = CONST_ME_TELEPORT }, - }, - monsters = { - { name = "bound astral power", pos = Position(31973, 32840, 15) }, - { name = "bound astral power", pos = Position(31973, 32856, 15) }, - { name = "bound astral power", pos = Position(31989, 32856, 15) }, - { name = "bound astral power", pos = Position(31989, 32840, 15) }, - { name = "a shielded astral glyph", pos = Position(31986, 32840, 14) }, - { name = "the distorted astral source", pos = Position(31986, 32823, 15) }, - { name = "an astral glyph", pos = Position(31989, 32823, 15) }, - }, - specPos = { - from = Position(31968, 32821, 14), - to = Position(32004, 32865, 15), - }, - exit = Position(32035, 32859, 14), + {newPosition = Position(31985, 32851, 14)}, + {pos = Position(31986, 32840, 14), monster = 'a shielded astral glyph'}, + {pos = Position(31975, 32856, 15), monster = 'bound astral power'}, + {pos = Position(31987, 32839, 14), monster = 'the astral source'}, + {pos = Position(31986, 32823, 15), monster = 'the distorted astral source'}, + {pos = Position(31989, 32823, 15), monster = 'an astral glyph'} } local leverLoreKeeper = Action() function leverLoreKeeper.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LastLoreKilled) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + if item.itemid == 8911 then + if player:getPosition() ~= Position(32019, 32844, 14) then + item:transform(8912) 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 - - 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) - - for _, monster in pairs(config.monsters) do - Game.createMonster(monster.name, monster.pos) - end - - 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 - - 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 -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 + local playersTable = {} + if player:doCheckBossRoom("The Last Lorekeeper", Position(31968, 32821, 14), Position(32004, 32865, 15)) then + for x = 32018, 32020 do + for y = 32844, 32848 do + local playerTile = Tile(Position(x, y, 14)):getTopCreature() + if playerTile and playerTile:isPlayer() then + playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) + playerTile:teleportTo(config[1].newPosition) + playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + playerTile:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.LastLoreTimer, os.time() + 60 * 60 * 14 * 24) + table.insert(playersTable, playerTile:getId()) end end end + for b = 2, #config do + Game.createMonster(config[b].monster, config[b].pos, true, true) + end + Game.setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AstralPowerCounter, 1) + Game.setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AstralGlyph, 0) + player:say('The Astral Glyph begins to draw upon bound astral power to expel you from the room!', TALKTYPE_MONSTER_SAY) + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(31968, 32821, 14), Position(32004, 32865, 15), Position(32035, 32859, 14)) + item:transform(8912) end + elseif item.itemid == 8912 then + item:transform(8911) end - return monstersRemoved + + return true end leverLoreKeeper:position(Position(32019, 32843, 14)) diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_thorn_knight.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_thorn_knight.lua index b0a1a95e9e2..b3a81a13ca2 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_thorn_knight.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_thorn_knight.lua @@ -1,129 +1,43 @@ local config = { - boss = { - name = "The Enraged Thorn Knight", - createFunction = function() - return Game.createMonster("Mounted Thorn Knight", Position(32624, 32880, 14), true, true) - end, - }, - requiredLevel = 250, - timeToDefeat = 15 * 60, - playerPositions = { - { pos = Position(32657, 32877, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32657, 32878, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32657, 32879, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32657, 32880, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(32657, 32881, 14), teleport = Position(32624, 32886, 14), effect = CONST_ME_TELEPORT }, - }, - specPos = { - from = Position(32613, 32869, 14), - to = Position(32636, 32892, 14), - }, - exit = Position(32678, 32888, 14), - onUseExtra = function(player) - for d = 1, 6 do - Game.createMonster("possessed tree", Position(math.random(32619, 32629), math.random(32877, 32884), 14), true, true) - end - end, + centerRoom = Position(32624, 32880, 14), + bossPosition = Position(32624, 32880, 14), + newPosition = Position(32624, 32886, 14) } local leverThornKnight = Action() function leverThornKnight.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.ThornKnightKilled) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + if item.itemid == 8911 then + if player:getPosition() ~= Position(32657, 32877, 14) then + item:transform(8912) 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 - - 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 - - config.boss.createFunction() - - config.onUseExtra(player) - - 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 - - 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 -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 + local playersTable = {} + if player:doCheckBossRoom("Thorn Knight", Position(32613, 32869, 14), Position(32636, 32892, 14)) then + for d = 1, 6 do + Game.createMonster('possessed tree', Position(math.random(32619, 32629), math.random(32877, 32884), 14), true, true) + end + Game.createMonster("mounted thorn knight", config.bossPosition, true, true) + for y = 32877, 32881 do + local playerTile = Tile(Position(32657, y, 14)):getTopCreature() + if playerTile and playerTile:isPlayer() then + playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) + playerTile:teleportTo(config.newPosition) + playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + playerTile:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.ThornKnightTimer, os.stime() + 20 * 60 * 60) + table.insert(playersTable, playerTile:getId()) end end + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(32613, 32869, 14), Position(32636, 32892, 14), Position(32678, 32888, 14)) + item:transform(8912) end + elseif item.itemid == 8912 then + item:transform(8911) end - return monstersRemoved + return true end leverThornKnight:position(Position(32657, 32876, 14)) -leverThornKnight:register() +leverThornKnight:register() \ No newline at end of file diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua index c25f1ccf1b9..41e89ea5074 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua @@ -1,128 +1,47 @@ local config = { - boss = { - name = "The Time Guardian", - position = Position(32977, 31662, 14), - }, - requiredLevel = 250, - timeToDefeat = 15 * 60, - playerPositions = { - { pos = Position(33010, 31660, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(33010, 31661, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(33010, 31662, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(33010, 31663, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, - { pos = Position(33010, 31664, 14), teleport = Position(32977, 31667, 14), effect = CONST_ME_TELEPORT }, - }, - monsters = { - { name = "The Freezing Time Guardian", pos = Position(32975, 31664, 13) }, - { name = "The Blazing Time Guardian", pos = Position(32980, 31664, 13) }, - }, - specPos = { - from = Position(32967, 31654, 14), - to = Position(32989, 31677, 14), - }, - exit = Position(32870, 32724, 14), + centerRoom = Position(32977, 31662, 14), + newPosition = Position(32977, 31667, 14) +} + +local bosses = { + {bossPosition = Position(32977, 31662, 14), bossName = 'The Time Guardian'}, + {bossPosition = Position(32975, 31664, 13), bossName = 'The Freezing Time Guardian'}, + {bossPosition = Position(32980, 31664, 13), bossName = 'The Blazing Time Guardian'} } local leverTimeGuardian = Action() function leverTimeGuardian.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local players = {} - local spectators = Game.getSpectators(config.specPos.from, false, false, 0, 0, 0, 0, config.specPos.to) - - 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 - - local cooldownTime = creature:getStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.TimeGuardianKilled) - if cooldownTime > os.time() then - local remainingTime = cooldownTime - os.time() - local hours = math.floor(remainingTime / 3600) - local minutes = math.floor((remainingTime % 3600) / 60) - player:sendCancelMessage(creature:getName() .. " must wait " .. hours .. " hours and " .. minutes .. " minutes to challenge again.") - return true - end - - if creature:getLevel() < config.requiredLevel then - player:sendCancelMessage(creature:getName() .. " needs to be at least level " .. config.requiredLevel .. " to challenge " .. config.boss.name .. ".") - return true - end - - table.insert(players, creature) - end - - for _, spec in pairs(spectators) do - if spec:isPlayer() then - player:say("Someone is already inside the room.", TALKTYPE_MONSTER_SAY) + if item.itemid == 8911 then + if player:getPosition() ~= Position(33010, 31660, 14) then + item:transform(8912) 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 - - 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) - - for _, monster in pairs(config.monsters) do - Game.createMonster(monster.name, monster.pos) - end - - 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 - - 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 -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 + local playersTable = {} + if doCheckBossRoom(player:getId(), "The Time Guardian", Position(32967, 31654, 13), Position(32989, 31677, 14)) then + for q = 1,#bosses do + Game.createMonster(bosses[q].bossName, bosses[q].bossPosition, true, true) + end + for y = 31660, 31664 do + local playerTile = Tile(Position(33010, y, 14)):getTopCreature() + if playerTile and playerTile:isPlayer() then + playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) + playerTile:teleportTo(config.newPosition) + playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) + playerTile:setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.TimeGuardianTimer, os.time() + 20 * 60 * 60) + table.insert(playersTable, playerTile:getId()) end end + addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(32967, 31654, 13), Position(32989, 31677, 14), Position(32870, 32724, 14)) + item:transform(8912) end + elseif item.itemid == 8912 then + item:transform(8911) end - return monstersRemoved + return true end leverTimeGuardian:position(Position(33010, 31659, 14)) -leverTimeGuardian:register() +leverTimeGuardian:register() \ No newline at end of file From 421107e0b88823b29fef0bfaa6c5f86cad723018 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 23 Oct 2024 16:40:04 +0000 Subject: [PATCH 64/70] Lua code format - (Stylua) --- .../actions_dragonking_zyrtarch.lua | 14 +++++++------- .../actions_frozen_horror.lua | 10 +++++----- .../actions_lady_tenebris.lua | 6 +++--- .../quests/forgotten_knowledge/actions_lloyd.lua | 10 +++++----- .../actions_the_last_lore_keeper.lua | 16 ++++++++-------- .../actions_the_thorn_knight.lua | 8 ++++---- .../actions_the_time_guardian.lua | 14 +++++++------- 7 files changed, 39 insertions(+), 39 deletions(-) diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_dragonking_zyrtarch.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_dragonking_zyrtarch.lua index f25571b13df..426177864b2 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_dragonking_zyrtarch.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_dragonking_zyrtarch.lua @@ -1,14 +1,14 @@ local config = { bossPosition = Position(33357, 31182, 10), newPosition = Position(33359, 31186, 10), - soulPosition = Position(33359, 31182, 12) + soulPosition = Position(33359, 31182, 12), } local monsters = { - {position = Position(33352, 31187, 10)}, - {position = Position(33363, 31187, 10)}, - {position = Position(33353, 31176, 10)}, - {position = Position(33363, 31176, 10)} + { position = Position(33352, 31187, 10) }, + { position = Position(33363, 31187, 10) }, + { position = Position(33353, 31176, 10) }, + { position = Position(33363, 31176, 10) }, } local leverZyrtarch = Action() @@ -24,7 +24,7 @@ function leverZyrtarch.onUse(player, item, fromPosition, target, toPosition, isH local playersTable = {} if player:doCheckBossRoom("Dragonking Zyrtarch", Position(33348, 31172, 10), Position(33368, 31190, 12)) then for d = 1, #monsters do - Game.createMonster('soulcatcher', monsters[d].position, true, true) + Game.createMonster("soulcatcher", monsters[d].position, true, true) end Game.createMonster("dragonking zyrtarch", config.bossPosition, true, true) Game.createMonster("soul of dragonking zyrtarch", config.soulPosition, true, true) @@ -49,4 +49,4 @@ function leverZyrtarch.onUse(player, item, fromPosition, target, toPosition, isH end leverZyrtarch:position(Position(33391, 31177, 10)) -leverZyrtarch:register() \ No newline at end of file +leverZyrtarch:register() diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua index dacfd92f0f9..91ac7ba58c5 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua @@ -1,14 +1,14 @@ local config = { centerRoom = Position(32269, 31091, 14), BossPosition = Position(32269, 31091, 14), - newPosition = Position(32271, 31097, 14) + newPosition = Position(32271, 31097, 14), } local monsters = { - {monster = 'icicle', pos = Position(32266, 31084, 14)}, - {monster = 'icicle', pos = Position(32272, 31084, 14)}, - {monster = 'dragon egg', pos = Position(32269, 31084, 14)}, - {monster = 'melting frozen horror', pos = Position(32267, 31071, 14)} + { monster = "icicle", pos = Position(32266, 31084, 14) }, + { monster = "icicle", pos = Position(32272, 31084, 14) }, + { monster = "dragon egg", pos = Position(32269, 31084, 14) }, + { monster = "melting frozen horror", pos = Position(32267, 31071, 14) }, } local leverZyrtarch = Action() diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lady_tenebris.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lady_tenebris.lua index 80ae371c11d..7f784c4516f 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lady_tenebris.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lady_tenebris.lua @@ -1,7 +1,7 @@ local config = { centerRoom = Position(32912, 31599, 14), bossPosition = Position(32912, 31599, 14), - newPosition = Position(32911, 31603, 14) + newPosition = Position(32911, 31603, 14), } local leverLadyTenebris = Action() @@ -16,7 +16,7 @@ function leverLadyTenebris.onUse(player, item, fromPosition, target, toPosition, local playersTable = {} if player:doCheckBossRoom("Lady Tenebris", Position(32902, 31589, 14), Position(32924, 31610, 14)) then for d = 1, 6 do - Game.createMonster('shadow tentacle', Position(math.random(32909, 32914), math.random(31596, 31601), 14), true, true) + Game.createMonster("shadow tentacle", Position(math.random(32909, 32914), math.random(31596, 31601), 14), true, true) end Game.createMonster("lady tenebris", config.bossPosition, true, true) for y = 31623, 31627 do @@ -40,4 +40,4 @@ function leverLadyTenebris.onUse(player, item, fromPosition, target, toPosition, end leverLadyTenebris:position(Position(32902, 31622, 14)) -leverLadyTenebris:register() \ No newline at end of file +leverLadyTenebris:register() diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lloyd.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lloyd.lua index 8ffcf010078..2a6a48b84c6 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lloyd.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_lloyd.lua @@ -1,14 +1,14 @@ local config = { centerRoom = Position(32799, 32832, 14), bossPosition = Position(32799, 32827, 14), - newPosition = Position(32800, 32831, 14) + newPosition = Position(32800, 32831, 14), } local monsters = { - {cosmic = 'cosmic energy prism a', pos = Position(32801, 32827, 14)}, - {cosmic = 'cosmic energy prism b', pos = Position(32798, 32827, 14)}, - {cosmic = 'cosmic energy prism c', pos = Position(32803, 32826, 14)}, - {cosmic = 'cosmic energy prism d', pos = Position(32796, 32826, 14)} + { cosmic = "cosmic energy prism a", pos = Position(32801, 32827, 14) }, + { cosmic = "cosmic energy prism b", pos = Position(32798, 32827, 14) }, + { cosmic = "cosmic energy prism c", pos = Position(32803, 32826, 14) }, + { cosmic = "cosmic energy prism d", pos = Position(32796, 32826, 14) }, } local leverLloyd = Action() diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_last_lore_keeper.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_last_lore_keeper.lua index f908b599692..aa704ba6435 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_last_lore_keeper.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_last_lore_keeper.lua @@ -1,10 +1,10 @@ local config = { - {newPosition = Position(31985, 32851, 14)}, - {pos = Position(31986, 32840, 14), monster = 'a shielded astral glyph'}, - {pos = Position(31975, 32856, 15), monster = 'bound astral power'}, - {pos = Position(31987, 32839, 14), monster = 'the astral source'}, - {pos = Position(31986, 32823, 15), monster = 'the distorted astral source'}, - {pos = Position(31989, 32823, 15), monster = 'an astral glyph'} + { newPosition = Position(31985, 32851, 14) }, + { pos = Position(31986, 32840, 14), monster = "a shielded astral glyph" }, + { pos = Position(31975, 32856, 15), monster = "bound astral power" }, + { pos = Position(31987, 32839, 14), monster = "the astral source" }, + { pos = Position(31986, 32823, 15), monster = "the distorted astral source" }, + { pos = Position(31989, 32823, 15), monster = "an astral glyph" }, } local leverLoreKeeper = Action() @@ -36,11 +36,11 @@ function leverLoreKeeper.onUse(player, item, fromPosition, target, toPosition, i end Game.setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AstralPowerCounter, 1) Game.setStorageValue(Storage.Quest.U11_02.ForgottenKnowledge.AstralGlyph, 0) - player:say('The Astral Glyph begins to draw upon bound astral power to expel you from the room!', TALKTYPE_MONSTER_SAY) + player:say("The Astral Glyph begins to draw upon bound astral power to expel you from the room!", TALKTYPE_MONSTER_SAY) addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(31968, 32821, 14), Position(32004, 32865, 15), Position(32035, 32859, 14)) item:transform(8912) end - elseif item.itemid == 8912 then + elseif item.itemid == 8912 then item:transform(8911) end diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_thorn_knight.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_thorn_knight.lua index b3a81a13ca2..16b22300ea1 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_thorn_knight.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_thorn_knight.lua @@ -1,7 +1,7 @@ local config = { centerRoom = Position(32624, 32880, 14), bossPosition = Position(32624, 32880, 14), - newPosition = Position(32624, 32886, 14) + newPosition = Position(32624, 32886, 14), } local leverThornKnight = Action() @@ -17,7 +17,7 @@ function leverThornKnight.onUse(player, item, fromPosition, target, toPosition, local playersTable = {} if player:doCheckBossRoom("Thorn Knight", Position(32613, 32869, 14), Position(32636, 32892, 14)) then for d = 1, 6 do - Game.createMonster('possessed tree', Position(math.random(32619, 32629), math.random(32877, 32884), 14), true, true) + Game.createMonster("possessed tree", Position(math.random(32619, 32629), math.random(32877, 32884), 14), true, true) end Game.createMonster("mounted thorn knight", config.bossPosition, true, true) for y = 32877, 32881 do @@ -33,11 +33,11 @@ function leverThornKnight.onUse(player, item, fromPosition, target, toPosition, addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(32613, 32869, 14), Position(32636, 32892, 14), Position(32678, 32888, 14)) item:transform(8912) end - elseif item.itemid == 8912 then + elseif item.itemid == 8912 then item:transform(8911) end return true end leverThornKnight:position(Position(32657, 32876, 14)) -leverThornKnight:register() \ No newline at end of file +leverThornKnight:register() diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua index 41e89ea5074..01ffdff702d 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua @@ -1,12 +1,12 @@ local config = { centerRoom = Position(32977, 31662, 14), - newPosition = Position(32977, 31667, 14) + newPosition = Position(32977, 31667, 14), } local bosses = { - {bossPosition = Position(32977, 31662, 14), bossName = 'The Time Guardian'}, - {bossPosition = Position(32975, 31664, 13), bossName = 'The Freezing Time Guardian'}, - {bossPosition = Position(32980, 31664, 13), bossName = 'The Blazing Time Guardian'} + { bossPosition = Position(32977, 31662, 14), bossName = "The Time Guardian" }, + { bossPosition = Position(32975, 31664, 13), bossName = "The Freezing Time Guardian" }, + { bossPosition = Position(32980, 31664, 13), bossName = "The Blazing Time Guardian" }, } local leverTimeGuardian = Action() @@ -21,7 +21,7 @@ function leverTimeGuardian.onUse(player, item, fromPosition, target, toPosition, if item.itemid == 8911 then local playersTable = {} if doCheckBossRoom(player:getId(), "The Time Guardian", Position(32967, 31654, 13), Position(32989, 31677, 14)) then - for q = 1,#bosses do + for q = 1, #bosses do Game.createMonster(bosses[q].bossName, bosses[q].bossPosition, true, true) end for y = 31660, 31664 do @@ -37,11 +37,11 @@ function leverTimeGuardian.onUse(player, item, fromPosition, target, toPosition, addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(32967, 31654, 13), Position(32989, 31677, 14), Position(32870, 32724, 14)) item:transform(8912) end - elseif item.itemid == 8912 then + elseif item.itemid == 8912 then item:transform(8911) end return true end leverTimeGuardian:position(Position(33010, 31659, 14)) -leverTimeGuardian:register() \ No newline at end of file +leverTimeGuardian:register() From d3e27a94a98867da8123060515e20fb08329b255 Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Wed, 23 Oct 2024 13:40:55 -0300 Subject: [PATCH 65/70] Update actions_the_time_guardian.lua --- .../quests/forgotten_knowledge/actions_the_time_guardian.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua index 01ffdff702d..75dcd0da028 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_the_time_guardian.lua @@ -20,7 +20,7 @@ function leverTimeGuardian.onUse(player, item, fromPosition, target, toPosition, end if item.itemid == 8911 then local playersTable = {} - if doCheckBossRoom(player:getId(), "The Time Guardian", Position(32967, 31654, 13), Position(32989, 31677, 14)) then + if player:doCheckBossRoom("The Time Guardian", Position(32967, 31654, 13), Position(32989, 31677, 14)) then for q = 1, #bosses do Game.createMonster(bosses[q].bossName, bosses[q].bossPosition, true, true) end From 7b0f3c4283910621faae067722aa89f640d6f93f Mon Sep 17 00:00:00 2001 From: HT Cesta <58153179+htc16@users.noreply.github.com> Date: Wed, 23 Oct 2024 18:04:28 -0300 Subject: [PATCH 66/70] Update actions_frozen_horror.lua --- .../quests/forgotten_knowledge/actions_frozen_horror.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua index 91ac7ba58c5..fc7e5049b6a 100644 --- a/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua +++ b/data-otservbr-global/scripts/quests/forgotten_knowledge/actions_frozen_horror.lua @@ -11,9 +11,9 @@ local monsters = { { monster = "melting frozen horror", pos = Position(32267, 31071, 14) }, } -local leverZyrtarch = Action() +local leverMeltingFrozenHorror = Action() -function leverZyrtarch.onUse(player, item, fromPosition, target, toPosition, isHotkey) +function leverMeltingFrozenHorror.onUse(player, item, fromPosition, target, toPosition, isHotkey) if item.itemid == 8911 then if player:getPosition() ~= Position(32302, 31088, 14) then item:transform(8912) @@ -55,5 +55,5 @@ function leverZyrtarch.onUse(player, item, fromPosition, target, toPosition, isH return true end -leverZyrtarch:position(Position(33391, 31177, 10)) -leverZyrtarch:register() +leverMeltingFrozenHorror:position(Position(32302, 31087, 14)) +leverMeltingFrozenHorror:register() From f23bfef2485085b790da1566a2ef8104b2690721 Mon Sep 17 00:00:00 2001 From: Glatharth Date: Wed, 30 Oct 2024 10:29:33 -0300 Subject: [PATCH 67/70] updated the levers to bossLever and fixed some conflicts --- .../scripts/actions/bosses_levers/brokul.lua | 23 -- .../bosses_levers/grand_master_oberon.lua | 22 -- .../actions_ferumbras_lever.lua | 144 ++++++------- .../ferumbras_ascension/actions_rat_lever.lua | 70 ++---- .../actions_the_shatterer_lever.lua | 69 ++---- .../quests/the_first_dragon/actions_lever.lua | 202 ++++-------------- .../liquid_death/actions_brokulLever.lua | 139 +++--------- .../actions_oberonLever.lua | 63 +++--- .../movements_bossEntrance.lua | 2 +- data-otservbr-global/startup/tables/lever.lua | 22 -- data/libs/functions/boss_lever.lua | 36 ++-- data/libs/functions/lever.lua | 22 ++ 12 files changed, 233 insertions(+), 581 deletions(-) delete mode 100644 data-otservbr-global/scripts/actions/bosses_levers/brokul.lua delete mode 100644 data-otservbr-global/scripts/actions/bosses_levers/grand_master_oberon.lua diff --git a/data-otservbr-global/scripts/actions/bosses_levers/brokul.lua b/data-otservbr-global/scripts/actions/bosses_levers/brokul.lua deleted file mode 100644 index 2cdded463af..00000000000 --- a/data-otservbr-global/scripts/actions/bosses_levers/brokul.lua +++ /dev/null @@ -1,23 +0,0 @@ -local config = { - boss = { - name = "Brokul", - position = Position(33483, 31434, 15), - }, - requiredLevel = 150, - playerPositions = { - { pos = Position(33522, 31465, 15), teleport = Position(33483, 31445, 15), effect = CONST_ME_TELEPORT }, - { pos = Position(33520, 31465, 15), teleport = Position(33483, 31445, 15), effect = CONST_ME_TELEPORT }, - { pos = Position(33521, 31465, 15), teleport = Position(33483, 31445, 15), effect = CONST_ME_TELEPORT }, - { pos = Position(33523, 31465, 15), teleport = Position(33483, 31445, 15), effect = CONST_ME_TELEPORT }, - { pos = Position(33524, 31465, 15), teleport = Position(33483, 31445, 15), effect = CONST_ME_TELEPORT }, - }, - specPos = { - from = Position(33469, 31430, 15), - to = Position(33497, 31453, 15), - }, - exit = Position(33522, 31468, 15), -} - -local lever = BossLever(config) -lever:aid(34000) -lever:register() diff --git a/data-otservbr-global/scripts/actions/bosses_levers/grand_master_oberon.lua b/data-otservbr-global/scripts/actions/bosses_levers/grand_master_oberon.lua deleted file mode 100644 index e7a1a104d52..00000000000 --- a/data-otservbr-global/scripts/actions/bosses_levers/grand_master_oberon.lua +++ /dev/null @@ -1,22 +0,0 @@ -local config = { - boss = { - name = "Grand Master Oberon", - position = Position(33364, 31317, 9), - }, - playerPositions = { - { pos = Position(33362, 31344, 9), teleport = Position(33364, 31322, 9) }, - { pos = Position(33363, 31344, 9), teleport = Position(33364, 31322, 9) }, - { pos = Position(33364, 31344, 9), teleport = Position(33364, 31322, 9) }, - { pos = Position(33365, 31344, 9), teleport = Position(33364, 31322, 9) }, - { pos = Position(33366, 31344, 9), teleport = Position(33364, 31322, 9) }, - }, - specPos = { - from = Position(33357, 31312, 9), - to = Position(33371, 31324, 9), - }, - exit = Position(33364, 31341, 9), -} - -local lever = BossLever(config) -lever:aid(57605) -lever:register() 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 9dabbb4f18c..916d7efd816 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,91 +1,69 @@ -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 }, -} - local config = { - centerRoom = Position(33392, 31473, 14), - BossPosition = Position(33392, 31473, 14), + boss = { + name = "Ascending Ferumbras", + position = Position(33392, 31473, 14) + }, + timeToFightAgain = 60 * 60 * 20 * 24, playerPositions = { - Position(33269, 31477, 14), - Position(33269, 31478, 14), - Position(33269, 31479, 14), - Position(33269, 31480, 14), - Position(33269, 31481, 14), - Position(33270, 31477, 14), - Position(33270, 31478, 14), - Position(33270, 31479, 14), - Position(33270, 31480, 14), - Position(33270, 31481, 14), - Position(33271, 31477, 14), - Position(33271, 31478, 14), - Position(33271, 31479, 14), - Position(33271, 31480, 14), - Position(33271, 31481, 14), + { pos = Position(33270, 31477, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33269, 31477, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33269, 31478, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33269, 31479, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33269, 31480, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33269, 31481, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33270, 31478, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33270, 31479, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33270, 31480, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33270, 31481, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33271, 31477, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33271, 31478, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33271, 31479, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33271, 31480, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33271, 31481, 14), teleport = Position(33392, 31479, 14) }, }, - newPosition = Position(33392, 31479, 14), -} - -local leverFerumbras = Action() - -function leverFerumbras.onUse(player, item, fromPosition, target, toPosition, isHotkey) - local playersTable = {} - if item.itemid == 8911 then - if player:getPosition() ~= Position(33270, 31477, 14) then - item:transform(8912) - return true - end - end - if item.itemid == 8911 then - if player:doCheckBossRoom("Ascending Ferumbras", Position(33379, 31460, 14), Position(33405, 31485, 14)) then - Game.createMonster("Ascending Ferumbras", config.BossPosition, true, true) - for b = 1, 10 do - local xrand = math.random(-10, 10) - local yrand = math.random(-10, 10) - local position = Position(33392 + xrand, 31473 + yrand, 14) - if Game.createMonster("rift invader", position) then - end - end - for x = 33269, 33271 do - for y = 31477, 31481 do - local playerTile = Tile(Position(x, y, 14)):getTopCreature() - if playerTile and playerTile:isPlayer() then - playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) - playerTile:teleportTo(config.newPosition) - playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - playerTile:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasTimer, os.time() + 60 * 60 * 20 * 24) - table.insert(playersTable, playerTile:getId()) - end - end - end - Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Crystals.AllCrystals, 0) - Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasEssence, 0) - for _, crystal in pairs(crystals) do - local pos = crystal.crystalPosition - local stg = crystal.globalStorage - local sqm = Tile(pos) - if sqm then - local item = sqm:getItemById(17586) - if item then - item:transform(17580) - end + specPos = { + from = Position(33379, 31460, 14), + to = Position(33405, 31485, 14) + }, + exit = Position(33319, 32318, 13), + monsters = { + { name = "rift invader", pos = Position(33385, 31466, 14) }, + { name = "rift invader", pos = Position(33396, 31466, 14) }, + { name = "rift invader", pos = Position(33392, 31480, 14) }, + { name = "rift invader", pos = Position(33392, 31468, 14) }, + { name = "rift invader", pos = Position(33385, 31473, 14) }, + { name = "rift invader", pos = Position(33398, 31478, 14) }, + { name = "rift invader", pos = Position(33384, 31478, 14) }, + { name = "rift invader", pos = Position(33390, 31463, 14) }, + { name = "rift invader", pos = Position(33400, 31473, 14) }, + { name = "rift invader", pos = Position(33400, 31465, 14) }, + }, + onUseExtra = function(player) + 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 }, + } + Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Crystals.AllCrystals, 0) + Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasEssence, 0) + for _, crystal in pairs(crystals) do + local tile = Tile(crystal.crystalPosition) + if tile then + local item = tile:getItemById(14961) + if item then + item:transform(14955) end - Game.setStorageValue(stg, 0) end - addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(33379, 31460, 14), Position(33405, 31485, 14), Position(33319, 32318, 13)) - item:transform(8912) + Game.setStorageValue(crystal.globalStorage, 0) end - elseif item.itemid == 8912 then - item:transform(8911) - end - return true -end + end, +} -leverFerumbras:uid(1021) +local leverFerumbras = BossLever(config) +leverFerumbras:position(Position(33270, 31476, 14)) leverFerumbras:register() 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 e9592b71585..ebb5f307922 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,57 +1,23 @@ local config = { - centerRoom = Position(33215, 31456, 12), - BossPosition = Position(33220, 31460, 12), + boss = { + name = "The Lord of the Lice", + position = Position(33220, 31460, 12), + }, + timeToFightAgain = 2 * 24 * 60 * 60, playerPositions = { - Position(33197, 31475, 11), - Position(33198, 31475, 11), - Position(33199, 31475, 11), - Position(33200, 31475, 11), - Position(33201, 31475, 11), + { pos = Position(33201, 31475, 11), teleport = Position(33215, 31470, 12) }, + { pos = Position(33197, 31475, 11), teleport = Position(33215, 31470, 12) }, + { pos = Position(33198, 31475, 11), teleport = Position(33215, 31470, 12) }, + { pos = Position(33199, 31475, 11), teleport = Position(33215, 31470, 12) }, + { pos = Position(33200, 31475, 11), teleport = Position(33215, 31470, 12) }, + }, + specPos = { + from = Position(33187, 31429, 12), + to = Position(33242, 31487, 12), }, - newPosition = Position(33215, 31470, 12), + exit = Position(33319, 32318, 13), } -local ferumbrasAscendantRatLever = Action() - -function ferumbrasAscendantRatLever.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if item.itemid == 8911 then - if player:getPosition() ~= Position(33201, 31475, 11) then - item:transform(8912) - return true - end - end - - if item.itemid == 8911 then - local playersTable = {} - if player:doCheckBossRoom("The Lord of the Lice", Position(33187, 31429, 12), Position(33242, 31487, 12)) then - local specs, spec = Game.getSpectators(config.centerRoom, false, false, 30, 30, 30, 30) - for i = 1, #specs do - spec = specs[i] - if spec:isPlayer() then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting with The Lord of The Lice.") - return true - end - end - Game.createMonster("the lord of the lice", config.BossPosition, true, true) - for x = 33197, 33201 do - local playerTile = Tile(Position(x, 31475, 11)):getTopCreature() - if playerTile and playerTile:isPlayer() then - playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) - playerTile:teleportTo(config.newPosition) - playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - playerTile:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheLordOfTheLiceTimer, os.time() + 60 * 60 * 2 * 24) - table.insert(playersTable, playerTile:getId()) - end - end - addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(33187, 31429, 12), Position(33242, 31487, 12), Position(33319, 32318, 13)) - item:transform(8912) - end - elseif item.itemid == 8912 then - item:transform(8911) - end - - return true -end - -ferumbrasAscendantRatLever:uid(1030) -ferumbrasAscendantRatLever:register() +local leverLordOfTheLice = BossLever(config) +leverLordOfTheLice:position(Position(33202, 31475, 11)) +leverLordOfTheLice:register() 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 9e061a2f4a4..6782d30c024 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,56 +1,23 @@ local config = { - centerRoom = Position(33406, 32418, 14), - BossPosition = Position(33406, 32418, 14), + boss = { + name = "The Shatterer", + position = Position(33406, 32418, 14), + }, + timeToFightAgain = 2 * 24 * 60 * 60, playerPositions = { - Position(33403, 32465, 13), - Position(33404, 32465, 13), - Position(33405, 32465, 13), - Position(33406, 32465, 13), - Position(33407, 32465, 13), + { pos = Position(33403, 32465, 13), teleport = Position(33398, 32414, 14) }, + { pos = Position(33404, 32465, 13), teleport = Position(33398, 32414, 14) }, + { pos = Position(33405, 32465, 13), teleport = Position(33398, 32414, 14) }, + { pos = Position(33406, 32465, 13), teleport = Position(33398, 32414, 14) }, + { pos = Position(33407, 32465, 13), teleport = Position(33398, 32414, 14) }, + }, + specPos = { + from = Position(33377, 32390, 14), + to = Position(33446, 32447, 14), }, - newPosition = Position(33398, 32414, 14), + exit = Position(33319, 32318, 13), } -local ferumbrasAscendantTheShattererLever = Action() - -function ferumbrasAscendantTheShattererLever.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if item.itemid == 8912 then - if player:getPosition() ~= Position(33403, 32465, 13) then - item:transform(8911) - return true - end - end - if item.itemid == 8912 then - local playersTable = {} - if player:doCheckBossRoom("The Shatterer", Position(33377, 32390, 14), Position(33446, 32447, 14)) then - local specs, spec = Game.getSpectators(config.centerRoom, false, false, 30, 30, 30, 30) - for i = 1, #specs do - spec = specs[i] - if spec:isPlayer() then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Someone is fighting with The Shatterer.") - return true - end - end - Game.createMonster("The Shatterer", config.BossPosition, true, true) - for x = 33403, 33407 do - local playerTile = Tile(Position(x, 32465, 13)):getTopCreature() - if playerTile and playerTile:isPlayer() then - playerTile:getPosition():sendMagicEffect(CONST_ME_POFF) - playerTile:teleportTo(config.newPosition) - playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - playerTile:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.TheShattererTimer, os.time() + 60 * 60 * 2 * 24) - table.insert(playersTable, playerTile:getId()) - end - end - addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, Position(33377, 32390, 14), Position(33446, 32447, 14), Position(33319, 32318, 13)) - item:transform(8911) - end - elseif item.itemid == 8911 then - item:transform(8912) - end - - return true -end - -ferumbrasAscendantTheShattererLever:uid(1029) -ferumbrasAscendantTheShattererLever:register() +local leverShatterer = BossLever(config) +leverShatterer:position(Position(33402, 32465, 13)) +leverShatterer:register() diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua b/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua index 698ada382b2..64acffb65c6 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua @@ -1,168 +1,50 @@ -local lever = Action() - local config = { - centerRoom = { x = 33616, y = 31022, z = 14 }, - range = 10, - storage = Storage.Quest.U11_02.TheFirstDragon.FirstDragonTimer, - monsterPosition = { - { position = Position(33574, 31013, 14) }, - { position = Position(33592, 31013, 14) }, - { position = Position(33583, 31022, 14) }, - { position = Position(33574, 31031, 14) }, - { position = Position(33592, 31031, 14) }, + boss = { + name = "spirit of fertility", + position = Position(33625, 31021, 14), }, + timeToFightAgain = 20 * 60 * 60, playerPositions = { - Position(33582, 30993, 14), - Position(33583, 30993, 14), - Position(33584, 30993, 14), - Position(33582, 30994, 14), - Position(33583, 30994, 14), - Position(33584, 30994, 14), - Position(33582, 30995, 14), - Position(33583, 30995, 14), - Position(33584, 30995, 14), - Position(33582, 30996, 14), - Position(33583, 30996, 14), - Position(33584, 30996, 14), - Position(33582, 30997, 14), - Position(33583, 30997, 14), - Position(33584, 30997, 14), - }, - toPosition1 = Position(33574, 31017, 14), - roomTile1 = { - { fromPosition = Position(33582, 30993, 14) }, - { fromPosition = Position(33583, 30993, 14) }, - { fromPosition = Position(33584, 30993, 14) }, - }, - toPosition2 = Position(33592, 31017, 14), - roomTile2 = { - { fromPosition = Position(33582, 30994, 14) }, - { fromPosition = Position(33583, 30994, 14) }, - { fromPosition = Position(33584, 30994, 14) }, - }, - toPosition3 = Position(33592, 31035, 14), - roomTile3 = { - { fromPosition = Position(33582, 30995, 14) }, - { fromPosition = Position(33583, 30995, 14) }, - { fromPosition = Position(33584, 30995, 14) }, - }, - toPosition4 = Position(33574, 31035, 14), - roomTile4 = { - { fromPosition = Position(33582, 30996, 14) }, - { fromPosition = Position(33583, 30996, 14) }, - { fromPosition = Position(33584, 30996, 14) }, - }, - toPosition5 = Position(33583, 31026, 14), - roomTile5 = { - { fromPosition = Position(33582, 30997, 14) }, - { fromPosition = Position(33583, 30997, 14) }, - { fromPosition = Position(33584, 30997, 14) }, - }, - clearArea = { + { pos = Position(33583, 30993, 14), teleport = Position(33592, 31017, 14) }, + { pos = Position(33582, 30993, 14), teleport = Position(33574, 31017, 14) }, + { pos = Position(33584, 30993, 14), teleport = Position(33592, 31035, 14) }, + { pos = Position(33582, 30994, 14), teleport = Position(33574, 31035, 14) }, + { pos = Position(33583, 30994, 14), teleport = Position(33583, 31026, 14) }, + { pos = Position(33584, 30994, 14), teleport = Position(33574, 31017, 14) }, + { pos = Position(33582, 30995, 14), teleport = Position(33592, 31017, 14) }, + { pos = Position(33583, 30995, 14), teleport = Position(33592, 31035, 14) }, + { pos = Position(33584, 30995, 14), teleport = Position(33574, 31035, 14) }, + { pos = Position(33582, 30996, 14), teleport = Position(33583, 31026, 14) }, + { pos = Position(33583, 30996, 14), teleport = Position(33574, 31017, 14) }, + { pos = Position(33584, 30996, 14), teleport = Position(33592, 31017, 14) }, + { pos = Position(33582, 30997, 14), teleport = Position(33592, 31035, 14) }, + { pos = Position(33583, 30997, 14), teleport = Position(33574, 31035, 14) }, + { pos = Position(33584, 30997, 14), teleport = Position(33583, 31026, 14) }, + }, + specPos = { from = Position(33566, 31006, 14), to = Position(33626, 31032, 14), }, -} - -local function clearMonstersInArea(fromPos, toPos) - for z = fromPos.z, toPos.z do - for y = fromPos.y, toPos.y do - for x = fromPos.x, toPos.x do - local tile = Tile(Position(x, y, z)) - if tile then - local creature = tile:getTopCreature() - if creature and creature:isMonster() then - creature:remove() - end - end - end - end - end -end - -local function isRoomOccupied(fromPos, toPos) - for z = fromPos.z, toPos.z do - for y = fromPos.y, toPos.y do - for x = fromPos.x, toPos.x do - local tile = Tile(Position(x, y, z)) - if tile then - local creature = tile:getTopCreature() - if creature and creature:isPlayer() then - return true - end - end - end + monsters = { + { position = Position(33574, 31013, 14), monster = "fallen challenger" }, + { position = Position(33592, 31013, 14), monster = "fallen challenger" }, + { position = Position(33583, 31022, 14), monster = "fallen challenger" }, + { position = Position(33574, 31031, 14), monster = "fallen challenger" }, + { position = Position(33592, 31031, 14), monster = "fallen challenger" }, + { position = Position(math.random(33610, 33622), math.random(31016, 31030), 14), monster = "unbeatable dragon" }, + { position = Position(math.random(33610, 33622), math.random(31016, 31030), 14), monster = "unbeatable dragon" }, + { position = Position(math.random(33610, 33622), math.random(31016, 31030), 14), monster = "unbeatable dragon" }, + { position = Position(math.random(33610, 33622), math.random(31016, 31030), 14), monster = "unbeatable dragon" }, + { position = Position(math.random(33610, 33622), math.random(31016, 31030), 14), monster = "unbeatable dragon" }, + }, + exit = Position(33597, 30994, 14), + onUseExtra = function(creature) + if creature and creature:isPlayer() then + creature:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.SomewhatBeatable, 0) end - end - return false -end - -function lever.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if item.itemid == 8911 then - for i = 1, #config.playerPositions do - local creature = Tile(config.playerPositions[i]):getTopCreature() - if not creature then - item:transform(8912) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need 15 players to fight with this boss.") - return true - end - end - end - - if item.itemid == 8911 then - if isRoomOccupied(config.clearArea.from, config.clearArea.to) then - player:say("Someone is fighting against the boss! You need to wait awhile.", TALKTYPE_MONSTER_SAY) - return true - else - clearMonstersInArea(config.clearArea.from, config.clearArea.to) - end - - for d = 1, 5 do - Game.createMonster("unbeatable dragon", Position(math.random(33610, 33622), math.random(31016, 31030), 14), true, true) - end - for b = 1, #config.monsterPosition do - Game.createMonster("fallen challenger", config.monsterPosition[b].position, true, true) - end - - for i = 1, #config.playerPositions do - local creature = Tile(config.playerPositions[i]):getTopCreature() - if creature then - for i = 1, #config.roomTile1 do - local toRoom1 = Tile(config.roomTile1[i].fromPosition):getTopCreature() - if toRoom1 then - toRoom1:teleportTo(config.toPosition1) - end - local toRoom2 = Tile(config.roomTile2[i].fromPosition):getTopCreature() - if toRoom2 then - toRoom2:teleportTo(config.toPosition2) - end - local toRoom3 = Tile(config.roomTile3[i].fromPosition):getTopCreature() - if toRoom3 then - toRoom3:teleportTo(config.toPosition3) - end - local toRoom4 = Tile(config.roomTile4[i].fromPosition):getTopCreature() - if toRoom4 then - toRoom4:teleportTo(config.toPosition4) - end - local toRoom5 = Tile(config.roomTile5[i].fromPosition):getTopCreature() - if toRoom5 then - toRoom5:teleportTo(config.toPosition5) - end - end - creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - creature:setStorageValue(config.storage, os.time() + 20 * 3600) - creature:setStorageValue(Storage.Quest.U11_02.TheFirstDragon.SomewhatBeatable, 0) - end - end - - addEvent(clearRoom, 60 * 60 * 1000, Position(33583, 31022, 14), 50, 50, config.storage) - Game.createMonster("spirit of fertility", Position(33625, 31021, 14), true, true) - item:transform(8912) - elseif item.itemid == 8912 then - item:transform(8911) - end - return true -end + end, +} -lever:uid(30003) -lever:register() +local leverFirstDragon = BossLever(config) +leverFirstDragon:position(Position(33583, 30992, 14)) +leverFirstDragon:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua index 2cab34c6e48..f66a45050af 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua @@ -1,113 +1,32 @@ -local transform = { - [2772] = 2773, - [2773] = 2772, -} - -local leverInfo = { - [1] = { - bossName = "Brokul", - bossPosition = Position(33483, 31437, 15), - leverPosition = Position(33522, 31464, 15), - pushPosition = Position(33522, 31465, 15), - leverFromPos = Position(33520, 31465, 15), - leverToPos = Position(33524, 31465, 15), - storageTimer = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimer, - teleportTo = Position(33484, 31446, 15), - globalTimer = Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimerGlobal, - roomFromPosition = Position(33472, 31427, 15), - roomToPosition = Position(33496, 31450, 15), - exitPosition = Position(33528, 31464, 14), +local config = { + boss = { + name = "Brokul", + position = Position(33483, 31437, 15), + }, + timeToFightAgain = 20 * 60 * 60, + --minPlayers = 5, + playerPositions = { + { pos = Position(33522, 31465, 15), teleport = Position(33484, 31446, 15) }, + { pos = Position(33520, 31465, 15), teleport = Position(33484, 31446, 15) }, + { pos = Position(33521, 31465, 15), teleport = Position(33484, 31446, 15) }, + { pos = Position(33523, 31465, 15), teleport = Position(33484, 31446, 15) }, + { pos = Position(33524, 31465, 15), teleport = Position(33484, 31446, 15) }, }, + specPos = { + from = Position(33472, 31427, 15), + to = Position(33496, 31450, 15), + }, + exit = Position(33528, 31464, 14), + onUseExtra = function(creature, infoPositions) + if creature and creature:isPlayer() then + if creature:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline) >= 6 then + return true + end + return false + end + end, } -local function clearBossRoom(fromPos, toPos) - local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) - for _, spec in pairs(spectators) do - if not spec:isPlayer() then - spec:remove() - end - end -end - -local function isBossInRoom(fromPos, toPos, bossName) - local hasBoss = false - local hasPlayers = false - local spectators = Game.getSpectators(fromPos, false, false, 0, 0, 0, 0, toPos) - - for _, spec in pairs(spectators) do - if spec:isPlayer() then - hasPlayers = true - elseif spec:isMonster() and spec:getName():lower() == bossName:lower() then - hasBoss = true - end - end - - return hasBoss, hasPlayers -end - -local actions_liquid_brokulLever = Action() - -function actions_liquid_brokulLever.onUse(player, item, fromPosition, target, toPosition, isHotkey) - if not player then - return true - end - - local playersTable = {} - local iPos = item:getPosition() - local pPos = player:getPosition() - - if item.itemid == 2772 then - for i = 1, #leverInfo do - if iPos == leverInfo[i].leverPosition then - local leverTable = leverInfo[i] - if pPos == leverTable.pushPosition then - local hasBoss, hasPlayers = isBossInRoom(leverTable.roomFromPosition, leverTable.roomToPosition, leverTable.bossName) - - if hasPlayers then - player:sendCancelMessage("The room is already occupied by other players.") - return true - elseif hasBoss then - clearBossRoom(leverTable.roomFromPosition, leverTable.roomToPosition) - end - - local playerCount = 0 - for i = leverTable.leverFromPos.x, leverTable.leverToPos.x do - local newPos = Position(i, leverTable.leverFromPos.y, leverTable.leverFromPos.z) - local creature = Tile(newPos):getTopCreature() - if creature and creature:isPlayer() then - if creature:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline) >= 6 then - playerCount = playerCount + 1 - table.insert(playersTable, creature:getId()) - else - creature:sendCancelMessage("You are not qualified to face the boss.") - end - end - end - - if playerCount < 5 then - player:sendCancelMessage("You need 5 qualified players for this challenge.") - return true - end - - for _, playerId in ipairs(playersTable) do - local creature = Creature(playerId) - if creature then - creature:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.BrokulTimer, os.time() + 20 * 60 * 60) - creature:teleportTo(leverTable.teleportTo, true) - creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - end - end - - local monster = Game.createMonster(leverTable.bossName, leverTable.bossPosition) - addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, leverTable.roomFromPosition, leverTable.roomToPosition, leverTable.exitPosition) - end - end - end - end - - item:transform(transform[item.itemid]) - return true -end - -actions_liquid_brokulLever:aid(4901) -actions_liquid_brokulLever:register() +local leverBrokul = BossLever(config) +leverBrokul:aid(34000) +leverBrokul:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_oberonLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_oberonLever.lua index c6e6841f714..dce69e4e796 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_oberonLever.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_oberonLever.lua @@ -1,39 +1,26 @@ -local actions_falcon_oberon_lever = Action() +local config = { + boss = { + name = "Grand Master Oberon", + createFunction = function() + Game.createMonster("Grand Master Oberon", Position(33365, 31318, 9), true, true):setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonHeal, 0) + return true + end, + }, + timeToFightAgain = 20 * 60 * 60, + playerPositions = { + { pos = Position(33364, 31344, 9), teleport = Position(33364, 31322, 9) }, + { pos = Position(33362, 31344, 9), teleport = Position(33364, 31322, 9) }, + { pos = Position(33363, 31344, 9), teleport = Position(33364, 31322, 9) }, + { pos = Position(33365, 31344, 9), teleport = Position(33364, 31322, 9) }, + { pos = Position(33366, 31344, 9), teleport = Position(33364, 31322, 9) }, + }, + specPos = { + from = Position(33356, 31311, 9), + to = Position(33376, 31328, 9), + }, + exit = Position(33297, 31285, 9) +} -function actions_falcon_oberon_lever.onUse(player, item, fromPosition, itemEx, toPosition) - local bossName = "Grand Master Oberon" - local playersTable = {} - local fromPosition_ = Position(33356, 31311, 9) - local toPosition_ = Position(33376, 31328, 9) - local exitPosition = Position(33297, 31285, 9) - - if item:getId() == 2772 then - if doCheckBossRoom(player:getId(), bossName, fromPosition_, toPosition_) then - for i = 33362, 33366, 1 do - local newpos = Position(i, 31344, 9) - local nplayer = Tile(newpos):getTopCreature() - if nplayer and nplayer:isPlayer() then - nplayer:teleportTo(Position(33364, 31322, 9), true) - nplayer:getPosition():sendMagicEffect(CONST_ME_TELEPORT) - table.insert(playersTable, nplayer:getId()) - nplayer:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonTimer, os.time() + 20 * 60 * 60) - end - end - local oberon = Game.createMonster("Grand Master Oberon", Position(33365, 31318, 9)) - if oberon then - oberon:setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonHeal, 0) - end - Game.setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonSay, -1) - Game.createNpc("Oberon's Spite", Position(33361, 31320, 9)) - Game.createNpc("Oberon's Ire", Position(33367, 31320, 9)) - Game.createNpc("Oberon's Bile", Position(33361, 31316, 9)) - Game.createNpc("Oberon's Hate", Position(33367, 31316, 9)) - addEvent(kickPlayersAfterTime, 30 * 60 * 1000, playersTable, fromPosition_, toPosition_, exitPosition) - end - end - - return true -end - -actions_falcon_oberon_lever:aid(4922) -actions_falcon_oberon_lever:register() +local leverOberon = BossLever(config) +leverOberon:aid(57605) +leverOberon:register() diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/movements_bossEntrance.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/movements_bossEntrance.lua index 0f000b94e7c..f6068da667b 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/movements_bossEntrance.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/movements_bossEntrance.lua @@ -36,7 +36,7 @@ function movements_falcon_bossEntrance.onStepIn(creature, item, position, fromPo if isInArray(blockedPositions, position) then return true else - if creature:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonTimer) <= os.time() then + if creature:canFightBoss("Grand Master Oberon") then creature:teleportTo(Position(33363, 31341, 9), true) else creature:teleportTo(fromPosition, true) diff --git a/data-otservbr-global/startup/tables/lever.lua b/data-otservbr-global/startup/tables/lever.lua index e7db97ab859..ab887209866 100644 --- a/data-otservbr-global/startup/tables/lever.lua +++ b/data-otservbr-global/startup/tables/lever.lua @@ -16,12 +16,6 @@ LeverAction = { }, }, -- The Secret Library Quest - [4901] = { - itemId = 2772, - itemPos = { - { x = 33522, y = 31464, z = 15 }, - }, - }, [4906] = { itemId = false, itemPos = { @@ -29,12 +23,6 @@ LeverAction = { { x = 33218, y = 32096, z = 10 }, }, }, - [4922] = { - itemId = 2772, - itemPos = { - { x = 33364, y = 31343, z = 9 }, - }, - }, -- Cults of Tibia Quest [5500] = { itemId = 8911, @@ -315,10 +303,6 @@ LeverUnique = { itemPos = { x = 33172, y = 31896, z = 8 }, }, -- Ferumbras' Ascension Quest - [1021] = { - itemId = 8911, - itemPos = { x = 33270, y = 31476, z = 14 }, - }, [1022] = { itemId = 8911, itemPos = { x = 33229, y = 31499, z = 13 }, @@ -547,12 +531,6 @@ LeverUnique = { itemId = 2773, itemPos = { x = 33582, y = 31844, z = 10 }, }, - -- The first dragon quest lever - -- Path: data\scripts\actions\quests\first_dragon\lever.lua - [30003] = { - itemId = 8911, - itemPos = { x = 33583, y = 30992, z = 14 }, - }, -- Thais lighthouse quest -- Path: data\scripts\quests\thais_lighthouse\action-lever.lua [30004] = { diff --git a/data/libs/functions/boss_lever.lua b/data/libs/functions/boss_lever.lua index da3b81d3704..539d53d2577 100644 --- a/data/libs/functions/boss_lever.lua +++ b/data/libs/functions/boss_lever.lua @@ -4,6 +4,7 @@ ---@field private createBoss function ---@field private timeToFightAgain number ---@field private timeToDefeat number +---@field private minPlayers number ---@field private timeAfterKill number ---@field private requiredLevel number ---@field private disabled boolean @@ -29,6 +30,7 @@ local config = { } requiredLevel = 250, timeToFightAgain = 10 * 60 * 60, -- In seconds + minPlayers = 4, playerPositions = { { pos = Position(33638, 32562, 13), teleport = Position(33617, 32567, 13) }, { pos = Position(33639, 32562, 13), teleport = Position(33617, 32567, 13) }, @@ -40,7 +42,7 @@ local config = { from = Position(33607, 32553, 13), to = Position(33627, 32570, 13) }, - onUseExtra = function(player) + onUseExtra = function(player, infoPositions) player:teleportTo(Position(33618, 32523, 15)) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) end, @@ -65,6 +67,7 @@ setmetatable(BossLever, { requiredLevel = config.requiredLevel or 0, createBoss = boss.createFunction, disabled = config.disabled, + minPlayers = config.minPlayers or 1, playerPositions = config.playerPositions, onUseExtra = config.onUseExtra or function() end, exitTeleporter = config.exitTeleporter, @@ -146,22 +149,10 @@ end function BossLever:onUse(player) local monsterName = MonsterType(self.name):getName() local isParticipant = false - local players = {} - - for i = 1, #self.playerPositions do - local pos = self.playerPositions[i].pos - local creature = Tile(pos):getTopCreature() - - if not creature or not creature:isPlayer() then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need " .. #self.playerPositions .. " players to challenge " .. self.name .. ".") - return true - end - - if pos == player:getPosition() then + for _, v in ipairs(self.playerPositions) do + if Position(v.pos) == player:getPosition() then isParticipant = true end - - table.insert(players, creature) end if not isParticipant then return false @@ -194,8 +185,8 @@ function BossLever:onUse(player) return false end + local infoPositions = lever:getInfoPositions() if creature:getGroup():getId() < GROUP_TYPE_GOD and isAccountNormal and self:lastEncounterTime(creature) > os.time() then - local infoPositions = lever:getInfoPositions() for _, posInfo in pairs(infoPositions) do local currentPlayer = posInfo.creature if currentPlayer then @@ -218,11 +209,18 @@ function BossLever:onUse(player) return false end - self.onUseExtra(creature) - return true + return self.onUseExtra(creature, infoPositions) ~= false end) lever:checkPositions() + if #lever:getPlayers() < self.minPlayers then + lever:executeOnPlayers(function(creature) + local message = string.format("You need %d qualified players for this challenge.", self.minPlayers) + creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) + creature:getPosition():sendMagicEffect(CONST_ME_POFF) + end) + return false + end if lever:checkConditions() then zone:removeMonsters() for _, monster in pairs(self.monsters) do @@ -315,4 +313,4 @@ function BossLever:register() SimpleTeleport(self.exitTeleporter, self.exit) end return true -end +end \ No newline at end of file diff --git a/data/libs/functions/lever.lua b/data/libs/functions/lever.lua index 54e6e5c4915..154f8560fdf 100644 --- a/data/libs/functions/lever.lua +++ b/data/libs/functions/lever.lua @@ -5,6 +5,7 @@ setmetatable(Lever, { local lever_data = { positions = {}, info_positions = nil, + players = {}, condition = function() return true end, @@ -51,6 +52,19 @@ function Lever.getInfoPositions(self) return self.info_positions end +---@return table +function Lever.getPlayers(self) + return self.players +end + +---@param player Player +---@return nil +function Lever.addPlayer(self, player) + if player and player:isPlayer() then + table.insert(self.players, player) + end +end + --[[ lever:setCondition(function(creature)) @@ -109,6 +123,7 @@ function Lever:checkPositions() local ground = tile:getGround() local actionID = ground:getActionId() local uniqueID = ground:getUniqueId() + self:addPlayer(creature) table.insert(array, { tile = tile, creature = creature, @@ -140,6 +155,13 @@ function Lever.checkConditions(self) -- It will check the conditions defined in return true end +function Lever.executeOnPlayers(self, func) + for _, player in pairs(self:getPlayers()) do + print(player:getName()) + func(player) + end +end + ---@return nil function Lever.teleportPlayers(self) -- It will teleport all players to the positions defined in setPositions() local info = self:getInfoPositions() From 342c5a42ec6cf271ae3c5dfef04020bc8e9e097c Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 30 Oct 2024 13:31:55 +0000 Subject: [PATCH 68/70] Lua code format - (Stylua) --- .../actions_ferumbras_lever.lua | 56 +++++++++---------- .../ferumbras_ascension/actions_rat_lever.lua | 2 +- .../liquid_death/actions_brokulLever.lua | 14 ++--- .../actions_oberonLever.lua | 18 +++--- data/libs/functions/boss_lever.lua | 16 +++--- data/libs/functions/lever.lua | 14 ++--- 6 files changed, 60 insertions(+), 60 deletions(-) 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 916d7efd816..bd4e2b171fe 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,29 +1,29 @@ local config = { boss = { name = "Ascending Ferumbras", - position = Position(33392, 31473, 14) + position = Position(33392, 31473, 14), }, timeToFightAgain = 60 * 60 * 20 * 24, playerPositions = { - { pos = Position(33270, 31477, 14), teleport = Position(33392, 31479, 14) }, - { pos = Position(33269, 31477, 14), teleport = Position(33392, 31479, 14) }, - { pos = Position(33269, 31478, 14), teleport = Position(33392, 31479, 14) }, - { pos = Position(33269, 31479, 14), teleport = Position(33392, 31479, 14) }, - { pos = Position(33269, 31480, 14), teleport = Position(33392, 31479, 14) }, - { pos = Position(33269, 31481, 14), teleport = Position(33392, 31479, 14) }, - { pos = Position(33270, 31478, 14), teleport = Position(33392, 31479, 14) }, - { pos = Position(33270, 31479, 14), teleport = Position(33392, 31479, 14) }, - { pos = Position(33270, 31480, 14), teleport = Position(33392, 31479, 14) }, - { pos = Position(33270, 31481, 14), teleport = Position(33392, 31479, 14) }, - { pos = Position(33271, 31477, 14), teleport = Position(33392, 31479, 14) }, - { pos = Position(33271, 31478, 14), teleport = Position(33392, 31479, 14) }, - { pos = Position(33271, 31479, 14), teleport = Position(33392, 31479, 14) }, - { pos = Position(33271, 31480, 14), teleport = Position(33392, 31479, 14) }, - { pos = Position(33271, 31481, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33270, 31477, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33269, 31477, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33269, 31478, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33269, 31479, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33269, 31480, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33269, 31481, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33270, 31478, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33270, 31479, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33270, 31480, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33270, 31481, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33271, 31477, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33271, 31478, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33271, 31479, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33271, 31480, 14), teleport = Position(33392, 31479, 14) }, + { pos = Position(33271, 31481, 14), teleport = Position(33392, 31479, 14) }, }, specPos = { from = Position(33379, 31460, 14), - to = Position(33405, 31485, 14) + to = Position(33405, 31485, 14), }, exit = Position(33319, 32318, 13), monsters = { @@ -40,17 +40,17 @@ local config = { }, onUseExtra = function(player) 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 }, - } - Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Crystals.AllCrystals, 0) - Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasEssence, 0) + [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 }, + } + Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Crystals.AllCrystals, 0) + Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasEssence, 0) for _, crystal in pairs(crystals) do local tile = Tile(crystal.crystalPosition) if tile then 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 ebb5f307922..97cb6fef4f9 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 @@ -5,7 +5,7 @@ local config = { }, timeToFightAgain = 2 * 24 * 60 * 60, playerPositions = { - { pos = Position(33201, 31475, 11), teleport = Position(33215, 31470, 12) }, + { pos = Position(33201, 31475, 11), teleport = Position(33215, 31470, 12) }, { pos = Position(33197, 31475, 11), teleport = Position(33215, 31470, 12) }, { pos = Position(33198, 31475, 11), teleport = Position(33215, 31470, 12) }, { pos = Position(33199, 31475, 11), teleport = Position(33215, 31470, 12) }, diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua index f66a45050af..7605d7bf8ff 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/liquid_death/actions_brokulLever.lua @@ -6,7 +6,7 @@ local config = { timeToFightAgain = 20 * 60 * 60, --minPlayers = 5, playerPositions = { - { pos = Position(33522, 31465, 15), teleport = Position(33484, 31446, 15) }, + { pos = Position(33522, 31465, 15), teleport = Position(33484, 31446, 15) }, { pos = Position(33520, 31465, 15), teleport = Position(33484, 31446, 15) }, { pos = Position(33521, 31465, 15), teleport = Position(33484, 31446, 15) }, { pos = Position(33523, 31465, 15), teleport = Position(33484, 31446, 15) }, @@ -18,12 +18,12 @@ local config = { }, exit = Position(33528, 31464, 14), onUseExtra = function(creature, infoPositions) - if creature and creature:isPlayer() then - if creature:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline) >= 6 then - return true - end - return false - end + if creature and creature:isPlayer() then + if creature:getStorageValue(Storage.Quest.U11_80.TheSecretLibrary.LiquidDeath.Questline) >= 6 then + return true + end + return false + end end, } diff --git a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_oberonLever.lua b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_oberonLever.lua index dce69e4e796..e736be79de5 100644 --- a/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_oberonLever.lua +++ b/data-otservbr-global/scripts/quests/the_secret_library_quest/the_order_of_the_falcon/actions_oberonLever.lua @@ -2,23 +2,23 @@ local config = { boss = { name = "Grand Master Oberon", createFunction = function() - Game.createMonster("Grand Master Oberon", Position(33365, 31318, 9), true, true):setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonHeal, 0) - return true - end, + Game.createMonster("Grand Master Oberon", Position(33365, 31318, 9), true, true):setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.FalconBastion.OberonHeal, 0) + return true + end, }, timeToFightAgain = 20 * 60 * 60, playerPositions = { - { pos = Position(33364, 31344, 9), teleport = Position(33364, 31322, 9) }, - { pos = Position(33362, 31344, 9), teleport = Position(33364, 31322, 9) }, - { pos = Position(33363, 31344, 9), teleport = Position(33364, 31322, 9) }, - { pos = Position(33365, 31344, 9), teleport = Position(33364, 31322, 9) }, - { pos = Position(33366, 31344, 9), teleport = Position(33364, 31322, 9) }, + { pos = Position(33364, 31344, 9), teleport = Position(33364, 31322, 9) }, + { pos = Position(33362, 31344, 9), teleport = Position(33364, 31322, 9) }, + { pos = Position(33363, 31344, 9), teleport = Position(33364, 31322, 9) }, + { pos = Position(33365, 31344, 9), teleport = Position(33364, 31322, 9) }, + { pos = Position(33366, 31344, 9), teleport = Position(33364, 31322, 9) }, }, specPos = { from = Position(33356, 31311, 9), to = Position(33376, 31328, 9), }, - exit = Position(33297, 31285, 9) + exit = Position(33297, 31285, 9), } local leverOberon = BossLever(config) diff --git a/data/libs/functions/boss_lever.lua b/data/libs/functions/boss_lever.lua index 539d53d2577..4b43fe4179b 100644 --- a/data/libs/functions/boss_lever.lua +++ b/data/libs/functions/boss_lever.lua @@ -214,13 +214,13 @@ function BossLever:onUse(player) lever:checkPositions() if #lever:getPlayers() < self.minPlayers then - lever:executeOnPlayers(function(creature) - local message = string.format("You need %d qualified players for this challenge.", self.minPlayers) - creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) - creature:getPosition():sendMagicEffect(CONST_ME_POFF) - end) - return false - end + lever:executeOnPlayers(function(creature) + local message = string.format("You need %d qualified players for this challenge.", self.minPlayers) + creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, message) + creature:getPosition():sendMagicEffect(CONST_ME_POFF) + end) + return false + end if lever:checkConditions() then zone:removeMonsters() for _, monster in pairs(self.monsters) do @@ -313,4 +313,4 @@ function BossLever:register() SimpleTeleport(self.exitTeleporter, self.exit) end return true -end \ No newline at end of file +end diff --git a/data/libs/functions/lever.lua b/data/libs/functions/lever.lua index 154f8560fdf..84f918a3f14 100644 --- a/data/libs/functions/lever.lua +++ b/data/libs/functions/lever.lua @@ -60,9 +60,9 @@ end ---@param player Player ---@return nil function Lever.addPlayer(self, player) - if player and player:isPlayer() then - table.insert(self.players, player) - end + if player and player:isPlayer() then + table.insert(self.players, player) + end end --[[ @@ -156,10 +156,10 @@ function Lever.checkConditions(self) -- It will check the conditions defined in end function Lever.executeOnPlayers(self, func) - for _, player in pairs(self:getPlayers()) do - print(player:getName()) - func(player) - end + for _, player in pairs(self:getPlayers()) do + print(player:getName()) + func(player) + end end ---@return nil From 4c7c51ef444d337db42b4bb181badc466483f139 Mon Sep 17 00:00:00 2001 From: Glatharth Date: Fri, 1 Nov 2024 15:49:19 -0300 Subject: [PATCH 69/70] minor fix --- .../quests/the_first_dragon/actions_lever.lua | 20 +++++++++---------- data/libs/functions/lever.lua | 1 - 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua b/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua index 64acffb65c6..ff4c20ff88d 100644 --- a/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua +++ b/data-otservbr-global/scripts/quests/the_first_dragon/actions_lever.lua @@ -26,16 +26,16 @@ local config = { to = Position(33626, 31032, 14), }, monsters = { - { position = Position(33574, 31013, 14), monster = "fallen challenger" }, - { position = Position(33592, 31013, 14), monster = "fallen challenger" }, - { position = Position(33583, 31022, 14), monster = "fallen challenger" }, - { position = Position(33574, 31031, 14), monster = "fallen challenger" }, - { position = Position(33592, 31031, 14), monster = "fallen challenger" }, - { position = Position(math.random(33610, 33622), math.random(31016, 31030), 14), monster = "unbeatable dragon" }, - { position = Position(math.random(33610, 33622), math.random(31016, 31030), 14), monster = "unbeatable dragon" }, - { position = Position(math.random(33610, 33622), math.random(31016, 31030), 14), monster = "unbeatable dragon" }, - { position = Position(math.random(33610, 33622), math.random(31016, 31030), 14), monster = "unbeatable dragon" }, - { position = Position(math.random(33610, 33622), math.random(31016, 31030), 14), monster = "unbeatable dragon" }, + { name = "fallen challenger", pos = Position(33592, 31013, 14) }, + { name = "fallen challenger", pos = Position(33583, 31022, 14) }, + { name = "fallen challenger", pos = Position(33574, 31013, 14) }, + { name = "fallen challenger", pos = Position(33574, 31031, 14) }, + { name = "fallen challenger", pos = Position(33592, 31031, 14) }, + { name = "unbeatable dragon", pos = Position(math.random(33610, 33622), math.random(31016, 31030), 14) }, + { name = "unbeatable dragon", pos = Position(math.random(33610, 33622), math.random(31016, 31030), 14) }, + { name = "unbeatable dragon", pos = Position(math.random(33610, 33622), math.random(31016, 31030), 14) }, + { name = "unbeatable dragon", pos = Position(math.random(33610, 33622), math.random(31016, 31030), 14) }, + { name = "unbeatable dragon", pos = Position(math.random(33610, 33622), math.random(31016, 31030), 14) }, }, exit = Position(33597, 30994, 14), onUseExtra = function(creature) diff --git a/data/libs/functions/lever.lua b/data/libs/functions/lever.lua index 154f8560fdf..8b166295282 100644 --- a/data/libs/functions/lever.lua +++ b/data/libs/functions/lever.lua @@ -157,7 +157,6 @@ end function Lever.executeOnPlayers(self, func) for _, player in pairs(self:getPlayers()) do - print(player:getName()) func(player) end end From c1b635b042b17583f97e0bed2e0dbe5b33c467e6 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Fri, 1 Nov 2024 18:53:51 +0000 Subject: [PATCH 70/70] Lua code format - (Stylua) --- data/libs/functions/lever.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/libs/functions/lever.lua b/data/libs/functions/lever.lua index b6eefc7b955..39802af49d2 100644 --- a/data/libs/functions/lever.lua +++ b/data/libs/functions/lever.lua @@ -156,9 +156,9 @@ function Lever.checkConditions(self) -- It will check the conditions defined in end function Lever.executeOnPlayers(self, func) - for _, player in pairs(self:getPlayers()) do - func(player) - end + for _, player in pairs(self:getPlayers()) do + func(player) + end end ---@return nil