From d87d3e2f419285a84ca0b39a0e919517a7036ae1 Mon Sep 17 00:00:00 2001 From: kevin Date: Sat, 17 Aug 2024 15:22:20 -0400 Subject: [PATCH] Fixed bug in camp selection for zone leveling --- src/engine/devcmd/cmds/SetCampLevelCmd.java | 22 ++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/engine/devcmd/cmds/SetCampLevelCmd.java b/src/engine/devcmd/cmds/SetCampLevelCmd.java index 9c0e8fe3..22dab7fc 100644 --- a/src/engine/devcmd/cmds/SetCampLevelCmd.java +++ b/src/engine/devcmd/cmds/SetCampLevelCmd.java @@ -2,9 +2,7 @@ package engine.devcmd.cmds; import engine.devcmd.AbstractDevCmd; import engine.gameManager.ZoneManager; -import engine.objects.AbstractGameObject; -import engine.objects.PlayerCharacter; -import engine.objects.Zone; +import engine.objects.*; public class SetCampLevelCmd extends AbstractDevCmd { public SetCampLevelCmd() { super("setcamplevel"); } @@ -17,13 +15,19 @@ public class SetCampLevelCmd extends AbstractDevCmd { this.sendUsage(pcSender); } - // Get the current occupied camp - Zone playerZone = ZoneManager.findSmallestZone(pcSender.loc); + if (!(target instanceof Mob)) + { + throwbackError(pcSender, "Must target a MOB while setting camp level!"); + return; + } + + // Get the camp that owns the targeted Mob + Zone campZone = ((Mob)target).parentZone; // Make sure that the zone we're targeting is valid for action - if (playerZone == null || - playerZone.zoneMobSet.isEmpty() || - playerZone.isPlayerCity()) + if (campZone == null || + campZone.zoneMobSet.isEmpty() || + campZone.isPlayerCity()) { throwbackError(pcSender, "Current zone must own mobs, and NOT be a city."); return; @@ -46,7 +50,7 @@ public class SetCampLevelCmd extends AbstractDevCmd { } } - playerZone.setCampLvl(targetLevel); + campZone.setCampLvl(targetLevel); } @Override