Fixed bug in camp selection for zone leveling

This commit is contained in:
2024-08-17 15:22:20 -04:00
parent edf11f166f
commit d87d3e2f41
+13 -9
View File
@@ -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