summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/Teleport.java
diff options
context:
space:
mode:
Diffstat (limited to 'NET/worlds/scape/Teleport.java')
-rw-r--r--NET/worlds/scape/Teleport.java149
1 files changed, 149 insertions, 0 deletions
diff --git a/NET/worlds/scape/Teleport.java b/NET/worlds/scape/Teleport.java
new file mode 100644
index 0000000..1e85fcd
--- /dev/null
+++ b/NET/worlds/scape/Teleport.java
@@ -0,0 +1,149 @@
+/* */ package NET.worlds.scape;
+/* */
+/* */ import NET.worlds.console.Console;
+/* */ import java.io.IOException;
+/* */ import java.text.MessageFormat;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class Teleport
+/* */ extends SwitchableBehavior
+/* */ implements FrameHandler, Persister, MouseDownHandler, BumpHandler, TeleportStatus
+/* */ {
+/* */ String trigger;
+/* */ String externalTriggerTag;
+/* */ String worldName;
+/* */ private Room currentRoom;
+/* */
+/* */ public Teleport()
+/* */ {
+/* 34 */ this.trigger = "none";
+/* 35 */ this.externalTriggerTag = "";
+/* 36 */ this.worldName = "";
+/* 37 */ this.currentRoom = null;
+/* */ }
+/* */
+/* 40 */ public boolean handle(FrameEvent e) { return true; }
+/* */
+/* 42 */ public boolean handle(MouseDownEvent e) { if ((this.enabled) &&
+/* 43 */ (this.trigger.equals("click"))) {
+/* 44 */ this.currentRoom = e.target.getRoom();
+/* 45 */ TeleportAction.teleport(this.worldName, this);
+/* */ }
+/* */
+/* 48 */ return true;
+/* */ }
+/* */
+/* 51 */ public boolean handle(BumpEventTemp e) { if ((this.enabled) &&
+/* 52 */ (this.trigger.equals("bump"))) {
+/* 53 */ this.currentRoom = e.target.getRoom();
+/* 54 */ TeleportAction.teleport(this.worldName, this);
+/* */ }
+/* */
+/* 57 */ return true;
+/* */ }
+/* */
+/* */ public void teleportStatus(String err, String url) {}
+/* */
+/* */ public Object properties(int index, int offset, int mode, Object value) throws NoSuchPropertyException
+/* */ {
+/* 64 */ Object ret = null;
+/* */
+/* 66 */ switch (index - offset) {
+/* */ case 0:
+/* 68 */ if (mode == 0) {
+/* 69 */ ret = StringPropertyEditor.make(
+/* 70 */ new Property(this, index, "Trigger"));
+/* 71 */ } else if (mode == 1) {
+/* 72 */ ret = new String(this.trigger);
+/* 73 */ } else if (mode == 2) {
+/* 74 */ this.trigger = ((String)value).trim();
+/* */ }
+/* 76 */ break;
+/* */ case 1:
+/* 78 */ if (mode == 0) {
+/* 79 */ ret = StringPropertyEditor.make(
+/* 80 */ new Property(this, index, "External Trigger Tag"));
+/* 81 */ } else if (mode == 1) {
+/* 82 */ ret = new String(this.externalTriggerTag);
+/* 83 */ } else if (mode == 2) {
+/* 84 */ this.externalTriggerTag = ((String)value).trim();
+/* */ }
+/* 86 */ break;
+/* */ case 2:
+/* 88 */ if (mode == 0) {
+/* 89 */ ret = StringPropertyEditor.make(
+/* 90 */ new Property(this, index, "World Name"));
+/* 91 */ } else if (mode == 1) {
+/* 92 */ ret = new String(this.worldName);
+/* 93 */ } else if (mode == 2) {
+/* 94 */ this.worldName = ((String)value).trim();
+/* */ }
+/* 96 */ break;
+/* */ default:
+/* 98 */ ret = super.properties(index, offset + 3, mode, value);
+/* */ }
+/* */
+/* 101 */ return ret;
+/* */ }
+/* */
+/* */ public String toString() {
+/* 105 */ return
+/* */
+/* */
+/* 108 */ super.toString() + "[trigger " + this.trigger + ", External trigger" + this.externalTriggerTag + ", World Name " + this.worldName + ", enabled " + this.enabled + "]";
+/* */ }
+/* */
+/* */ public void saveState(Saver s)
+/* */ throws IOException
+/* */ {
+/* 114 */ s.saveString(this.trigger);
+/* 115 */ s.saveString(this.externalTriggerTag);
+/* 116 */ s.saveString(this.worldName);
+/* */ }
+/* */
+/* */ public void restoreState(Restorer r)
+/* */ throws IOException
+/* */ {
+/* 122 */ this.trigger = r.restoreString();
+/* 123 */ this.externalTriggerTag = r.restoreString();
+/* 124 */ this.worldName = r.restoreString();
+/* */ }
+/* */
+/* */
+/* */ public void postRestore(int version)
+/* */ {
+/* 130 */ String name = getName();
+/* 131 */ String arg1 = name == null ? "<null>" : name;
+/* 132 */ SuperRoot owner = getOwner();
+/* */
+/* 134 */ String oname = "";
+/* 135 */ if (owner != null) {
+/* 136 */ oname = owner.getName();
+/* */ }
+/* 138 */ String arg2 = oname == null ? "<null>" : oname;
+/* 139 */ Object[] arguments = { new String(arg1), new String(arg2) };
+/* 140 */ Console.println(MessageFormat.format(
+/* 141 */ Console.message("Teleport-obs"), arguments));
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\Teleport.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file