diff options
| author | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
| commit | c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch) | |
| tree | df9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/network/sessionInitCmd.java | |
| download | worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip | |
Initial commit
Diffstat (limited to 'NET/worlds/network/sessionInitCmd.java')
| -rw-r--r-- | NET/worlds/network/sessionInitCmd.java | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/NET/worlds/network/sessionInitCmd.java b/NET/worlds/network/sessionInitCmd.java new file mode 100644 index 0000000..32b6b77 --- /dev/null +++ b/NET/worlds/network/sessionInitCmd.java @@ -0,0 +1,120 @@ +package NET.worlds.network; + +import NET.worlds.console.Console; +import java.util.Enumeration; + +public class sessionInitCmd extends propCmd { + public static final byte SESSIONINITCMD = 6; + + public sessionInitCmd() { + this._commandType = 6; + } + + public sessionInitCmd(String user, String pass, String proto, String avatars, String ver) { + this._commandType = 6; + + assert user != null; + + this._propList.addProperty(new netProperty(2, user)); + if (pass != null) { + this._propList.addProperty(new netProperty(6, pass)); + } + + this._propList.addProperty(new netProperty(3, proto)); + this._propList.addProperty(new netProperty(7, avatars)); + this._propList.addProperty(new netProperty(9, ver)); + } + + public sessionInitCmd(OldPropertyList props) { + this._commandType = 6; + this._propList = props; + } + + @Override + void process(WorldServer serv) throws Exception { + if (serv.getState() == 8) { + for (int i = 0; i < this._propList.size(); i++) { + netProperty tmpProp = this._propList.elementAt(i); + switch (tmpProp.property()) { + case 1: + case 3: + case 8: + case 13: + case 15: + break; + case 2: + serv.setUsername(tmpProp.value()); + serv.getGalaxy().setNewChatname(null); + break; + case 4: + try { + int errorval = Integer.parseInt(tmpProp.value()); + if (errorval != 0) { + throw new VarErrorException(errorval); + } + } catch (NumberFormatException var7) { + System.err.println("sessionInitCmd: couldn't parse VAR_ERROR = " + tmpProp.value()); + } + break; + case 5: + serv.getGalaxy().setChannel(tmpProp.value()); + break; + case 6: + serv.getGalaxy().setPassword(tmpProp.value()); + serv.getGalaxy().setNewPassword(null); + break; + case 7: + case 9: + case 11: + case 12: + case 14: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + default: + System.out.println("sessionInitCmd: received unknown property: " + tmpProp.property()); + + assert false; + break; + case 10: + serv.getGalaxy().setSerialNum(tmpProp.value()); + break; + case 22: + try { + int priv = Integer.parseInt(tmpProp.value()); + Enumeration<NetworkObject> list = serv.getGalaxy().getConsoles(); + + while (list.hasMoreElements()) { + Console c = (Console)list.nextElement(); + c.setVIP((priv & 8) != 0); + c.setFullVIP((priv & 16) != 0); + c.setSpecialGuest((priv & 64) != 0); + } + + list = serv.getGalaxy().getConsoles(); + + while (list.hasMoreElements()) { + Console c = (Console)list.nextElement(); + c.enableBroadcast((priv & 2) != 0); + } + } catch (NumberFormatException var8) { + } + } + } + + if (serv.getVersion() < 18) { + serv.setState(9); + } else { + serv.setState(11); + } + } + } + + @Override + public String toString(WorldServer serv) { + return "SESSINIT " + this._propList; + } +} |