Fixed an NPE with pest control bots

This commit is contained in:
ceikry
2021-07-26 09:46:07 -05:00
parent c2e9cde82e
commit 830059cba6
2 changed files with 6 additions and 6 deletions
@@ -37,9 +37,6 @@ object RegionManager {
var region = REGION_CACHE[regionId] var region = REGION_CACHE[regionId]
if (region == null) { if (region == null) {
region = Region((regionId shr 8) and 0xFF, regionId and 0xFF) 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 REGION_CACHE[regionId] = region
} }
LOCK.unlock() LOCK.unlock()
@@ -98,7 +98,10 @@ class PestControlTestBot2(l: Location) : PvMBots(legitimizeLocation(l)) {
combathandler.goToPortals() combathandler.goToPortals()
} else { } else {
movetimer = RandomFunction.random(2,10) 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() combathandler.fightNPCs()
} }
} }
@@ -108,7 +111,7 @@ class PestControlTestBot2(l: Location) : PvMBots(legitimizeLocation(l)) {
justStartedGame = true justStartedGame = true
openedGate = false openedGate = false
time = 0 time = 0
if (!prayer.active.isEmpty()) { if (prayer.active.isNotEmpty()) {
prayer.reset() prayer.reset()
} }
if (PestControlHelper.outsideGangplankContainsLoc2(getLocation())){ if (PestControlHelper.outsideGangplankContainsLoc2(getLocation())){
@@ -168,7 +171,7 @@ class PestControlTestBot2(l: Location) : PvMBots(legitimizeLocation(l)) {
} }
var switch = false var switch = false
fun toPC() { private fun toPC() {
time = 0 time = 0
if (!switch) { if (!switch) {
this.teleport(PestControlHelper.PestControlLanderIntermediate)//.also { println("I was stuck ${this.username}") } this.teleport(PestControlHelper.PestControlLanderIntermediate)//.also { println("I was stuck ${this.username}") }