package NET.worlds.console; import NET.worlds.scape.HoloDrone; import NET.worlds.scape.Room; import NET.worlds.scape.World; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; public class BBAppearDroneCommand extends BlackBoxCommand { private short x; private short y; private short z; private short dir; private String room; private String name; public BBAppearDroneCommand(String roomName, String pName, short px, short py, short pz, short pdir) { this(); this.x = px; this.y = py; this.z = pz; this.dir = pdir; this.room = new String(roomName); this.name = new String(pName); } public BBAppearDroneCommand() { this.commandType = 5; } @Override public boolean execute() { HoloDrone d = new HoloDrone(null, null); d.setName(this.name); Room r = World.findRoomByName(this.room); if (r != null) { d.appear(r, this.x, this.y, this.z, this.dir); d.makeTag(true); ArmyOfZombies.instance().addZombie(d); this.doCallback(true); } else { this.doCallback(false); } return true; } @Override public void save(DataOutputStream dos) throws IOException { super.save(dos); dos.writeShort(this.x); dos.writeShort(this.y); dos.writeShort(this.z); dos.writeShort(this.dir); dos.writeUTF(this.room); dos.writeUTF(this.name); } @Override public void load(DataInputStream dis) throws IOException { super.load(dis); this.x = dis.readShort(); this.y = dis.readShort(); this.z = dis.readShort(); this.dir = dis.readShort(); this.room = new String(dis.readUTF()); this.name = new String(dis.readUTF()); } }