From 830059cba6a2b34edebbb14f049675cfaaa03183 Mon Sep 17 00:00:00 2001 From: ceikry Date: Mon, 26 Jul 2021 09:46:07 -0500 Subject: [PATCH] Fixed an NPE with pest control bots --- .../src/main/java/core/game/world/map/RegionManager.kt | 3 --- .../pestcontrol/PestControlIntermediateBot.kt | 9 ++++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Server/src/main/java/core/game/world/map/RegionManager.kt b/Server/src/main/java/core/game/world/map/RegionManager.kt index 1947271bf..50f77a212 100644 --- a/Server/src/main/java/core/game/world/map/RegionManager.kt +++ b/Server/src/main/java/core/game/world/map/RegionManager.kt @@ -37,9 +37,6 @@ object RegionManager { var region = REGION_CACHE[regionId] if (region == null) { region = Region((regionId shr 8) and 0xFF, regionId and 0xFF) - if (region!!.regionId != regionId) { - SystemLogger.logErr("IDs do NOT match - ${region!!.regionId} supposed to be $regionId") - } REGION_CACHE[regionId] = region } LOCK.unlock() diff --git a/Server/src/main/kotlin/rs09/game/ai/minigamebots/pestcontrol/PestControlIntermediateBot.kt b/Server/src/main/kotlin/rs09/game/ai/minigamebots/pestcontrol/PestControlIntermediateBot.kt index 812140aa0..3f19a5335 100644 --- a/Server/src/main/kotlin/rs09/game/ai/minigamebots/pestcontrol/PestControlIntermediateBot.kt +++ b/Server/src/main/kotlin/rs09/game/ai/minigamebots/pestcontrol/PestControlIntermediateBot.kt @@ -98,7 +98,10 @@ class PestControlTestBot2(l: Location) : PvMBots(legitimizeLocation(l)) { combathandler.goToPortals() } else { movetimer = RandomFunction.random(2,10) - randomWalkAroundPoint(PestControlHelper.getMyPestControlSession2(this)?.squire?.location ?: location,5) + val location = PestControlHelper.getMyPestControlSession2(this)?.squire?.location ?: location + if(location != null) { + randomWalkAroundPoint(location, 5) + } combathandler.fightNPCs() } } @@ -108,7 +111,7 @@ class PestControlTestBot2(l: Location) : PvMBots(legitimizeLocation(l)) { justStartedGame = true openedGate = false time = 0 - if (!prayer.active.isEmpty()) { + if (prayer.active.isNotEmpty()) { prayer.reset() } if (PestControlHelper.outsideGangplankContainsLoc2(getLocation())){ @@ -168,7 +171,7 @@ class PestControlTestBot2(l: Location) : PvMBots(legitimizeLocation(l)) { } var switch = false - fun toPC() { + private fun toPC() { time = 0 if (!switch) { this.teleport(PestControlHelper.PestControlLanderIntermediate)//.also { println("I was stuck ${this.username}") }