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