summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/Attribute.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-03 16:38:41 -0700
committerFuwn <[email protected]>2021-05-03 16:38:41 -0700
commite1e781bb2135ef78592226f1a3eaba4925702f1f (patch)
tree8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/Attribute.java
downloadworlds.jar-main.tar.xz
worlds.jar-main.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/scape/Attribute.java')
-rw-r--r--NET/worlds/scape/Attribute.java740
1 files changed, 740 insertions, 0 deletions
diff --git a/NET/worlds/scape/Attribute.java b/NET/worlds/scape/Attribute.java
new file mode 100644
index 0000000..ca1c4b6
--- /dev/null
+++ b/NET/worlds/scape/Attribute.java
@@ -0,0 +1,740 @@
+/* */ package NET.worlds.scape;
+/* */
+/* */ import NET.worlds.console.Console;
+/* */ import NET.worlds.network.InfiniteWaitException;
+/* */ import NET.worlds.network.NetworkObject;
+/* */ import NET.worlds.network.NetworkRoom;
+/* */ import NET.worlds.network.ObjID;
+/* */ import NET.worlds.network.PacketTooLargeException;
+/* */ import NET.worlds.network.WorldServer;
+/* */ import NET.worlds.network.propReqCmd;
+/* */ import java.io.DataInputStream;
+/* */ import java.io.DataOutputStream;
+/* */ import java.io.IOException;
+/* */ import java.util.Vector;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public abstract class Attribute
+/* */ extends Sensor
+/* */ {
+/* 116 */ public int _shorthandVersion = getMaxShorthandVersion();
+/* */ int _attrID;
+/* */ byte[] _serverData;
+/* */ boolean _waitingForFeedback;
+/* */
+/* */ public int getMaxShorthandVersion()
+/* */ {
+/* 123 */ return 0;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void load(LoadedAttribute callback)
+/* */ {
+/* 138 */ if (this.loaded) {
+/* 139 */ if (callback != null)
+/* 140 */ callback.loadedAttribute(this, null);
+/* 141 */ return;
+/* */ }
+/* */
+/* */
+/* 145 */ Sharer s = (Sharer)getOwner();
+/* 146 */ if ((s == null) || (!s.isShared())) {
+/* 147 */ if (callback != null)
+/* 148 */ callback.loadedAttribute(this, "unshared");
+/* 149 */ return;
+/* */ }
+/* */
+/* 152 */ if (callback != null) {
+/* 153 */ if (this.callbacks == null)
+/* 154 */ this.callbacks = new Vector();
+/* 155 */ this.callbacks.addElement(callback);
+/* */ }
+/* */
+/* */
+/* 159 */ Attribute f = getForwardAttribute();
+/* 160 */ if (f != null)
+/* */ {
+/* */
+/* 163 */ f.load(null);
+/* 164 */ return;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* 170 */ assert ((s.getMode() & 0x1) == 0);
+/* */
+/* 172 */ Object served = s.getOwner();
+/* */ try { String id;
+/* */ WorldServer servr;
+/* */ String id;
+/* 176 */ if ((served instanceof Room)) {
+/* 177 */ WorldServer servr = ((Room)served).getServer();
+/* 178 */ id = ((Room)served).getNetworkRoom().getLongID();
+/* */ } else {
+/* 180 */ servr = ((NetworkObject)served).getServer();
+/* 181 */ id = ((NetworkObject)served).getLongID();
+/* */ }
+/* 183 */ servr.sendNetworkMsg(new propReqCmd(new ObjID(id), this._attrID));
+/* */ }
+/* */ catch (InfiniteWaitException localInfiniteWaitException) {}catch (PacketTooLargeException e) {
+/* 186 */ if (!$assertionsDisabled) { throw new AssertionError();
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public int getAttrID()
+/* */ {
+/* 213 */ return this._attrID;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public Attribute(int attrID)
+/* */ {
+/* 222 */ this._attrID = attrID;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public Attribute() {}
+/* */
+/* */
+/* */
+/* */ public void setAttrID(int newID)
+/* */ {
+/* 234 */ flushBuffers();
+/* */
+/* 236 */ Sharer sharer = (Sharer)getOwner();
+/* 237 */ if (sharer == null) {
+/* 238 */ this._attrID = newID;
+/* */ } else {
+/* 240 */ sharer.resetAttributeID(this, newID);
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ private void flushBuffers()
+/* */ {
+/* 266 */ this._serverData = null;
+/* 267 */ this._waitingForFeedback = false;
+/* 268 */ this._outgoing = null;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ byte[] _outgoing;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ boolean loaded;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ Vector<LoadedAttribute> callbacks;
+/* */
+/* */
+/* */
+/* */
+/* */ private Attribute _to;
+/* */
+/* */
+/* */
+/* */
+/* 298 */ private int _storedForwardAttrID = -1;
+/* */
+/* */
+/* */
+/* */
+/* */ public int getForwardAttrID()
+/* */ {
+/* 305 */ if (this._to != null) {
+/* 306 */ return this._to._attrID;
+/* */ }
+/* 308 */ return this._storedForwardAttrID;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public void unforward()
+/* */ {
+/* 316 */ if (this._to != null) {
+/* 317 */ this._storedForwardAttrID = this._to.getAttrID();
+/* */
+/* 319 */ Sharer s = (Sharer)this._to.getOwner();
+/* 320 */ if (s != null)
+/* 321 */ s.removeAttribute(this._to);
+/* */ }
+/* 323 */ flushBuffers();
+/* */ }
+/* */
+/* */
+/* */
+/* */ public boolean isForwarded()
+/* */ {
+/* 330 */ return this._to != null;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public Attribute getForwardAttribute()
+/* */ {
+/* 338 */ return this._to;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void setForwardAttrID(int newID)
+/* */ {
+/* 351 */ if (this._to != null) {
+/* 352 */ this._to.setAttrID(newID);
+/* */ } else {
+/* 354 */ this._storedForwardAttrID = newID;
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void noteChange()
+/* */ {
+/* 372 */ Sharer sharer = (Sharer)getOwner();
+/* 373 */ if (sharer == null) {
+/* 374 */ return;
+/* */ }
+/* */
+/* 377 */ sharer.noteChange(this, this.actions.size() > 0);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void addForwarding()
+/* */ {
+/* 392 */ if (isForwarded()) {
+/* 393 */ return;
+/* */ }
+/* 395 */ Sharer s = (Sharer)getOwner();
+/* 396 */ assert (((WObject)s.getOwner()).getSharerMode() == 3);
+/* */
+/* */
+/* 399 */ WObject terminal = ((WObject)s.getOwner()).getServed();
+/* 400 */ if (terminal == null) {
+/* 401 */ return;
+/* */ }
+/* */
+/* 404 */ if (getOwner().getOwner() == terminal) {
+/* 405 */ return;
+/* */ }
+/* 407 */ ForwardAttribute fwd = new ForwardAttribute(this, this._storedForwardAttrID);
+/* 408 */ terminal.addShareableAttribute(fwd);
+/* 409 */ this._to = fwd;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public abstract void generateNetData(DataOutputStream paramDataOutputStream)
+/* */ throws IOException;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public abstract void setFromNetData(DataInputStream paramDataInputStream, int paramInt)
+/* */ throws IOException;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public void detach()
+/* */ {
+/* 446 */ super.detach();
+/* */
+/* 448 */ unforward();
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 456 */ protected int _propertyFlags = 208;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public int getFlags()
+/* */ {
+/* 464 */ return this._propertyFlags;
+/* */ }
+/* */
+/* */
+/* */
+/* */ public void setFlag(int flag, boolean onoff)
+/* */ {
+/* 471 */ if (onoff) {
+/* 472 */ this._propertyFlags |= flag;
+/* */ } else {
+/* 474 */ this._propertyFlags &= (flag ^ 0xFFFFFFFF);
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */ public void setFinger(boolean onoff)
+/* */ {
+/* 482 */ setFlag(32, onoff);
+/* */ }
+/* */
+/* */
+/* */
+/* */ public boolean getFinger()
+/* */ {
+/* 489 */ return (getFlags() & 0x20) != 0;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public void setAutoUpdate(boolean onoff)
+/* */ {
+/* 497 */ setFlag(64, onoff);
+/* */ }
+/* */
+/* */
+/* */
+/* */ public boolean getAutoUpdate()
+/* */ {
+/* 504 */ return (getFlags() & 0x40) != 0;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public void setDatabase(boolean onoff)
+/* */ {
+/* 512 */ setFlag(128, onoff);
+/* */ }
+/* */
+/* */
+/* */
+/* */ public boolean getDatabase()
+/* */ {
+/* 519 */ return (getFlags() & 0x80) != 0;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public void setBinary(boolean onoff)
+/* */ {
+/* 527 */ setFlag(16, onoff);
+/* */ }
+/* */
+/* */
+/* */
+/* */ public boolean getBinary()
+/* */ {
+/* 534 */ return (getFlags() & 0x10) != 0;
+/* */ }
+/* */
+/* */
+/* 538 */ protected int _accessFlags = 0;
+/* */
+/* */
+/* */
+/* */
+/* */ public int getAccessFlags()
+/* */ {
+/* 545 */ return this._accessFlags;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public void setAccessFlags(int flags)
+/* */ {
+/* 553 */ this._accessFlags = flags;
+/* */ }
+/* */
+/* */
+/* */ public Object properties(int index, int offset, int mode, Object value)
+/* */ throws NoSuchPropertyException
+/* */ {
+/* 560 */ Object ret = null;
+/* */
+/* 562 */ switch (index - offset) {
+/* */ case 0:
+/* 564 */ if (mode == 0) {
+/* 565 */ ret = IntegerPropertyEditor.make(new Property(this, index,
+/* 566 */ "Attribute ID"));
+/* 567 */ } else if (mode == 1) {
+/* 568 */ ret = new Integer(this._attrID);
+/* 569 */ } else if (mode == 2) {
+/* 570 */ int id = ((Integer)value).intValue();
+/* 571 */ if ((id < 0) || (id > 255)) {
+/* 572 */ Console.println(Console.message("Attribute-id"));
+/* */ } else
+/* 574 */ setAttrID(id);
+/* */ }
+/* 576 */ break;
+/* */ case 1:
+/* 578 */ if (mode == 0) {
+/* 579 */ ret = BooleanPropertyEditor.make(new Property(this, index,
+/* 580 */ "Fingerable"), "No", "Yes");
+/* 581 */ } else if (mode == 1) {
+/* 582 */ ret = new Boolean(getFinger());
+/* 583 */ } else if (mode == 2)
+/* 584 */ setFinger(((Boolean)value).booleanValue());
+/* 585 */ break;
+/* */
+/* */ case 2:
+/* 588 */ if (mode == 0) {
+/* 589 */ ret = BooleanPropertyEditor.make(new Property(this, index,
+/* 590 */ "Auto Update"), "No", "Yes");
+/* 591 */ } else if (mode == 1) {
+/* 592 */ ret = new Boolean(getAutoUpdate());
+/* 593 */ } else if (mode == 2)
+/* 594 */ setAutoUpdate(((Boolean)value).booleanValue());
+/* 595 */ break;
+/* */
+/* */ case 3:
+/* 598 */ if (mode == 0) {
+/* 599 */ ret = BooleanPropertyEditor.make(new Property(this, index,
+/* 600 */ "Store in Database"), "No", "Yes");
+/* 601 */ } else if (mode == 1) {
+/* 602 */ ret = new Boolean(getDatabase());
+/* 603 */ } else if (mode == 2)
+/* 604 */ setDatabase(((Boolean)value).booleanValue());
+/* 605 */ break;
+/* */
+/* */ case 4:
+/* 608 */ if (mode == 0) {
+/* 609 */ ret = IntegerPropertyEditor.make(new Property(this, index,
+/* 610 */ "Shorthand version"));
+/* 611 */ } else if (mode == 1) {
+/* 612 */ ret = new Integer(this._shorthandVersion);
+/* 613 */ } else if (mode == 2) {
+/* 614 */ int id = ((Integer)value).intValue();
+/* 615 */ if ((id < 0) || (id > getMaxShorthandVersion())) {
+/* 616 */ Console.println(
+/* 617 */ Console.message("Shorthand-version") + " " + getMaxShorthandVersion());
+/* */ } else
+/* 619 */ this._shorthandVersion = id;
+/* */ }
+/* 621 */ break;
+/* */
+/* */ case 5:
+/* 624 */ if (mode == 0) {
+/* 625 */ ret = IntegerPropertyEditor.make(new Property(this, index,
+/* 626 */ "Forwarder attrID"));
+/* 627 */ } else if (mode == 1) {
+/* 628 */ ret = new Integer(getForwardAttrID());
+/* 629 */ } else if (mode == 2) {
+/* 630 */ int id = ((Integer)value).intValue();
+/* 631 */ if ((id < 0) || (id > 255)) {
+/* 632 */ Console.println(Console.message("Attribute-id"));
+/* */ } else
+/* 634 */ setForwardAttrID(id);
+/* */ }
+/* 636 */ break;
+/* */
+/* */ case 6:
+/* 639 */ if (mode == 0) {
+/* 640 */ ret = BooleanPropertyEditor.make(new Property(this, index,
+/* 641 */ "Load Now"), "No", "Yes");
+/* 642 */ } else if (mode == 1) {
+/* 643 */ ret = new Boolean(false);
+/* 644 */ } else if ((mode == 2) &&
+/* 645 */ (((Boolean)value).booleanValue())) {
+/* 646 */ load(null);
+/* */ }
+/* 648 */ break;
+/* */
+/* */ default:
+/* 651 */ ret = super.properties(index, offset + 7, mode, value);
+/* */ }
+/* 653 */ return ret;
+/* */ }
+/* */
+/* */ public Object propertyParent()
+/* */ {
+/* 658 */ return getOwner().getOwner();
+/* */ }
+/* */
+/* */
+/* */
+/* 663 */ private static Object classCookie = new Object();
+/* */
+/* */ public void saveState(Saver s) throws IOException
+/* */ {
+/* 667 */ s.saveVersion(5, classCookie);
+/* 668 */ super.saveState(s);
+/* 669 */ s.saveInt(this._attrID);
+/* 670 */ s.saveInt(getForwardAttrID());
+/* 671 */ s.saveInt(this._propertyFlags);
+/* 672 */ s.saveInt(this._shorthandVersion);
+/* */ }
+/* */
+/* */ public void restoreState(Restorer r) throws IOException, TooNewException
+/* */ {
+/* 677 */ switch (r.restoreVersion(classCookie)) {
+/* */ case 0:
+/* 679 */ this._attrID = r.restoreInt();
+/* 680 */ if (r.restoreBoolean()) {
+/* 681 */ this._storedForwardAttrID = r.restoreInt();
+/* */ } else
+/* 683 */ r.restoreInt();
+/* 684 */ break;
+/* */
+/* */ case 1:
+/* 687 */ this._attrID = r.restoreInt();
+/* 688 */ this._storedForwardAttrID = r.restoreInt();
+/* 689 */ break;
+/* */
+/* */ case 2:
+/* 692 */ this._attrID = r.restoreInt();
+/* 693 */ this._storedForwardAttrID = r.restoreInt();
+/* 694 */ this._propertyFlags = r.restoreInt();
+/* 695 */ break;
+/* */
+/* */ case 3:
+/* 698 */ restoreStateSuperRoot(r);
+/* 699 */ this._attrID = r.restoreInt();
+/* 700 */ this._storedForwardAttrID = r.restoreInt();
+/* 701 */ this._propertyFlags = r.restoreInt();
+/* 702 */ break;
+/* */
+/* */ case 4:
+/* 705 */ restoreStateSuperRoot(r);
+/* 706 */ this._attrID = r.restoreInt();
+/* 707 */ this._storedForwardAttrID = r.restoreInt();
+/* 708 */ this._propertyFlags = r.restoreInt();
+/* 709 */ this._shorthandVersion = r.restoreInt();
+/* 710 */ break;
+/* */
+/* */ case 5:
+/* 713 */ super.restoreState(r);
+/* 714 */ this._attrID = r.restoreInt();
+/* 715 */ this._storedForwardAttrID = r.restoreInt();
+/* 716 */ this._propertyFlags = r.restoreInt();
+/* 717 */ this._shorthandVersion = r.restoreInt();
+/* 718 */ break;
+/* */
+/* */ default:
+/* 721 */ throw new TooNewException();
+/* */ }
+/* */ }
+/* */
+/* */ public String toString()
+/* */ {
+/* 727 */ if (isForwarded()) {
+/* 728 */ return super.toString() + "[forwarded to " + this._to.getName() + "]";
+/* */ }
+/* 730 */ return super.toString();
+/* */ }
+/* */
+/* */ public void releaseAuxilaryData() {}
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\Attribute.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file