diff --git a/data-otservbr-global/lib/quests/soul_war.lua b/data-otservbr-global/lib/quests/soul_war.lua index 7ebe42b0441..aa71fc36d95 100644 --- a/data-otservbr-global/lib/quests/soul_war.lua +++ b/data-otservbr-global/lib/quests/soul_war.lua @@ -680,6 +680,39 @@ SoulWarQuest = { }, } +function RegisterSoulWarBossesLevers() + -- Register levers + local goshnarsMaliceLever = BossLever(SoulWarQuest.levers.goshnarsMalice) + goshnarsMaliceLever:position(SoulWarQuest.levers.goshnarsMalicePosition) + goshnarsMaliceLever:register() + logger.debug("Registering soul war boss lever zone: {}", goshnarsMaliceLever:getZone():getName()) + + local goshnarsSpiteLever = BossLever(SoulWarQuest.levers.goshnarsSpite) + goshnarsSpiteLever:position(SoulWarQuest.levers.goshnarsSpitePosition) + goshnarsSpiteLever:register() + logger.debug("Registering soul war boss lever zone: {}", goshnarsSpiteLever:getZone():getName()) + + local goshnarsGreedLever = BossLever(SoulWarQuest.levers.goshnarsGreed) + goshnarsGreedLever:position(SoulWarQuest.levers.goshnarsGreedPosition) + goshnarsGreedLever:register() + logger.debug("Registering soul war boss lever zone: {}", goshnarsGreedLever:getZone():getName()) + + local goshnarsHatredLever = BossLever(SoulWarQuest.levers.goshnarsHatred) + goshnarsHatredLever:position(SoulWarQuest.levers.goshnarsHatredPosition) + goshnarsHatredLever:register() + logger.debug("Registering soul war boss lever zone: {}", goshnarsHatredLever:getZone():getName()) + + local goshnarsCrueltyLever = BossLever(SoulWarQuest.levers.goshnarsCruelty) + goshnarsCrueltyLever:position(SoulWarQuest.levers.goshnarsCrueltyPosition) + goshnarsCrueltyLever:register() + logger.debug("Registering soul war boss lever zone: {}", goshnarsCrueltyLever:getZone():getName()) + + local goshnarsMegalomaniaLever = BossLever(SoulWarQuest.levers.goshnarsMegalomania) + goshnarsMegalomaniaLever:position(SoulWarQuest.levers.goshnarsMegalomaniaPosition) + goshnarsMegalomaniaLever:register() + logger.debug("Registering soul war boss lever zone: {}", goshnarsMegalomaniaLever:getZone():getName()) +end + -- Initialize ebb and flow zone area SoulWarQuest.ebbAndFlow.zone:addArea({ x = 33869, y = 30991, z = 8 }, { x = 33964, y = 31147, z = 9 }) diff --git a/data-otservbr-global/scripts/quests/soul_war/soul_war_mechanics.lua b/data-otservbr-global/scripts/quests/soul_war/soul_war_mechanics.lua index 9f8c5c4f031..bc6d6a7e920 100644 --- a/data-otservbr-global/scripts/quests/soul_war/soul_war_mechanics.lua +++ b/data-otservbr-global/scripts/quests/soul_war/soul_war_mechanics.lua @@ -1,34 +1,3 @@ --- Register levers -local goshnarsMaliceLever = BossLever(SoulWarQuest.levers.goshnarsMalice) -goshnarsMaliceLever:position(SoulWarQuest.levers.goshnarsMalicePosition) -goshnarsMaliceLever:register() -logger.debug("Registering soul war boss lever zone: {}", goshnarsMaliceLever:getZone():getName()) - -local goshnarsSpiteLever = BossLever(SoulWarQuest.levers.goshnarsSpite) -goshnarsSpiteLever:position(SoulWarQuest.levers.goshnarsSpitePosition) -goshnarsSpiteLever:register() -logger.debug("Registering soul war boss lever zone: {}", goshnarsSpiteLever:getZone():getName()) - -local goshnarsGreedLever = BossLever(SoulWarQuest.levers.goshnarsGreed) -goshnarsGreedLever:position(SoulWarQuest.levers.goshnarsGreedPosition) -goshnarsGreedLever:register() -logger.debug("Registering soul war boss lever zone: {}", goshnarsGreedLever:getZone():getName()) - -local goshnarsHatredLever = BossLever(SoulWarQuest.levers.goshnarsHatred) -goshnarsHatredLever:position(SoulWarQuest.levers.goshnarsHatredPosition) -goshnarsHatredLever:register() -logger.debug("Registering soul war boss lever zone: {}", goshnarsHatredLever:getZone():getName()) - -local goshnarsCrueltyLever = BossLever(SoulWarQuest.levers.goshnarsCruelty) -goshnarsCrueltyLever:position(SoulWarQuest.levers.goshnarsCrueltyPosition) -goshnarsCrueltyLever:register() -logger.debug("Registering soul war boss lever zone: {}", goshnarsCrueltyLever:getZone():getName()) - -local goshnarsMegalomaniaLever = BossLever(SoulWarQuest.levers.goshnarsMegalomania) -goshnarsMegalomaniaLever:position(SoulWarQuest.levers.goshnarsMegalomaniaPosition) -goshnarsMegalomaniaLever:register() -logger.debug("Registering soul war boss lever zone: {}", goshnarsMegalomaniaLever:getZone():getName()) - local login = CreatureEvent("SoulWarLogin") function login.onLogin(player) diff --git a/data/scripts/lib/quests.lua b/data/scripts/lib/quests.lua new file mode 100644 index 00000000000..08005e34ae2 --- /dev/null +++ b/data/scripts/lib/quests.lua @@ -0,0 +1,2 @@ +-- We need to register the variables beforehand to avoid accessing null values. +RegisterSoulWarBossesLevers()