diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/creaturescripts_bosses_kill.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/creaturescripts_bosses_kill.lua index 2c162c243c8..2c9515d9786 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/creaturescripts_bosses_kill.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/creaturescripts_bosses_kill.lua @@ -67,10 +67,18 @@ local crystals = { } local function transformCrystal(player) + if type(player) ~= "userdata" or not player:isPlayer() then + print("[Error] transformCrystal: invalid player argument") + return + end + for c = 1, #crystals do local crystal = crystals[c] player:setStorageValue(crystal.globalStorage, 0) + Game.setStorageValue(crystal.globalStorage, 0) player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Crystals.AllCrystals, 0) + Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Crystals.AllCrystals, 0) + local item = Tile(crystal.crystalPosition):getItemById(14961) if item then item:transform(14955) @@ -110,22 +118,31 @@ function ascendantBossesKill.onDeath(creature) local cooldownTime = bossConfig.cooldown * 3600 local nextAvailableTime = os.time() + cooldownTime player:setStorageValue(bossConfig.storage, nextAvailableTime) + local cooldownMessage = formatCooldownMessage(bossConfig.cooldown) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have defeated " .. bossName .. ". You can challenge this boss again in " .. cooldownMessage .. ".") end end) + -- Handle teleport transformation local teleport = Tile(bossConfig.teleportPos):getItemById(1949) if teleport then teleport:transform(22761) teleport:getPosition():sendMagicEffect(CONST_ME_THUNDER) teleport:setDestination(bossConfig.godbreakerPos) + addEvent(revertTeleport, 1 * 60 * 1000, bossConfig.teleportPos, 22761, 1949, Position(33319, 32318, 13)) end + -- Special case for Ferumbras Mortal Shell if creature:getName():lower() == "ferumbras mortal shell" then onDeathForDamagingPlayers(creature, function(creature, player) - addEvent(transformCrystal, 2 * 60 * 1000, player) + addEvent(function(playerId) + local player = Player(playerId) + if player then + transformCrystal(player) + end + end, 2 * 60 * 1000, player:getId()) end) end diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/creaturescripts_rift_invader_death.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/creaturescripts_rift_invader_death.lua index ecd56ef0467..b9d86f05071 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/creaturescripts_rift_invader_death.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/creaturescripts_rift_invader_death.lua @@ -23,26 +23,26 @@ function riftInvaderDeath.onDeath(creature, corpse, lasthitkiller, mostdamagekil for i = 1, #crystals do local crystal = crystals[i] if creature:getPosition():isInRange(crystal.fromPosition, crystal.toPosition) then - if player:getStorageValue(crystal.globalStorage) > 8 then + if Game.getStorageValue(crystal.globalStorage) > 8 then local item = Tile(crystal.crystalPosition):getItemById(14955) if not item then return true end item:transform(14961) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Crystals.AllCrystals, player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Crystals.AllCrystals) + 1) + Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Crystals.AllCrystals, Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Crystals.AllCrystals) + 1) end - if player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Crystals.AllCrystals) == 8 then + if Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.Crystals.AllCrystals) == 8 then local creature = Tile(config.bossPos):getTopCreature() creature:say("NOOOOOOOOOOO!", TALKTYPE_MONSTER_YELL) creature:say("FERUMBRAS BURSTS INTO SOUL SPLINTERS!", TALKTYPE_MONSTER_YELL, nil, nil, Position(33392, 31475, 14)) creature:remove() for a = 1, #crystals do - local crystalEffect = crystals[i] + local crystalEffect = crystals[a] crystalEffect.crystalPosition:sendMagicEffect(CONST_ME_FERUMBRAS) Game.createMonster("Ferumbras Soul Splinter", Position(33392, 31473, 14), false, true) end end - player:setStorageValue(crystal.globalStorage, player:getStorageValue(crystal.globalStorage) + 1) + Game.setStorageValue(crystal.globalStorage, Game.getStorageValue(crystal.globalStorage) + 1) lasthitkiller:say("The negative energy of the rift creature is absorbed by the crystal!", TALKTYPE_MONSTER_SAY, nil, nil, crystal.crystalPosition) lasthitkiller:say("ARGH!", TALKTYPE_MONSTER_SAY, nil, nil, Position(33392, 31473, 14)) end diff --git a/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_vortex.lua b/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_vortex.lua index 6a001370f7c..c89c03e6411 100644 --- a/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_vortex.lua +++ b/data-otservbr-global/scripts/quests/ferumbras_ascension/movements_vortex.lua @@ -10,8 +10,8 @@ function vortex.onStepIn(creature, item, position, fromPosition) monster:remove() position:sendMagicEffect(CONST_ME_POFF) - player:setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasEssence, player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasEssence) + 1) - if player:getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasEssence) >= 8 then + Game.setStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasEssence, Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasEssence) + 1) + if Game.getStorageValue(Storage.Quest.U10_90.FerumbrasAscension.FerumbrasEssence) >= 8 then Game.createMonster("Destabilized Ferumbras", config.bossPos, true, true) for i = 1, config.maxSummon do Game.createMonster("Rift Fragment", Position(math.random(33381, 33403), math.random(31462, 31483), 14), true, true)