package NET.worlds.console; import NET.worlds.scape.Drone; import NET.worlds.scape.Pilot; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; public class BBAnimateDroneCommand extends BlackBoxCommand { private String animation; private String droneName; public BBAnimateDroneCommand() { this.commandType = 9; } public BBAnimateDroneCommand(String drone, String cmd) { this(); this.animation = new String(cmd); this.droneName = new String(drone); } @Override public boolean execute() { if (this.droneName.equals("@Pilot")) { Pilot p = Pilot.getActive(); if (p != null) { p.animate(this.animation); } } else { Drone d = ArmyOfZombies.instance().get(this.droneName); if (d != null) { d.animate(this.animation); } } this.doCallback(true); return true; } @Override public void save(DataOutputStream dos) throws IOException { super.save(dos); dos.writeUTF(this.animation); dos.writeUTF(this.droneName); } @Override public void load(DataInputStream dis) throws IOException { super.load(dis); this.animation = new String(dis.readUTF()); this.droneName = new String(dis.readUTF()); } }