Skip to content

Commit

Permalink
fix: nil value with boss levers
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas committed Apr 16, 2024
1 parent c3bbf05 commit cd7a82c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 31 deletions.
33 changes: 33 additions & 0 deletions data-otservbr-global/lib/quests/soul_war.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 })

Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 2 additions & 0 deletions data/scripts/lib/quests.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- We need to register the variables beforehand to avoid accessing null values.
RegisterSoulWarBossesLevers()

0 comments on commit cd7a82c

Please sign in to comment.