Browse Source

Fixed bug in camp selection for zone leveling

NovaTest
kevin 3 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;
import engine.devcmd.AbstractDevCmd; import engine.devcmd.AbstractDevCmd;
import engine.gameManager.ZoneManager; import engine.gameManager.ZoneManager;
import engine.objects.AbstractGameObject; import engine.objects.*;
import engine.objects.PlayerCharacter;
import engine.objects.Zone;
public class SetCampLevelCmd extends AbstractDevCmd { public class SetCampLevelCmd extends AbstractDevCmd {
public SetCampLevelCmd() { super("setcamplevel"); } public SetCampLevelCmd() { super("setcamplevel"); }
@ -17,13 +15,19 @@ public class SetCampLevelCmd extends AbstractDevCmd {
this.sendUsage(pcSender); this.sendUsage(pcSender);
} }
// Get the current occupied camp if (!(target instanceof Mob))
Zone playerZone = ZoneManager.findSmallestZone(pcSender.loc); {
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 // Make sure that the zone we're targeting is valid for action
if (playerZone == null || if (campZone == null ||
playerZone.zoneMobSet.isEmpty() || campZone.zoneMobSet.isEmpty() ||
playerZone.isPlayerCity()) campZone.isPlayerCity())
{ {
throwbackError(pcSender, "Current zone must own mobs, and NOT be a city."); throwbackError(pcSender, "Current zone must own mobs, and NOT be a city.");
return; return;
@ -46,7 +50,7 @@ public class SetCampLevelCmd extends AbstractDevCmd {
} }
} }
playerZone.setCampLvl(targetLevel); campZone.setCampLvl(targetLevel);
} }
@Override @Override

Loading…
Cancel
Save