/* */ package NET.worlds.scape; /* */ /* */ import NET.worlds.console.Console; /* */ import NET.worlds.console.Main; /* */ import NET.worlds.console.MainCallback; /* */ import NET.worlds.network.URL; /* */ import java.io.IOException; /* */ import java.text.MessageFormat; /* */ import java.util.Enumeration; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class MontyDoor /* */ extends Portal /* */ implements MouseDownHandler, MainCallback /* */ { /* */ public MontyDoor() /* */ { /* 36 */ this.flags |= 0x40000; /* */ } /* */ /* */ /* 40 */ boolean setsAvatar = false; /* */ /* */ /* */ URL url; /* */ /* */ /* 46 */ String description = ""; /* */ /* */ DialogAction action; /* */ /* */ String viewName; /* */ /* */ URL viewURL; /* */ Persister lastTrigger; /* */ /* */ public boolean handle(MouseDownEvent e) /* */ { /* 57 */ if ((e.key & 0x1) == 0) { /* 58 */ return false; /* */ } /* */ /* 61 */ if ((this.action != null) || (this.url == null)) { /* 62 */ return true; /* */ } /* 64 */ if (this.setsAvatar) /* */ { /* 66 */ SelectAvatarAction a = new SelectAvatarAction(); /* 67 */ a.url = this.viewURL; /* 68 */ a.description = this.description; /* 69 */ this.action = a; /* */ } /* */ else { /* 72 */ SendURLAction a = new SendURLAction(); /* 73 */ a.destination = this.url; /* 74 */ a.description = this.description; /* 75 */ this.action = a; /* */ } /* */ /* */ /* 79 */ this.action.cancelOnly = true; /* 80 */ Main.register(this); /* */ /* 82 */ return true; /* */ } /* */ /* */ /* */ /* */ public void mainCallback() /* */ { /* 89 */ if (this.action.cancelOnly) { /* 90 */ this.lastTrigger = this.action.trigger(null, this.lastTrigger); /* 91 */ if (this.lastTrigger != null) { /* 92 */ return; /* */ } /* */ /* 95 */ if ((this.viewURL != null) && (this.viewName != null) && /* 96 */ (this._farSideRoomName != null)) /* */ { /* 98 */ Room r = getRoom(); /* */ World w; /* 100 */ if ((r != null) && ((w = r.getWorld()) != null)) { /* 101 */ r = w.getRoom(this._farSideRoomName); /* */ /* 103 */ if (r == null) { /* 104 */ Main.unregister(this); /* 105 */ this.action = null; /* 106 */ Object[] arguments = { new String(getName()), /* 107 */ new String(this._farSideRoomName) }; /* 108 */ Console.println(MessageFormat.format( /* 109 */ Console.message("MontyDoor"), arguments)); /* 110 */ return; /* */ } /* */ /* 113 */ Enumeration list = r.getDeepOwned(); /* 114 */ SetPropertyAction.propHelper(2, this.viewURL, "File", /* 115 */ SuperRoot.nameSearch(list, this.viewName)); /* */ } /* */ } /* */ /* */ /* 120 */ this.action.cancelOnly = false; /* */ /* 122 */ this.flags &= 0xFFFBFFFF; /* 123 */ reset(); /* */ } /* */ /* */ /* */ /* */ /* 129 */ this.lastTrigger = this.action.trigger(null, this.lastTrigger); /* 130 */ if (this.lastTrigger != null) { /* 131 */ return; /* */ } /* */ /* 134 */ Main.unregister(this); /* 135 */ this.action = null; /* */ /* */ /* 138 */ this.flags |= 0x40000; /* 139 */ reset(); /* */ } /* */ /* */ public BumpCalc getBumpCalc(BumpEventTemp b) { /* 143 */ return standardPlaneBumpCalc; /* */ } /* */ /* */ public boolean handle(BumpEventTemp b) /* */ { /* 148 */ return true; /* */ } /* */ /* */ /* */ public Object properties(int index, int offset, int mode, Object value) /* */ throws NoSuchPropertyException /* */ { /* 155 */ Object ret = null; /* 156 */ switch (index - offset) { /* */ case 0: /* 158 */ if (mode == 0) { /* 159 */ ret = BooleanPropertyEditor.make( /* 160 */ new Property(this, index, "Avatar type"), /* 161 */ "SendURL", /* 162 */ "SelectAvatar"); /* */ } /* 164 */ else if (mode == 1) { /* 165 */ ret = new Boolean(this.setsAvatar); /* */ } /* 167 */ else if (mode == 2) { /* 168 */ this.setsAvatar = ((Boolean)value).booleanValue(); /* */ } /* 170 */ break; /* */ case 1: /* 172 */ if (mode == 0) { /* 173 */ ret = URLPropertyEditor.make( /* 174 */ new Property(this, index, /* 175 */ "URL (used only for non-avatar)") /* 176 */ .allowSetNull(), null); /* */ } /* 178 */ else if (mode == 1) { /* 179 */ ret = this.url; /* 180 */ } else if (mode == 2) /* 181 */ this.url = ((URL)value); /* 182 */ break; /* */ case 2: /* 184 */ if (mode == 0) { /* 185 */ ret = StringPropertyEditor.make( /* 186 */ new Property(this, index, "Description")); /* 187 */ } else if (mode == 1) { /* 188 */ ret = this.description; /* 189 */ } else if (mode == 2) /* 190 */ this.description = ((String)value).toString().trim(); /* 191 */ break; /* */ case 3: /* 193 */ if (mode == 0) { /* 194 */ ret = URLPropertyEditor.make( /* 195 */ new Property(this, index, "Display URL") /* 196 */ .allowSetNull(), null); /* */ } /* 198 */ else if (mode == 1) { /* 199 */ ret = this.viewURL; /* 200 */ } else if (mode == 2) /* 201 */ this.viewURL = ((URL)value); /* 202 */ break; /* */ case 4: /* 204 */ if (mode == 0) { /* 205 */ ret = StringPropertyEditor.make( /* 206 */ new Property(this, index, "Display Name")); /* 207 */ } else if (mode == 1) { /* 208 */ ret = this.viewName; /* 209 */ } else if (mode == 2) /* 210 */ this.viewName = ((String)value).toString().trim(); /* 211 */ break; /* */ default: /* 213 */ ret = super.properties(index, offset + 5, mode, value); /* */ } /* 215 */ return ret; /* */ } /* */ /* */ /* 219 */ private static Object classCookie = new Object(); /* */ /* */ public void saveState(Saver s) throws IOException { /* 222 */ s.saveVersion(0, classCookie); /* 223 */ int f = this.flags; /* 224 */ this.flags |= 0x40000; /* 225 */ super.saveState(s); /* 226 */ this.flags = f; /* 227 */ s.saveBoolean(this.setsAvatar); /* 228 */ URL.save(s, this.url); /* 229 */ s.saveString(this.description); /* 230 */ URL.save(s, this.viewURL); /* 231 */ s.saveString(this.viewName); /* */ } /* */ /* */ public void restoreState(Restorer r) throws IOException, TooNewException { /* 235 */ switch (r.restoreVersion(classCookie)) { /* */ case 0: /* 237 */ super.restoreState(r); /* 238 */ this.setsAvatar = r.restoreBoolean(); /* 239 */ this.url = URL.restore(r); /* 240 */ this.description = r.restoreString(); /* 241 */ this.viewURL = URL.restore(r); /* 242 */ this.viewName = r.restoreString(); /* 243 */ break; /* */ /* */ default: /* 246 */ throw new TooNewException(); /* */ } /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\MontyDoor.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */