diff options
| author | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
| commit | e1e781bb2135ef78592226f1a3eaba4925702f1f (patch) | |
| tree | 8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/Pilot.java | |
| download | worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.tar.xz worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.zip | |
Diffstat (limited to 'NET/worlds/scape/Pilot.java')
| -rw-r--r-- | NET/worlds/scape/Pilot.java | 1497 |
1 files changed, 1497 insertions, 0 deletions
diff --git a/NET/worlds/scape/Pilot.java b/NET/worlds/scape/Pilot.java new file mode 100644 index 0000000..a7de474 --- /dev/null +++ b/NET/worlds/scape/Pilot.java @@ -0,0 +1,1497 @@ +/* */ package NET.worlds.scape; +/* */ +/* */ import NET.worlds.console.AdPart; +/* */ import NET.worlds.console.BBAnimateDroneCommand; +/* */ import NET.worlds.console.BBMoveDroneCommand; +/* */ import NET.worlds.console.BBTeleportCommand; +/* */ import NET.worlds.console.BlackBox; +/* */ import NET.worlds.console.Console; +/* */ import NET.worlds.console.FramePart; +/* */ import NET.worlds.console.RenderCanvas; +/* */ import NET.worlds.core.Std; +/* */ import NET.worlds.network.Galaxy; +/* */ import NET.worlds.network.InfiniteWaitException; +/* */ import NET.worlds.network.NetworkObject; +/* */ import NET.worlds.network.NetworkRoom; +/* */ import NET.worlds.network.OldPropertyList; +/* */ import NET.worlds.network.PacketTooLargeException; +/* */ import NET.worlds.network.PropertyList; +/* */ import NET.worlds.network.PropertySetCmd; +/* */ import NET.worlds.network.URL; +/* */ import NET.worlds.network.WorldServer; +/* */ import NET.worlds.network.longLocCmd; +/* */ import NET.worlds.network.net2Property; +/* */ import NET.worlds.network.netPacket; +/* */ import NET.worlds.network.roomChangeCmd; +/* */ import NET.worlds.network.teleportCmd; +/* */ import java.io.ByteArrayInputStream; +/* */ import java.io.ByteArrayOutputStream; +/* */ import java.io.DataInputStream; +/* */ import java.io.DataOutputStream; +/* */ import java.io.IOException; +/* */ import java.io.PrintStream; +/* */ import java.util.Enumeration; +/* */ import java.util.Vector; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public abstract class Pilot +/* */ extends WObject +/* */ implements NetworkObject, BumpHandler +/* */ { +/* */ static +/* */ { +/* 161 */ nativeInit(); +/* */ } +/* */ +/* */ +/* */ public static native void nativeInit(); +/* */ +/* */ +/* */ public float animate(String action) +/* */ { +/* 170 */ action = action.toLowerCase(); +/* 171 */ BlackBox.getInstance().submitEvent( +/* 172 */ new BBAnimateDroneCommand("@Pilot", action)); +/* 173 */ if ((action.equals("sleep")) || (action.equals("s"))) { +/* 174 */ Console console = Console.getActive(); +/* 175 */ if (console != null) +/* 176 */ console.goToSleep(); +/* 177 */ } else if (this == getActive()) +/* */ { +/* 179 */ sendText("&|+action>" + action); +/* */ } +/* 181 */ return 0.0F; +/* */ } +/* */ +/* */ public Vector<String> getAnimationList() { +/* 185 */ Vector<String> v = new Vector(); +/* 186 */ v.addElement("sleep"); +/* 187 */ return v; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void setSleepMode(String mode) {} +/* */ +/* */ +/* */ +/* */ +/* */ public static void load(URL url, WobLoaded callback) +/* */ { +/* 201 */ if ((url.endsWith(".mov")) || (url.endsWith(".rwx")) || +/* 202 */ (url.endsWith(".rwg"))) { +/* 203 */ callback.wobLoaded(null, new HoloPilot(url)); +/* */ } else { +/* 205 */ String s = url.getInternal(); +/* 206 */ if (s.endsWith(".drone")) { +/* 207 */ s = s.substring(0, s.length() - 6) + ".pilot"; +/* 208 */ } else if (!s.endsWith(".pilot")) { +/* 209 */ s = s + ".pilot"; +/* */ } +/* 211 */ new WobLoader(URL.make(s), callback); +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void addInventory(WObject child) +/* */ throws ClassCastException +/* */ { +/* 222 */ assert (child.isDynamic()); +/* 223 */ add(child); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ public void addInSlot(WObject child, int slot) +/* */ { +/* 231 */ assert (child.isDynamic()); +/* 232 */ Sharer s = getSharer(); +/* 233 */ if (s.getAttribute(slot) != null) { +/* 234 */ System.out.println("Attempting to add a second object (" + +/* 235 */ child.getName() + ") to slot number " + slot); +/* 236 */ return; +/* */ } +/* 238 */ s.moveToSlot(child, slot); +/* */ } +/* */ +/* */ public void add(WObject w) +/* */ { +/* 243 */ super.add(w); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* 266 */ static Vector<Room> visibleRooms = new Vector(); +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* 275 */ static Vector<RoomSubscribeInfo> visibleRoomInfo = new Vector(); +/* */ +/* */ +/* */ +/* */ +/* */ int lastUpdateTime; +/* */ +/* */ +/* */ +/* */ +/* */ public float distToVisibleObject(WObject w) +/* */ { +/* 287 */ return distToVisiblePoint(w.getRoom(), w.getWorldPosition()); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void aboutToDraw() {} +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public float distToVisiblePoint(Room r, Point3Temp pos) +/* */ { +/* 307 */ if (r == null) { +/* 308 */ return 0.0F; +/* */ } +/* 310 */ int i = visibleRooms.indexOf(r); +/* 311 */ if (i == -1) { +/* 312 */ return 0.0F; +/* */ } +/* 314 */ RoomSubscribeInfo rsi = +/* 315 */ (RoomSubscribeInfo)visibleRoomInfo.elementAt(i); +/* */ +/* */ +/* 318 */ if (rsi.d == 0.0F) { +/* 319 */ return pos.minus(getWorldPosition()).length(); +/* */ } +/* 321 */ return pos.minus(Point3Temp.make(rsi.x, rsi.y, rsi.z)).length() + +/* 322 */ rsi.d; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* 332 */ private static Vector<Room> nextVisibleRooms = new Vector(); +/* 333 */ private static Vector<RoomSubscribeInfo> nextVisibleRoomInfo = new Vector(); +/* */ int positionSentTime; +/* */ short lastx; +/* */ short lasty; +/* */ short lastz; +/* */ short lastdir; +/* */ Room lastroom; +/* */ Room lastFrameRoom; +/* */ +/* */ public static void addVisibleRoom(Room r, float x, float y, float z, float d) { +/* 343 */ r.noteRef(); +/* */ +/* 345 */ int i = nextVisibleRooms.indexOf(r); +/* 346 */ if (i == -1) { +/* 347 */ nextVisibleRooms.addElement(r); +/* 348 */ nextVisibleRoomInfo.addElement(new RoomSubscribeInfo(x, y, z, d)); +/* */ } +/* */ else { +/* 351 */ RoomSubscribeInfo info = +/* 352 */ (RoomSubscribeInfo)nextVisibleRoomInfo.elementAt(i); +/* 353 */ if (d < info.d) { +/* 354 */ info.x = x; +/* 355 */ info.y = y; +/* 356 */ info.z = z; +/* 357 */ info.d = d; +/* */ } +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void generateFrameEvents(FrameEvent f) +/* */ { +/* 379 */ Room currentRoom = getRoom(); +/* 380 */ if (currentRoom != null) { +/* 381 */ addVisibleRoom(currentRoom, 0.0F, 0.0F, 0.0F, 0.0F); +/* */ } +/* */ +/* 384 */ synchronized (visibleRooms) { +/* 385 */ Vector<RoomSubscribeInfo> t = visibleRoomInfo; +/* 386 */ visibleRoomInfo = nextVisibleRoomInfo; +/* 387 */ nextVisibleRoomInfo = t; +/* */ +/* 389 */ Vector<Room> j = nextVisibleRooms; +/* 390 */ nextVisibleRooms = visibleRooms; +/* */ +/* */ +/* */ +/* 394 */ visibleRooms = j; +/* */ } +/* */ +/* 397 */ Vector<Room> prevVisibleRooms = nextVisibleRooms; +/* */ +/* */ +/* 400 */ Object oldEventSource = f.source; +/* 401 */ f.source = this; +/* */ +/* */ +/* 404 */ int i = visibleRooms.size(); +/* 405 */ do { Room r = (Room)visibleRooms.elementAt(i); +/* 406 */ r.generateFrameEvents(f); +/* */ +/* */ +/* 409 */ prevVisibleRooms.removeElement(r);i--; +/* 404 */ } while (i >= 0); +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* 413 */ int i = prevVisibleRooms.size(); +/* 414 */ do { ((Room)prevVisibleRooms.elementAt(i)).generateFrameEvents(f);i--; +/* 413 */ } while (i >= 0); +/* */ +/* */ +/* */ +/* 417 */ nextVisibleRooms.removeAllElements(); +/* 418 */ nextVisibleRoomInfo.removeAllElements(); +/* */ +/* */ +/* */ +/* */ +/* */ +/* 424 */ int diffTime = f.time - this.lastUpdateTime; +/* */ +/* */ +/* 427 */ if (diffTime > 500) { +/* 428 */ subscribeRooms(); +/* */ +/* */ +/* */ +/* 432 */ boolean hasMoved = pilotUpdate(f.time); +/* */ +/* */ +/* */ +/* 436 */ subscriptionUpdate(hasMoved); +/* */ +/* */ +/* 439 */ updateUnsubscribes(); +/* */ +/* 441 */ this.lastUpdateTime = f.time; +/* */ } +/* */ +/* */ +/* 445 */ touchSubscribers(); +/* */ +/* 447 */ f.source = oldEventSource; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ public static void sendText(String msg) +/* */ { +/* 455 */ sendText(null, msg); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ public static boolean containsWord(String word, String msg) +/* */ { +/* 463 */ for (int i = -1; (i = msg.indexOf(word, i + 1)) >= 0;) { +/* 464 */ if ((i == 0) || (!Character.isLetter(msg.charAt(i - 1)))) +/* */ { +/* */ +/* 467 */ int end = i + word.length(); +/* 468 */ if ((end >= msg.length()) || (!Character.isLetter(msg.charAt(end)))) +/* */ { +/* */ +/* 471 */ return true; } +/* */ } +/* */ } +/* 474 */ return false; +/* */ } +/* */ +/* */ public static void sendText(String who, String msg) { +/* 478 */ WorldServer server = active.getServer(); +/* 479 */ if (server != null) { +/* 480 */ if (msg.contains("&|+action>")) +/* */ { +/* */ +/* */ +/* */ +/* */ +/* 486 */ PropertyList propList = new PropertyList(); +/* */ +/* 488 */ String strUrl = getActive().getSourceURL().getAbsolute(); +/* */ +/* 490 */ strUrl = strUrl + "#" + msg.substring(msg.indexOf(">") + 1, msg.length()); +/* */ +/* */ +/* */ +/* 494 */ propList.addProperty(new net2Property(5, +/* 495 */ 64, 1, strUrl)); +/* */ try +/* */ { +/* 498 */ server.sendNetworkMsg(new PropertySetCmd(propList)); +/* */ } +/* */ catch (PacketTooLargeException localPacketTooLargeException) {}catch (InfiniteWaitException localInfiniteWaitException) {} +/* */ } +/* */ +/* */ +/* */ +/* 505 */ server.sendText(who, msg); +/* */ +/* */ +/* 508 */ if (((containsWord("brb", msg)) || (containsWord("ggp", msg))) && +/* 509 */ (Console.getActive() != null)) { +/* 510 */ Console.getActive().goToSleep(); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* 516 */ int i = msg.indexOf('*'); +/* */ int next; +/* 518 */ do { int next; int space = msg.indexOf(' ', i); +/* */ +/* */ +/* 521 */ if ((next > i + 1) && ((space == -1) || (space > next))) +/* */ { +/* */ +/* */ +/* 525 */ String act = msg.substring(i + 1, next).toLowerCase(); +/* 526 */ if ((who == null) && (active != null)) { +/* 527 */ active.animate(act); +/* */ } else { +/* 529 */ sendText(who, "&|+action>" + act); +/* */ } +/* */ } +/* 517 */ i = next; +/* 516 */ if (i < 0) break; } while ( +/* 517 */ (next = msg.indexOf('*', i + 1)) > i); +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ } +/* 532 */ else if (!msg.startsWith("&|+")) { +/* 533 */ Console.println(Console.message("No-server-connect")); +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ private static float round(float x, float mul) +/* */ { +/* 541 */ return mul * Math.round(x / mul); +/* */ } +/* */ +/* */ +/* */ +/* */ public String getWorldRoomChannel(Room room) +/* */ { +/* 548 */ if (room == null) { +/* 549 */ return null; +/* */ } +/* 551 */ World world = room.getWorld(); +/* 552 */ if (world == null) { +/* 553 */ return null; +/* */ } +/* 555 */ URL url = world.getSourceURL(); +/* 556 */ if (url == null) { +/* 557 */ return null; +/* */ } +/* 559 */ String newURL = url.getAbsolute(); +/* */ +/* 561 */ Galaxy g = room.getGalaxy(); +/* 562 */ String channelPart = g.getChannel(); +/* */ +/* */ +/* 565 */ return newURL + "#" + room.getName() + "<" + channelPart + ">"; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ public String getURL() +/* */ { +/* 573 */ Room room = getRoom(); +/* */ +/* 575 */ String newURL = getWorldRoomChannel(room); +/* 576 */ if (newURL == null) { +/* 577 */ return null; +/* */ } +/* 579 */ Point3Temp pos = getPosition(); +/* 580 */ float val = round(pos.x, 1.0F); +/* 581 */ newURL = newURL + "@" + val; +/* */ +/* 583 */ val = round(pos.y, 1.0F); +/* 584 */ newURL = newURL + "," + val; +/* */ +/* 586 */ val = round(pos.z, 1.0F); +/* 587 */ newURL = newURL + "," + val; +/* */ +/* 589 */ Point3Temp camAxis = Point3Temp.make(); +/* 590 */ val = round(getSpin(camAxis), 1.0F); +/* 591 */ newURL = newURL + "," + val; +/* */ +/* 593 */ val = round(camAxis.x, 0.001F); +/* 594 */ newURL = newURL + "," + val; +/* */ +/* 596 */ val = round(camAxis.y, 0.001F); +/* 597 */ newURL = newURL + "," + val; +/* */ +/* 599 */ val = round(camAxis.z, 0.001F); +/* 600 */ newURL = newURL + "," + val; +/* */ +/* 602 */ return newURL; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public String getTeleportURL() +/* */ { +/* 614 */ Camera tester = new Camera(); +/* */ +/* 616 */ Room room = getRoom(); +/* 617 */ if (room == null) { +/* 618 */ return null; +/* */ } +/* */ +/* 621 */ room.add(tester); +/* 622 */ tester.yaw(220.0F); +/* 623 */ tester.post(this); +/* */ +/* */ +/* 626 */ boolean pBumpable = getBumpable(); +/* 627 */ setBumpable(false); +/* 628 */ Transform t = tester.getObjectToWorldMatrix(); +/* 629 */ tester.moveThrough(Point3Temp.make(0.0F, -170.0F, 0.0F).times(t) +/* 630 */ .minus(t.getPosition())); +/* 631 */ t.recycle(); +/* 632 */ setBumpable(pBumpable); +/* */ +/* 634 */ room = tester.getRoom(); +/* 635 */ tester.detach(); +/* */ +/* 637 */ String wrc = getWorldRoomChannel(room); +/* 638 */ if (wrc == null) { +/* 639 */ return null; +/* */ } +/* 641 */ Point3Temp pos = tester.getPosition(); +/* */ +/* 643 */ return wrc + "@" + (int)pos.x + "," + (int)pos.y + "," + (int)pos.z + +/* 644 */ "," + (int)tester.getYaw(); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public Room getLastServedRoom() +/* */ { +/* 658 */ return this.lastroom; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ public float getFootHeight() +/* */ { +/* 666 */ return 0.0F; +/* */ } +/* */ +/* */ private static void sendToRoom(Room r, netPacket msg) +/* */ { +/* 671 */ if (r == null) +/* 672 */ return; +/* 673 */ synchronized (r) { +/* 674 */ WorldServer s = r.getServer(); +/* 675 */ if (s != null) { +/* */ try { +/* 677 */ s.sendNetworkMsg(msg); +/* */ } +/* */ catch (InfiniteWaitException localInfiniteWaitException) {}catch (PacketTooLargeException localPacketTooLargeException) {} +/* */ } +/* */ } +/* */ } +/* */ +/* */ +/* */ private boolean validRoom(Room r) +/* */ { +/* 687 */ return (r == null) || (r.getNetworkRoom().getRoomID() != 0); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public boolean pilotUpdate(int t) +/* */ { +/* 698 */ Point3Temp pos = getPosition(); +/* 699 */ short x = (short)(int)pos.x;short y = (short)(int)pos.y;short z = (short)(int)getFootHeight(); +/* 700 */ short dir = (short)(int)(-getYaw() + 90.0F); +/* 701 */ dir = (short)(dir % 360); +/* 702 */ while (dir < 0) { +/* 703 */ dir = (short)(dir + 360); +/* */ } +/* */ +/* 706 */ Room room = getRoom(); +/* */ +/* 708 */ if (room != this.lastFrameRoom) { +/* 709 */ BlackBox.getInstance().submitEvent(new BBTeleportCommand(getURL())); +/* 710 */ this.lastFrameRoom = getRoom(); +/* */ } +/* */ +/* */ +/* 714 */ if ((room != null) && (!room.getNetworkRoom().isServed())) { +/* 715 */ room = null; +/* */ } +/* */ +/* 718 */ if ((this.lastroom != null) && (!this.lastroom.getNetworkRoom().isServed())) { +/* 719 */ this.lastroom = null; +/* */ } +/* */ +/* */ +/* 723 */ int diffTime = t - this.positionSentTime; +/* */ +/* */ +/* */ +/* 727 */ if ((x == this.lastx) && (y == this.lasty) && (z == this.lastz) && (dir == this.lastdir) && +/* 728 */ (diffTime <= 40000) && (room == this.lastroom)) { +/* 729 */ return false; +/* */ } +/* */ +/* */ +/* 733 */ BlackBox.getInstance().submitEvent( +/* 734 */ new BBMoveDroneCommand("@Pilot", x, y, z, dir)); +/* */ +/* 736 */ if ((room != this.lastroom) && (validRoom(room)) && (validRoom(this.lastroom))) +/* */ { +/* */ Galaxy lrGalaxy; +/* */ +/* */ +/* */ +/* 742 */ Galaxy rGalaxy = lrGalaxy = null; +/* 743 */ if (room != null) +/* 744 */ rGalaxy = room.getGalaxy(); +/* 745 */ if (this.lastroom != null) +/* 746 */ lrGalaxy = this.lastroom.getGalaxy(); +/* 747 */ if (rGalaxy != lrGalaxy) +/* */ { +/* 749 */ if (room != null) +/* */ { +/* */ +/* */ +/* 753 */ sendToRoom(room, +/* 754 */ new teleportCmd(room, (byte)0, (byte)1, x, y, z, +/* 755 */ dir)); +/* 756 */ BlackBox.getInstance().submitEvent( +/* 757 */ new BBTeleportCommand(getURL())); +/* */ } +/* */ +/* 760 */ if (this.lastroom != null) +/* 761 */ sendToRoom(this.lastroom, +/* 762 */ new teleportCmd(null, (byte)1, (byte)0, x, y, z, +/* 763 */ dir)); +/* 764 */ BlackBox.getInstance().submitEvent( +/* 765 */ new BBTeleportCommand(getURL())); +/* 766 */ } else if (room.getServer() != this.lastroom.getServer()) +/* */ { +/* */ +/* */ +/* */ +/* 771 */ if (room != null) +/* */ { +/* */ +/* */ +/* 775 */ sendToRoom(room, +/* 776 */ new teleportCmd(room, (byte)0, (byte)1, x, y, z, +/* 777 */ dir)); +/* 778 */ BlackBox.getInstance().submitEvent( +/* 779 */ new BBTeleportCommand(getURL())); +/* */ } +/* 781 */ if (this.lastroom != null) { +/* 782 */ sendToRoom(this.lastroom, +/* 783 */ new teleportCmd(null, (byte)1, (byte)0, x, y, z, +/* 784 */ dir)); +/* */ } +/* */ +/* */ +/* */ } +/* */ else +/* */ { +/* 791 */ sendToRoom(this.lastroom, new roomChangeCmd(room, x, y, z, dir)); +/* 792 */ BlackBox.getInstance().submitEvent( +/* 793 */ new BBTeleportCommand(getURL())); +/* */ } +/* */ +/* 796 */ this.lastroom = room; +/* 797 */ } else if (room != null) { +/* 798 */ sendToRoom(room, new longLocCmd(x, y, z, dir)); +/* */ } +/* */ +/* 801 */ this.positionSentTime = t; +/* 802 */ this.lastx = x; +/* 803 */ this.lasty = y; +/* 804 */ this.lastz = z; +/* 805 */ this.lastdir = dir; +/* */ +/* 807 */ return true; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* 813 */ private static Vector<Room> subscribers = new Vector(); +/* */ +/* */ private static int lastWarning; +/* */ private static Pilot active; +/* */ +/* */ private void updateUnsubscribes() +/* */ { +/* 820 */ int i = subscribers.size(); +/* 821 */ do { if (!visibleRooms.contains(subscribers.elementAt(i))) { +/* 822 */ ((Room)subscribers.elementAt(i)).unsubscribe(); +/* 823 */ subscribers.removeElementAt(i); +/* */ } +/* 820 */ i--; } while (i >= 0); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void subscribeRooms() +/* */ { +/* 832 */ int i = visibleRooms.size(); +/* 833 */ do { Room r = (Room)visibleRooms.elementAt(i); +/* 834 */ if (!subscribers.contains(r)) { +/* 835 */ RoomSubscribeInfo newInfo = +/* 836 */ (RoomSubscribeInfo)visibleRoomInfo.elementAt(i); +/* 837 */ r.subscribe(newInfo); +/* */ } +/* 832 */ i--; } while (i >= 0); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public boolean removeSubscribedRoom(Room suspect) +/* */ { +/* 851 */ int i = subscribers.size(); +/* 852 */ do { if (subscribers.elementAt(i) == suspect) { +/* 853 */ subscribers.removeElementAt(i); +/* */ +/* 855 */ return true; +/* */ } +/* 851 */ i--; } while (i >= 0); +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* 858 */ return false; +/* */ } +/* */ +/* */ +/* */ +/* */ public void touchSubscribers() +/* */ { +/* 865 */ int i = subscribers.size(); +/* 866 */ do { ((Room)subscribers.elementAt(i)).noteRef();i--; +/* 865 */ } while (i >= 0); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ private void subscriptionUpdate(boolean hasMoved) +/* */ { +/* 876 */ Room camRoom = getRoom(); +/* */ +/* */ +/* */ +/* 880 */ int i = visibleRooms.size(); +/* 881 */ do { Room r = (Room)visibleRooms.elementAt(i); +/* */ +/* 883 */ assert (r.getNetworkRoom() != null); +/* */ +/* 885 */ RoomSubscribeInfo newInfo = +/* 886 */ (RoomSubscribeInfo)visibleRoomInfo.elementAt(i); +/* 887 */ if (!subscribers.contains(r)) +/* */ { +/* */ +/* 890 */ subscribers.addElement(r); +/* 891 */ } else if ((hasMoved) && (r.getNetworkRoom().isServed()) && +/* 892 */ (r != camRoom)) +/* */ { +/* */ +/* */ +/* */ +/* 897 */ r.subscribeDist(newInfo); +/* */ } +/* 880 */ i--; } while (i >= 0); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void property(OldPropertyList propList) {} +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void propertyUpdate(PropertyList propList) {} +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void register() {} +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void galaxyDisconnected() {} +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void reacquireServer(WorldServer oldServ) {} +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void changeChannel(Galaxy g, String oldChannel, String newChannel) +/* */ { +/* 929 */ sendToRoom(this.lastroom, +/* 930 */ new teleportCmd(null, (byte)1, (byte)0, this.lastx, this.lasty, this.lastz, +/* 931 */ this.lastdir)); +/* 932 */ BlackBox.getInstance().submitEvent(new BBTeleportCommand(getURL())); +/* 933 */ this.lastroom = null; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public WorldServer getServer() +/* */ { +/* 942 */ Room r = getLastServedRoom(); +/* 943 */ if (r != null) { +/* 944 */ return r.getServer(); +/* */ } +/* 946 */ if (this.console == null) { +/* 947 */ return null; +/* */ } +/* 949 */ return this.console.getServerNew(); +/* */ } +/* */ +/* */ public String getLongID() { +/* 953 */ if (this.console != null) { +/* 954 */ return this.console.getGalaxy().getChatname(); +/* */ } +/* 956 */ return null; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public WObject changeRoom(Room newRoom, Transform invPos) +/* */ { +/* 975 */ assert (this == active); +/* */ +/* */ +/* 978 */ if ((newRoom.getVIPOnly()) && (!newRoom.getWorld().getConsole().getVIP())) { +/* 979 */ int now = Std.getFastTime(); +/* 980 */ if (now > lastWarning + 3000) { +/* 981 */ lastWarning = now; +/* 982 */ Console.println(Console.message("Only-VIPs-here")); +/* */ } +/* 984 */ return null; +/* */ } +/* */ +/* 987 */ Room oldRoom = getActiveRoom(); +/* */ +/* 989 */ if (oldRoom != null) { +/* 990 */ oldRoom.removePostrenderHandler(BlackBox.getInstance()); +/* 991 */ oldRoom.removeFrameHandler(BlackBox.getInstance(), null); +/* */ } +/* */ +/* 994 */ WObject p = changeActiveRoom(newRoom); +/* */ +/* 996 */ p.makeIdentity(); +/* 997 */ p.pre(invPos); +/* */ +/* 999 */ if (oldRoom != null) +/* 1000 */ oldRoom.move(oldRoom, newRoom); +/* 1001 */ if (newRoom != null) { +/* 1002 */ newRoom.move(oldRoom, newRoom); +/* */ } +/* 1004 */ return p; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public static Pilot getActive() +/* */ { +/* 1014 */ return active; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* 1022 */ protected int cameraMode = 0; +/* 1023 */ protected int cameraSpeed = 0; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void setOutsideCameraMode(int camMode, int camSpeed) +/* */ { +/* 1034 */ this.cameraMode = camMode; +/* 1035 */ this.cameraSpeed = camSpeed; +/* 1036 */ if (getMainCamera() != null) +/* 1037 */ getMainCamera().lookAround.makeIdentity(); +/* */ } +/* */ +/* */ public int getOutsideCameraMode() { +/* 1041 */ return this.cameraMode; +/* */ } +/* */ +/* */ public int getOutsideCameraSpeed() { +/* 1045 */ return this.cameraSpeed; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ public static Room getActiveRoom() +/* */ { +/* 1053 */ if (active == null) { +/* 1054 */ return null; +/* */ } +/* 1056 */ return active.getRoom(); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ public static World getActiveWorld() +/* */ { +/* 1064 */ if (active == null) { +/* 1065 */ return null; +/* */ } +/* 1067 */ return active.getWorld(); +/* */ } +/* */ +/* 1070 */ private static World lastWorld = null; +/* */ +/* */ +/* */ +/* */ +/* */ private Camera lastCam; +/* */ +/* */ +/* */ +/* */ +/* */ protected Console console; +/* */ +/* */ +/* */ +/* */ +/* */ public abstract void resetAvatarNow(); +/* */ +/* */ +/* */ +/* */ +/* */ public static Pilot changeActiveRoom(Room newRoom) +/* */ { +/* 1092 */ BackgroundLoader.activeRoomChanged(newRoom); +/* */ +/* 1094 */ Console oldc = Console.getActive(); +/* 1095 */ Console newc = oldc; +/* 1096 */ if (newRoom != null) { +/* 1097 */ newc = newRoom.getWorld().getConsole(); +/* */ } +/* 1099 */ Pilot p = newc.getPilot(); +/* 1100 */ if (p != active) { +/* 1101 */ p.transferFrom(active); +/* */ +/* */ +/* 1104 */ if ((newRoom != null) && (active != null) && +/* 1105 */ (newRoom == active.getRoom())) { +/* 1106 */ p.makeIdentity().post(active); +/* */ } +/* */ } +/* */ +/* */ +/* 1111 */ if (oldc != newc) { +/* 1112 */ newc.forPilotOnlyActivate(); +/* */ } +/* */ +/* */ +/* 1116 */ if (oldc != null) +/* 1117 */ active.detach(); +/* 1118 */ active = p; +/* */ +/* 1120 */ p.setUpCameras(newc); +/* */ +/* 1122 */ if (newRoom != null) { +/* 1123 */ newRoom.add(p); +/* */ } +/* 1125 */ active.resetAvatarNow(); +/* */ +/* */ +/* 1128 */ newc.checkCourtesyVIP(); +/* */ +/* */ +/* 1131 */ if (active.getWorld() != lastWorld) { +/* 1132 */ lastWorld = active.getWorld(); +/* 1133 */ newc.displayAds(); +/* 1134 */ WorldScriptManager.getInstance().worldEntered(lastWorld.toString()); +/* */ } +/* 1136 */ WorldScriptManager.getInstance().roomEntered(newRoom.toString()); +/* */ +/* */ +/* 1139 */ newRoom.addPostrenderHandler(BlackBox.getInstance()); +/* 1140 */ newRoom.addFrameHandler(BlackBox.getInstance(), null); +/* */ +/* 1142 */ return active; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ public void changeChannel(String newChannel) +/* */ { +/* 1150 */ Galaxy g = this.console.getGalaxy(); +/* 1151 */ g.changeChannel(newChannel); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ private void setUpCameras(Console c) +/* */ { +/* 1161 */ Enumeration<WObject> camList = getContents(); +/* */ +/* 1163 */ for (Enumeration<FramePart> e = c.getParts(); e.hasMoreElements();) { +/* 1164 */ Object o = e.nextElement(); +/* 1165 */ if (((o instanceof RenderCanvas)) && (!(o instanceof AdPart))) { +/* 1166 */ ((RenderCanvas)o).setCamera(getNextCamera(camList)); +/* */ } +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public Camera getMainCamera() +/* */ { +/* 1177 */ if (this.lastCam != null) +/* */ { +/* */ +/* */ +/* 1181 */ SuperRoot o = this.lastCam.getOwner(); +/* 1182 */ if ((o == this) || ((o != null) && (o.getOwner() == this))) { +/* 1183 */ return this.lastCam; +/* */ } +/* */ } +/* 1186 */ return this.lastCam = getNextCamera(new DeepEnumeration(getContents())); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ private static Camera getNextCamera(Enumeration<WObject> list) +/* */ { +/* 1206 */ while (list.hasMoreElements()) { +/* 1207 */ WObject o = (WObject)list.nextElement(); +/* 1208 */ if ((o instanceof Camera)) { +/* 1209 */ return (Camera)o; +/* */ } +/* */ } +/* 1212 */ return null; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ protected void transferFrom(Pilot old) +/* */ { +/* 1222 */ if (old == null) +/* 1223 */ return; +/* 1224 */ this.lastx = old.lastx; +/* 1225 */ this.lasty = old.lasty; +/* 1226 */ this.lastz = old.lastz; +/* 1227 */ this.lastdir = old.lastdir; +/* 1228 */ this.lastroom = old.lastroom; +/* 1229 */ this.positionSentTime = old.positionSentTime; +/* */ +/* 1231 */ for (Enumeration<Object> ehs = getHandlers(); ehs.hasMoreElements();) { +/* 1232 */ Object eh = ehs.nextElement(); +/* 1233 */ if ((eh instanceof MomentumBehavior)) { +/* 1234 */ ((MomentumBehavior)eh).transferFrom(old.getHandlers()); +/* */ } +/* */ } +/* 1237 */ getMainCamera().transferFrom(old.getMainCamera()); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ public boolean handle(BumpEventTemp b) +/* */ { +/* 1245 */ slideBumpHandler(b); +/* 1246 */ return true; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void slideBumpHandler(BumpEventTemp b) +/* */ { +/* 1258 */ if (b.receiver != b.source) { +/* 1259 */ return; +/* */ } +/* */ +/* */ +/* */ +/* 1264 */ Point3Temp bumpNormal = Point3Temp.make(b.bumpNormal).normalize(); +/* 1265 */ b.postBumpPath.minus(Point3Temp.make(bumpNormal).times( +/* 1266 */ b.postBumpPath.dot(bumpNormal))); +/* */ +/* */ +/* */ +/* */ +/* */ +/* 1272 */ b.postBumpPath.plus(Point3Temp.make(b.bumpNormal).times(1.0E-6F)); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void makeShadow() {} +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public void setConsole(Console c) +/* */ { +/* 1305 */ assert (this.console == null); +/* 1306 */ this.console = c; +/* */ +/* 1308 */ copySoul(c.getPilotSoulTemplate(), this); +/* */ } +/* */ +/* */ +/* */ +/* */ private static void saveEnum(Saver s, Enumeration<?> e) +/* */ throws IOException +/* */ { +/* 1316 */ while (e.hasMoreElements()) { +/* 1317 */ Object o = e.nextElement(); +/* 1318 */ if (((o instanceof Persister)) && (!(o instanceof NonPersister))) +/* 1319 */ s.saveMaybeNull((Persister)o); +/* */ } +/* 1321 */ s.saveMaybeNull(null); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public static void copySoul(WObject source, WObject target) +/* */ { +/* 1330 */ ByteArrayOutputStream buffer = new ByteArrayOutputStream(); +/* */ try +/* */ { +/* 1333 */ Saver saver = new Saver(new DataOutputStream(buffer)); +/* */ +/* 1335 */ saveEnum(saver, source.getContents()); +/* 1336 */ saveEnum(saver, source.getHandlers()); +/* 1337 */ saveEnum(saver, source.getActions()); +/* 1338 */ saveEnum(saver, source.getAttributes()); +/* */ +/* 1340 */ saver.done(); +/* */ } catch (Exception e) { +/* 1342 */ e.printStackTrace(System.out); +/* 1343 */ throw new Error(e.toString()); +/* */ } +/* */ +/* */ try +/* */ { +/* 1348 */ Restorer r = new Restorer(new DataInputStream( +/* 1349 */ new ByteArrayInputStream(buffer.toByteArray()))); +/* */ Persister p; +/* 1351 */ while ((p = r.restoreMaybeNull()) != null) { Persister p; +/* 1352 */ target.add((Transform)p); } +/* 1353 */ while ((p = r.restoreMaybeNull()) != null) +/* 1354 */ target.addHandler((SuperRoot)p); +/* 1355 */ while ((p = r.restoreMaybeNull()) != null) +/* 1356 */ target.addAction((Action)p); +/* 1357 */ while ((p = r.restoreMaybeNull()) != null) { +/* 1358 */ target.addAttribute((Attribute)p); +/* */ } +/* 1360 */ r.done(); +/* */ } catch (Exception e) { +/* 1362 */ e.printStackTrace(System.out); +/* 1363 */ throw new Error(e.toString()); +/* */ } +/* */ } +/* */ +/* */ +/* */ protected void noteUnadding(SuperRoot child) +/* */ { +/* 1370 */ if ((child instanceof WObject)) { +/* 1371 */ WObject w = (WObject)child; +/* */ +/* */ +/* */ +/* 1375 */ w.isDynamic(); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* 1381 */ super.noteUnadding(child); +/* */ } +/* */ +/* */ +/* */ +/* */ public Object properties(int index, int offset, int mode, Object value) +/* */ throws NoSuchPropertyException +/* */ { +/* 1389 */ Object ret = null; +/* 1390 */ switch (index - offset) { +/* */ case 0: +/* 1392 */ if (mode == 0) { +/* 1393 */ ret = new Property(this, index, "Console"); +/* 1394 */ } else if (mode == 1) +/* 1395 */ ret = this.console; +/* 1396 */ break; +/* */ +/* */ default: +/* 1399 */ ret = super.properties(index, offset + 1, mode, value); +/* */ } +/* 1401 */ return ret; +/* */ } +/* */ +/* 1404 */ private static Object classCookie = new Object(); +/* */ +/* */ public void saveState(Saver s) throws IOException +/* */ { +/* 1408 */ if (this.console != null) { +/* 1409 */ System.out.println("Warning: saving pilot " + getName() + +/* 1410 */ " with soul, which won't restore correctly!"); +/* */ } +/* 1412 */ s.saveVersion(0, classCookie); +/* 1413 */ super.saveState(s); +/* */ } +/* */ +/* */ public void restoreState(Restorer r) throws IOException, TooNewException +/* */ { +/* 1418 */ switch (r.restoreVersion(classCookie)) { +/* */ case 0: +/* 1420 */ super.restoreState(r); +/* 1421 */ break; +/* */ +/* */ default: +/* 1424 */ throw new TooNewException(); +/* */ } +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\Pilot.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |