diff options
| author | Fuwn <[email protected]> | 2021-04-06 20:11:26 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-04-06 20:11:26 -0700 |
| commit | 6e04b1bab644045398b213900b60bf1ac1c0272d (patch) | |
| tree | 0cc17281bbd67244efc3c23e71297c9cbaa9c0d8 /docs/worlds-jar | |
| parent | chore: Create contribution guidelines (diff) | |
| download | site-6e04b1bab644045398b213900b60bf1ac1c0272d.tar.xz site-6e04b1bab644045398b213900b60bf1ac1c0272d.zip | |
major: Furnish repository
Diffstat (limited to 'docs/worlds-jar')
| -rw-r--r-- | docs/worlds-jar/net-worlds/network/netconst.md | 189 | ||||
| -rw-r--r-- | docs/worlds-jar/net-worlds/network/netpacket.md | 61 | ||||
| -rw-r--r-- | docs/worlds-jar/net-worlds/network/objid.md | 68 | ||||
| -rw-r--r-- | docs/worlds-jar/net-worlds/network/serveroutputstream.md | 110 |
4 files changed, 428 insertions, 0 deletions
diff --git a/docs/worlds-jar/net-worlds/network/netconst.md b/docs/worlds-jar/net-worlds/network/netconst.md new file mode 100644 index 0000000..4210c5b --- /dev/null +++ b/docs/worlds-jar/net-worlds/network/netconst.md @@ -0,0 +1,189 @@ +--- +title: netConst +--- + +## Class Type +`interface` + +## Fields +```java +public static final byte PROTOCOL_VERSION = 24; + +public static final byte STATECMD = 2; + +public static final int MAXCMD = 255; + +public static final int CURRENT_ROOM = 253; + +public static final int CLIENT = 1; + +public static final int CO = 254; + +public static final int PO = 255; + +public static final byte VAR_APPNAME = 1; + +public static final byte VAR_USERNAME = 2; + +public static final byte VAR_PROTOCOL = 3; + +public static final byte VAR_ERROR = 4; + +public static final byte VAR_CHANNEL = 5; + +public static final byte VAR_BITMAP = 5; + +public static final byte VAR_PASSWORD = 6; + +public static final byte VAR_AVATARS = 7; + +public static final byte VAR_UPDATETIME = 8; + +public static final byte VAR_CLIENT = 9; + +public static final int VAR_SERIAL = 10; + +public static final int VAR_EMAIL = 11; + +public static final int VAR_LOGONOFF = 12; + +public static final int VAR_DURATION = 13; + +public static final int VAR_GUEST = 14; + +public static final int VAR_SERVERTYPE = 15; + +public static final int VAR_BIZCARD = 16; + +public static final int VAR_NEW_PASSWD = 20; + +public static final int VAR_PRIV = 22; + +public static final byte VAR_ASLEEP = 23; + +public static final byte VAR_EXTERNAL_HTTP_SERVER = 24; + +public static final byte VAR_SCRIPT_SERVER = 25; + +public static final byte VAR_SMTP_SERVER = 26; + +public static final byte VAR_MAIL_DOMAIN = 27; + +public static final byte VAR_NEW_USERNAME = 28; + +public static final byte VAR_INTERNAL_HTTP_SERVER = 29; + +public static final byte VAR_INVENTORY = 32; + +public static final int ACK = 0; + +public static final int NAK_BAD_USER = 1; + +public static final int NAK_MAX_ORDINARY = 2; + +public static final int NAK_MAX_PRIORITY = 3; + +public static final int NAK_BAD_WORLD = 4; + +public static final int NAK_FATAL = 5; + +public static final int NAK_BAD_PROTOCOL = 6; + +public static final int NAK_BAD_CLIENTSW = 7; + +public static final int NAK_BAD_ROOM = 8; + +public static final int NAK_BAD_SERIAL = 9; + +public static final int NAK_TAKEN_SERIAL = 10; + +public static final int NAK_TAKEN_USER = 11; + +public static final int NAK_NO_SUCH_USER = 12; + +public static final int NAK_BAD_PASSWORD = 13; + +public static final int NAK_BAD_ACCOUNT = 14; + +public static final int NAK_NOT_LOGGEDON = 15; + +public static final int NAK_BAD_IPADDRESS = 16; + +public static final int NAK_LOGGEDON = 17; + +public static final int NAK_CRYPT_METHOD = 18; + +public static final int NAK_CRYPT_ERROR = 19; + +public static final int NAK_SESSIONINIT = 20; + +public static final int NAK_ROOM_FULL = 21; + +public static final int NAK_SHUTDOWN = 100; + +public static final int NAK_WRITE_ERROR = 101; + +public static final int NAK_READ_ERROR = 102; + +public static final int NAK_UNEXPECTED = 103; + +public static final int NAK_CONNECTION = 104; + +public static final int NAK_IOSTREAMS = 105; + +public static final int NAK_TIMEOUT = 106; + +public static final int NAK_UNREACHABLE = 107; + +public static final int STATUS_CONNECTED = 200; + +public static final int STATUS_DETACHING = 201; + +public static final int STATUS_WILLRETRY = 202; + +public static final int STATUS_DISCONNECTED = 203; + +public static final int STATUS_DEAD = 204; + +public static final int STATUS_OFFLINE = 205; + +public static final int STATUS_GALAXY_ONLINE = 206; + +public static final int STATUS_GALAXY_OFFLINE = 206; + +public static final int PROPFLAG_BINARY = 16; + +public static final int PROPFLAG_FINGER = 32; + +public static final int PROPFLAG_AUTOUPDATE = 64; + +public static final int PROPFLAG_DBSTORE = 128; + +public static final int PROPACCESS_POSSESS = 1; + +public static final int PROPACCESS_PRIVATE = 2; + +public static final int SERVER_UNKNOWN = 0; + +public static final int USER_SERVER_DB = 1; + +public static final int USER_SERVER_ANON = 2; + +public static final int ROOM_SERVER_US = 3; + +public static final int ROOM_SERVER_ANON = 4; + +public static final int PRIV_NONE = 0; + +public static final int PRIV_BUILD = 1; + +public static final int PRIV_BROADCAST = 2; + +public static final int PRIV_PROPERTY = 4; + +public static final int PRIV_VIP = 8; + +public static final int PRIV_VIP2 = 16; + +public static final int PRIV_SPECIALGUEST = 64; +``` diff --git a/docs/worlds-jar/net-worlds/network/netpacket.md b/docs/worlds-jar/net-worlds/network/netpacket.md new file mode 100644 index 0000000..1c134d3 --- /dev/null +++ b/docs/worlds-jar/net-worlds/network/netpacket.md @@ -0,0 +1,61 @@ +--- +title: netPacket +--- + +## Imports +- `NET.worlds.console.StatNetMUNode` +- `java.io.IOException` + +## Class Type +`abstract` + +## Fields +### `protected ObjID _objID` + +### `protected int _commandType` + +## Constructors +```java +public netPacket(ObjID id, int cmd) { + if (id != null) { + this._objID = id; + } else { + this._objID = new ObjID(1); + } + this._commandType = cmd; +} + +public netPacket() { + this._objID = new ObjID(1); +} +``` + +## Methods +### `public int msgID()` +Returns [`this._commandType`](#protected-int-_commandtype). + +### `int packetSize()` +Returns `2 + `[`this._objID`](#protected-objid-_objid)`.packetSize()` + +### `public String toString(WorldServer serv`) +Returns `new Integer(`[`this._commandType`](#protected-int-_commandtype)`).toString()` + +### `void send(`[`ServerOutputStream`](./serveroutputstream)` o) throws IOException` +```java +int packetsize = packetSize(); +if (packetsize >= 256 && o.getVersion() <= 24) + throw new PacketTooLargeException(); +StatNetMUNode netStat = StatNetMUNode.getNode(); +netStat.addBytesSent(packetsize); +netStat.addPacketsSent(1); +assert this._commandType > 0; +if (packetsize >= 128 && o.getVersion() > 24) { + o.writeByte(128 + packetsize / 256); + o.writeByte(packetsize & 0xFF); +} else { + o.writeByte(packetsize); +} +this._objID.send(o); +o.writeByte(this._commandType); +} +``` diff --git a/docs/worlds-jar/net-worlds/network/objid.md b/docs/worlds-jar/net-worlds/network/objid.md new file mode 100644 index 0000000..c75bad3 --- /dev/null +++ b/docs/worlds-jar/net-worlds/network/objid.md @@ -0,0 +1,68 @@ +--- +title: ObjId +--- + +## Imports +- `java.io.IOException` + +## Fields +### `private int _shortObjID` + +### `private String _longObjID` + +## Constructors +```java +public ObjID(int id) { + this._shortObjID = id; + this._longObjID = null; +} + +public ObjID(String id) { + this._shortObjID = 0; + if (id.startsWith("!")) + id = id.substring(1); + this._longObjID = id; +} + +public ObjID() { + this._shortObjID = 0; + this._longObjID = null; +} +``` + +## Methods +### `public int shortID()` +Returns [`this._shortObjID`](#private-int-_shortobjid). + +### `public int longID()` +Returns [`this._longObjID`](#private-string-_longobjid). + +### `void parseNetData(ServerInputStream o) throws IOException` +```java +if (this._longObjID != null) { + o.writeByte(0); + o.writeUTF(this._longObjID); +} else { + assert this._shortObjID == 1 || this._shortObjID >= 253; + o.writeByte(this._shortObjID); +} +``` + +TLDR; Returns the correct field? + +### `public String toString(WorldServer serv)` +```java +if (this._longObjID != null) + return this._longObjID; + +return String.valueOf(Integer.toString(this._shortObjID)) + + "[" + serv.getLongID(this) + "]"; +``` + +### `public String toString()` +```java +if (this._longObjID != null) + return this._longObjID; + +return "[#" + Integer.toString(this._shortObjID) + "]"; +``` diff --git a/docs/worlds-jar/net-worlds/network/serveroutputstream.md b/docs/worlds-jar/net-worlds/network/serveroutputstream.md new file mode 100644 index 0000000..888e71a --- /dev/null +++ b/docs/worlds-jar/net-worlds/network/serveroutputstream.md @@ -0,0 +1,110 @@ +--- +title: ServerOutputStream +--- + +## Imports +- `java.io.FilterOutputStream` +- `java.io.IOException` +- `java.io.OutputStream` + +## Extends +[FilterOutputStream](https://docs.oracle.com/javase/7/docs/api/java/io/FilterOutputStream.html) + +## Fields +### `private int _version` +Purpose is to be determined. + +## Constructors +```java +public ServerOutputStream(OutputStream o) { + super(o); + setVersion(24); +} + +public ServerOutputStream(OutputStream o, int vers) { + super(o); + setVersion(vers); +} +``` + +## Methods +### `public void setVersion(int vers)` +Sets [`this._version`](#private-int-_version) to `vers`. + +### `public int getVersion()` +Returns [`this._version`](#private-int-_version). + +### `public final void write(int b) throws IOException` +Writes the singular byte; `b` to the output stream. + +```java +this.out.write(b); +``` + +### `public final void write(byte[] b, int off, len) throws IOException` +Writes `len` bytes from the specified byte array starting at the offset; `off` to the output stream. + +```java +this.out.write(b, off, len); +``` + +### `public final void writeByte(int v) throws IOException` +Clone of [`write(int b)`](#public-final-void-writeint-b-throws-ioexception). + +### `public final void writeShort(int v) throws IOException` +```java +OutputStream out = this.out; +out.write(v >>> 8 & 0xFF); +out.write(v >>> 0 & 0xFF); +``` + +### `public final void writeInt(int v) throws IOException` +```java +OutputStream out = this.out; +out.write(v >>> 24 & 0xFF); +out.write(v >>> 16 & 0xFF); +out.write(v >>> 8 & 0xFF); +out.write(v >>> 0 & 0xFF); +``` + +### `public static int utfLength(String str)` +```java +int strlen = str.length(); +int utflen = 0; +for (int i = 0; i < strlen; i++) { + int c = str.charAt(i); + if (c >= 1 && c <= 127) { + utflen++; + } else if (c > 2047) { + utflen += 3; + } else { + utflen += 2; + } +} +return utflen; +``` + +### `public final void writeUTF(String str) throws IOException` +```java +OutputStream out = this.out; +int strlen = str.length(); +int utflen = utfLength(str); +assert utflen < 256; +out.write(utflen >>> 0 & 0xFF); +for (int i = 0; i < strlen; i++) { + int c = str.charAt(i); + if (c >= 1 && c <= 127) { + out.write(c); + } else if (c > 2047) { + out.write(0xE0 | c >> 12 & 0xF); + out.write(0x80 | c >> 6 & 0x3F); + out.write(0x80 | c >> 0 & 0x3F); + } else { + out.write(0xC0 | c >> 6 & 0x1F); + out.write(0x80 | c >> 0 & 0x3F); + } +} +``` + +### Resources +- [https://docs.oracle.com/javase/7/docs/api/java/io/FilterOutputStream.html](https://docs.oracle.com/javase/7/docs/api/java/io/FilterOutputStream.html) |