/* */ package NET.worlds.scape; /* */ /* */ import NET.worlds.console.BBAppearDroneCommand; /* */ import NET.worlds.console.BBDisappearDroneCommand; /* */ import NET.worlds.console.BBDroneBitmapCommand; /* */ import NET.worlds.console.BBDroneDeltaPosCommand; /* */ import NET.worlds.console.BBMoveDroneCommand; /* */ import NET.worlds.console.BlackBox; /* */ import NET.worlds.console.Console; /* */ import NET.worlds.console.FriendsListPart; /* */ import NET.worlds.console.Main; /* */ import NET.worlds.console.MainCallback; /* */ import NET.worlds.console.MuteListPart; /* */ import NET.worlds.core.IniFile; /* */ import NET.worlds.core.ServerTableManager; /* */ import NET.worlds.core.Std; /* */ import NET.worlds.network.FilthFilter; /* */ import NET.worlds.network.Galaxy; /* */ import NET.worlds.network.InfiniteWaitException; /* */ import NET.worlds.network.NetworkObject; /* */ import NET.worlds.network.ObjID; /* */ import NET.worlds.network.OldPropertyList; /* */ import NET.worlds.network.PacketTooLargeException; /* */ import NET.worlds.network.PropertyList; /* */ import NET.worlds.network.URL; /* */ import NET.worlds.network.WorldServer; /* */ import NET.worlds.network.net2Property; /* */ import NET.worlds.network.netProperty; /* */ import NET.worlds.network.propReqCmd; /* */ import java.awt.Color; /* */ import java.io.IOException; /* */ import java.io.PrintStream; /* */ import java.net.MalformedURLException; /* */ import java.util.Enumeration; /* */ import java.util.Hashtable; /* */ import java.util.Vector; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public abstract class Drone /* */ extends WObject /* */ implements NetworkObject, WobLoaded, MouseDownHandler, FrameHandler /* */ { /* */ private int _last_FrameTime; /* */ private int _last_PosTime; /* */ private int _vel_x; /* */ private int _vel_y; /* */ private int _vel_z; /* */ private int _vel_yaw; /* */ private int _last_x; /* */ private int _last_y; /* */ private int _last_z; /* */ private int _last_yaw; /* */ private int _x; /* */ private int _y; /* */ private int _z; /* */ private int _yaw; /* 170 */ private boolean inited = false; /* */ /* */ /* */ /* */ protected WObject tag; /* */ /* */ /* */ /* */ protected WObject tagbg; /* */ /* */ /* */ /* */ private Console console; /* */ /* */ /* */ /* */ private float tagHeight; /* */ /* */ /* */ /* */ private Shape sleepBox; /* */ /* */ /* */ /* */ /* */ public Drone(ObjID id, WorldServer serv) /* */ { /* 197 */ if (serv != null) { /* 198 */ assert (id != null); /* 199 */ attachToServer(serv.getLongID(id), serv); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ protected Drone(String longID, WorldServer serv) /* */ { /* 211 */ assert (longID != null); /* 212 */ if (serv != null) { /* 213 */ attachToServer(longID, serv); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ private void attachToServer(String longID, WorldServer serv) /* */ { /* 222 */ if (serv == null) { /* 223 */ return; /* */ } /* */ /* */ /* 227 */ assert (Main.isMainThread()); /* 228 */ String nameWas = null; /* 229 */ if (this.tag != null) { /* 230 */ nameWas = getLongID(); /* */ } /* */ /* 233 */ getSharer().createDynamicFromNet(); /* */ /* 235 */ setName(longID); /* 236 */ String nameIs = getLongID(); /* 237 */ this._server = serv; /* 238 */ this._server.incRefCnt(this); /* */ /* 240 */ this._server.regObject(nameIs, this); /* */ try { /* 242 */ this._server.sendNetworkMsg(new propReqCmd(new ObjID(getLongID()))); /* */ } /* */ catch (InfiniteWaitException localInfiniteWaitException) {}catch (PacketTooLargeException e) { /* 245 */ if (!$assertionsDisabled) { throw new AssertionError(); /* */ } /* */ } /* 248 */ if (nameIs.equals(nameWas)) /* */ { /* 250 */ avatarHeightChangedTo(189.0F); /* */ } else { /* 252 */ makeTag(false); /* */ } /* 254 */ Main.register(new MakeSleepBox()); /* */ } /* */ /* */ class MakeSleepBox /* */ implements MainCallback /* */ { /* */ MakeSleepBox() {} /* */ /* */ public void mainCallback() /* */ { /* 264 */ if ((Drone.this.sleepMode != null) && /* 265 */ (Drone.this.sleepMode.equals(Console.message("asleep"))) && /* 266 */ (!(Drone.this instanceof MutedDrone))) /* */ { /* 268 */ if (Drone.this.sleepBox == null) { /* 269 */ Drone.this.sleepBox = new Shape(); /* 270 */ Drone.this.sleepBox.setURL(URL.make("home:idle.rwg")); /* 271 */ Drone.this.sleepBox.setBumpable(false); /* 272 */ Drone.this.sleepBox.scale(100.0F); /* 273 */ Drone.this.sleepBox.spin(0.0F, 1.0F, 1.0F, 180.0F); /* 274 */ Drone.this.sleepBox.raise(189.0F); /* 275 */ Drone.this.add(Drone.this.sleepBox); /* */ } /* */ /* */ } /* 279 */ else if (Drone.this.sleepBox != null) { /* 280 */ Drone.this.sleepBox.detach(); /* 281 */ Drone.this.sleepBox = null; /* */ } /* */ /* 284 */ Main.unregister(this); /* */ } /* */ } /* */ /* */ static class Flusher implements MainCallback { /* */ int lastTime; /* */ /* */ public void mainCallback() { /* 292 */ int now = Std.getFastTime(); /* 293 */ if (now > this.lastTime + 1000) { /* 294 */ Drone.access$3(); /* 295 */ this.lastTime = now; /* */ } /* */ } /* */ } /* */ /* */ static { /* 301 */ Main.register(new Flusher()); /* */ } /* */ /* */ /* */ /* */ /* */ private static void flushUnusedDrones() /* */ { /* 309 */ synchronized (usableDrones) { /* 310 */ int now = Std.getFastTime(); /* 311 */ int i = usableDrones.size(); /* 312 */ do { Drone d = (Drone)usableDrones.elementAt(i); /* 313 */ if (now > d.lastUsed + 2000) { /* 314 */ usableDrones.removeElementAt(i); /* 315 */ d.discard(); /* */ } /* 311 */ i--; } while (i >= 0); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 321 */ static boolean showNametags = IniFile.gamma().getIniInt("SHOWNAMETAGS", 1) == 1; /* */ /* 323 */ private static String[] employeeAccounts = ServerTableManager.instance() /* 324 */ .getTable("employeeAccounts"); /* */ /* 326 */ private static Hashtable employeeHash = null; /* */ /* */ public static boolean isEmployeeAccount(String name) { /* 329 */ if (employeeHash == null) { /* 330 */ employeeHash = new Hashtable(); /* 331 */ for (int i = 0; i < employeeAccounts.length; i++) { /* 332 */ employeeHash.put(employeeAccounts[i], employeeAccounts[i]); /* */ } /* */ } /* */ /* 336 */ return employeeHash.get(name) != null; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public void makeTag(boolean force) /* */ { /* 345 */ this.tagHeight = 195.0F; /* 346 */ if (this.tag != null) /* */ { /* 348 */ this.tagHeight = this.tag.getPosition().z; /* 349 */ this.tag.detach(); /* 350 */ this.tag = null; /* */ } /* 352 */ if (this.tagbg != null) { /* 353 */ this.tagbg.detach(); /* 354 */ this.tagbg = null; /* */ } /* */ /* */ /* 358 */ if (((this._server == null) && (!force)) || ((this instanceof MutedDrone)) || /* 359 */ (!showNametags)) { /* 360 */ return; /* */ } /* 362 */ String unfilteredName = getLongID(); /* */ /* 364 */ String name = FilthFilter.get().filterName(unfilteredName); /* 365 */ if ((name == null) || (name.equals(""))) { /* 366 */ return; /* */ } /* 368 */ Texture[] tagText = new Texture[1]; /* */ /* */ /* 371 */ boolean hw = RenderWare.get3DHardwareInUse(); /* */ /* 373 */ boolean isHost = (name.toLowerCase().startsWith(Console.message("host"))) || /* 374 */ (name.toLowerCase().startsWith("host")); /* 375 */ if (isHost) { /* 376 */ name = Console.message("host-upper") + name.substring(4); /* */ } /* 378 */ boolean isSpecialGuest = /* 379 */ (name.toLowerCase().startsWith(Console.message("guest-"))) || /* 380 */ (name.toLowerCase().startsWith("guest-")); /* 381 */ if (isSpecialGuest) { /* 382 */ name = Console.message("guest-upper") + name.substring(5); /* */ } /* 384 */ boolean isEmployee = isEmployeeAccount(name); /* */ /* */ Color bgColor; /* */ Color bgColor; /* 388 */ if (isSpecialGuest) { /* 389 */ bgColor = Color.pink; } else { Color bgColor; /* 390 */ if (isHost) { /* 391 */ bgColor = Color.yellow; } else { Color bgColor; /* 392 */ if (isEmployee) { /* 393 */ bgColor = Color.cyan; /* */ } else /* 395 */ bgColor = Color.lightGray; /* */ } } /* 397 */ tagText[0] = new StringTexture(name, Console.message("TagFont"), 48, /* 398 */ Color.black, hw ? new Color(254, 254, 254) : bgColor); /* */ /* */ /* */ /* */ /* 403 */ int height = 14; /* */ /* 405 */ int width = name.length() * 10; /* 406 */ Hologram h = new Hologram(width, height, tagText); /* 407 */ h.setViewplaneAligned(true); /* 408 */ h.raise(this.tagHeight); /* 409 */ h.setScaleDist(300.0F); /* 410 */ this.tag = h; /* 411 */ this.tag.setVisible(true); /* 412 */ this.tag.setBumpable(false); /* 413 */ this.tag.setLocalShadowed(false); /* 414 */ this.tag.setShadowedLocally(true); /* 415 */ add(this.tag); /* */ /* 417 */ if (hw) { /* 418 */ Texture[] bgText = new Texture[1]; /* 419 */ bgText[0] = new StringTexture(name, Console.message("TagFont"), 48, /* 420 */ Color.black, /* */ /* */ /* */ /* */ /* 425 */ bgColor); /* 426 */ Hologram h2 = new Hologram(width, height, bgText); /* 427 */ h2.setViewplaneAligned(true); /* 428 */ h2.raise(this.tagHeight); /* */ /* 430 */ h2.setScaleDist(300.0F); /* 431 */ h2.setMaterial(new Material(0.75F, 0.0F, 0.0F, Color.white, null, 0.5F, /* 432 */ false, false)); /* 433 */ this.tagbg = h2; /* 434 */ this.tagbg.setVisible(true); /* 435 */ this.tagbg.setBumpable(false); /* 436 */ this.tagbg.setLocalShadowed(false); /* 437 */ this.tagbg.setShadowedLocally(true); /* 438 */ add(this.tagbg); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ protected void avatarHeightChangedTo(float h) /* */ { /* 447 */ if (this.tag != null) { /* 448 */ this.tag.raise(h + 1.0F + 5.0F - this.tag.getPosition().z); /* */ } /* 450 */ if (this.tagbg != null) { /* 451 */ this.tagbg.raise(h + 1.0F + 5.0F - this.tagbg.getPosition().z); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public void detachFromServer(boolean reuse) /* */ { /* 461 */ assert (Main.isMainThread()); /* 462 */ if (this._server != null) { /* 463 */ this._server.delObject(new ObjID(getLongID())); /* 464 */ this._server.decRefCnt(this); /* 465 */ this._server = null; /* */ } /* */ /* */ /* 469 */ if (reuse) { /* 470 */ this.lastUsed = Std.getFastTime(); /* 471 */ synchronized (usableDrones) { /* 472 */ usableDrones.addElement(this); /* */ } /* */ } /* */ } /* */ /* 477 */ public static Vector usableDrones = new Vector(); /* */ /* */ private int lastUsed; /* */ /* */ protected WorldServer _server; /* */ private String sleepMode; /* */ /* */ public static Drone make(ObjID id, WorldServer serv) /* */ { /* 486 */ synchronized (usableDrones) { /* 487 */ if ((usableDrones.isEmpty()) || (id == null) || (serv == null)) /* */ { /* 489 */ return new HoloDrone(id, serv); /* */ } /* 491 */ String name = "!" + serv.getLongID(id); /* */ /* */ /* */ /* */ /* 496 */ for (int i = usableDrones.size() - 1; i > 0; i--) { /* 497 */ Drone d = (Drone)usableDrones.elementAt(i); /* 498 */ if (d.getName().equals(name)) { /* */ break; /* */ } /* */ } /* 502 */ Drone d = (Drone)usableDrones.elementAt(i); /* */ /* */ /* */ /* 506 */ if ((!d.getName().equals(name)) && (usableDrones.size() < 5)) /* */ { /* 508 */ return new HoloDrone(id, serv); /* */ } /* 510 */ usableDrones.removeElementAt(i); /* */ /* 512 */ d.attachToServer(serv.getLongID(id), serv); /* 513 */ return d; /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ public boolean handle(MouseDownEvent event) /* */ { /* 522 */ if ((this._server != null) && ((event.key & 0x1) == '\001')) /* */ { /* 524 */ FriendsListPart.droneClick(this, event); /* */ } /* */ /* 527 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ public float animate(String action) /* */ { /* 535 */ if (action.equalsIgnoreCase("_hdb")) { /* 536 */ getClass();new BounceNametag(); } /* 537 */ return 0.0F; /* */ } /* */ /* */ class BounceNametag implements MainCallback { /* */ int start; /* */ WObject origTag; /* */ WObject origTagbg; /* */ /* */ BounceNametag() { /* 546 */ if (Drone.this.tag != null) { /* 547 */ this.start = Std.getFastTime(); /* 548 */ this.origTag = Drone.this.tag; /* 549 */ this.origTagbg = Drone.this.tagbg; /* 550 */ Main.register(this); /* */ } /* */ } /* */ /* */ /* */ public void mainCallback() /* */ { /* 557 */ int now = Std.getFastTime(); /* 558 */ float h = Drone.this.tagHeight; /* 559 */ if ((now > this.start + 6000) || (this.origTag != Drone.this.tag) || (this.origTagbg != Drone.this.tagbg)) { /* 560 */ Main.unregister(this); /* 561 */ } else if (now < this.start + 1500) { /* 562 */ h = Drone.this.tagHeight + 200.0F * ((now - this.start) / 1500.0F); /* */ } /* */ else { /* 565 */ float t = (now - this.start) / 1500.0F; /* 566 */ h = (float)(200.0D * Math.pow(1.4140000343322754D, t) * /* 567 */ Math.cos(t * 3.14159F)); /* */ } /* */ /* 570 */ this.origTag.setZ(h); /* 571 */ if (this.origTagbg != null) /* 572 */ this.origTagbg.setZ(h); /* */ } /* */ } /* */ /* */ public Vector getAnimationList() { /* 577 */ return new Vector(); /* */ } /* */ /* */ /* */ public void muteStateChanged() /* */ { /* 583 */ setAvatarNow(getCurrentURL()); /* */ } /* */ /* */ /* */ /* */ /* */ public boolean shouldBeMuted() /* */ { /* 591 */ return MuteListPart.isMuted(this._server, getLongID()); /* */ } /* */ /* */ private World getOwnerWorld() { /* 595 */ WObject o = (WObject)getOwner(); /* 596 */ Room room = o == null ? null : o.getRoom(); /* 597 */ World w = room == null ? null : room.getWorld(); /* 598 */ return w; /* */ } /* */ /* */ public boolean shouldBeForcedHuman() { /* 602 */ World w = getOwnerWorld(); /* 603 */ return (w != null) && (w.getForceHuman()); /* */ } /* */ /* */ public URL getCurrentURL() { /* 607 */ if ((this instanceof PosableDrone)) { /* 608 */ return ((PosableDrone)this).getPosableShapeURL(); /* */ } /* */ /* 611 */ return getSourceURL(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public Drone setAvatarNow(URL url) /* */ { /* 627 */ if (url == null) { /* 628 */ return this; /* */ } /* */ /* */ /* */ /* */ /* 634 */ if (shouldBeForcedHuman()) { /* 635 */ url = PosableShape.getHuman(url); /* 636 */ if (Console.getActive() != null) /* */ { /* 638 */ Console.getActive().pendingPilot = url.toString(); /* */ } /* */ } /* */ /* */ /* 643 */ url = PosableShape.getPermitted(url, getWorld()); /* */ /* 645 */ boolean muted = shouldBeMuted(); /* */ /* 647 */ if ((url.equals(getCurrentURL())) && /* 648 */ (muted == this instanceof MutedDrone)) { /* 649 */ return this; /* */ } /* 651 */ if ((url.endsWith(".rwx")) || (url.endsWith(".rwg")) || /* 652 */ (url.endsWith(".mov"))) /* */ { /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 667 */ WObject o = (WObject)getOwner(); /* 668 */ if (o == null) /* */ { /* */ /* */ /* */ /* 673 */ return this; /* */ } /* */ /* 676 */ WorldServer serv = this._server; /* 677 */ String longID = getLongID(); /* */ /* */ /* 680 */ detachFromServer(false); /* */ /* 682 */ detach(); /* */ /* */ Drone d; /* */ Drone d; /* 686 */ if (muted) { /* 687 */ d = new MutedDrone(new ObjID(longID), serv, url); /* 688 */ } else if (url.endsWith(".mov")) { /* 689 */ Drone d = new HoloDrone(new ObjID(longID), serv); /* 690 */ d.setAvatarNow(url); /* */ } /* */ else { /* 693 */ d = new PosableDrone(new ObjID(longID), serv, url); /* */ } /* */ /* 696 */ if (serv != null) { /* 697 */ d.transferFrom(this); /* 698 */ d.addTo(o.getRoom()); /* */ } else { /* 700 */ d.makeIdentity().post(this); /* 701 */ d.setName(getLongID()); /* 702 */ o.add(d); /* */ } /* 704 */ return d; /* */ } /* 706 */ String s = url.getInternal(); /* 707 */ if (s.endsWith(".pilot")) { /* 708 */ s = s.substring(0, s.length() - 6) + ".drone"; /* 709 */ } else if (!s.endsWith(".drone")) { /* 710 */ s = s + ".drone"; /* */ } /* 712 */ url = URL.make(s); /* */ /* 714 */ if (url.equals(getSourceURL())) { /* 715 */ return this; /* */ } /* 717 */ new WobLoader(url, this); /* */ /* 719 */ return this; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public void wobLoaded(WobLoader loader, SuperRoot w) /* */ { /* 728 */ if (!(w instanceof Drone)) /* 729 */ return; /* 730 */ assert (w != null); /* */ /* 732 */ Drone d = (Drone)w; /* 733 */ d.setName(getLongID()); /* */ /* */ /* */ /* 737 */ if (this._server == null) { /* 738 */ WObject o = (WObject)getOwner(); /* 739 */ detach(); /* 740 */ d.makeIdentity().post(this); /* 741 */ o.add(d); /* 742 */ return; /* */ } /* */ /* 745 */ WorldServer serv = this._server; /* 746 */ String longID = getLongID(); /* 747 */ detachFromServer(false); /* */ /* */ /* 750 */ Room r = getRoom(); /* 751 */ detach(); /* */ /* */ /* 754 */ d.addTo(r); /* */ /* 756 */ d.attachToServer(longID, serv); /* */ /* 758 */ d.transferFrom(this); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public void addTo(Room r) /* */ { /* 767 */ if (r == null) { /* 768 */ return; /* */ } /* 770 */ Console c = r.getWorld().getConsole(); /* */ /* 772 */ if (this.console == null) { /* 773 */ this.console = c; /* 774 */ if (c != null) { /* 775 */ Pilot.copySoul(c.getDroneSoulTemplate(), this); /* */ } /* */ } /* 778 */ r.add(this); /* */ } /* */ /* */ /* */ public void add(WObject w) /* */ { /* 784 */ super.add(w); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ protected void noteUnadding(SuperRoot child) /* */ { /* 793 */ if ((child instanceof WObject)) { /* 794 */ WObject w = (WObject)child; /* */ /* 796 */ if (w.isDynamic()) { /* 797 */ w.setVisible(true); /* */ } /* */ } /* 800 */ super.noteUnadding(child); /* */ } /* */ /* */ /* */ /* */ /* */ public void setSleepMode(String mode) /* */ { /* 808 */ if (mode.equals(this.sleepMode)) { /* 809 */ return; /* */ } /* 811 */ this.sleepMode = mode; /* 812 */ Main.register(new MakeSleepBox()); /* */ } /* */ /* */ private void handleVAR_ASLEEP(String s) /* */ { /* 817 */ if ((s != null) && (s.length() > 2) && (s.charAt(0) == 0)) { /* 818 */ s = s.substring(2); /* */ } /* 820 */ setSleepMode(s); /* */ } /* */ /* */ /* */ /* */ /* */ public Drone handleVAR_BITMAP(String s) /* */ { /* 828 */ if (s.equals("")) { /* 829 */ return this; /* */ } /* 831 */ BlackBox.getInstance().submitEvent( /* 832 */ new BBDroneBitmapCommand(getName(), s)); /* */ /* */ /* 835 */ if (s.charAt(0) == 0) { /* 836 */ s = s.substring(2); /* */ } /* */ try { /* 839 */ return setAvatarNow(new URL(URL.getAvatar(), s)); /* */ } catch (MalformedURLException e) { /* 841 */ Console.println(Console.message("Invalid-av") + s); } /* 842 */ return this; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ public Point3Temp getVelocity() /* */ { /* 852 */ return Point3Temp.make(this._vel_x, this._vel_y, this._vel_z); /* */ } /* */ /* */ public int getYawRate() { /* 856 */ return this._vel_yaw; /* */ } /* */ /* */ public boolean handle(FrameEvent fe) { /* 860 */ if (this._server == null) { /* 861 */ return true; /* */ } /* */ /* 864 */ int timeNow = fe.time; /* */ /* 866 */ interpolate(timeNow, this._server.getUpdateTime(), this); /* */ /* 868 */ return true; /* */ } /* */ /* */ public void interpolate(int timeNow, int updateTime, Transform target) { /* 872 */ if (!this.inited) { /* 873 */ return; /* */ } /* 875 */ if (timeNow - this._last_PosTime > updateTime) /* */ { /* */ /* 878 */ this._last_PosTime = timeNow; /* 879 */ this._vel_x = (this._last_x - this._x); /* 880 */ this._vel_y = (this._last_y - this._y); /* 881 */ this._vel_z = (this._last_z - this._z); /* 882 */ this._vel_yaw = (((this._last_yaw - this._yaw) % 360 + 360) % 360); /* */ /* 884 */ assert (this._vel_yaw >= 0); /* 885 */ if (this._vel_yaw > 180) { /* 886 */ this._vel_yaw -= 360; /* */ } /* */ } /* */ /* 890 */ double timeDiff = (timeNow - this._last_FrameTime) / /* 891 */ updateTime; /* 892 */ if (timeNow - this._last_FrameTime > updateTime) { /* 893 */ timeDiff = 0.0D; /* */ } /* 895 */ this._x += (int)(timeDiff * this._vel_x); /* 896 */ this._y += (int)(timeDiff * this._vel_y); /* 897 */ this._z += (int)(timeDiff * this._vel_z); /* 898 */ this._yaw += (int)(timeDiff * this._vel_yaw) % 360; /* */ /* 900 */ target.makeIdentity().moveBy(this._x, this._y, this._z).yaw(this._yaw); /* */ /* 902 */ this._last_FrameTime = timeNow; /* */ } /* */ /* */ public void reset(short x, short y, short z, short yaw) { /* 906 */ this._x = x; /* 907 */ this._y = y; /* 908 */ this._z = z; /* 909 */ this._yaw = yaw; /* */ /* 911 */ this._vel_x = (this._vel_y = this._vel_z = 0); /* 912 */ this._vel_yaw = 0; /* 913 */ this._last_x = this._x; /* 914 */ this._last_y = this._y; /* 915 */ this._last_z = this._z; /* 916 */ this._last_yaw = this._yaw; /* */ /* 918 */ this._last_PosTime = (this._last_FrameTime = Std.getRealTime()); /* */ /* 920 */ this.inited = true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ protected void transferFrom(Drone i) /* */ { /* 930 */ makeIdentity().post(i); /* */ /* 932 */ this._x = i._x; /* 933 */ this._y = i._y; /* 934 */ this._z = i._z; /* 935 */ this._yaw = i._yaw; /* 936 */ this._vel_x = i._vel_x; /* 937 */ this._vel_y = i._vel_y; /* 938 */ this._vel_z = i._vel_z; /* 939 */ this._vel_yaw = i._vel_yaw; /* 940 */ this._last_x = i._last_x; /* 941 */ this._last_y = i._last_y; /* 942 */ this._last_z = i._last_z; /* 943 */ this._last_yaw = i._last_yaw; /* 944 */ this._last_PosTime = i._last_PosTime; /* 945 */ this._last_FrameTime = i._last_FrameTime; /* 946 */ this.inited = true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public void appear(Room rm, short x, short y, short z, short yaw) /* */ { /* 961 */ assert (rm != null); /* */ /* 963 */ BlackBox.getInstance() /* 964 */ .submitEvent( /* 965 */ new BBAppearDroneCommand(rm.toString(), getName(), x, /* 966 */ y, z, yaw)); /* */ /* 968 */ if (getRoom() != rm) { /* 969 */ detach(); /* 970 */ rm.add(this); /* */ } /* */ /* 973 */ makeIdentity().moveBy(x, y, z).yaw(yaw); /* */ /* */ /* 976 */ this._x = x; /* 977 */ this._y = y; /* 978 */ this._z = z; /* 979 */ this._yaw = yaw; /* 980 */ this._vel_x = (this._vel_y = this._vel_z = 0); /* 981 */ this._vel_yaw = 0; /* 982 */ this._last_x = x; /* 983 */ this._last_y = y; /* 984 */ this._last_z = z; /* 985 */ this._last_yaw = yaw; /* */ /* 987 */ this._last_PosTime = (this._last_FrameTime = Std.getRealTime()); /* */ /* 989 */ URL u = getCurrentURL(); /* 990 */ if (u != null) { /* 991 */ setAvatarNow(u); /* */ } /* */ /* 994 */ this.inited = true; /* */ } /* */ /* */ public void disappear() { /* 998 */ BlackBox.getInstance().submitEvent( /* 999 */ new BBDisappearDroneCommand(getName())); /* 1000 */ detachFromServer(true); /* 1001 */ detach(); /* */ } /* */ /* */ public void longLoc(short x, short y, short z, short yaw) { /* 1005 */ if (!(getOwner() instanceof Pilot)) { /* 1006 */ BlackBox.getInstance().submitEvent( /* 1007 */ new BBMoveDroneCommand(getName(), x, y, z, yaw)); /* */ } /* */ /* 1010 */ this._last_x = x; /* 1011 */ this._last_y = y; /* 1012 */ this._last_z = z; /* 1013 */ this._last_yaw = yaw; /* 1014 */ this._vel_x = (this._last_x - this._x); /* 1015 */ this._vel_y = (this._last_y - this._y); /* 1016 */ this._vel_z = (this._last_z - this._z); /* 1017 */ this._vel_yaw = (((this._last_yaw - this._yaw) % 360 + 360) % 360); /* */ /* 1019 */ assert (this._vel_yaw >= 0); /* 1020 */ if (this._vel_yaw > 180) { /* 1021 */ this._vel_yaw -= 360; /* */ } /* */ /* 1024 */ this._last_PosTime = Std.getRealTime(); /* 1025 */ this.inited = true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public void property(OldPropertyList propList) /* */ { /* 1034 */ int end = propList.size(); /* 1035 */ for (int i = 0; i < end; i++) { /* 1036 */ netProperty tmpProp = propList.elementAt(i); /* 1037 */ switch (tmpProp.property()) { /* */ case 5: /* 1039 */ handleVAR_BITMAP(tmpProp.value()); /* 1040 */ break; /* */ /* */ case 23: /* 1043 */ handleVAR_ASLEEP(tmpProp.value()); /* 1044 */ break; /* */ /* */ /* */ /* */ /* */ default: /* 1050 */ byte[] data = tmpProp.value().getBytes(); /* 1051 */ getSharer().setFromNetData(tmpProp.property(), data); /* */ } /* */ /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ public void propertyUpdate(PropertyList propList) /* */ { /* 1064 */ int end = propList.size(); /* 1065 */ for (int i = 0; i < end; i++) { /* 1066 */ net2Property tmpProp = propList.elementAt(i); /* */ /* 1068 */ switch (tmpProp.property()) { /* */ case 5: /* 1070 */ handleVAR_BITMAP(tmpProp.value()); /* 1071 */ break; /* */ /* */ case 23: /* 1074 */ handleVAR_ASLEEP(tmpProp.value()); /* 1075 */ break; /* */ /* */ default: /* 1078 */ getSharer().setFromNetData(tmpProp.property(), tmpProp.data()); /* */ } /* */ /* */ } /* */ } /* */ /* */ /* */ /* */ public void roomChange(Room newRoom, short x, short y, short z, short yaw) /* */ { /* 1088 */ detach(); /* 1089 */ if (newRoom != null) { /* 1090 */ appear(newRoom, x, y, z, yaw); /* */ } /* */ } /* */ /* */ /* */ /* */ public void shortLoc(byte dx, byte dy, byte dyaw) /* */ { /* 1098 */ if (!(getOwner() instanceof Pilot)) { /* 1099 */ BlackBox.getInstance().submitEvent( /* 1100 */ new BBDroneDeltaPosCommand(getName(), dx, dy, dyaw)); /* */ } /* */ /* 1103 */ this._last_x += dx; /* 1104 */ this._last_y += dy; /* */ /* 1106 */ this._last_yaw += dyaw; /* 1107 */ this._last_yaw %= 360; /* */ /* 1109 */ this._vel_x = (this._last_x - this._x); /* 1110 */ this._vel_y = (this._last_y - this._y); /* */ /* 1112 */ this._vel_z = 0; /* 1113 */ this._vel_yaw = (((this._last_yaw - this._yaw) % 360 + 360) % 360); /* */ /* 1115 */ assert (this._vel_yaw >= 0); /* 1116 */ if (this._vel_yaw > 180) { /* 1117 */ this._vel_yaw -= 360; /* */ } /* */ /* 1120 */ this._last_PosTime = Std.getRealTime(); /* */ } /* */ /* */ public void teleport(WorldServer serv, byte exitType, byte entryType, Room newRoom, short x, short y, short z, short yaw) /* */ { /* 1125 */ assert (serv.getObject(new ObjID(getLongID())) == this); /* 1126 */ Room curRoom = getRoom(); /* 1127 */ switch (exitType) /* */ { /* */ case 0: /* */ break; /* */ default: /* 1132 */ if (curRoom != null) /* */ { /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 1142 */ assert (curRoom != null); /* 1143 */ detach(); /* */ } /* */ break; /* */ } /* */ /* 1148 */ switch (entryType) { /* */ case 0: /* 1150 */ detachFromServer(true); /* 1151 */ detach(); /* 1152 */ break; /* */ default: /* 1154 */ if (newRoom == null) /* */ { /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 1163 */ detach(); /* */ } else { /* 1165 */ assert (newRoom != null); /* 1166 */ appear(newRoom, x, y, z, yaw); /* */ } /* */ break; /* */ } /* */ /* */ } /* */ /* */ public WorldServer getServer() /* */ { /* 1175 */ return this._server; /* */ } /* */ /* */ public String getLongID() { /* 1179 */ String name = getName(); /* 1180 */ if (name.startsWith("!")) { /* 1181 */ name = name.substring(1); /* */ } /* 1183 */ return name; /* */ } /* */ /* */ public void register() /* */ { /* 1188 */ if (!$assertionsDisabled) throw new AssertionError(); /* */ } /* */ /* */ public void galaxyDisconnected() /* */ { /* 1193 */ if (!$assertionsDisabled) throw new AssertionError(); /* */ } /* */ /* */ public void reacquireServer(WorldServer oldServ) /* */ { /* 1198 */ if (!$assertionsDisabled) throw new AssertionError(); /* */ } /* */ /* */ public void changeChannel(Galaxy g, String oldChannel, String newChannel) /* */ { /* 1203 */ if (!$assertionsDisabled) { throw new AssertionError(); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public Object properties(int index, int offset, int mode, Object value) /* */ throws NoSuchPropertyException /* */ { /* 1221 */ Object ret = null; /* 1222 */ (index - offset); /* */ /* 1224 */ ret = super.properties(index, offset + 0, mode, value); /* */ /* 1226 */ return ret; /* */ } /* */ /* 1229 */ private static Object classCookie = new Object(); /* 1230 */ private static Object classCookieInterpolatedDrone = new Object(); /* */ /* */ public void saveState(Saver s) throws IOException /* */ { /* 1234 */ if (this.console != null) { /* 1235 */ System.out.println("Warning: saving drone " + getName() + /* 1236 */ " WITH soul, which won't restore correctly!"); /* */ } /* */ /* 1239 */ s.saveVersion(0, classCookieInterpolatedDrone); /* 1240 */ s.saveVersion(0, classCookie); /* 1241 */ super.saveState(s); /* */ } /* */ /* */ public void restoreStateDrone(Restorer r) throws IOException, TooNewException /* */ { /* 1246 */ r.restoreVersion(classCookieInterpolatedDrone); /* 1247 */ switch (r.restoreVersion(classCookie)) { /* */ case 0: /* 1249 */ super.restoreState(r); /* 1250 */ break; /* */ /* */ default: /* 1253 */ throw new TooNewException(); /* */ } /* */ /* */ /* */ /* */ /* 1259 */ Enumeration e = getContents(); /* 1260 */ while (e.hasMoreElements()) { /* 1261 */ WObject w = (WObject)e.nextElement(); /* 1262 */ if ((w instanceof Hologram)) { /* 1263 */ Hologram h = (Hologram)w; /* 1264 */ if (h.getMovieName() == null) { /* 1265 */ this.tag = h; /* */ } /* */ } /* */ } /* */ } /* */ /* */ public void restoreState(Restorer r) throws IOException, TooNewException /* */ { /* 1273 */ restoreStateDrone(r); /* */ } /* */ /* */ public Drone() {} /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\Drone.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */