/* */ package NET.worlds.scape; /* */ /* */ import java.awt.Color; /* */ import java.io.IOException; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class BuildStairs /* */ extends SwitchableBehavior /* */ implements FrameHandler, Persister /* */ { /* 31 */ protected boolean doBuild = false; /* 32 */ protected boolean built = false; /* 33 */ protected WrStaircase stairs = null; /* */ /* */ /* 36 */ protected String stairName = "staircase"; /* 37 */ protected float length = 1000.0F; /* 38 */ protected float width = 300.0F; /* 39 */ protected float pWidth = 250.0F; /* 40 */ protected float pHeight = 240.0F; /* 41 */ protected float dz = 300.0F; /* 42 */ protected float lintelZ = 50.0F; /* 43 */ protected int numsteps = 10; /* */ /* */ /* 46 */ protected Material riser = new Material(Color.gray); /* 47 */ protected Material tread = new Material(Color.green); /* 48 */ protected Material left = new Material(Color.cyan); /* 49 */ protected Material right = new Material(Color.red); /* 50 */ protected Material doorpost = new Material(Color.yellow); /* 51 */ protected Material lintel = new Material(Color.magenta); /* 52 */ protected Material ceiling = new Material(Color.blue); /* */ /* 54 */ protected String worldURL = null; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ protected void build(Portal end1) /* */ { /* 68 */ Room room = end1.getRoom(); /* 69 */ World world = room.getWorld(); /* */ /* */ /* 72 */ this.stairs = new WrStaircase(world, this.stairName, /* 73 */ this.length, this.width, this.pWidth, this.pHeight, /* 74 */ this.dz, this.lintelZ, this.numsteps, /* 75 */ this.riser, this.tread, this.left, this.right, this.doorpost, this.lintel, this.ceiling); /* */ /* */ /* 78 */ end1.biconnect(this.stairs.portal1); /* */ /* */ /* 81 */ this.built = true; /* */ /* 83 */ end1.removeHandler(this); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ protected void unbuild(Portal end1) /* */ { /* 95 */ this.built = false; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ public boolean handle(FrameEvent e) /* */ { /* 105 */ if ((!this.built) && (this.doBuild) && ((e.target instanceof Portal))) { /* 106 */ build((Portal)e.target); /* 107 */ } else if ((this.built) && (!this.doBuild) && ((e.target instanceof Portal))) /* 108 */ unbuild((Portal)e.target); /* 109 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public Object properties(int index, int offset, int mode, Object value) /* */ throws NoSuchPropertyException /* */ { /* 119 */ Object ret = null; /* 120 */ switch (index - offset) { /* */ case 0: /* 122 */ if (mode == 0) /* 123 */ ret = new ClassProperty(this, index, "BuildStairs"); /* 124 */ break; /* */ case 1: /* 126 */ if (mode == 0) { /* 127 */ ret = BooleanPropertyEditor.make( /* 128 */ new Property(this, index, "Build now?"), /* 129 */ "Later", "Now"); /* 130 */ } else if (mode == 1) { /* 131 */ ret = new Boolean(this.doBuild); /* 132 */ } else if (mode == 2) /* 133 */ this.doBuild = ((Boolean)value).booleanValue(); /* 134 */ break; /* */ case 2: /* 136 */ if (mode == 0) { /* 137 */ ret = StringPropertyEditor.make( /* 138 */ new Property(this, index, "Staircase Name")); /* 139 */ } else if (mode == 1) { /* 140 */ ret = this.stairName; /* 141 */ } else if (mode == 2) /* 142 */ this.stairName = ((String)value); /* 143 */ break; /* */ case 3: /* 145 */ if (mode == 0) { /* 146 */ ret = IntegerPropertyEditor.make( /* 147 */ new Property(this, index, "Number of Steps")); /* 148 */ } else if (mode == 1) { /* 149 */ ret = new Integer(this.numsteps); /* 150 */ } else if (mode == 2) /* 151 */ this.numsteps = ((Integer)value).intValue(); /* 152 */ break; /* */ case 4: /* 154 */ if (mode == 0) { /* 155 */ ret = FloatPropertyEditor.make( /* 156 */ new Property(this, index, "Portal-to-portal Distance")); /* 157 */ } else if (mode == 1) { /* 158 */ ret = new Float(this.length); /* 159 */ } else if (mode == 2) /* 160 */ this.length = ((Float)value).floatValue(); /* 161 */ break; /* */ case 5: /* 163 */ if (mode == 0) { /* 164 */ ret = FloatPropertyEditor.make( /* 165 */ new Property(this, index, "Stairwell Width")); /* 166 */ } else if (mode == 1) { /* 167 */ ret = new Float(this.width); /* 168 */ } else if (mode == 2) /* 169 */ this.width = ((Float)value).floatValue(); /* 170 */ break; /* */ case 6: /* 172 */ if (mode == 0) { /* 173 */ ret = FloatPropertyEditor.make( /* 174 */ new Property(this, index, "Portal Width")); /* 175 */ } else if (mode == 1) { /* 176 */ ret = new Float(this.pWidth); /* 177 */ } else if (mode == 2) /* 178 */ this.pWidth = ((Float)value).floatValue(); /* 179 */ break; /* */ case 7: /* 181 */ if (mode == 0) { /* 182 */ ret = FloatPropertyEditor.make( /* 183 */ new Property(this, index, "Portal Height")); /* 184 */ } else if (mode == 1) { /* 185 */ ret = new Float(this.pHeight); /* 186 */ } else if (mode == 2) /* 187 */ this.pHeight = ((Float)value).floatValue(); /* 188 */ break; /* */ case 8: /* 190 */ if (mode == 0) { /* 191 */ ret = FloatPropertyEditor.make( /* 192 */ new Property(this, index, "Total Rise")); /* 193 */ } else if (mode == 1) { /* 194 */ ret = new Float(this.dz); /* 195 */ } else if (mode == 2) /* 196 */ this.dz = ((Float)value).floatValue(); /* 197 */ break; /* */ case 9: /* 199 */ if (mode == 0) { /* 200 */ ret = FloatPropertyEditor.make( /* 201 */ new Property(this, index, "Lintel Height")); /* 202 */ } else if (mode == 1) { /* 203 */ ret = new Float(this.lintelZ); /* 204 */ } else if (mode == 2) /* 205 */ this.lintelZ = ((Float)value).floatValue(); /* 206 */ break; /* */ case 10: /* 208 */ if (mode == 0) { /* 209 */ ret = new Property(this, index, "Riser Material"); /* 210 */ } else if (mode == 1) /* 211 */ ret = this.riser; /* 212 */ break; /* */ case 11: /* 214 */ if (mode == 0) { /* 215 */ ret = new Property(this, index, "Tread Material"); /* 216 */ } else if (mode == 1) /* 217 */ ret = this.tread; /* 218 */ break; /* */ case 12: /* 220 */ if (mode == 0) { /* 221 */ ret = new Property(this, index, "Left Wall Material"); /* 222 */ } else if (mode == 1) /* 223 */ ret = this.left; /* 224 */ break; /* */ case 13: /* 226 */ if (mode == 0) { /* 227 */ ret = new Property(this, index, "Right Wall Material"); /* 228 */ } else if (mode == 1) /* 229 */ ret = this.right; /* 230 */ break; /* */ case 14: /* 232 */ if (mode == 0) { /* 233 */ ret = new Property(this, index, "Doorpost Material"); /* 234 */ } else if (mode == 1) /* 235 */ ret = this.doorpost; /* 236 */ break; /* */ case 15: /* 238 */ if (mode == 0) { /* 239 */ ret = new Property(this, index, "Lintel Material"); /* 240 */ } else if (mode == 1) /* 241 */ ret = this.lintel; /* 242 */ break; /* */ case 16: /* 244 */ if (mode == 0) { /* 245 */ ret = new Property(this, index, "Ceiling Material"); /* 246 */ } else if (mode == 1) /* 247 */ ret = this.ceiling; /* 248 */ break; /* */ default: /* 250 */ ret = super.properties(index, offset + 17, mode, value); /* */ } /* */ /* 253 */ return ret; /* */ } /* */ /* */ /* */ /* */ public String toString() /* */ { /* 260 */ return "Stairs: built=" + this.built; /* */ } /* */ /* */ /* */ /* */ public void saveState(Saver s) /* */ throws IOException /* */ { /* 268 */ s.saveBoolean(this.built); /* 269 */ s.saveString(this.stairName); /* 270 */ s.saveFloat(this.length); /* 271 */ s.saveFloat(this.width); /* 272 */ s.saveFloat(this.pWidth); /* 273 */ s.saveFloat(this.pHeight); /* 274 */ s.saveFloat(this.dz); /* 275 */ s.saveFloat(this.lintelZ); /* 276 */ s.saveInt(this.numsteps); /* */ } /* */ /* */ /* */ /* */ public void restoreState(Restorer r) /* */ throws IOException /* */ { /* 284 */ this.built = r.restoreBoolean(); /* 285 */ this.stairName = r.restoreString(); /* 286 */ this.length = r.restoreFloat(); /* 287 */ this.width = r.restoreFloat(); /* 288 */ this.pWidth = r.restoreFloat(); /* 289 */ this.pHeight = r.restoreFloat(); /* 290 */ this.dz = r.restoreFloat(); /* 291 */ this.lintelZ = r.restoreFloat(); /* 292 */ this.numsteps = r.restoreInt(); /* */ } /* */ /* */ public void postRestore(int version) {} /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\BuildStairs.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */