Browse Source

Fixed bug in camp selection for zone leveling

NovaTest
kevin 4 months ago
parent
commit
d87d3e2f41
  1. 22
      src/engine/devcmd/cmds/SetCampLevelCmd.java

22
src/engine/devcmd/cmds/SetCampLevelCmd.java

@ -2,9 +2,7 @@ package engine.devcmd.cmds; @@ -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 { @@ -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 { @@ -46,7 +50,7 @@ public class SetCampLevelCmd extends AbstractDevCmd {
}
}
playerZone.setCampLvl(targetLevel);
campZone.setCampLvl(targetLevel);
}
@Override

Loading…
Cancel
Save