1 /* 2 * This file has been automatically generated by Soupply and released under the MIT license. 3 * Generated from data/java316.xml 4 */ 5 module soupply.java316.protocol.login; 6 7 static import std.conv; 8 import std.typetuple : TypeTuple; 9 import xpacket; 10 11 import soupply.util; 12 import soupply.java316.metadata : Metadata; 13 import soupply.java316.packet : Java316Packet; 14 15 static import soupply.java316.types; 16 17 alias Packets = TypeTuple!(Disconnect, LoginStart, EncryptionRequest, EncryptionResponse, LoginSuccess, SetCompression); 18 19 class Disconnect : Java316Packet 20 { 21 22 enum uint ID = 0; 23 24 enum bool CLIENTBOUND = true; 25 enum bool SERVERBOUND = false; 26 27 enum string[] __fields = ["reason"]; 28 29 string reason; 30 31 this() pure nothrow @safe @nogc {} 32 33 this(string reason) pure nothrow @safe @nogc 34 { 35 this.reason = reason; 36 } 37 38 mixin Make; 39 40 public static typeof(this) fromBuffer(ubyte[] buffer) 41 { 42 Disconnect ret = new Disconnect(); 43 ret.decode(buffer); 44 return ret; 45 } 46 47 override string toString() 48 { 49 return "Disconnect(reason: " ~ std.conv.to!string(this.reason) ~ ")"; 50 } 51 52 } 53 54 class LoginStart : Java316Packet 55 { 56 57 enum uint ID = 0; 58 59 enum bool CLIENTBOUND = false; 60 enum bool SERVERBOUND = true; 61 62 enum string[] __fields = ["username"]; 63 64 string username; 65 66 this() pure nothrow @safe @nogc {} 67 68 this(string username) pure nothrow @safe @nogc 69 { 70 this.username = username; 71 } 72 73 mixin Make; 74 75 public static typeof(this) fromBuffer(ubyte[] buffer) 76 { 77 LoginStart ret = new LoginStart(); 78 ret.decode(buffer); 79 return ret; 80 } 81 82 override string toString() 83 { 84 return "LoginStart(username: " ~ std.conv.to!string(this.username) ~ ")"; 85 } 86 87 } 88 89 class EncryptionRequest : Java316Packet 90 { 91 92 enum uint ID = 1; 93 94 enum bool CLIENTBOUND = true; 95 enum bool SERVERBOUND = false; 96 97 enum string[] __fields = ["serverId", "publicKey", "verifyToken"]; 98 99 string serverId; 100 ubyte[] publicKey; 101 ubyte[] verifyToken; 102 103 this() pure nothrow @safe @nogc {} 104 105 this(string serverId, ubyte[] publicKey=(ubyte[]).init, ubyte[] verifyToken=(ubyte[]).init) pure nothrow @safe @nogc 106 { 107 this.serverId = serverId; 108 this.publicKey = publicKey; 109 this.verifyToken = verifyToken; 110 } 111 112 mixin Make; 113 114 public static typeof(this) fromBuffer(ubyte[] buffer) 115 { 116 EncryptionRequest ret = new EncryptionRequest(); 117 ret.decode(buffer); 118 return ret; 119 } 120 121 override string toString() 122 { 123 return "EncryptionRequest(serverId: " ~ std.conv.to!string(this.serverId) ~ ", publicKey: " ~ std.conv.to!string(this.publicKey) ~ ", verifyToken: " ~ std.conv.to!string(this.verifyToken) ~ ")"; 124 } 125 126 } 127 128 class EncryptionResponse : Java316Packet 129 { 130 131 enum uint ID = 1; 132 133 enum bool CLIENTBOUND = false; 134 enum bool SERVERBOUND = true; 135 136 enum string[] __fields = ["sharedSecret", "verifyToken"]; 137 138 ubyte[] sharedSecret; 139 ubyte[] verifyToken; 140 141 this() pure nothrow @safe @nogc {} 142 143 this(ubyte[] sharedSecret, ubyte[] verifyToken=(ubyte[]).init) pure nothrow @safe @nogc 144 { 145 this.sharedSecret = sharedSecret; 146 this.verifyToken = verifyToken; 147 } 148 149 mixin Make; 150 151 public static typeof(this) fromBuffer(ubyte[] buffer) 152 { 153 EncryptionResponse ret = new EncryptionResponse(); 154 ret.decode(buffer); 155 return ret; 156 } 157 158 override string toString() 159 { 160 return "EncryptionResponse(sharedSecret: " ~ std.conv.to!string(this.sharedSecret) ~ ", verifyToken: " ~ std.conv.to!string(this.verifyToken) ~ ")"; 161 } 162 163 } 164 165 class LoginSuccess : Java316Packet 166 { 167 168 enum uint ID = 2; 169 170 enum bool CLIENTBOUND = true; 171 enum bool SERVERBOUND = false; 172 173 enum string[] __fields = ["uuid", "username"]; 174 175 string uuid; 176 string username; 177 178 this() pure nothrow @safe @nogc {} 179 180 this(string uuid, string username=string.init) pure nothrow @safe @nogc 181 { 182 this.uuid = uuid; 183 this.username = username; 184 } 185 186 mixin Make; 187 188 public static typeof(this) fromBuffer(ubyte[] buffer) 189 { 190 LoginSuccess ret = new LoginSuccess(); 191 ret.decode(buffer); 192 return ret; 193 } 194 195 override string toString() 196 { 197 return "LoginSuccess(uuid: " ~ std.conv.to!string(this.uuid) ~ ", username: " ~ std.conv.to!string(this.username) ~ ")"; 198 } 199 200 } 201 202 class SetCompression : Java316Packet 203 { 204 205 enum uint ID = 3; 206 207 enum bool CLIENTBOUND = true; 208 enum bool SERVERBOUND = false; 209 210 enum string[] __fields = ["thresold"]; 211 212 @Var uint thresold; 213 214 this() pure nothrow @safe @nogc {} 215 216 this(uint thresold) pure nothrow @safe @nogc 217 { 218 this.thresold = thresold; 219 } 220 221 mixin Make; 222 223 public static typeof(this) fromBuffer(ubyte[] buffer) 224 { 225 SetCompression ret = new SetCompression(); 226 ret.decode(buffer); 227 return ret; 228 } 229 230 override string toString() 231 { 232 return "SetCompression(thresold: " ~ std.conv.to!string(this.thresold) ~ ")"; 233 } 234 235 }