From 7af6e70d8b855b9c164b5e3183e874abbff64aed Mon Sep 17 00:00:00 2001 From: Sky Johnson Date: Fri, 5 Sep 2025 16:45:12 -0500 Subject: [PATCH] implement initial packet parse conditionals --- defs/gen/main.go | 158 +- defs/generated/common.go | 2224 ++++++++++------------------ defs/generated/login.go | 2981 +++++++++++++++++--------------------- 3 files changed, 2220 insertions(+), 3143 deletions(-) diff --git a/defs/gen/main.go b/defs/gen/main.go index ae0aac0..3eae962 100644 --- a/defs/gen/main.go +++ b/defs/gen/main.go @@ -396,14 +396,17 @@ type {{.Name}} struct { // Serialize writes the packet data to the provided buffer func (p *{{.Name}}) Serialize(dest []byte) uint32 { offset := uint32(0) - {{range .Fields}} + {{- range .Fields}} + {{- if .IfVarSet}} + if p.{{toGoName .IfVarSet}} != 0 { + {{- else if .IfVarNotSet}} + if p.{{toGoName .IfVarNotSet}} == 0 { + {{- end}} {{- if .IsDynamicArray}} - // Write {{.GoName}} array (dynamic size) for _, elem := range p.{{.GoName}} { {{- template "serializeFields" .ArrayElements}} } {{- else if eq .Type "string"}} - // Write {{.GoName}} as {{if contains .Tag "str16"}}16-bit{{else if contains .Tag "str32"}}32-bit{{else if contains .Tag "EQ2_32Bit_String"}}32-bit{{else}}8-bit{{end}} length-prefixed string {{- if or (contains .Tag "str16") (contains .Tag "EQ2_16Bit_String")}} binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.{{.GoName}}))) offset += 2 @@ -417,7 +420,6 @@ func (p *{{.Name}}) Serialize(dest []byte) uint32 { copy(dest[offset:], []byte(p.{{.GoName}})) offset += uint32(len(p.{{.GoName}})) {{- else if .IsArray}} - // Write {{.GoName}} array for i := 0; i < {{.Size}}; i++ { {{- if eq (baseType .Type) "float32"}} binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.{{.GoName}}[i])) @@ -428,7 +430,7 @@ func (p *{{.Name}}) Serialize(dest []byte) uint32 { {{- else if (eq (baseType .Type) "int8")}} dest[offset] = byte(p.{{.GoName}}[i]) offset++ - {{- else if or (eq (baseType .Type) "uint8") (eq (baseType .Type) "byte")}} + {{- else if or (eq (baseType .Type) "uint8") (eq (baseType .Type) "byte")}} dest[offset] = p.{{.GoName}}[i] offset++ {{- else if or (eq (baseType .Type) "int16") (eq (baseType .Type) "uint16")}} @@ -454,7 +456,6 @@ func (p *{{.Name}}) Serialize(dest []byte) uint32 { {{- end}} } {{- else}} - // Write {{.GoName}} {{- if eq .Type "float32"}} binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.{{.GoName}})) offset += 4 @@ -480,31 +481,82 @@ func (p *{{.Name}}) Serialize(dest []byte) uint32 { offset += 8 {{- end}} {{- end}} - {{end}} + {{- if or .IfVarSet .IfVarNotSet}} + } + {{- end}} + {{- end}} return offset } // Size returns the serialized size of the packet func (p *{{.Name}}) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + {{- range .Fields}} + {{- if .IfVarSet}} + if p.{{toGoName .IfVarSet}} != 0 { + {{- else if .IfVarNotSet}} + if p.{{toGoName .IfVarNotSet}} == 0 { + {{- end}} + {{- if .IsDynamicArray}} + for _, elem := range p.{{.GoName}} { + _ = elem + {{- template "sizeFields" .ArrayElements}} + } + {{- else if eq .Type "string"}} + {{- if or (contains .Tag "str16") (contains .Tag "EQ2_16Bit_String")}} + size += 2 + uint32(len(p.{{.GoName}})) + {{- else if or (contains .Tag "str32") (contains .Tag "EQ2_32Bit_String")}} + size += 4 + uint32(len(p.{{.GoName}})) + {{- else}} + size += 1 + uint32(len(p.{{.GoName}})) + {{- end}} + {{- else if .IsArray}} + {{- if eq (baseType .Type) "types.EquipmentItem"}} + size += uint32({{.Size}}) * 8 + {{- else if eq (baseType .Type) "types.Color"}} + size += uint32({{.Size}}) * 3 + {{- else if or (eq (baseType .Type) "float32") (eq (baseType .Type) "int32") (eq (baseType .Type) "uint32")}} + size += uint32({{.Size}}) * 4 + {{- else if or (eq (baseType .Type) "float64") (eq (baseType .Type) "int64") (eq (baseType .Type) "uint64")}} + size += uint32({{.Size}}) * 8 + {{- else if or (eq (baseType .Type) "int16") (eq (baseType .Type) "uint16")}} + size += uint32({{.Size}}) * 2 + {{- else}} + size += uint32({{.Size}}) + {{- end}} + {{- else}} + {{- if eq .Type "types.Color"}} + size += 3 + {{- else if or (eq .Type "float32") (eq .Type "int32") (eq .Type "uint32")}} + size += 4 + {{- else if or (eq .Type "float64") (eq .Type "int64") (eq .Type "uint64")}} + size += 8 + {{- else if or (eq .Type "int16") (eq .Type "uint16")}} + size += 2 + {{- else}} + size += 1 + {{- end}} + {{- end}} + {{- if or .IfVarSet .IfVarNotSet}} + } + {{- end}} + {{- end}} + return size } {{end}} {{define "serializeFields"}} {{- range .}} {{- if .IsDynamicArray}} - // Write nested {{.GoName}} array for _, nestedElem := range elem.{{.GoName}} { {{- template "serializeNestedFields" .ArrayElements}} } {{- else if eq .Type "string"}} - // Write {{.GoName}} string field dest[offset] = byte(len(elem.{{.GoName}})) offset++ copy(dest[offset:], []byte(elem.{{.GoName}})) offset += uint32(len(elem.{{.GoName}})) {{- else if .IsArray}} - // Write {{.GoName}} array field for i := 0; i < {{.Size}}; i++ { {{- if eq (baseType .Type) "float32"}} binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(elem.{{.GoName}}[i])) @@ -551,24 +603,21 @@ func (p *{{.Name}}) Size() uint32 { offset++ {{- end}} {{- end}} -{{end}} +{{- end}} {{define "serializeNestedFields"}} {{- range .}} {{- if .IsDynamicArray}} - // Write deeply nested {{.GoName}} array for _, deepNested := range nestedElem.{{.GoName}} { // TODO: Handle deeper nesting if needed _ = deepNested } {{- else if eq .Type "string"}} - // Write {{.GoName}} string field dest[offset] = byte(len(nestedElem.{{.GoName}})) offset++ copy(dest[offset:], []byte(nestedElem.{{.GoName}})) offset += uint32(len(nestedElem.{{.GoName}})) {{- else if .IsArray}} - // Write {{.GoName}} array field for i := 0; i < {{.Size}}; i++ { {{- if eq (baseType .Type) "float32"}} binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(nestedElem.{{.GoName}}[i])) @@ -615,6 +664,80 @@ func (p *{{.Name}}) Size() uint32 { offset++ {{- end}} {{- end}} +{{- end}} + +{{define "sizeFields"}} +{{- range .}} +{{- if .IsDynamicArray}} + for _, nestedElem := range elem.{{.GoName}} { + _ = nestedElem + {{- template "sizeNestedFields" .ArrayElements}} + } +{{- else if eq .Type "string"}} + size += 1 + uint32(len(elem.{{.GoName}})) +{{- else if .IsArray}} + {{- if eq (baseType .Type) "float32"}} + size += uint32({{.Size}}) * 4 + {{- else if eq (baseType .Type) "uint32"}} + size += uint32({{.Size}}) * 4 + {{- else if eq (baseType .Type) "uint16"}} + size += uint32({{.Size}}) * 2 + {{- else}} + size += uint32({{.Size}}) + {{- end}} +{{- else if eq .Type "float32"}} + size += 4 +{{- else if eq .Type "types.Color"}} + size += 3 +{{- else if eq .Type "uint32"}} + size += 4 +{{- else if eq .Type "int32"}} + size += 4 +{{- else if eq .Type "uint16"}} + size += 2 +{{- else if eq .Type "int16"}} + size += 2 +{{- else}} + size += 1 +{{- end}} +{{- end}} +{{end}} + +{{define "sizeNestedFields"}} +{{- range .}} +{{- if .IsDynamicArray}} + for _, deepNested := range nestedElem.{{.GoName}} { + // TODO: Handle deeper nesting size calculation + _ = deepNested + } +{{- else if eq .Type "string"}} + size += 1 + uint32(len(nestedElem.{{.GoName}})) +{{- else if .IsArray}} + {{- if eq (baseType .Type) "float32"}} + size += uint32({{.Size}}) * 4 + {{- else if eq (baseType .Type) "uint32"}} + size += uint32({{.Size}}) * 4 + {{- else if eq (baseType .Type) "uint16"}} + size += uint32({{.Size}}) * 2 + {{- else}} + size += uint32({{.Size}}) + {{- end}} +{{- else if eq .Type "float32"}} + size += 4 +{{- else if eq .Type "types.Color"}} + size += 3 +{{- else if eq .Type "uint32"}} + size += 4 +{{- else if eq .Type "int32"}} + size += 4 +{{- else if eq .Type "uint16"}} + size += 2 +{{- else if eq .Type "int16"}} + size += 2 +{{- else}} + size += 1 +{{- end}} +{{- end}} {{end}} ` @@ -622,6 +745,10 @@ func contains(s, substr string) bool { return strings.Contains(s, substr) } +func toGoNameInTemplate(name string) string { + return toGoName(name) +} + func baseType(arrayType string) string { // Extract base type from array declaration like "[10]uint32" if strings.HasPrefix(arrayType, "[") { @@ -717,6 +844,7 @@ func processFile(inputFile, outputPath, packageName string) { tmpl.Funcs(template.FuncMap{ "contains": contains, "baseType": baseType, + "toGoName": toGoNameInTemplate, "sizeOf": sizeOf, }) diff --git a/defs/generated/common.go b/defs/generated/common.go index 772f325..8db0a8e 100644 --- a/defs/generated/common.go +++ b/defs/generated/common.go @@ -56,227 +56,188 @@ type CreateCharacter struct { // Serialize writes the packet data to the provided buffer func (p *CreateCharacter) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - - // Write Race dest[offset] = byte(p.Race) offset++ - - // Write Gender dest[offset] = byte(p.Gender) offset++ - - // Write Deity dest[offset] = byte(p.Deity) offset++ - - // Write Class dest[offset] = byte(p.Class) offset++ - - // Write Level dest[offset] = byte(p.Level) offset++ - - // Write StartingZone dest[offset] = byte(p.StartingZone) offset++ - - // Write Unknown1 array for i := 0; i < 2; i++ { dest[offset] = p.Unknown1[i] offset++ } - - // Write RaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.RaceFile))) offset += 2 copy(dest[offset:], []byte(p.RaceFile)) offset += uint32(len(p.RaceFile)) - - // Write SkinColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SkinColor[i])) offset += 4 } - - // Write EyeColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.EyeColor[i])) offset += 4 } - - // Write HairColor1 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairColor1[i])) offset += 4 } - - // Write HairColor2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairColor2[i])) offset += 4 } - - // Write HairHighlight array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairHighlight[i])) offset += 4 } - - // Write Unknown2 array for i := 0; i < 26; i++ { dest[offset] = p.Unknown2[i] offset++ } - - // Write HairFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.HairFile))) offset += 2 copy(dest[offset:], []byte(p.HairFile)) offset += uint32(len(p.HairFile)) - - // Write HairTypeColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairTypeColor[i])) offset += 4 } - - // Write HairTypeHighlightColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairTypeHighlightColor[i])) offset += 4 } - - // Write FaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.FaceFile))) offset += 2 copy(dest[offset:], []byte(p.FaceFile)) offset += uint32(len(p.FaceFile)) - - // Write HairFaceColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairFaceColor[i])) offset += 4 } - - // Write HairFaceHighlightColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairFaceHighlightColor[i])) offset += 4 } - - // Write ChestFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.ChestFile))) offset += 2 copy(dest[offset:], []byte(p.ChestFile)) offset += uint32(len(p.ChestFile)) - - // Write ShirtColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.ShirtColor[i])) offset += 4 } - - // Write UnknownChestColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.UnknownChestColor[i])) offset += 4 } - - // Write LegsFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.LegsFile))) offset += 2 copy(dest[offset:], []byte(p.LegsFile)) offset += uint32(len(p.LegsFile)) - - // Write PantsColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.PantsColor[i])) offset += 4 } - - // Write UnknownLegsColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.UnknownLegsColor[i])) offset += 4 } - - // Write Unknown9 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Unknown9[i])) offset += 4 } - - // Write Eyes2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Eyes2[i])) offset += 4 } - - // Write Ears array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Ears[i])) offset += 4 } - - // Write EyeBrows array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.EyeBrows[i])) offset += 4 } - - // Write Cheeks array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Cheeks[i])) offset += 4 } - - // Write Lips array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Lips[i])) offset += 4 } - - // Write Chin array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Chin[i])) offset += 4 } - - // Write Nose array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Nose[i])) offset += 4 } - - // Write BodySize binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodySize)) offset += 4 - - // Write BodyAge binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodyAge)) offset += 4 - return offset } // Size returns the serialized size of the packet func (p *CreateCharacter) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 4 + size += 4 + size += 2 + uint32(len(p.Name)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += uint32(2) + size += 2 + uint32(len(p.RaceFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(26) + size += 2 + uint32(len(p.HairFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 2 + uint32(len(p.FaceFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 2 + uint32(len(p.ChestFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 2 + uint32(len(p.LegsFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 4 + size += 4 + return size } // CreateCharacterV373 represents packet structure for OP_CreateCharacterRequestMsg @@ -326,231 +287,191 @@ type CreateCharacterV373 struct { // Serialize writes the packet data to the provided buffer func (p *CreateCharacterV373) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Unknown0 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown0)) offset += 4 - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - - // Write Race dest[offset] = byte(p.Race) offset++ - - // Write Gender dest[offset] = byte(p.Gender) offset++ - - // Write Deity dest[offset] = byte(p.Deity) offset++ - - // Write Class dest[offset] = byte(p.Class) offset++ - - // Write Level dest[offset] = byte(p.Level) offset++ - - // Write StartingZone dest[offset] = byte(p.StartingZone) offset++ - - // Write Unknown1 array for i := 0; i < 2; i++ { dest[offset] = p.Unknown1[i] offset++ } - - // Write RaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.RaceFile))) offset += 2 copy(dest[offset:], []byte(p.RaceFile)) offset += uint32(len(p.RaceFile)) - - // Write SkinColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SkinColor[i])) offset += 4 } - - // Write EyeColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.EyeColor[i])) offset += 4 } - - // Write HairColor1 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairColor1[i])) offset += 4 } - - // Write HairColor2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairColor2[i])) offset += 4 } - - // Write HairHighlight array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairHighlight[i])) offset += 4 } - - // Write Unknown2 array for i := 0; i < 26; i++ { dest[offset] = p.Unknown2[i] offset++ } - - // Write HairFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.HairFile))) offset += 2 copy(dest[offset:], []byte(p.HairFile)) offset += uint32(len(p.HairFile)) - - // Write HairTypeColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairTypeColor[i])) offset += 4 } - - // Write HairTypeHighlightColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairTypeHighlightColor[i])) offset += 4 } - - // Write FaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.FaceFile))) offset += 2 copy(dest[offset:], []byte(p.FaceFile)) offset += uint32(len(p.FaceFile)) - - // Write HairFaceColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairFaceColor[i])) offset += 4 } - - // Write HairFaceHighlightColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairFaceHighlightColor[i])) offset += 4 } - - // Write ChestFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.ChestFile))) offset += 2 copy(dest[offset:], []byte(p.ChestFile)) offset += uint32(len(p.ChestFile)) - - // Write ShirtColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.ShirtColor[i])) offset += 4 } - - // Write UnknownChestColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.UnknownChestColor[i])) offset += 4 } - - // Write LegsFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.LegsFile))) offset += 2 copy(dest[offset:], []byte(p.LegsFile)) offset += uint32(len(p.LegsFile)) - - // Write PantsColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.PantsColor[i])) offset += 4 } - - // Write UnknownLegsColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.UnknownLegsColor[i])) offset += 4 } - - // Write Unknown9 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Unknown9[i])) offset += 4 } - - // Write Eyes2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Eyes2[i])) offset += 4 } - - // Write Ears array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Ears[i])) offset += 4 } - - // Write EyeBrows array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.EyeBrows[i])) offset += 4 } - - // Write Cheeks array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Cheeks[i])) offset += 4 } - - // Write Lips array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Lips[i])) offset += 4 } - - // Write Chin array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Chin[i])) offset += 4 } - - // Write Nose array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Nose[i])) offset += 4 } - - // Write BodySize binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodySize)) offset += 4 - - // Write BodyAge binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodyAge)) offset += 4 - return offset } // Size returns the serialized size of the packet func (p *CreateCharacterV373) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Name)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += uint32(2) + size += 2 + uint32(len(p.RaceFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(26) + size += 2 + uint32(len(p.HairFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 2 + uint32(len(p.FaceFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 2 + uint32(len(p.ChestFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 2 + uint32(len(p.LegsFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 4 + size += 4 + return size } // CreateCharacterV546 represents packet structure for OP_CreateCharacterRequestMsg @@ -602,237 +523,195 @@ type CreateCharacterV546 struct { // Serialize writes the packet data to the provided buffer func (p *CreateCharacterV546) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Unknown0 dest[offset] = byte(p.Unknown0) offset++ - - // Write Unknown1 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown1)) offset += 4 - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - - // Write Race dest[offset] = byte(p.Race) offset++ - - // Write Gender dest[offset] = byte(p.Gender) offset++ - - // Write Deity dest[offset] = byte(p.Deity) offset++ - - // Write Class dest[offset] = byte(p.Class) offset++ - - // Write Level dest[offset] = byte(p.Level) offset++ - - // Write StartingZone dest[offset] = byte(p.StartingZone) offset++ - - // Write CcUnknown0 dest[offset] = byte(p.CcUnknown0) offset++ - - // Write Version dest[offset] = byte(p.Version) offset++ - - // Write RaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.RaceFile))) offset += 2 copy(dest[offset:], []byte(p.RaceFile)) offset += uint32(len(p.RaceFile)) - - // Write SkinColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SkinColor[i])) offset += 4 } - - // Write EyeColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.EyeColor[i])) offset += 4 } - - // Write HairColor1 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairColor1[i])) offset += 4 } - - // Write HairColor2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairColor2[i])) offset += 4 } - - // Write HairHighlight array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairHighlight[i])) offset += 4 } - - // Write Unknown2 array for i := 0; i < 26; i++ { dest[offset] = p.Unknown2[i] offset++ } - - // Write HairFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.HairFile))) offset += 2 copy(dest[offset:], []byte(p.HairFile)) offset += uint32(len(p.HairFile)) - - // Write HairTypeColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairTypeColor[i])) offset += 4 } - - // Write HairTypeHighlightColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairTypeHighlightColor[i])) offset += 4 } - - // Write FaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.FaceFile))) offset += 2 copy(dest[offset:], []byte(p.FaceFile)) offset += uint32(len(p.FaceFile)) - - // Write HairFaceColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairFaceColor[i])) offset += 4 } - - // Write HairFaceHighlightColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairFaceHighlightColor[i])) offset += 4 } - - // Write ChestFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.ChestFile))) offset += 2 copy(dest[offset:], []byte(p.ChestFile)) offset += uint32(len(p.ChestFile)) - - // Write ShirtColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.ShirtColor[i])) offset += 4 } - - // Write UnknownChestColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.UnknownChestColor[i])) offset += 4 } - - // Write LegsFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.LegsFile))) offset += 2 copy(dest[offset:], []byte(p.LegsFile)) offset += uint32(len(p.LegsFile)) - - // Write PantsColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.PantsColor[i])) offset += 4 } - - // Write UnknownLegsColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.UnknownLegsColor[i])) offset += 4 } - - // Write Unknown9 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Unknown9[i])) offset += 4 } - - // Write Eyes2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Eyes2[i])) offset += 4 } - - // Write Ears array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Ears[i])) offset += 4 } - - // Write EyeBrows array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.EyeBrows[i])) offset += 4 } - - // Write Cheeks array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Cheeks[i])) offset += 4 } - - // Write Lips array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Lips[i])) offset += 4 } - - // Write Chin array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Chin[i])) offset += 4 } - - // Write Nose array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Nose[i])) offset += 4 } - - // Write BodySize binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodySize)) offset += 4 - - // Write BodyAge binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodyAge)) offset += 4 - return offset } // Size returns the serialized size of the packet func (p *CreateCharacterV546) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Name)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 2 + uint32(len(p.RaceFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(26) + size += 2 + uint32(len(p.HairFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 2 + uint32(len(p.FaceFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 2 + uint32(len(p.ChestFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 2 + uint32(len(p.LegsFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 4 + size += 4 + return size } // CreateCharacterV561 represents packet structure for OP_CreateCharacterRequestMsg @@ -883,233 +762,192 @@ type CreateCharacterV561 struct { // Serialize writes the packet data to the provided buffer func (p *CreateCharacterV561) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Unknown0 dest[offset] = byte(p.Unknown0) offset++ - - // Write Unknown1 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown1)) offset += 4 - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - - // Write Race dest[offset] = byte(p.Race) offset++ - - // Write Gender dest[offset] = byte(p.Gender) offset++ - - // Write Deity dest[offset] = byte(p.Deity) offset++ - - // Write Class dest[offset] = byte(p.Class) offset++ - - // Write Level dest[offset] = byte(p.Level) offset++ - - // Write StartingZone dest[offset] = byte(p.StartingZone) offset++ - - // Write Version dest[offset] = byte(p.Version) offset++ - - // Write RaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.RaceFile))) offset += 2 copy(dest[offset:], []byte(p.RaceFile)) offset += uint32(len(p.RaceFile)) - - // Write SkinColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SkinColor[i])) offset += 4 } - - // Write EyeColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.EyeColor[i])) offset += 4 } - - // Write HairColor1 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairColor1[i])) offset += 4 } - - // Write HairColor2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairColor2[i])) offset += 4 } - - // Write HairHighlight array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairHighlight[i])) offset += 4 } - - // Write Unknown2 array for i := 0; i < 26; i++ { dest[offset] = p.Unknown2[i] offset++ } - - // Write HairFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.HairFile))) offset += 2 copy(dest[offset:], []byte(p.HairFile)) offset += uint32(len(p.HairFile)) - - // Write HairTypeColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairTypeColor[i])) offset += 4 } - - // Write HairTypeHighlightColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairTypeHighlightColor[i])) offset += 4 } - - // Write FaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.FaceFile))) offset += 2 copy(dest[offset:], []byte(p.FaceFile)) offset += uint32(len(p.FaceFile)) - - // Write HairFaceColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairFaceColor[i])) offset += 4 } - - // Write HairFaceHighlightColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.HairFaceHighlightColor[i])) offset += 4 } - - // Write ChestFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.ChestFile))) offset += 2 copy(dest[offset:], []byte(p.ChestFile)) offset += uint32(len(p.ChestFile)) - - // Write ShirtColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.ShirtColor[i])) offset += 4 } - - // Write UnknownChestColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.UnknownChestColor[i])) offset += 4 } - - // Write LegsFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.LegsFile))) offset += 2 copy(dest[offset:], []byte(p.LegsFile)) offset += uint32(len(p.LegsFile)) - - // Write PantsColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.PantsColor[i])) offset += 4 } - - // Write UnknownLegsColor array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.UnknownLegsColor[i])) offset += 4 } - - // Write Unknown9 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Unknown9[i])) offset += 4 } - - // Write Eyes2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Eyes2[i])) offset += 4 } - - // Write Ears array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Ears[i])) offset += 4 } - - // Write EyeBrows array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.EyeBrows[i])) offset += 4 } - - // Write Cheeks array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Cheeks[i])) offset += 4 } - - // Write Lips array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Lips[i])) offset += 4 } - - // Write Chin array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Chin[i])) offset += 4 } - - // Write Nose array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Nose[i])) offset += 4 } - - // Write BodySize binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodySize)) offset += 4 - - // Write BodyAge binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodyAge)) offset += 4 - return offset } // Size returns the serialized size of the packet func (p *CreateCharacterV561) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Name)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 2 + uint32(len(p.RaceFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(26) + size += 2 + uint32(len(p.HairFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 2 + uint32(len(p.FaceFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 2 + uint32(len(p.ChestFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 2 + uint32(len(p.LegsFile)) + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 4 + size += 4 + return size } // CreateCharacterV562 represents packet structure for OP_CreateCharacterRequestMsg @@ -1197,447 +1035,369 @@ type CreateCharacterV562 struct { // Serialize writes the packet data to the provided buffer func (p *CreateCharacterV562) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Unknown0 dest[offset] = byte(p.Unknown0) offset++ - - // Write Unknown1 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown1)) offset += 4 - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown3 dest[offset] = byte(p.Unknown3) offset++ - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - - // Write Race dest[offset] = byte(p.Race) offset++ - - // Write Gender dest[offset] = byte(p.Gender) offset++ - - // Write Deity dest[offset] = byte(p.Deity) offset++ - - // Write Class dest[offset] = byte(p.Class) offset++ - - // Write Level dest[offset] = byte(p.Level) offset++ - - // Write StartingZone dest[offset] = byte(p.StartingZone) offset++ - - // Write Version dest[offset] = byte(p.Version) offset++ - - // Write RaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.RaceFile))) offset += 2 copy(dest[offset:], []byte(p.RaceFile)) offset += uint32(len(p.RaceFile)) - - // Write SkinColor dest[offset] = p.SkinColor.R dest[offset+1] = p.SkinColor.G dest[offset+2] = p.SkinColor.B offset += 3 - - // Write SkinColor2 dest[offset] = p.SkinColor2.R dest[offset+1] = p.SkinColor2.G dest[offset+2] = p.SkinColor2.B offset += 3 - - // Write EyeColor dest[offset] = p.EyeColor.R dest[offset+1] = p.EyeColor.G dest[offset+2] = p.EyeColor.B offset += 3 - - // Write HairColor1 dest[offset] = p.HairColor1.R dest[offset+1] = p.HairColor1.G dest[offset+2] = p.HairColor1.B offset += 3 - - // Write HairColor2 dest[offset] = p.HairColor2.R dest[offset+1] = p.HairColor2.G dest[offset+2] = p.HairColor2.B offset += 3 - - // Write Unknown8 array for i := 0; i < 26; i++ { dest[offset] = p.Unknown8[i] offset++ } - - // Write HairFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.HairFile))) offset += 2 copy(dest[offset:], []byte(p.HairFile)) offset += uint32(len(p.HairFile)) - - // Write HairTypeColor dest[offset] = p.HairTypeColor.R dest[offset+1] = p.HairTypeColor.G dest[offset+2] = p.HairTypeColor.B offset += 3 - - // Write HairTypeHighlightColor dest[offset] = p.HairTypeHighlightColor.R dest[offset+1] = p.HairTypeHighlightColor.G dest[offset+2] = p.HairTypeHighlightColor.B offset += 3 - - // Write FaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.FaceFile))) offset += 2 copy(dest[offset:], []byte(p.FaceFile)) offset += uint32(len(p.FaceFile)) - - // Write HairFaceColor dest[offset] = p.HairFaceColor.R dest[offset+1] = p.HairFaceColor.G dest[offset+2] = p.HairFaceColor.B offset += 3 - - // Write HairFaceHighlightColor dest[offset] = p.HairFaceHighlightColor.R dest[offset+1] = p.HairFaceHighlightColor.G dest[offset+2] = p.HairFaceHighlightColor.B offset += 3 - - // Write WingFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.WingFile))) offset += 2 copy(dest[offset:], []byte(p.WingFile)) offset += uint32(len(p.WingFile)) - - // Write WingColor1 dest[offset] = p.WingColor1.R dest[offset+1] = p.WingColor1.G dest[offset+2] = p.WingColor1.B offset += 3 - - // Write WingColor2 dest[offset] = p.WingColor2.R dest[offset+1] = p.WingColor2.G dest[offset+2] = p.WingColor2.B offset += 3 - - // Write ChestFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.ChestFile))) offset += 2 copy(dest[offset:], []byte(p.ChestFile)) offset += uint32(len(p.ChestFile)) - - // Write ShirtColor dest[offset] = p.ShirtColor.R dest[offset+1] = p.ShirtColor.G dest[offset+2] = p.ShirtColor.B offset += 3 - - // Write UnknownChestColor dest[offset] = p.UnknownChestColor.R dest[offset+1] = p.UnknownChestColor.G dest[offset+2] = p.UnknownChestColor.B offset += 3 - - // Write LegsFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.LegsFile))) offset += 2 copy(dest[offset:], []byte(p.LegsFile)) offset += uint32(len(p.LegsFile)) - - // Write PantsColor dest[offset] = p.PantsColor.R dest[offset+1] = p.PantsColor.G dest[offset+2] = p.PantsColor.B offset += 3 - - // Write UnknownLegsColor dest[offset] = p.UnknownLegsColor.R dest[offset+1] = p.UnknownLegsColor.G dest[offset+2] = p.UnknownLegsColor.B offset += 3 - - // Write Unknown9 dest[offset] = p.Unknown9.R dest[offset+1] = p.Unknown9.G dest[offset+2] = p.Unknown9.B offset += 3 - - // Write Eyes2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Eyes2[i])) offset += 4 } - - // Write Ears array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Ears[i])) offset += 4 } - - // Write EyeBrows array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.EyeBrows[i])) offset += 4 } - - // Write Cheeks array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Cheeks[i])) offset += 4 } - - // Write Lips array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Lips[i])) offset += 4 } - - // Write Chin array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Chin[i])) offset += 4 } - - // Write Nose array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Nose[i])) offset += 4 } - - // Write BodySize binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodySize)) offset += 4 - - // Write BodyAge binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodyAge)) offset += 4 - - // Write SogaVersion dest[offset] = byte(p.SogaVersion) offset++ - - // Write SogaRaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaRaceFile))) offset += 2 copy(dest[offset:], []byte(p.SogaRaceFile)) offset += uint32(len(p.SogaRaceFile)) - - // Write SogaSkinColor dest[offset] = p.SogaSkinColor.R dest[offset+1] = p.SogaSkinColor.G dest[offset+2] = p.SogaSkinColor.B offset += 3 - - // Write SogaEyeColor dest[offset] = p.SogaEyeColor.R dest[offset+1] = p.SogaEyeColor.G dest[offset+2] = p.SogaEyeColor.B offset += 3 - - // Write SogaHairColor1 dest[offset] = p.SogaHairColor1.R dest[offset+1] = p.SogaHairColor1.G dest[offset+2] = p.SogaHairColor1.B offset += 3 - - // Write SogaHairColor2 dest[offset] = p.SogaHairColor2.R dest[offset+1] = p.SogaHairColor2.G dest[offset+2] = p.SogaHairColor2.B offset += 3 - - // Write SogaHairHighlight dest[offset] = p.SogaHairHighlight.R dest[offset+1] = p.SogaHairHighlight.G dest[offset+2] = p.SogaHairHighlight.B offset += 3 - - // Write SogaUnknown11 array for i := 0; i < 26; i++ { dest[offset] = p.SogaUnknown11[i] offset++ } - - // Write SogaHairFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaHairFile))) offset += 2 copy(dest[offset:], []byte(p.SogaHairFile)) offset += uint32(len(p.SogaHairFile)) - - // Write SogaHairTypeColor dest[offset] = p.SogaHairTypeColor.R dest[offset+1] = p.SogaHairTypeColor.G dest[offset+2] = p.SogaHairTypeColor.B offset += 3 - - // Write SogaHairTypeHighlightColor dest[offset] = p.SogaHairTypeHighlightColor.R dest[offset+1] = p.SogaHairTypeHighlightColor.G dest[offset+2] = p.SogaHairTypeHighlightColor.B offset += 3 - - // Write SogaFaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaFaceFile))) offset += 2 copy(dest[offset:], []byte(p.SogaFaceFile)) offset += uint32(len(p.SogaFaceFile)) - - // Write SogaHairFaceColor dest[offset] = p.SogaHairFaceColor.R dest[offset+1] = p.SogaHairFaceColor.G dest[offset+2] = p.SogaHairFaceColor.B offset += 3 - - // Write SogaHairFaceHighlightColor dest[offset] = p.SogaHairFaceHighlightColor.R dest[offset+1] = p.SogaHairFaceHighlightColor.G dest[offset+2] = p.SogaHairFaceHighlightColor.B offset += 3 - - // Write SogaWingFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaWingFile))) offset += 2 copy(dest[offset:], []byte(p.SogaWingFile)) offset += uint32(len(p.SogaWingFile)) - - // Write SogaWingColor1 dest[offset] = p.SogaWingColor1.R dest[offset+1] = p.SogaWingColor1.G dest[offset+2] = p.SogaWingColor1.B offset += 3 - - // Write SogaWingColor2 dest[offset] = p.SogaWingColor2.R dest[offset+1] = p.SogaWingColor2.G dest[offset+2] = p.SogaWingColor2.B offset += 3 - - // Write SogaChestFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaChestFile))) offset += 2 copy(dest[offset:], []byte(p.SogaChestFile)) offset += uint32(len(p.SogaChestFile)) - - // Write SogaShirtColor dest[offset] = p.SogaShirtColor.R dest[offset+1] = p.SogaShirtColor.G dest[offset+2] = p.SogaShirtColor.B offset += 3 - - // Write SogaUnknownChestColor dest[offset] = p.SogaUnknownChestColor.R dest[offset+1] = p.SogaUnknownChestColor.G dest[offset+2] = p.SogaUnknownChestColor.B offset += 3 - - // Write SogaLegsFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaLegsFile))) offset += 2 copy(dest[offset:], []byte(p.SogaLegsFile)) offset += uint32(len(p.SogaLegsFile)) - - // Write SogaPantsColor dest[offset] = p.SogaPantsColor.R dest[offset+1] = p.SogaPantsColor.G dest[offset+2] = p.SogaPantsColor.B offset += 3 - - // Write SogaUnknownLegsColor dest[offset] = p.SogaUnknownLegsColor.R dest[offset+1] = p.SogaUnknownLegsColor.G dest[offset+2] = p.SogaUnknownLegsColor.B offset += 3 - - // Write SogaUnknown12 dest[offset] = p.SogaUnknown12.R dest[offset+1] = p.SogaUnknown12.G dest[offset+2] = p.SogaUnknown12.B offset += 3 - - // Write SogaEyes2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEyes2[i])) offset += 4 } - - // Write SogaEars array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEars[i])) offset += 4 } - - // Write SogaEyeBrows array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEyeBrows[i])) offset += 4 } - - // Write SogaCheeks array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaCheeks[i])) offset += 4 } - - // Write SogaLips array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaLips[i])) offset += 4 } - - // Write SogaChin array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaChin[i])) offset += 4 } - - // Write SogaNose array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaNose[i])) offset += 4 } - - // Write SogaBodySize binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaBodySize)) offset += 4 - - // Write SogaBodyAge binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaBodyAge)) offset += 4 - return offset } // Size returns the serialized size of the packet func (p *CreateCharacterV562) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 4 + size += 4 + size += 1 + size += 4 + size += 2 + uint32(len(p.Name)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 2 + uint32(len(p.RaceFile)) + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += uint32(26) + size += 2 + uint32(len(p.HairFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.FaceFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.WingFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.ChestFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.LegsFile)) + size += 3 + size += 3 + size += 3 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 4 + size += 4 + size += 1 + size += 2 + uint32(len(p.SogaRaceFile)) + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += uint32(26) + size += 2 + uint32(len(p.SogaHairFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaFaceFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaWingFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaChestFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaLegsFile)) + size += 3 + size += 3 + size += 3 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 4 + size += 4 + return size } // CreateCharacterV869 represents packet structure for OP_CreateCharacterRequestMsg @@ -1727,459 +1487,379 @@ type CreateCharacterV869 struct { // Serialize writes the packet data to the provided buffer func (p *CreateCharacterV869) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Unknown0 dest[offset] = byte(p.Unknown0) offset++ - - // Write Unknown1 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown1)) offset += 4 - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown3 dest[offset] = byte(p.Unknown3) offset++ - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - - // Write Race dest[offset] = byte(p.Race) offset++ - - // Write Gender dest[offset] = byte(p.Gender) offset++ - - // Write Deity dest[offset] = byte(p.Deity) offset++ - - // Write Class dest[offset] = byte(p.Class) offset++ - - // Write Level dest[offset] = byte(p.Level) offset++ - - // Write StartingZone dest[offset] = byte(p.StartingZone) offset++ - - // Write Version dest[offset] = byte(p.Version) offset++ - - // Write RaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.RaceFile))) offset += 2 copy(dest[offset:], []byte(p.RaceFile)) offset += uint32(len(p.RaceFile)) - - // Write SkinColor dest[offset] = p.SkinColor.R dest[offset+1] = p.SkinColor.G dest[offset+2] = p.SkinColor.B offset += 3 - - // Write SkinColor2 dest[offset] = p.SkinColor2.R dest[offset+1] = p.SkinColor2.G dest[offset+2] = p.SkinColor2.B offset += 3 - - // Write EyeColor dest[offset] = p.EyeColor.R dest[offset+1] = p.EyeColor.G dest[offset+2] = p.EyeColor.B offset += 3 - - // Write HairColor1 dest[offset] = p.HairColor1.R dest[offset+1] = p.HairColor1.G dest[offset+2] = p.HairColor1.B offset += 3 - - // Write HairColor2 dest[offset] = p.HairColor2.R dest[offset+1] = p.HairColor2.G dest[offset+2] = p.HairColor2.B offset += 3 - - // Write HairHighlight dest[offset] = p.HairHighlight.R dest[offset+1] = p.HairHighlight.G dest[offset+2] = p.HairHighlight.B offset += 3 - - // Write Unknown8 array for i := 0; i < 26; i++ { dest[offset] = p.Unknown8[i] offset++ } - - // Write HairFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.HairFile))) offset += 2 copy(dest[offset:], []byte(p.HairFile)) offset += uint32(len(p.HairFile)) - - // Write HairTypeColor dest[offset] = p.HairTypeColor.R dest[offset+1] = p.HairTypeColor.G dest[offset+2] = p.HairTypeColor.B offset += 3 - - // Write HairTypeHighlightColor dest[offset] = p.HairTypeHighlightColor.R dest[offset+1] = p.HairTypeHighlightColor.G dest[offset+2] = p.HairTypeHighlightColor.B offset += 3 - - // Write FaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.FaceFile))) offset += 2 copy(dest[offset:], []byte(p.FaceFile)) offset += uint32(len(p.FaceFile)) - - // Write HairFaceColor dest[offset] = p.HairFaceColor.R dest[offset+1] = p.HairFaceColor.G dest[offset+2] = p.HairFaceColor.B offset += 3 - - // Write HairFaceHighlightColor dest[offset] = p.HairFaceHighlightColor.R dest[offset+1] = p.HairFaceHighlightColor.G dest[offset+2] = p.HairFaceHighlightColor.B offset += 3 - - // Write WingFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.WingFile))) offset += 2 copy(dest[offset:], []byte(p.WingFile)) offset += uint32(len(p.WingFile)) - - // Write WingColor1 dest[offset] = p.WingColor1.R dest[offset+1] = p.WingColor1.G dest[offset+2] = p.WingColor1.B offset += 3 - - // Write WingColor2 dest[offset] = p.WingColor2.R dest[offset+1] = p.WingColor2.G dest[offset+2] = p.WingColor2.B offset += 3 - - // Write ChestFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.ChestFile))) offset += 2 copy(dest[offset:], []byte(p.ChestFile)) offset += uint32(len(p.ChestFile)) - - // Write ShirtColor dest[offset] = p.ShirtColor.R dest[offset+1] = p.ShirtColor.G dest[offset+2] = p.ShirtColor.B offset += 3 - - // Write UnknownChestColor dest[offset] = p.UnknownChestColor.R dest[offset+1] = p.UnknownChestColor.G dest[offset+2] = p.UnknownChestColor.B offset += 3 - - // Write LegsFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.LegsFile))) offset += 2 copy(dest[offset:], []byte(p.LegsFile)) offset += uint32(len(p.LegsFile)) - - // Write PantsColor dest[offset] = p.PantsColor.R dest[offset+1] = p.PantsColor.G dest[offset+2] = p.PantsColor.B offset += 3 - - // Write UnknownLegsColor dest[offset] = p.UnknownLegsColor.R dest[offset+1] = p.UnknownLegsColor.G dest[offset+2] = p.UnknownLegsColor.B offset += 3 - - // Write Unknown9 dest[offset] = p.Unknown9.R dest[offset+1] = p.Unknown9.G dest[offset+2] = p.Unknown9.B offset += 3 - - // Write Eyes2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Eyes2[i])) offset += 4 } - - // Write Ears array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Ears[i])) offset += 4 } - - // Write EyeBrows array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.EyeBrows[i])) offset += 4 } - - // Write Cheeks array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Cheeks[i])) offset += 4 } - - // Write Lips array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Lips[i])) offset += 4 } - - // Write Chin array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Chin[i])) offset += 4 } - - // Write Nose array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Nose[i])) offset += 4 } - - // Write BodySize binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodySize)) offset += 4 - - // Write BodyAge binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodyAge)) offset += 4 - - // Write SogaVersion dest[offset] = byte(p.SogaVersion) offset++ - - // Write SogaRaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaRaceFile))) offset += 2 copy(dest[offset:], []byte(p.SogaRaceFile)) offset += uint32(len(p.SogaRaceFile)) - - // Write SogaSkinColor dest[offset] = p.SogaSkinColor.R dest[offset+1] = p.SogaSkinColor.G dest[offset+2] = p.SogaSkinColor.B offset += 3 - - // Write SogaEyeColor dest[offset] = p.SogaEyeColor.R dest[offset+1] = p.SogaEyeColor.G dest[offset+2] = p.SogaEyeColor.B offset += 3 - - // Write SogaHairColor1 dest[offset] = p.SogaHairColor1.R dest[offset+1] = p.SogaHairColor1.G dest[offset+2] = p.SogaHairColor1.B offset += 3 - - // Write SogaHairColor2 dest[offset] = p.SogaHairColor2.R dest[offset+1] = p.SogaHairColor2.G dest[offset+2] = p.SogaHairColor2.B offset += 3 - - // Write SogaHairHighlight dest[offset] = p.SogaHairHighlight.R dest[offset+1] = p.SogaHairHighlight.G dest[offset+2] = p.SogaHairHighlight.B offset += 3 - - // Write SogaUnknownColor1 dest[offset] = p.SogaUnknownColor1.R dest[offset+1] = p.SogaUnknownColor1.G dest[offset+2] = p.SogaUnknownColor1.B offset += 3 - - // Write SogaUnknown11 array for i := 0; i < 26; i++ { dest[offset] = p.SogaUnknown11[i] offset++ } - - // Write SogaHairFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaHairFile))) offset += 2 copy(dest[offset:], []byte(p.SogaHairFile)) offset += uint32(len(p.SogaHairFile)) - - // Write SogaHairTypeColor dest[offset] = p.SogaHairTypeColor.R dest[offset+1] = p.SogaHairTypeColor.G dest[offset+2] = p.SogaHairTypeColor.B offset += 3 - - // Write SogaHairTypeHighlightColor dest[offset] = p.SogaHairTypeHighlightColor.R dest[offset+1] = p.SogaHairTypeHighlightColor.G dest[offset+2] = p.SogaHairTypeHighlightColor.B offset += 3 - - // Write SogaFaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaFaceFile))) offset += 2 copy(dest[offset:], []byte(p.SogaFaceFile)) offset += uint32(len(p.SogaFaceFile)) - - // Write SogaHairFaceColor dest[offset] = p.SogaHairFaceColor.R dest[offset+1] = p.SogaHairFaceColor.G dest[offset+2] = p.SogaHairFaceColor.B offset += 3 - - // Write SogaHairFaceHighlightColor dest[offset] = p.SogaHairFaceHighlightColor.R dest[offset+1] = p.SogaHairFaceHighlightColor.G dest[offset+2] = p.SogaHairFaceHighlightColor.B offset += 3 - - // Write SogaWingFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaWingFile))) offset += 2 copy(dest[offset:], []byte(p.SogaWingFile)) offset += uint32(len(p.SogaWingFile)) - - // Write SogaWingColor1 dest[offset] = p.SogaWingColor1.R dest[offset+1] = p.SogaWingColor1.G dest[offset+2] = p.SogaWingColor1.B offset += 3 - - // Write SogaWingColor2 dest[offset] = p.SogaWingColor2.R dest[offset+1] = p.SogaWingColor2.G dest[offset+2] = p.SogaWingColor2.B offset += 3 - - // Write SogaChestFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaChestFile))) offset += 2 copy(dest[offset:], []byte(p.SogaChestFile)) offset += uint32(len(p.SogaChestFile)) - - // Write SogaShirtColor dest[offset] = p.SogaShirtColor.R dest[offset+1] = p.SogaShirtColor.G dest[offset+2] = p.SogaShirtColor.B offset += 3 - - // Write SogaUnknownChestColor dest[offset] = p.SogaUnknownChestColor.R dest[offset+1] = p.SogaUnknownChestColor.G dest[offset+2] = p.SogaUnknownChestColor.B offset += 3 - - // Write SogaLegsFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaLegsFile))) offset += 2 copy(dest[offset:], []byte(p.SogaLegsFile)) offset += uint32(len(p.SogaLegsFile)) - - // Write SogaPantsColor dest[offset] = p.SogaPantsColor.R dest[offset+1] = p.SogaPantsColor.G dest[offset+2] = p.SogaPantsColor.B offset += 3 - - // Write SogaUnknownLegsColor dest[offset] = p.SogaUnknownLegsColor.R dest[offset+1] = p.SogaUnknownLegsColor.G dest[offset+2] = p.SogaUnknownLegsColor.B offset += 3 - - // Write SogaUnknown12 dest[offset] = p.SogaUnknown12.R dest[offset+1] = p.SogaUnknown12.G dest[offset+2] = p.SogaUnknown12.B offset += 3 - - // Write SogaEyes2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEyes2[i])) offset += 4 } - - // Write SogaEars array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEars[i])) offset += 4 } - - // Write SogaEyeBrows array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEyeBrows[i])) offset += 4 } - - // Write SogaCheeks array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaCheeks[i])) offset += 4 } - - // Write SogaLips array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaLips[i])) offset += 4 } - - // Write SogaChin array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaChin[i])) offset += 4 } - - // Write SogaNose array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaNose[i])) offset += 4 } - - // Write SogaBodySize binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaBodySize)) offset += 4 - - // Write SogaBodyAge binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaBodyAge)) offset += 4 - return offset } // Size returns the serialized size of the packet func (p *CreateCharacterV869) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 4 + size += 4 + size += 1 + size += 4 + size += 2 + uint32(len(p.Name)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 2 + uint32(len(p.RaceFile)) + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += uint32(26) + size += 2 + uint32(len(p.HairFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.FaceFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.WingFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.ChestFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.LegsFile)) + size += 3 + size += 3 + size += 3 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 4 + size += 4 + size += 1 + size += 2 + uint32(len(p.SogaRaceFile)) + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += uint32(26) + size += 2 + uint32(len(p.SogaHairFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaFaceFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaWingFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaChestFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaLegsFile)) + size += 3 + size += 3 + size += 3 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 4 + size += 4 + return size } // CreateCharacterV1096 represents packet structure for OP_CreateCharacterRequestMsg @@ -2269,459 +1949,379 @@ type CreateCharacterV1096 struct { // Serialize writes the packet data to the provided buffer func (p *CreateCharacterV1096) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Unknown0 dest[offset] = byte(p.Unknown0) offset++ - - // Write Unknown1 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown1)) offset += 4 - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown3 dest[offset] = byte(p.Unknown3) offset++ - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - - // Write Race dest[offset] = byte(p.Race) offset++ - - // Write Gender dest[offset] = byte(p.Gender) offset++ - - // Write Deity dest[offset] = byte(p.Deity) offset++ - - // Write Class dest[offset] = byte(p.Class) offset++ - - // Write Level dest[offset] = byte(p.Level) offset++ - - // Write StartingZone dest[offset] = byte(p.StartingZone) offset++ - - // Write Version dest[offset] = byte(p.Version) offset++ - - // Write RaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.RaceFile))) offset += 2 copy(dest[offset:], []byte(p.RaceFile)) offset += uint32(len(p.RaceFile)) - - // Write SkinColor dest[offset] = p.SkinColor.R dest[offset+1] = p.SkinColor.G dest[offset+2] = p.SkinColor.B offset += 3 - - // Write SkinColor2 dest[offset] = p.SkinColor2.R dest[offset+1] = p.SkinColor2.G dest[offset+2] = p.SkinColor2.B offset += 3 - - // Write EyeColor dest[offset] = p.EyeColor.R dest[offset+1] = p.EyeColor.G dest[offset+2] = p.EyeColor.B offset += 3 - - // Write HairColor1 dest[offset] = p.HairColor1.R dest[offset+1] = p.HairColor1.G dest[offset+2] = p.HairColor1.B offset += 3 - - // Write HairColor2 dest[offset] = p.HairColor2.R dest[offset+1] = p.HairColor2.G dest[offset+2] = p.HairColor2.B offset += 3 - - // Write HairHighlight dest[offset] = p.HairHighlight.R dest[offset+1] = p.HairHighlight.G dest[offset+2] = p.HairHighlight.B offset += 3 - - // Write Unknown8 array for i := 0; i < 26; i++ { dest[offset] = p.Unknown8[i] offset++ } - - // Write HairFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.HairFile))) offset += 2 copy(dest[offset:], []byte(p.HairFile)) offset += uint32(len(p.HairFile)) - - // Write HairTypeColor dest[offset] = p.HairTypeColor.R dest[offset+1] = p.HairTypeColor.G dest[offset+2] = p.HairTypeColor.B offset += 3 - - // Write HairTypeHighlightColor dest[offset] = p.HairTypeHighlightColor.R dest[offset+1] = p.HairTypeHighlightColor.G dest[offset+2] = p.HairTypeHighlightColor.B offset += 3 - - // Write FaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.FaceFile))) offset += 2 copy(dest[offset:], []byte(p.FaceFile)) offset += uint32(len(p.FaceFile)) - - // Write HairFaceColor dest[offset] = p.HairFaceColor.R dest[offset+1] = p.HairFaceColor.G dest[offset+2] = p.HairFaceColor.B offset += 3 - - // Write HairFaceHighlightColor dest[offset] = p.HairFaceHighlightColor.R dest[offset+1] = p.HairFaceHighlightColor.G dest[offset+2] = p.HairFaceHighlightColor.B offset += 3 - - // Write WingFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.WingFile))) offset += 2 copy(dest[offset:], []byte(p.WingFile)) offset += uint32(len(p.WingFile)) - - // Write WingColor1 dest[offset] = p.WingColor1.R dest[offset+1] = p.WingColor1.G dest[offset+2] = p.WingColor1.B offset += 3 - - // Write WingColor2 dest[offset] = p.WingColor2.R dest[offset+1] = p.WingColor2.G dest[offset+2] = p.WingColor2.B offset += 3 - - // Write ChestFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.ChestFile))) offset += 2 copy(dest[offset:], []byte(p.ChestFile)) offset += uint32(len(p.ChestFile)) - - // Write ShirtColor dest[offset] = p.ShirtColor.R dest[offset+1] = p.ShirtColor.G dest[offset+2] = p.ShirtColor.B offset += 3 - - // Write UnknownChestColor dest[offset] = p.UnknownChestColor.R dest[offset+1] = p.UnknownChestColor.G dest[offset+2] = p.UnknownChestColor.B offset += 3 - - // Write LegsFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.LegsFile))) offset += 2 copy(dest[offset:], []byte(p.LegsFile)) offset += uint32(len(p.LegsFile)) - - // Write PantsColor dest[offset] = p.PantsColor.R dest[offset+1] = p.PantsColor.G dest[offset+2] = p.PantsColor.B offset += 3 - - // Write UnknownLegsColor dest[offset] = p.UnknownLegsColor.R dest[offset+1] = p.UnknownLegsColor.G dest[offset+2] = p.UnknownLegsColor.B offset += 3 - - // Write Unknown9 dest[offset] = p.Unknown9.R dest[offset+1] = p.Unknown9.G dest[offset+2] = p.Unknown9.B offset += 3 - - // Write Eyes2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Eyes2[i])) offset += 4 } - - // Write Ears array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Ears[i])) offset += 4 } - - // Write EyeBrows array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.EyeBrows[i])) offset += 4 } - - // Write Cheeks array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Cheeks[i])) offset += 4 } - - // Write Lips array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Lips[i])) offset += 4 } - - // Write Chin array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Chin[i])) offset += 4 } - - // Write Nose array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Nose[i])) offset += 4 } - - // Write BodySize binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodySize)) offset += 4 - - // Write BodyAge binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodyAge)) offset += 4 - - // Write SogaVersion dest[offset] = byte(p.SogaVersion) offset++ - - // Write SogaRaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaRaceFile))) offset += 2 copy(dest[offset:], []byte(p.SogaRaceFile)) offset += uint32(len(p.SogaRaceFile)) - - // Write SogaSkinColor dest[offset] = p.SogaSkinColor.R dest[offset+1] = p.SogaSkinColor.G dest[offset+2] = p.SogaSkinColor.B offset += 3 - - // Write SogaEyeColor dest[offset] = p.SogaEyeColor.R dest[offset+1] = p.SogaEyeColor.G dest[offset+2] = p.SogaEyeColor.B offset += 3 - - // Write SogaHairColor1 dest[offset] = p.SogaHairColor1.R dest[offset+1] = p.SogaHairColor1.G dest[offset+2] = p.SogaHairColor1.B offset += 3 - - // Write SogaHairColor2 dest[offset] = p.SogaHairColor2.R dest[offset+1] = p.SogaHairColor2.G dest[offset+2] = p.SogaHairColor2.B offset += 3 - - // Write SogaHairHighlight dest[offset] = p.SogaHairHighlight.R dest[offset+1] = p.SogaHairHighlight.G dest[offset+2] = p.SogaHairHighlight.B offset += 3 - - // Write SogaUnknownColor dest[offset] = p.SogaUnknownColor.R dest[offset+1] = p.SogaUnknownColor.G dest[offset+2] = p.SogaUnknownColor.B offset += 3 - - // Write SogaUnknown11 array for i := 0; i < 26; i++ { dest[offset] = p.SogaUnknown11[i] offset++ } - - // Write SogaHairFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaHairFile))) offset += 2 copy(dest[offset:], []byte(p.SogaHairFile)) offset += uint32(len(p.SogaHairFile)) - - // Write SogaHairTypeColor dest[offset] = p.SogaHairTypeColor.R dest[offset+1] = p.SogaHairTypeColor.G dest[offset+2] = p.SogaHairTypeColor.B offset += 3 - - // Write SogaHairTypeHighlightColor dest[offset] = p.SogaHairTypeHighlightColor.R dest[offset+1] = p.SogaHairTypeHighlightColor.G dest[offset+2] = p.SogaHairTypeHighlightColor.B offset += 3 - - // Write SogaFaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaFaceFile))) offset += 2 copy(dest[offset:], []byte(p.SogaFaceFile)) offset += uint32(len(p.SogaFaceFile)) - - // Write SogaHairFaceColor dest[offset] = p.SogaHairFaceColor.R dest[offset+1] = p.SogaHairFaceColor.G dest[offset+2] = p.SogaHairFaceColor.B offset += 3 - - // Write SogaHairFaceHighlightColor dest[offset] = p.SogaHairFaceHighlightColor.R dest[offset+1] = p.SogaHairFaceHighlightColor.G dest[offset+2] = p.SogaHairFaceHighlightColor.B offset += 3 - - // Write SogaWingFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaWingFile))) offset += 2 copy(dest[offset:], []byte(p.SogaWingFile)) offset += uint32(len(p.SogaWingFile)) - - // Write SogaWingColor1 dest[offset] = p.SogaWingColor1.R dest[offset+1] = p.SogaWingColor1.G dest[offset+2] = p.SogaWingColor1.B offset += 3 - - // Write SogaWingColor2 dest[offset] = p.SogaWingColor2.R dest[offset+1] = p.SogaWingColor2.G dest[offset+2] = p.SogaWingColor2.B offset += 3 - - // Write SogaChestFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaChestFile))) offset += 2 copy(dest[offset:], []byte(p.SogaChestFile)) offset += uint32(len(p.SogaChestFile)) - - // Write SogaShirtColor dest[offset] = p.SogaShirtColor.R dest[offset+1] = p.SogaShirtColor.G dest[offset+2] = p.SogaShirtColor.B offset += 3 - - // Write SogaUnknownChestColor dest[offset] = p.SogaUnknownChestColor.R dest[offset+1] = p.SogaUnknownChestColor.G dest[offset+2] = p.SogaUnknownChestColor.B offset += 3 - - // Write SogaLegsFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaLegsFile))) offset += 2 copy(dest[offset:], []byte(p.SogaLegsFile)) offset += uint32(len(p.SogaLegsFile)) - - // Write SogaPantsColor dest[offset] = p.SogaPantsColor.R dest[offset+1] = p.SogaPantsColor.G dest[offset+2] = p.SogaPantsColor.B offset += 3 - - // Write SogaUnknownLegsColor dest[offset] = p.SogaUnknownLegsColor.R dest[offset+1] = p.SogaUnknownLegsColor.G dest[offset+2] = p.SogaUnknownLegsColor.B offset += 3 - - // Write SogaUnknown12 dest[offset] = p.SogaUnknown12.R dest[offset+1] = p.SogaUnknown12.G dest[offset+2] = p.SogaUnknown12.B offset += 3 - - // Write SogaEyes2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEyes2[i])) offset += 4 } - - // Write SogaEars array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEars[i])) offset += 4 } - - // Write SogaEyeBrows array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEyeBrows[i])) offset += 4 } - - // Write SogaCheeks array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaCheeks[i])) offset += 4 } - - // Write SogaLips array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaLips[i])) offset += 4 } - - // Write SogaChin array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaChin[i])) offset += 4 } - - // Write SogaNose array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaNose[i])) offset += 4 } - - // Write SogaBodySize binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaBodySize)) offset += 4 - - // Write SogaBodyAge binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaBodyAge)) offset += 4 - return offset } // Size returns the serialized size of the packet func (p *CreateCharacterV1096) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 4 + size += 4 + size += 1 + size += 4 + size += 2 + uint32(len(p.Name)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 2 + uint32(len(p.RaceFile)) + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += uint32(26) + size += 2 + uint32(len(p.HairFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.FaceFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.WingFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.ChestFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.LegsFile)) + size += 3 + size += 3 + size += 3 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 4 + size += 4 + size += 1 + size += 2 + uint32(len(p.SogaRaceFile)) + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += uint32(26) + size += 2 + uint32(len(p.SogaHairFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaFaceFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaWingFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaChestFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaLegsFile)) + size += 3 + size += 3 + size += 3 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 4 + size += 4 + return size } // CreateCharacterV57080 represents packet structure for OP_CreateCharacterRequestMsg @@ -2812,463 +2412,382 @@ type CreateCharacterV57080 struct { // Serialize writes the packet data to the provided buffer func (p *CreateCharacterV57080) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Unknown0 dest[offset] = byte(p.Unknown0) offset++ - - // Write Unknown1 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown1)) offset += 4 - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown3 dest[offset] = byte(p.Unknown3) offset++ - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - - // Write Race dest[offset] = byte(p.Race) offset++ - - // Write Gender dest[offset] = byte(p.Gender) offset++ - - // Write Deity dest[offset] = byte(p.Deity) offset++ - - // Write Class dest[offset] = byte(p.Class) offset++ - - // Write Level dest[offset] = byte(p.Level) offset++ - - // Write StartingZone dest[offset] = byte(p.StartingZone) offset++ - - // Write Version dest[offset] = byte(p.Version) offset++ - - // Write Unknown10 binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Unknown10)) offset += 2 - - // Write RaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.RaceFile))) offset += 2 copy(dest[offset:], []byte(p.RaceFile)) offset += uint32(len(p.RaceFile)) - - // Write SkinColor dest[offset] = p.SkinColor.R dest[offset+1] = p.SkinColor.G dest[offset+2] = p.SkinColor.B offset += 3 - - // Write EyeColor dest[offset] = p.EyeColor.R dest[offset+1] = p.EyeColor.G dest[offset+2] = p.EyeColor.B offset += 3 - - // Write UnknownSkinColor2 dest[offset] = p.UnknownSkinColor2.R dest[offset+1] = p.UnknownSkinColor2.G dest[offset+2] = p.UnknownSkinColor2.B offset += 3 - - // Write HairColor1 dest[offset] = p.HairColor1.R dest[offset+1] = p.HairColor1.G dest[offset+2] = p.HairColor1.B offset += 3 - - // Write HairColor2 dest[offset] = p.HairColor2.R dest[offset+1] = p.HairColor2.G dest[offset+2] = p.HairColor2.B offset += 3 - - // Write HairHighlight dest[offset] = p.HairHighlight.R dest[offset+1] = p.HairHighlight.G dest[offset+2] = p.HairHighlight.B offset += 3 - - // Write Unknown8 array for i := 0; i < 26; i++ { dest[offset] = p.Unknown8[i] offset++ } - - // Write HairFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.HairFile))) offset += 2 copy(dest[offset:], []byte(p.HairFile)) offset += uint32(len(p.HairFile)) - - // Write HairTypeColor dest[offset] = p.HairTypeColor.R dest[offset+1] = p.HairTypeColor.G dest[offset+2] = p.HairTypeColor.B offset += 3 - - // Write HairTypeHighlightColor dest[offset] = p.HairTypeHighlightColor.R dest[offset+1] = p.HairTypeHighlightColor.G dest[offset+2] = p.HairTypeHighlightColor.B offset += 3 - - // Write FaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.FaceFile))) offset += 2 copy(dest[offset:], []byte(p.FaceFile)) offset += uint32(len(p.FaceFile)) - - // Write HairFaceColor dest[offset] = p.HairFaceColor.R dest[offset+1] = p.HairFaceColor.G dest[offset+2] = p.HairFaceColor.B offset += 3 - - // Write HairFaceHighlightColor dest[offset] = p.HairFaceHighlightColor.R dest[offset+1] = p.HairFaceHighlightColor.G dest[offset+2] = p.HairFaceHighlightColor.B offset += 3 - - // Write WingFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.WingFile))) offset += 2 copy(dest[offset:], []byte(p.WingFile)) offset += uint32(len(p.WingFile)) - - // Write WingColor1 dest[offset] = p.WingColor1.R dest[offset+1] = p.WingColor1.G dest[offset+2] = p.WingColor1.B offset += 3 - - // Write WingColor2 dest[offset] = p.WingColor2.R dest[offset+1] = p.WingColor2.G dest[offset+2] = p.WingColor2.B offset += 3 - - // Write ChestFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.ChestFile))) offset += 2 copy(dest[offset:], []byte(p.ChestFile)) offset += uint32(len(p.ChestFile)) - - // Write ShirtColor dest[offset] = p.ShirtColor.R dest[offset+1] = p.ShirtColor.G dest[offset+2] = p.ShirtColor.B offset += 3 - - // Write UnknownChestColor dest[offset] = p.UnknownChestColor.R dest[offset+1] = p.UnknownChestColor.G dest[offset+2] = p.UnknownChestColor.B offset += 3 - - // Write LegsFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.LegsFile))) offset += 2 copy(dest[offset:], []byte(p.LegsFile)) offset += uint32(len(p.LegsFile)) - - // Write PantsColor dest[offset] = p.PantsColor.R dest[offset+1] = p.PantsColor.G dest[offset+2] = p.PantsColor.B offset += 3 - - // Write UnknownLegsColor dest[offset] = p.UnknownLegsColor.R dest[offset+1] = p.UnknownLegsColor.G dest[offset+2] = p.UnknownLegsColor.B offset += 3 - - // Write Unknown9 dest[offset] = p.Unknown9.R dest[offset+1] = p.Unknown9.G dest[offset+2] = p.Unknown9.B offset += 3 - - // Write Eyes2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Eyes2[i])) offset += 4 } - - // Write Ears array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Ears[i])) offset += 4 } - - // Write EyeBrows array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.EyeBrows[i])) offset += 4 } - - // Write Cheeks array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Cheeks[i])) offset += 4 } - - // Write Lips array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Lips[i])) offset += 4 } - - // Write Chin array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Chin[i])) offset += 4 } - - // Write Nose array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Nose[i])) offset += 4 } - - // Write BodySize binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodySize)) offset += 4 - - // Write BodyAge binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodyAge)) offset += 4 - - // Write SogaVersion dest[offset] = byte(p.SogaVersion) offset++ - - // Write SogaRaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaRaceFile))) offset += 2 copy(dest[offset:], []byte(p.SogaRaceFile)) offset += uint32(len(p.SogaRaceFile)) - - // Write SogaSkinColor dest[offset] = p.SogaSkinColor.R dest[offset+1] = p.SogaSkinColor.G dest[offset+2] = p.SogaSkinColor.B offset += 3 - - // Write SogaEyeColor dest[offset] = p.SogaEyeColor.R dest[offset+1] = p.SogaEyeColor.G dest[offset+2] = p.SogaEyeColor.B offset += 3 - - // Write SogaHairColor1 dest[offset] = p.SogaHairColor1.R dest[offset+1] = p.SogaHairColor1.G dest[offset+2] = p.SogaHairColor1.B offset += 3 - - // Write SogaHairColor2 dest[offset] = p.SogaHairColor2.R dest[offset+1] = p.SogaHairColor2.G dest[offset+2] = p.SogaHairColor2.B offset += 3 - - // Write SogaHairHighlight dest[offset] = p.SogaHairHighlight.R dest[offset+1] = p.SogaHairHighlight.G dest[offset+2] = p.SogaHairHighlight.B offset += 3 - - // Write SogaUnknownColor dest[offset] = p.SogaUnknownColor.R dest[offset+1] = p.SogaUnknownColor.G dest[offset+2] = p.SogaUnknownColor.B offset += 3 - - // Write SogaUnknown11 array for i := 0; i < 26; i++ { dest[offset] = p.SogaUnknown11[i] offset++ } - - // Write SogaHairFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaHairFile))) offset += 2 copy(dest[offset:], []byte(p.SogaHairFile)) offset += uint32(len(p.SogaHairFile)) - - // Write SogaHairTypeColor dest[offset] = p.SogaHairTypeColor.R dest[offset+1] = p.SogaHairTypeColor.G dest[offset+2] = p.SogaHairTypeColor.B offset += 3 - - // Write SogaHairTypeHighlightColor dest[offset] = p.SogaHairTypeHighlightColor.R dest[offset+1] = p.SogaHairTypeHighlightColor.G dest[offset+2] = p.SogaHairTypeHighlightColor.B offset += 3 - - // Write SogaFaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaFaceFile))) offset += 2 copy(dest[offset:], []byte(p.SogaFaceFile)) offset += uint32(len(p.SogaFaceFile)) - - // Write SogaHairFaceColor dest[offset] = p.SogaHairFaceColor.R dest[offset+1] = p.SogaHairFaceColor.G dest[offset+2] = p.SogaHairFaceColor.B offset += 3 - - // Write SogaHairFaceHighlightColor dest[offset] = p.SogaHairFaceHighlightColor.R dest[offset+1] = p.SogaHairFaceHighlightColor.G dest[offset+2] = p.SogaHairFaceHighlightColor.B offset += 3 - - // Write SogaWingFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaWingFile))) offset += 2 copy(dest[offset:], []byte(p.SogaWingFile)) offset += uint32(len(p.SogaWingFile)) - - // Write SogaWingColor1 dest[offset] = p.SogaWingColor1.R dest[offset+1] = p.SogaWingColor1.G dest[offset+2] = p.SogaWingColor1.B offset += 3 - - // Write SogaWingColor2 dest[offset] = p.SogaWingColor2.R dest[offset+1] = p.SogaWingColor2.G dest[offset+2] = p.SogaWingColor2.B offset += 3 - - // Write SogaChestFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaChestFile))) offset += 2 copy(dest[offset:], []byte(p.SogaChestFile)) offset += uint32(len(p.SogaChestFile)) - - // Write SogaShirtColor dest[offset] = p.SogaShirtColor.R dest[offset+1] = p.SogaShirtColor.G dest[offset+2] = p.SogaShirtColor.B offset += 3 - - // Write SogaUnknownChestColor dest[offset] = p.SogaUnknownChestColor.R dest[offset+1] = p.SogaUnknownChestColor.G dest[offset+2] = p.SogaUnknownChestColor.B offset += 3 - - // Write SogaLegsFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaLegsFile))) offset += 2 copy(dest[offset:], []byte(p.SogaLegsFile)) offset += uint32(len(p.SogaLegsFile)) - - // Write SogaPantsColor dest[offset] = p.SogaPantsColor.R dest[offset+1] = p.SogaPantsColor.G dest[offset+2] = p.SogaPantsColor.B offset += 3 - - // Write SogaUnknownLegsColor dest[offset] = p.SogaUnknownLegsColor.R dest[offset+1] = p.SogaUnknownLegsColor.G dest[offset+2] = p.SogaUnknownLegsColor.B offset += 3 - - // Write SogaUnknown12 dest[offset] = p.SogaUnknown12.R dest[offset+1] = p.SogaUnknown12.G dest[offset+2] = p.SogaUnknown12.B offset += 3 - - // Write SogaEyes2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEyes2[i])) offset += 4 } - - // Write SogaEars array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEars[i])) offset += 4 } - - // Write SogaEyeBrows array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEyeBrows[i])) offset += 4 } - - // Write SogaCheeks array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaCheeks[i])) offset += 4 } - - // Write SogaLips array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaLips[i])) offset += 4 } - - // Write SogaChin array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaChin[i])) offset += 4 } - - // Write SogaNose array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaNose[i])) offset += 4 } - - // Write SogaBodySize binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaBodySize)) offset += 4 - - // Write SogaBodyAge binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaBodyAge)) offset += 4 - return offset } // Size returns the serialized size of the packet func (p *CreateCharacterV57080) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 4 + size += 4 + size += 1 + size += 4 + size += 2 + uint32(len(p.Name)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 2 + size += 2 + uint32(len(p.RaceFile)) + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += uint32(26) + size += 2 + uint32(len(p.HairFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.FaceFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.WingFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.ChestFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.LegsFile)) + size += 3 + size += 3 + size += 3 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 4 + size += 4 + size += 1 + size += 2 + uint32(len(p.SogaRaceFile)) + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += uint32(26) + size += 2 + uint32(len(p.SogaHairFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaFaceFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaWingFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaChestFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaLegsFile)) + size += 3 + size += 3 + size += 3 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 4 + size += 4 + return size } // CreateCharacterV60085 represents packet structure for OP_CreateCharacterRequestMsg @@ -3359,463 +2878,382 @@ type CreateCharacterV60085 struct { // Serialize writes the packet data to the provided buffer func (p *CreateCharacterV60085) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Unknown0 dest[offset] = byte(p.Unknown0) offset++ - - // Write Unknown1 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown1)) offset += 4 - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown3 dest[offset] = byte(p.Unknown3) offset++ - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - - // Write Race dest[offset] = byte(p.Race) offset++ - - // Write Gender dest[offset] = byte(p.Gender) offset++ - - // Write Deity dest[offset] = byte(p.Deity) offset++ - - // Write Class dest[offset] = byte(p.Class) offset++ - - // Write Level dest[offset] = byte(p.Level) offset++ - - // Write StartingZone dest[offset] = byte(p.StartingZone) offset++ - - // Write Version dest[offset] = byte(p.Version) offset++ - - // Write Unknown10 binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Unknown10)) offset += 2 - - // Write RaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.RaceFile))) offset += 2 copy(dest[offset:], []byte(p.RaceFile)) offset += uint32(len(p.RaceFile)) - - // Write SkinColor dest[offset] = p.SkinColor.R dest[offset+1] = p.SkinColor.G dest[offset+2] = p.SkinColor.B offset += 3 - - // Write EyeColor dest[offset] = p.EyeColor.R dest[offset+1] = p.EyeColor.G dest[offset+2] = p.EyeColor.B offset += 3 - - // Write UnknownSkinColor2 dest[offset] = p.UnknownSkinColor2.R dest[offset+1] = p.UnknownSkinColor2.G dest[offset+2] = p.UnknownSkinColor2.B offset += 3 - - // Write HairColor1 dest[offset] = p.HairColor1.R dest[offset+1] = p.HairColor1.G dest[offset+2] = p.HairColor1.B offset += 3 - - // Write HairColor2 dest[offset] = p.HairColor2.R dest[offset+1] = p.HairColor2.G dest[offset+2] = p.HairColor2.B offset += 3 - - // Write HairHighlight dest[offset] = p.HairHighlight.R dest[offset+1] = p.HairHighlight.G dest[offset+2] = p.HairHighlight.B offset += 3 - - // Write Unknown8 array for i := 0; i < 26; i++ { dest[offset] = p.Unknown8[i] offset++ } - - // Write HairFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.HairFile))) offset += 2 copy(dest[offset:], []byte(p.HairFile)) offset += uint32(len(p.HairFile)) - - // Write HairTypeColor dest[offset] = p.HairTypeColor.R dest[offset+1] = p.HairTypeColor.G dest[offset+2] = p.HairTypeColor.B offset += 3 - - // Write HairTypeHighlightColor dest[offset] = p.HairTypeHighlightColor.R dest[offset+1] = p.HairTypeHighlightColor.G dest[offset+2] = p.HairTypeHighlightColor.B offset += 3 - - // Write FaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.FaceFile))) offset += 2 copy(dest[offset:], []byte(p.FaceFile)) offset += uint32(len(p.FaceFile)) - - // Write HairFaceColor dest[offset] = p.HairFaceColor.R dest[offset+1] = p.HairFaceColor.G dest[offset+2] = p.HairFaceColor.B offset += 3 - - // Write HairFaceHighlightColor dest[offset] = p.HairFaceHighlightColor.R dest[offset+1] = p.HairFaceHighlightColor.G dest[offset+2] = p.HairFaceHighlightColor.B offset += 3 - - // Write WingFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.WingFile))) offset += 2 copy(dest[offset:], []byte(p.WingFile)) offset += uint32(len(p.WingFile)) - - // Write WingColor1 dest[offset] = p.WingColor1.R dest[offset+1] = p.WingColor1.G dest[offset+2] = p.WingColor1.B offset += 3 - - // Write WingColor2 dest[offset] = p.WingColor2.R dest[offset+1] = p.WingColor2.G dest[offset+2] = p.WingColor2.B offset += 3 - - // Write ChestFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.ChestFile))) offset += 2 copy(dest[offset:], []byte(p.ChestFile)) offset += uint32(len(p.ChestFile)) - - // Write ShirtColor dest[offset] = p.ShirtColor.R dest[offset+1] = p.ShirtColor.G dest[offset+2] = p.ShirtColor.B offset += 3 - - // Write UnknownChestColor dest[offset] = p.UnknownChestColor.R dest[offset+1] = p.UnknownChestColor.G dest[offset+2] = p.UnknownChestColor.B offset += 3 - - // Write LegsFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.LegsFile))) offset += 2 copy(dest[offset:], []byte(p.LegsFile)) offset += uint32(len(p.LegsFile)) - - // Write PantsColor dest[offset] = p.PantsColor.R dest[offset+1] = p.PantsColor.G dest[offset+2] = p.PantsColor.B offset += 3 - - // Write UnknownLegsColor dest[offset] = p.UnknownLegsColor.R dest[offset+1] = p.UnknownLegsColor.G dest[offset+2] = p.UnknownLegsColor.B offset += 3 - - // Write Unknown9 dest[offset] = p.Unknown9.R dest[offset+1] = p.Unknown9.G dest[offset+2] = p.Unknown9.B offset += 3 - - // Write Eyes2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Eyes2[i])) offset += 4 } - - // Write Ears array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Ears[i])) offset += 4 } - - // Write EyeBrows array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.EyeBrows[i])) offset += 4 } - - // Write Cheeks array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Cheeks[i])) offset += 4 } - - // Write Lips array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Lips[i])) offset += 4 } - - // Write Chin array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Chin[i])) offset += 4 } - - // Write Nose array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Nose[i])) offset += 4 } - - // Write BodySize binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodySize)) offset += 4 - - // Write BodyAge binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodyAge)) offset += 4 - - // Write SogaVersion dest[offset] = byte(p.SogaVersion) offset++ - - // Write SogaRaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaRaceFile))) offset += 2 copy(dest[offset:], []byte(p.SogaRaceFile)) offset += uint32(len(p.SogaRaceFile)) - - // Write SogaSkinColor dest[offset] = p.SogaSkinColor.R dest[offset+1] = p.SogaSkinColor.G dest[offset+2] = p.SogaSkinColor.B offset += 3 - - // Write SogaEyeColor dest[offset] = p.SogaEyeColor.R dest[offset+1] = p.SogaEyeColor.G dest[offset+2] = p.SogaEyeColor.B offset += 3 - - // Write SogaHairColor1 dest[offset] = p.SogaHairColor1.R dest[offset+1] = p.SogaHairColor1.G dest[offset+2] = p.SogaHairColor1.B offset += 3 - - // Write SogaHairColor2 dest[offset] = p.SogaHairColor2.R dest[offset+1] = p.SogaHairColor2.G dest[offset+2] = p.SogaHairColor2.B offset += 3 - - // Write SogaHairHighlight dest[offset] = p.SogaHairHighlight.R dest[offset+1] = p.SogaHairHighlight.G dest[offset+2] = p.SogaHairHighlight.B offset += 3 - - // Write SogaUnknownColor dest[offset] = p.SogaUnknownColor.R dest[offset+1] = p.SogaUnknownColor.G dest[offset+2] = p.SogaUnknownColor.B offset += 3 - - // Write SogaUnknown11 array for i := 0; i < 26; i++ { dest[offset] = p.SogaUnknown11[i] offset++ } - - // Write SogaHairFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaHairFile))) offset += 2 copy(dest[offset:], []byte(p.SogaHairFile)) offset += uint32(len(p.SogaHairFile)) - - // Write SogaHairTypeColor dest[offset] = p.SogaHairTypeColor.R dest[offset+1] = p.SogaHairTypeColor.G dest[offset+2] = p.SogaHairTypeColor.B offset += 3 - - // Write SogaHairTypeHighlightColor dest[offset] = p.SogaHairTypeHighlightColor.R dest[offset+1] = p.SogaHairTypeHighlightColor.G dest[offset+2] = p.SogaHairTypeHighlightColor.B offset += 3 - - // Write SogaFaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaFaceFile))) offset += 2 copy(dest[offset:], []byte(p.SogaFaceFile)) offset += uint32(len(p.SogaFaceFile)) - - // Write SogaHairFaceColor dest[offset] = p.SogaHairFaceColor.R dest[offset+1] = p.SogaHairFaceColor.G dest[offset+2] = p.SogaHairFaceColor.B offset += 3 - - // Write SogaHairFaceHighlightColor dest[offset] = p.SogaHairFaceHighlightColor.R dest[offset+1] = p.SogaHairFaceHighlightColor.G dest[offset+2] = p.SogaHairFaceHighlightColor.B offset += 3 - - // Write SogaWingFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaWingFile))) offset += 2 copy(dest[offset:], []byte(p.SogaWingFile)) offset += uint32(len(p.SogaWingFile)) - - // Write SogaWingColor1 dest[offset] = p.SogaWingColor1.R dest[offset+1] = p.SogaWingColor1.G dest[offset+2] = p.SogaWingColor1.B offset += 3 - - // Write SogaWingColor2 dest[offset] = p.SogaWingColor2.R dest[offset+1] = p.SogaWingColor2.G dest[offset+2] = p.SogaWingColor2.B offset += 3 - - // Write SogaChestFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaChestFile))) offset += 2 copy(dest[offset:], []byte(p.SogaChestFile)) offset += uint32(len(p.SogaChestFile)) - - // Write SogaShirtColor dest[offset] = p.SogaShirtColor.R dest[offset+1] = p.SogaShirtColor.G dest[offset+2] = p.SogaShirtColor.B offset += 3 - - // Write SogaUnknownChestColor dest[offset] = p.SogaUnknownChestColor.R dest[offset+1] = p.SogaUnknownChestColor.G dest[offset+2] = p.SogaUnknownChestColor.B offset += 3 - - // Write SogaLegsFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaLegsFile))) offset += 2 copy(dest[offset:], []byte(p.SogaLegsFile)) offset += uint32(len(p.SogaLegsFile)) - - // Write SogaPantsColor dest[offset] = p.SogaPantsColor.R dest[offset+1] = p.SogaPantsColor.G dest[offset+2] = p.SogaPantsColor.B offset += 3 - - // Write SogaUnknownLegsColor dest[offset] = p.SogaUnknownLegsColor.R dest[offset+1] = p.SogaUnknownLegsColor.G dest[offset+2] = p.SogaUnknownLegsColor.B offset += 3 - - // Write SogaUnknown12 dest[offset] = p.SogaUnknown12.R dest[offset+1] = p.SogaUnknown12.G dest[offset+2] = p.SogaUnknown12.B offset += 3 - - // Write SogaEyes2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEyes2[i])) offset += 4 } - - // Write SogaEars array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEars[i])) offset += 4 } - - // Write SogaEyeBrows array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEyeBrows[i])) offset += 4 } - - // Write SogaCheeks array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaCheeks[i])) offset += 4 } - - // Write SogaLips array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaLips[i])) offset += 4 } - - // Write SogaChin array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaChin[i])) offset += 4 } - - // Write SogaNose array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaNose[i])) offset += 4 } - - // Write SogaBodySize binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaBodySize)) offset += 4 - - // Write SogaBodyAge binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaBodyAge)) offset += 4 - return offset } // Size returns the serialized size of the packet func (p *CreateCharacterV60085) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 4 + size += 4 + size += 1 + size += 4 + size += 2 + uint32(len(p.Name)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 2 + size += 2 + uint32(len(p.RaceFile)) + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += uint32(26) + size += 2 + uint32(len(p.HairFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.FaceFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.WingFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.ChestFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.LegsFile)) + size += 3 + size += 3 + size += 3 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 4 + size += 4 + size += 1 + size += 2 + uint32(len(p.SogaRaceFile)) + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += uint32(26) + size += 2 + uint32(len(p.SogaHairFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaFaceFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaWingFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaChestFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaLegsFile)) + size += 3 + size += 3 + size += 3 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 4 + size += 4 + return size } // CreateCharacterV64659 represents packet structure for OP_CreateCharacterRequestMsg @@ -3904,453 +3342,374 @@ type CreateCharacterV64659 struct { // Serialize writes the packet data to the provided buffer func (p *CreateCharacterV64659) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Unknown0 dest[offset] = byte(p.Unknown0) offset++ - - // Write Unknown1 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown1)) offset += 4 - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown3 dest[offset] = byte(p.Unknown3) offset++ - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - - // Write Race dest[offset] = byte(p.Race) offset++ - - // Write Gender dest[offset] = byte(p.Gender) offset++ - - // Write Deity dest[offset] = byte(p.Deity) offset++ - - // Write Class dest[offset] = byte(p.Class) offset++ - - // Write Level dest[offset] = byte(p.Level) offset++ - - // Write StartingZone binary.LittleEndian.PutUint32(dest[offset:], uint32(p.StartingZone)) offset += 4 - - // Write Version dest[offset] = byte(p.Version) offset++ - - // Write RaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.RaceFile))) offset += 2 copy(dest[offset:], []byte(p.RaceFile)) offset += uint32(len(p.RaceFile)) - - // Write SkinColor dest[offset] = p.SkinColor.R dest[offset+1] = p.SkinColor.G dest[offset+2] = p.SkinColor.B offset += 3 - - // Write SkinColor2 dest[offset] = p.SkinColor2.R dest[offset+1] = p.SkinColor2.G dest[offset+2] = p.SkinColor2.B offset += 3 - - // Write EyeColor dest[offset] = p.EyeColor.R dest[offset+1] = p.EyeColor.G dest[offset+2] = p.EyeColor.B offset += 3 - - // Write HairColor1 dest[offset] = p.HairColor1.R dest[offset+1] = p.HairColor1.G dest[offset+2] = p.HairColor1.B offset += 3 - - // Write HairColor2 dest[offset] = p.HairColor2.R dest[offset+1] = p.HairColor2.G dest[offset+2] = p.HairColor2.B offset += 3 - - // Write Unknown8 array for i := 0; i < 38; i++ { dest[offset] = p.Unknown8[i] offset++ } - - // Write HairFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.HairFile))) offset += 2 copy(dest[offset:], []byte(p.HairFile)) offset += uint32(len(p.HairFile)) - - // Write HairTypeColor dest[offset] = p.HairTypeColor.R dest[offset+1] = p.HairTypeColor.G dest[offset+2] = p.HairTypeColor.B offset += 3 - - // Write HairTypeHighlightColor dest[offset] = p.HairTypeHighlightColor.R dest[offset+1] = p.HairTypeHighlightColor.G dest[offset+2] = p.HairTypeHighlightColor.B offset += 3 - - // Write FaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.FaceFile))) offset += 2 copy(dest[offset:], []byte(p.FaceFile)) offset += uint32(len(p.FaceFile)) - - // Write HairFaceColor dest[offset] = p.HairFaceColor.R dest[offset+1] = p.HairFaceColor.G dest[offset+2] = p.HairFaceColor.B offset += 3 - - // Write HairFaceHighlightColor dest[offset] = p.HairFaceHighlightColor.R dest[offset+1] = p.HairFaceHighlightColor.G dest[offset+2] = p.HairFaceHighlightColor.B offset += 3 - - // Write WingFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.WingFile))) offset += 2 copy(dest[offset:], []byte(p.WingFile)) offset += uint32(len(p.WingFile)) - - // Write WingColor1 dest[offset] = p.WingColor1.R dest[offset+1] = p.WingColor1.G dest[offset+2] = p.WingColor1.B offset += 3 - - // Write WingColor2 dest[offset] = p.WingColor2.R dest[offset+1] = p.WingColor2.G dest[offset+2] = p.WingColor2.B offset += 3 - - // Write ChestFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.ChestFile))) offset += 2 copy(dest[offset:], []byte(p.ChestFile)) offset += uint32(len(p.ChestFile)) - - // Write ShirtColor dest[offset] = p.ShirtColor.R dest[offset+1] = p.ShirtColor.G dest[offset+2] = p.ShirtColor.B offset += 3 - - // Write UnknownChestColor dest[offset] = p.UnknownChestColor.R dest[offset+1] = p.UnknownChestColor.G dest[offset+2] = p.UnknownChestColor.B offset += 3 - - // Write LegsFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.LegsFile))) offset += 2 copy(dest[offset:], []byte(p.LegsFile)) offset += uint32(len(p.LegsFile)) - - // Write PantsColor dest[offset] = p.PantsColor.R dest[offset+1] = p.PantsColor.G dest[offset+2] = p.PantsColor.B offset += 3 - - // Write UnknownLegsColor dest[offset] = p.UnknownLegsColor.R dest[offset+1] = p.UnknownLegsColor.G dest[offset+2] = p.UnknownLegsColor.B offset += 3 - - // Write Unknown9 dest[offset] = p.Unknown9.R dest[offset+1] = p.Unknown9.G dest[offset+2] = p.Unknown9.B offset += 3 - - // Write Eyes2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Eyes2[i])) offset += 4 } - - // Write Ears array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Ears[i])) offset += 4 } - - // Write EyeBrows array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.EyeBrows[i])) offset += 4 } - - // Write Cheeks array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Cheeks[i])) offset += 4 } - - // Write Lips array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Lips[i])) offset += 4 } - - // Write Chin array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Chin[i])) offset += 4 } - - // Write Nose array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Nose[i])) offset += 4 } - - // Write BodySize binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodySize)) offset += 4 - - // Write BodyAge binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodyAge)) offset += 4 - - // Write SogaVersion dest[offset] = byte(p.SogaVersion) offset++ - - // Write SogaRaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaRaceFile))) offset += 2 copy(dest[offset:], []byte(p.SogaRaceFile)) offset += uint32(len(p.SogaRaceFile)) - - // Write SogaSkinColor dest[offset] = p.SogaSkinColor.R dest[offset+1] = p.SogaSkinColor.G dest[offset+2] = p.SogaSkinColor.B offset += 3 - - // Write SogaEyeColor dest[offset] = p.SogaEyeColor.R dest[offset+1] = p.SogaEyeColor.G dest[offset+2] = p.SogaEyeColor.B offset += 3 - - // Write SogaHairColor1 dest[offset] = p.SogaHairColor1.R dest[offset+1] = p.SogaHairColor1.G dest[offset+2] = p.SogaHairColor1.B offset += 3 - - // Write SogaHairColor2 dest[offset] = p.SogaHairColor2.R dest[offset+1] = p.SogaHairColor2.G dest[offset+2] = p.SogaHairColor2.B offset += 3 - - // Write SogaHairHighlight dest[offset] = p.SogaHairHighlight.R dest[offset+1] = p.SogaHairHighlight.G dest[offset+2] = p.SogaHairHighlight.B offset += 3 - - // Write SogaUnknown11 array for i := 0; i < 38; i++ { dest[offset] = p.SogaUnknown11[i] offset++ } - - // Write SogaHairFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaHairFile))) offset += 2 copy(dest[offset:], []byte(p.SogaHairFile)) offset += uint32(len(p.SogaHairFile)) - - // Write SogaHairTypeColor dest[offset] = p.SogaHairTypeColor.R dest[offset+1] = p.SogaHairTypeColor.G dest[offset+2] = p.SogaHairTypeColor.B offset += 3 - - // Write SogaHairTypeHighlightColor dest[offset] = p.SogaHairTypeHighlightColor.R dest[offset+1] = p.SogaHairTypeHighlightColor.G dest[offset+2] = p.SogaHairTypeHighlightColor.B offset += 3 - - // Write SogaFaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaFaceFile))) offset += 2 copy(dest[offset:], []byte(p.SogaFaceFile)) offset += uint32(len(p.SogaFaceFile)) - - // Write SogaHairFaceColor dest[offset] = p.SogaHairFaceColor.R dest[offset+1] = p.SogaHairFaceColor.G dest[offset+2] = p.SogaHairFaceColor.B offset += 3 - - // Write SogaHairFaceHighlightColor dest[offset] = p.SogaHairFaceHighlightColor.R dest[offset+1] = p.SogaHairFaceHighlightColor.G dest[offset+2] = p.SogaHairFaceHighlightColor.B offset += 3 - - // Write SogaWingFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaWingFile))) offset += 2 copy(dest[offset:], []byte(p.SogaWingFile)) offset += uint32(len(p.SogaWingFile)) - - // Write SogaWingColor1 dest[offset] = p.SogaWingColor1.R dest[offset+1] = p.SogaWingColor1.G dest[offset+2] = p.SogaWingColor1.B offset += 3 - - // Write SogaWingColor2 dest[offset] = p.SogaWingColor2.R dest[offset+1] = p.SogaWingColor2.G dest[offset+2] = p.SogaWingColor2.B offset += 3 - - // Write SogaChestFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaChestFile))) offset += 2 copy(dest[offset:], []byte(p.SogaChestFile)) offset += uint32(len(p.SogaChestFile)) - - // Write SogaShirtColor dest[offset] = p.SogaShirtColor.R dest[offset+1] = p.SogaShirtColor.G dest[offset+2] = p.SogaShirtColor.B offset += 3 - - // Write SogaUnknownChestColor dest[offset] = p.SogaUnknownChestColor.R dest[offset+1] = p.SogaUnknownChestColor.G dest[offset+2] = p.SogaUnknownChestColor.B offset += 3 - - // Write SogaLegsFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaLegsFile))) offset += 2 copy(dest[offset:], []byte(p.SogaLegsFile)) offset += uint32(len(p.SogaLegsFile)) - - // Write SogaPantsColor dest[offset] = p.SogaPantsColor.R dest[offset+1] = p.SogaPantsColor.G dest[offset+2] = p.SogaPantsColor.B offset += 3 - - // Write SogaUnknownLegsColor dest[offset] = p.SogaUnknownLegsColor.R dest[offset+1] = p.SogaUnknownLegsColor.G dest[offset+2] = p.SogaUnknownLegsColor.B offset += 3 - - // Write SogaUnknown12 dest[offset] = p.SogaUnknown12.R dest[offset+1] = p.SogaUnknown12.G dest[offset+2] = p.SogaUnknown12.B offset += 3 - - // Write SogaEyes2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEyes2[i])) offset += 4 } - - // Write SogaEars array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEars[i])) offset += 4 } - - // Write SogaEyeBrows array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEyeBrows[i])) offset += 4 } - - // Write SogaCheeks array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaCheeks[i])) offset += 4 } - - // Write SogaLips array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaLips[i])) offset += 4 } - - // Write SogaChin array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaChin[i])) offset += 4 } - - // Write SogaNose array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaNose[i])) offset += 4 } - - // Write SogaBodySize binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaBodySize)) offset += 4 - - // Write SogaBodyAge binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaBodyAge)) offset += 4 - - // Write Unknown13 array for i := 0; i < 2; i++ { dest[offset] = p.Unknown13[i] offset++ } - return offset } // Size returns the serialized size of the packet func (p *CreateCharacterV64659) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 4 + size += 4 + size += 1 + size += 4 + size += 2 + uint32(len(p.Name)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 4 + size += 1 + size += 2 + uint32(len(p.RaceFile)) + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += uint32(38) + size += 2 + uint32(len(p.HairFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.FaceFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.WingFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.ChestFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.LegsFile)) + size += 3 + size += 3 + size += 3 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 4 + size += 4 + size += 1 + size += 2 + uint32(len(p.SogaRaceFile)) + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += uint32(38) + size += 2 + uint32(len(p.SogaHairFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaFaceFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaWingFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaChestFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaLegsFile)) + size += 3 + size += 3 + size += 3 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 4 + size += 4 + size += uint32(2) + return size } // CreateCharacterV65534 represents packet structure for OP_CreateCharacterRequestMsg @@ -4439,453 +3798,374 @@ type CreateCharacterV65534 struct { // Serialize writes the packet data to the provided buffer func (p *CreateCharacterV65534) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Unknown0 dest[offset] = byte(p.Unknown0) offset++ - - // Write Unknown1 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown1)) offset += 4 - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown3 dest[offset] = byte(p.Unknown3) offset++ - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - - // Write Race dest[offset] = byte(p.Race) offset++ - - // Write Gender dest[offset] = byte(p.Gender) offset++ - - // Write Deity dest[offset] = byte(p.Deity) offset++ - - // Write Class dest[offset] = byte(p.Class) offset++ - - // Write Level dest[offset] = byte(p.Level) offset++ - - // Write StartingZone binary.LittleEndian.PutUint32(dest[offset:], uint32(p.StartingZone)) offset += 4 - - // Write Version dest[offset] = byte(p.Version) offset++ - - // Write RaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.RaceFile))) offset += 2 copy(dest[offset:], []byte(p.RaceFile)) offset += uint32(len(p.RaceFile)) - - // Write SkinColor dest[offset] = p.SkinColor.R dest[offset+1] = p.SkinColor.G dest[offset+2] = p.SkinColor.B offset += 3 - - // Write SkinColor2 dest[offset] = p.SkinColor2.R dest[offset+1] = p.SkinColor2.G dest[offset+2] = p.SkinColor2.B offset += 3 - - // Write EyeColor dest[offset] = p.EyeColor.R dest[offset+1] = p.EyeColor.G dest[offset+2] = p.EyeColor.B offset += 3 - - // Write HairColor1 dest[offset] = p.HairColor1.R dest[offset+1] = p.HairColor1.G dest[offset+2] = p.HairColor1.B offset += 3 - - // Write HairColor2 dest[offset] = p.HairColor2.R dest[offset+1] = p.HairColor2.G dest[offset+2] = p.HairColor2.B offset += 3 - - // Write Unknown8 array for i := 0; i < 38; i++ { dest[offset] = p.Unknown8[i] offset++ } - - // Write HairFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.HairFile))) offset += 2 copy(dest[offset:], []byte(p.HairFile)) offset += uint32(len(p.HairFile)) - - // Write HairTypeColor dest[offset] = p.HairTypeColor.R dest[offset+1] = p.HairTypeColor.G dest[offset+2] = p.HairTypeColor.B offset += 3 - - // Write HairTypeHighlightColor dest[offset] = p.HairTypeHighlightColor.R dest[offset+1] = p.HairTypeHighlightColor.G dest[offset+2] = p.HairTypeHighlightColor.B offset += 3 - - // Write FaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.FaceFile))) offset += 2 copy(dest[offset:], []byte(p.FaceFile)) offset += uint32(len(p.FaceFile)) - - // Write HairFaceColor dest[offset] = p.HairFaceColor.R dest[offset+1] = p.HairFaceColor.G dest[offset+2] = p.HairFaceColor.B offset += 3 - - // Write HairFaceHighlightColor dest[offset] = p.HairFaceHighlightColor.R dest[offset+1] = p.HairFaceHighlightColor.G dest[offset+2] = p.HairFaceHighlightColor.B offset += 3 - - // Write WingFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.WingFile))) offset += 2 copy(dest[offset:], []byte(p.WingFile)) offset += uint32(len(p.WingFile)) - - // Write WingColor1 dest[offset] = p.WingColor1.R dest[offset+1] = p.WingColor1.G dest[offset+2] = p.WingColor1.B offset += 3 - - // Write WingColor2 dest[offset] = p.WingColor2.R dest[offset+1] = p.WingColor2.G dest[offset+2] = p.WingColor2.B offset += 3 - - // Write ChestFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.ChestFile))) offset += 2 copy(dest[offset:], []byte(p.ChestFile)) offset += uint32(len(p.ChestFile)) - - // Write ShirtColor dest[offset] = p.ShirtColor.R dest[offset+1] = p.ShirtColor.G dest[offset+2] = p.ShirtColor.B offset += 3 - - // Write UnknownChestColor dest[offset] = p.UnknownChestColor.R dest[offset+1] = p.UnknownChestColor.G dest[offset+2] = p.UnknownChestColor.B offset += 3 - - // Write LegsFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.LegsFile))) offset += 2 copy(dest[offset:], []byte(p.LegsFile)) offset += uint32(len(p.LegsFile)) - - // Write PantsColor dest[offset] = p.PantsColor.R dest[offset+1] = p.PantsColor.G dest[offset+2] = p.PantsColor.B offset += 3 - - // Write UnknownLegsColor dest[offset] = p.UnknownLegsColor.R dest[offset+1] = p.UnknownLegsColor.G dest[offset+2] = p.UnknownLegsColor.B offset += 3 - - // Write Unknown9 dest[offset] = p.Unknown9.R dest[offset+1] = p.Unknown9.G dest[offset+2] = p.Unknown9.B offset += 3 - - // Write Eyes2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Eyes2[i])) offset += 4 } - - // Write Ears array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Ears[i])) offset += 4 } - - // Write EyeBrows array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.EyeBrows[i])) offset += 4 } - - // Write Cheeks array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Cheeks[i])) offset += 4 } - - // Write Lips array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Lips[i])) offset += 4 } - - // Write Chin array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Chin[i])) offset += 4 } - - // Write Nose array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.Nose[i])) offset += 4 } - - // Write BodySize binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodySize)) offset += 4 - - // Write BodyAge binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.BodyAge)) offset += 4 - - // Write SogaVersion dest[offset] = byte(p.SogaVersion) offset++ - - // Write SogaRaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaRaceFile))) offset += 2 copy(dest[offset:], []byte(p.SogaRaceFile)) offset += uint32(len(p.SogaRaceFile)) - - // Write SogaSkinColor dest[offset] = p.SogaSkinColor.R dest[offset+1] = p.SogaSkinColor.G dest[offset+2] = p.SogaSkinColor.B offset += 3 - - // Write SogaEyeColor dest[offset] = p.SogaEyeColor.R dest[offset+1] = p.SogaEyeColor.G dest[offset+2] = p.SogaEyeColor.B offset += 3 - - // Write SogaHairColor1 dest[offset] = p.SogaHairColor1.R dest[offset+1] = p.SogaHairColor1.G dest[offset+2] = p.SogaHairColor1.B offset += 3 - - // Write SogaHairColor2 dest[offset] = p.SogaHairColor2.R dest[offset+1] = p.SogaHairColor2.G dest[offset+2] = p.SogaHairColor2.B offset += 3 - - // Write SogaHairHighlight dest[offset] = p.SogaHairHighlight.R dest[offset+1] = p.SogaHairHighlight.G dest[offset+2] = p.SogaHairHighlight.B offset += 3 - - // Write SogaUnknown11 array for i := 0; i < 38; i++ { dest[offset] = p.SogaUnknown11[i] offset++ } - - // Write SogaHairFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaHairFile))) offset += 2 copy(dest[offset:], []byte(p.SogaHairFile)) offset += uint32(len(p.SogaHairFile)) - - // Write SogaHairTypeColor dest[offset] = p.SogaHairTypeColor.R dest[offset+1] = p.SogaHairTypeColor.G dest[offset+2] = p.SogaHairTypeColor.B offset += 3 - - // Write SogaHairTypeHighlightColor dest[offset] = p.SogaHairTypeHighlightColor.R dest[offset+1] = p.SogaHairTypeHighlightColor.G dest[offset+2] = p.SogaHairTypeHighlightColor.B offset += 3 - - // Write SogaFaceFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaFaceFile))) offset += 2 copy(dest[offset:], []byte(p.SogaFaceFile)) offset += uint32(len(p.SogaFaceFile)) - - // Write SogaHairFaceColor dest[offset] = p.SogaHairFaceColor.R dest[offset+1] = p.SogaHairFaceColor.G dest[offset+2] = p.SogaHairFaceColor.B offset += 3 - - // Write SogaHairFaceHighlightColor dest[offset] = p.SogaHairFaceHighlightColor.R dest[offset+1] = p.SogaHairFaceHighlightColor.G dest[offset+2] = p.SogaHairFaceHighlightColor.B offset += 3 - - // Write SogaWingFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaWingFile))) offset += 2 copy(dest[offset:], []byte(p.SogaWingFile)) offset += uint32(len(p.SogaWingFile)) - - // Write SogaWingColor1 dest[offset] = p.SogaWingColor1.R dest[offset+1] = p.SogaWingColor1.G dest[offset+2] = p.SogaWingColor1.B offset += 3 - - // Write SogaWingColor2 dest[offset] = p.SogaWingColor2.R dest[offset+1] = p.SogaWingColor2.G dest[offset+2] = p.SogaWingColor2.B offset += 3 - - // Write SogaChestFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaChestFile))) offset += 2 copy(dest[offset:], []byte(p.SogaChestFile)) offset += uint32(len(p.SogaChestFile)) - - // Write SogaShirtColor dest[offset] = p.SogaShirtColor.R dest[offset+1] = p.SogaShirtColor.G dest[offset+2] = p.SogaShirtColor.B offset += 3 - - // Write SogaUnknownChestColor dest[offset] = p.SogaUnknownChestColor.R dest[offset+1] = p.SogaUnknownChestColor.G dest[offset+2] = p.SogaUnknownChestColor.B offset += 3 - - // Write SogaLegsFile as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SogaLegsFile))) offset += 2 copy(dest[offset:], []byte(p.SogaLegsFile)) offset += uint32(len(p.SogaLegsFile)) - - // Write SogaPantsColor dest[offset] = p.SogaPantsColor.R dest[offset+1] = p.SogaPantsColor.G dest[offset+2] = p.SogaPantsColor.B offset += 3 - - // Write SogaUnknownLegsColor dest[offset] = p.SogaUnknownLegsColor.R dest[offset+1] = p.SogaUnknownLegsColor.G dest[offset+2] = p.SogaUnknownLegsColor.B offset += 3 - - // Write SogaUnknown12 dest[offset] = p.SogaUnknown12.R dest[offset+1] = p.SogaUnknown12.G dest[offset+2] = p.SogaUnknown12.B offset += 3 - - // Write SogaEyes2 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEyes2[i])) offset += 4 } - - // Write SogaEars array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEars[i])) offset += 4 } - - // Write SogaEyeBrows array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaEyeBrows[i])) offset += 4 } - - // Write SogaCheeks array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaCheeks[i])) offset += 4 } - - // Write SogaLips array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaLips[i])) offset += 4 } - - // Write SogaChin array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaChin[i])) offset += 4 } - - // Write SogaNose array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaNose[i])) offset += 4 } - - // Write SogaBodySize binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaBodySize)) offset += 4 - - // Write SogaBodyAge binary.LittleEndian.PutUint32(dest[offset:], math.Float32bits(p.SogaBodyAge)) offset += 4 - - // Write Unknown13 array for i := 0; i < 2; i++ { dest[offset] = p.Unknown13[i] offset++ } - return offset } // Size returns the serialized size of the packet func (p *CreateCharacterV65534) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 4 + size += 4 + size += 1 + size += 4 + size += 2 + uint32(len(p.Name)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + size += 4 + size += 1 + size += 2 + uint32(len(p.RaceFile)) + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += uint32(38) + size += 2 + uint32(len(p.HairFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.FaceFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.WingFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.ChestFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.LegsFile)) + size += 3 + size += 3 + size += 3 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 4 + size += 4 + size += 1 + size += 2 + uint32(len(p.SogaRaceFile)) + size += 3 + size += 3 + size += 3 + size += 3 + size += 3 + size += uint32(38) + size += 2 + uint32(len(p.SogaHairFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaFaceFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaWingFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaChestFile)) + size += 3 + size += 3 + size += 2 + uint32(len(p.SogaLegsFile)) + size += 3 + size += 3 + size += 3 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += uint32(3) * 4 + size += 4 + size += 4 + size += uint32(2) + return size } // BadLanguageFilter represents packet structure for OP_BadLanguageFilter @@ -4899,30 +4179,34 @@ type BadLanguageFilter struct { // Serialize writes the packet data to the provided buffer func (p *BadLanguageFilter) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write NumWords binary.LittleEndian.PutUint16(dest[offset:], uint16(p.NumWords)) offset += 2 - - // Write WordsArray array (dynamic size) for _, elem := range p.WordsArray { - // Write Word string field dest[offset] = byte(len(elem.Word)) offset++ copy(dest[offset:], []byte(elem.Word)) offset += uint32(len(elem.Word)) - } - return offset } // Size returns the serialized size of the packet func (p *BadLanguageFilter) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 2 + for _, elem := range p.WordsArray { + _ = elem + size += 1 + uint32(len(elem.Word)) + + } + return size } + + + + diff --git a/defs/generated/login.go b/defs/generated/login.go index 3021551..0baee33 100644 --- a/defs/generated/login.go +++ b/defs/generated/login.go @@ -19,27 +19,24 @@ type LSCreateCharacterReply struct { // Serialize writes the packet data to the provided buffer func (p *LSCreateCharacterReply) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Response dest[offset] = byte(p.Response) offset++ - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - return offset } // Size returns the serialized size of the packet func (p *LSCreateCharacterReply) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 4 + size += 1 + size += 2 + uint32(len(p.Name)) + return size } // LSCreateCharacterReplyV1189 represents packet structure for OP_CreateCharacterReplyMsg @@ -53,31 +50,27 @@ type LSCreateCharacterReplyV1189 struct { // Serialize writes the packet data to the provided buffer func (p *LSCreateCharacterReplyV1189) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown)) offset += 4 - - // Write Response dest[offset] = byte(p.Response) offset++ - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - return offset } // Size returns the serialized size of the packet func (p *LSCreateCharacterReplyV1189) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 4 + size += 4 + size += 1 + size += 2 + uint32(len(p.Name)) + return size } // LSCreateCharacterReplyV60085 represents packet structure for OP_CreateCharacterReplyMsg @@ -91,31 +84,27 @@ type LSCreateCharacterReplyV60085 struct { // Serialize writes the packet data to the provided buffer func (p *LSCreateCharacterReplyV60085) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown)) offset += 4 - - // Write Response dest[offset] = byte(p.Response) offset++ - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - return offset } // Size returns the serialized size of the packet func (p *LSCreateCharacterReplyV60085) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 4 + size += 4 + size += 1 + size += 2 + uint32(len(p.Name)) + return size } // LSDeleteCharacterRequest represents packet structure for OP_DeleteCharacterRequestMsg @@ -129,31 +118,27 @@ type LSDeleteCharacterRequest struct { // Serialize writes the packet data to the provided buffer func (p *LSDeleteCharacterRequest) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write CharId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.CharId)) offset += 4 - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Unknown binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - return offset } // Size returns the serialized size of the packet func (p *LSDeleteCharacterRequest) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Name)) + return size } // LSDeleteCharacterResponse represents packet structure for OP_DeleteCharacterReplyMsg @@ -169,39 +154,33 @@ type LSDeleteCharacterResponse struct { // Serialize writes the packet data to the provided buffer func (p *LSDeleteCharacterResponse) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Response dest[offset] = byte(p.Response) offset++ - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write CharId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.CharId)) offset += 4 - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - - // Write MaxCharacters binary.LittleEndian.PutUint32(dest[offset:], uint32(p.MaxCharacters)) offset += 4 - return offset } // Size returns the serialized size of the packet func (p *LSDeleteCharacterResponse) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Name)) + size += 4 + return size } // LSLoginRequest represents packet structure for OP_LoginRequestMsg @@ -218,49 +197,42 @@ type LSLoginRequest struct { // Serialize writes the packet data to the provided buffer func (p *LSLoginRequest) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write SessionID as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SessionID))) offset += 2 copy(dest[offset:], []byte(p.SessionID)) offset += uint32(len(p.SessionID)) - - // Write SessionRecycleToken as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.SessionRecycleToken))) offset += 2 copy(dest[offset:], []byte(p.SessionRecycleToken)) offset += uint32(len(p.SessionRecycleToken)) - - // Write Username as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Username))) offset += 2 copy(dest[offset:], []byte(p.Username)) offset += uint32(len(p.Username)) - - // Write Password as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Password))) offset += 2 copy(dest[offset:], []byte(p.Password)) offset += uint32(len(p.Password)) - - // Write AcctNum binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AcctNum)) offset += 4 - - // Write PassCode binary.LittleEndian.PutUint32(dest[offset:], uint32(p.PassCode)) offset += 4 - - // Write Version binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Version)) offset += 2 - return offset } // Size returns the serialized size of the packet func (p *LSLoginRequest) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 2 + uint32(len(p.SessionID)) + size += 2 + uint32(len(p.SessionRecycleToken)) + size += 2 + uint32(len(p.Username)) + size += 2 + uint32(len(p.Password)) + size += 4 + size += 4 + size += 2 + return size } // LSLoginRequestV562 represents packet structure for OP_LoginRequestMsg @@ -279,61 +251,52 @@ type LSLoginRequestV562 struct { // Serialize writes the packet data to the provided buffer func (p *LSLoginRequestV562) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Accesscode as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Accesscode))) offset += 2 copy(dest[offset:], []byte(p.Accesscode)) offset += uint32(len(p.Accesscode)) - - // Write Unknown1 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown1))) offset += 2 copy(dest[offset:], []byte(p.Unknown1)) offset += uint32(len(p.Unknown1)) - - // Write Username as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Username))) offset += 2 copy(dest[offset:], []byte(p.Username)) offset += uint32(len(p.Username)) - - // Write Password as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Password))) offset += 2 copy(dest[offset:], []byte(p.Password)) offset += uint32(len(p.Password)) - - // Write Unknown2 array for i := 0; i < 8; i++ { dest[offset] = p.Unknown2[i] offset++ } - - // Write Unknown3 array for i := 0; i < 2; i++ { dest[offset] = p.Unknown3[i] offset++ } - - // Write Version binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Version)) offset += 4 - - // Write Unknown4 binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Unknown4)) offset += 2 - - // Write Unknown5 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown5)) offset += 4 - return offset } // Size returns the serialized size of the packet func (p *LSLoginRequestV562) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 2 + uint32(len(p.Accesscode)) + size += 2 + uint32(len(p.Unknown1)) + size += 2 + uint32(len(p.Username)) + size += 2 + uint32(len(p.Password)) + size += uint32(8) + size += uint32(2) + size += 4 + size += 2 + size += 4 + return size } // LSLoginRequestV1208 represents packet structure for OP_LoginRequestMsg @@ -354,73 +317,62 @@ type LSLoginRequestV1208 struct { // Serialize writes the packet data to the provided buffer func (p *LSLoginRequestV1208) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Accesscode as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Accesscode))) offset += 2 copy(dest[offset:], []byte(p.Accesscode)) offset += uint32(len(p.Accesscode)) - - // Write Unknown1 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown1))) offset += 2 copy(dest[offset:], []byte(p.Unknown1)) offset += uint32(len(p.Unknown1)) - - // Write Username as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Username))) offset += 2 copy(dest[offset:], []byte(p.Username)) offset += uint32(len(p.Username)) - - // Write Password as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Password))) offset += 2 copy(dest[offset:], []byte(p.Password)) offset += uint32(len(p.Password)) - - // Write Unknown2 array for i := 0; i < 8; i++ { dest[offset] = p.Unknown2[i] offset++ } - - // Write Unknown3 array for i := 0; i < 2; i++ { dest[offset] = p.Unknown3[i] offset++ } - - // Write Version binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Version)) offset += 2 - - // Write Unknown4 dest[offset] = byte(p.Unknown4) offset++ - - // Write Unknown5 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown5[i])) offset += 4 } - - // Write Unknown6 binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Unknown6)) offset += 2 - - // Write Unknown7 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown7))) offset += 2 copy(dest[offset:], []byte(p.Unknown7)) offset += uint32(len(p.Unknown7)) - return offset } // Size returns the serialized size of the packet func (p *LSLoginRequestV1208) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 2 + uint32(len(p.Accesscode)) + size += 2 + uint32(len(p.Unknown1)) + size += 2 + uint32(len(p.Username)) + size += 2 + uint32(len(p.Password)) + size += uint32(8) + size += uint32(2) + size += 2 + size += 1 + size += uint32(3) * 4 + size += 2 + size += 2 + uint32(len(p.Unknown7)) + return size } // LSWorldList represents packet structure for OP_WorldListMsg @@ -440,16 +392,11 @@ type LSWorldList struct { // Serialize writes the packet data to the provided buffer func (p *LSWorldList) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write NumWorlds dest[offset] = byte(p.NumWorlds) offset++ - - // Write WorldList array (dynamic size) for _, elem := range p.WorldList { binary.LittleEndian.PutUint32(dest[offset:], elem.Id) offset += 4 - // Write Name string field dest[offset] = byte(len(elem.Name)) offset++ copy(dest[offset:], []byte(elem.Name)) @@ -464,15 +411,26 @@ func (p *LSWorldList) Serialize(dest []byte) uint32 { offset++ dest[offset] = elem.Load offset++ - } - return offset } // Size returns the serialized size of the packet func (p *LSWorldList) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + for _, elem := range p.WorldList { + _ = elem + size += 4 + size += 1 + uint32(len(elem.Name)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 1 + + } + return size } // LSWorldListV373 represents packet structure for OP_WorldListMsg @@ -495,16 +453,11 @@ type LSWorldListV373 struct { // Serialize writes the packet data to the provided buffer func (p *LSWorldListV373) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write NumWorlds dest[offset] = byte(p.NumWorlds) offset++ - - // Write WorldList array (dynamic size) for _, elem := range p.WorldList { binary.LittleEndian.PutUint32(dest[offset:], elem.Id) offset += 4 - // Write Name string field dest[offset] = byte(len(elem.Name)) offset++ copy(dest[offset:], []byte(elem.Name)) @@ -525,15 +478,29 @@ func (p *LSWorldListV373) Serialize(dest []byte) uint32 { offset++ binary.LittleEndian.PutUint32(dest[offset:], elem.AllowedRaces) offset += 4 - } - return offset } // Size returns the serialized size of the packet func (p *LSWorldListV373) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + for _, elem := range p.WorldList { + _ = elem + size += 4 + size += 1 + uint32(len(elem.Name)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 2 + size += 1 + size += 1 + size += 4 + + } + return size } // LSWorldListV546 represents packet structure for OP_WorldListMsg @@ -558,21 +525,15 @@ type LSWorldListV546 struct { // Serialize writes the packet data to the provided buffer func (p *LSWorldListV546) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write NumWorlds dest[offset] = byte(p.NumWorlds) offset++ - - // Write WorldList array (dynamic size) for _, elem := range p.WorldList { binary.LittleEndian.PutUint32(dest[offset:], elem.Id) offset += 4 - // Write Name string field dest[offset] = byte(len(elem.Name)) offset++ copy(dest[offset:], []byte(elem.Name)) offset += uint32(len(elem.Name)) - // Write Name2 string field dest[offset] = byte(len(elem.Name2)) offset++ copy(dest[offset:], []byte(elem.Name2)) @@ -595,15 +556,31 @@ func (p *LSWorldListV546) Serialize(dest []byte) uint32 { offset++ binary.LittleEndian.PutUint32(dest[offset:], elem.AllowedRaces) offset += 4 - } - return offset } // Size returns the serialized size of the packet func (p *LSWorldListV546) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + for _, elem := range p.WorldList { + _ = elem + size += 4 + size += 1 + uint32(len(elem.Name)) + size += 1 + uint32(len(elem.Name2)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 2 + size += 1 + size += 1 + size += 1 + size += 4 + + } + return size } // LSWorldListV562 represents packet structure for OP_WorldListMsg @@ -629,21 +606,15 @@ type LSWorldListV562 struct { // Serialize writes the packet data to the provided buffer func (p *LSWorldListV562) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write NumWorlds dest[offset] = byte(p.NumWorlds) offset++ - - // Write WorldList array (dynamic size) for _, elem := range p.WorldList { binary.LittleEndian.PutUint32(dest[offset:], elem.Id) offset += 4 - // Write Name string field dest[offset] = byte(len(elem.Name)) offset++ copy(dest[offset:], []byte(elem.Name)) offset += uint32(len(elem.Name)) - // Write Name2 string field dest[offset] = byte(len(elem.Name2)) offset++ copy(dest[offset:], []byte(elem.Name2)) @@ -662,26 +633,40 @@ func (p *LSWorldListV562) Serialize(dest []byte) uint32 { offset++ dest[offset] = elem.NumberOnlineFlag offset++ - // Write FeatureSet array field for i := 0; i < 2; i++ { dest[offset] = byte(elem.FeatureSet[i]) offset++ } binary.LittleEndian.PutUint32(dest[offset:], elem.AllowedRaces) offset += 4 - } - - // Write Unknown2 dest[offset] = byte(p.Unknown2) offset++ - return offset } // Size returns the serialized size of the packet func (p *LSWorldListV562) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + for _, elem := range p.WorldList { + _ = elem + size += 4 + size += 1 + uint32(len(elem.Name)) + size += 1 + uint32(len(elem.Name2)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 2 + size += 1 + size += 1 + size += uint32(2) + size += 4 + + } + size += 1 + return size } // LSWorldListV60114 represents packet structure for OP_WorldListMsg @@ -707,21 +692,15 @@ type LSWorldListV60114 struct { // Serialize writes the packet data to the provided buffer func (p *LSWorldListV60114) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write NumWorlds dest[offset] = byte(p.NumWorlds) offset++ - - // Write WorldList array (dynamic size) for _, elem := range p.WorldList { binary.LittleEndian.PutUint32(dest[offset:], elem.Id) offset += 4 - // Write Name string field dest[offset] = byte(len(elem.Name)) offset++ copy(dest[offset:], []byte(elem.Name)) offset += uint32(len(elem.Name)) - // Write Name2 string field dest[offset] = byte(len(elem.Name2)) offset++ copy(dest[offset:], []byte(elem.Name2)) @@ -740,26 +719,40 @@ func (p *LSWorldListV60114) Serialize(dest []byte) uint32 { offset++ dest[offset] = elem.NumberOnlineFlag offset++ - // Write FeatureSet array field for i := 0; i < 2; i++ { dest[offset] = byte(elem.FeatureSet[i]) offset++ } binary.LittleEndian.PutUint32(dest[offset:], elem.AllowedRaces) offset += 4 - } - - // Write Unknown2 dest[offset] = byte(p.Unknown2) offset++ - return offset } // Size returns the serialized size of the packet func (p *LSWorldListV60114) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + for _, elem := range p.WorldList { + _ = elem + size += 4 + size += 1 + uint32(len(elem.Name)) + size += 1 + uint32(len(elem.Name2)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 2 + size += 1 + size += 1 + size += uint32(2) + size += 4 + + } + size += 1 + return size } // LSWorldListV65534 represents packet structure for OP_WorldListMsg @@ -785,21 +778,15 @@ type LSWorldListV65534 struct { // Serialize writes the packet data to the provided buffer func (p *LSWorldListV65534) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write NumWorlds dest[offset] = byte(p.NumWorlds) offset++ - - // Write WorldList array (dynamic size) for _, elem := range p.WorldList { binary.LittleEndian.PutUint32(dest[offset:], elem.Id) offset += 4 - // Write Name string field dest[offset] = byte(len(elem.Name)) offset++ copy(dest[offset:], []byte(elem.Name)) offset += uint32(len(elem.Name)) - // Write Name2 string field dest[offset] = byte(len(elem.Name2)) offset++ copy(dest[offset:], []byte(elem.Name2)) @@ -818,26 +805,40 @@ func (p *LSWorldListV65534) Serialize(dest []byte) uint32 { offset++ dest[offset] = elem.NumberOnlineFlag offset++ - // Write FeatureSet array field for i := 0; i < 3; i++ { dest[offset] = byte(elem.FeatureSet[i]) offset++ } binary.LittleEndian.PutUint32(dest[offset:], elem.AllowedRaces) offset += 4 - } - - // Write Unknown2 dest[offset] = byte(p.Unknown2) offset++ - return offset } // Size returns the serialized size of the packet func (p *LSWorldListV65534) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + for _, elem := range p.WorldList { + _ = elem + size += 4 + size += 1 + uint32(len(elem.Name)) + size += 1 + uint32(len(elem.Name2)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 2 + size += 1 + size += 1 + size += uint32(3) + size += 4 + + } + size += 1 + return size } // LSWorldUpdate represents packet structure for OP_WorldStatusChangeMsg @@ -852,33 +853,28 @@ type LSWorldUpdate struct { // Serialize writes the packet data to the provided buffer func (p *LSWorldUpdate) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Up dest[offset] = byte(p.Up) offset++ - - // Write Locked dest[offset] = byte(p.Locked) offset++ - - // Write Unknown1 dest[offset] = byte(p.Unknown1) offset++ - - // Write Unknown2 dest[offset] = byte(p.Unknown2) offset++ - return offset } // Size returns the serialized size of the packet func (p *LSWorldUpdate) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 4 + size += 1 + size += 1 + size += 1 + size += 1 + return size } // LSPlayRequest represents packet structure for OP_PlayCharacterRequestMsg @@ -890,23 +886,21 @@ type LSPlayRequest struct { // Serialize writes the packet data to the provided buffer func (p *LSPlayRequest) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write CharId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.CharId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - return offset } // Size returns the serialized size of the packet func (p *LSPlayRequest) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 4 + size += 2 + uint32(len(p.Name)) + return size } // LSPlayRequestV284 represents packet structure for OP_PlayCharacterRequestMsg @@ -919,27 +913,24 @@ type LSPlayRequestV284 struct { // Serialize writes the packet data to the provided buffer func (p *LSPlayRequestV284) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write CharId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.CharId)) offset += 4 - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Unknown array for i := 0; i < 3; i++ { dest[offset] = p.Unknown[i] offset++ } - return offset } // Size returns the serialized size of the packet func (p *LSPlayRequestV284) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 4 + size += 4 + size += uint32(3) + return size } // LSPlayResponse represents packet structure for OP_PlayCharacterReplyMsg @@ -954,35 +945,30 @@ type LSPlayResponse struct { // Serialize writes the packet data to the provided buffer func (p *LSPlayResponse) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Response dest[offset] = byte(p.Response) offset++ - - // Write Server as 8-bit length-prefixed string dest[offset] = byte(len(p.Server)) offset++ copy(dest[offset:], []byte(p.Server)) offset += uint32(len(p.Server)) - - // Write Port binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Port)) offset += 2 - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write AccessCode binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccessCode)) offset += 4 - return offset } // Size returns the serialized size of the packet func (p *LSPlayResponse) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 1 + uint32(len(p.Server)) + size += 2 + size += 4 + size += 4 + return size } // LSPlayResponseV1096 represents packet structure for OP_PlayCharacterReplyMsg @@ -998,39 +984,33 @@ type LSPlayResponseV1096 struct { // Serialize writes the packet data to the provided buffer func (p *LSPlayResponseV1096) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Response dest[offset] = byte(p.Response) offset++ - - // Write Unknown1 binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Unknown1)) offset += 2 - - // Write Server as 8-bit length-prefixed string dest[offset] = byte(len(p.Server)) offset++ copy(dest[offset:], []byte(p.Server)) offset += uint32(len(p.Server)) - - // Write Port binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Port)) offset += 2 - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write AccessCode binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccessCode)) offset += 4 - return offset } // Size returns the serialized size of the packet func (p *LSPlayResponseV1096) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 2 + size += 1 + uint32(len(p.Server)) + size += 2 + size += 4 + size += 4 + return size } // LSPlayResponseV60085 represents packet structure for OP_PlayCharacterReplyMsg @@ -1046,41 +1026,35 @@ type LSPlayResponseV60085 struct { // Serialize writes the packet data to the provided buffer func (p *LSPlayResponseV60085) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Response dest[offset] = byte(p.Response) offset++ - - // Write Unknown1 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Unknown1[i])) offset += 2 } - - // Write Server as 8-bit length-prefixed string dest[offset] = byte(len(p.Server)) offset++ copy(dest[offset:], []byte(p.Server)) offset += uint32(len(p.Server)) - - // Write Port binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Port)) offset += 2 - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write AccessCode binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccessCode)) offset += 4 - return offset } // Size returns the serialized size of the packet func (p *LSPlayResponseV60085) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += uint32(3) * 2 + size += 1 + uint32(len(p.Server)) + size += 2 + size += 4 + size += 4 + return size } // LSPlayResponseV60099 represents packet structure for OP_PlayCharacterReplyMsg @@ -1096,41 +1070,35 @@ type LSPlayResponseV60099 struct { // Serialize writes the packet data to the provided buffer func (p *LSPlayResponseV60099) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Response dest[offset] = byte(p.Response) offset++ - - // Write Unknown1 array for i := 0; i < 3; i++ { binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Unknown1[i])) offset += 2 } - - // Write Server as 8-bit length-prefixed string dest[offset] = byte(len(p.Server)) offset++ copy(dest[offset:], []byte(p.Server)) offset += uint32(len(p.Server)) - - // Write Port binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Port)) offset += 2 - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write AccessCode binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccessCode)) offset += 4 - return offset } // Size returns the serialized size of the packet func (p *LSPlayResponseV60099) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += uint32(3) * 2 + size += 1 + uint32(len(p.Server)) + size += 2 + size += 4 + size += 4 + return size } // CharSelectProfile represents packet structure for client version 1 @@ -1189,96 +1157,56 @@ type CharSelectProfile struct { // Serialize writes the packet data to the provided buffer func (p *CharSelectProfile) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Charid binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Charid)) offset += 4 - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - - // Write Race dest[offset] = byte(p.Race) offset++ - - // Write Class dest[offset] = byte(p.Class) offset++ - - // Write Level binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Level)) offset += 4 - - // Write Zone as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Zone))) offset += 2 copy(dest[offset:], []byte(p.Zone)) offset += uint32(len(p.Zone)) - - // Write Unknown1 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown1)) offset += 4 - - // Write Unknown2 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown2)) offset += 4 - - // Write CreatedDate binary.LittleEndian.PutUint32(dest[offset:], uint32(p.CreatedDate)) offset += 4 - - // Write LastPlayed binary.LittleEndian.PutUint32(dest[offset:], uint32(p.LastPlayed)) offset += 4 - - // Write Unknown3 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown3)) offset += 4 - - // Write Unknown4 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown4)) offset += 4 - - // Write Zonename2 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Zonename2))) offset += 2 copy(dest[offset:], []byte(p.Zonename2)) offset += uint32(len(p.Zonename2)) - - // Write Zonedesc as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Zonedesc))) offset += 2 copy(dest[offset:], []byte(p.Zonedesc)) offset += uint32(len(p.Zonedesc)) - - // Write Version dest[offset] = byte(p.Version) offset++ - - // Write RaceType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.RaceType)) offset += 2 - - // Write SkinColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.SkinColor[i]) offset++ } - - // Write EyeColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.EyeColor[i]) offset++ } - - // Write Equip array for i := 0; i < 21; i++ { binary.LittleEndian.PutUint16(dest[offset:], p.Equip[i].Type) offset += 2 @@ -1291,171 +1219,162 @@ func (p *CharSelectProfile) Serialize(dest []byte) uint32 { dest[offset+2] = p.Equip[i].Highlight.B offset += 3 } - - // Write HairType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.HairType)) offset += 2 - - // Write HairTypeColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairTypeColor[i]) offset++ } - - // Write HairTypeHighlightColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairTypeHighlightColor[i]) offset++ } - - // Write HairFaceType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.HairFaceType)) offset += 2 - - // Write HairFaceColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairFaceColor[i]) offset++ } - - // Write HairFaceHighlightColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairFaceHighlightColor[i]) offset++ } - - // Write ChestType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.ChestType)) offset += 2 - - // Write ShirtColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.ShirtColor[i]) offset++ } - - // Write UnknownChestColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.UnknownChestColor[i]) offset++ } - - // Write LegsType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.LegsType)) offset += 2 - - // Write PantsColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.PantsColor[i]) offset++ } - - // Write UnknownLegsColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.UnknownLegsColor[i]) offset++ } - - // Write Unknown9 array for i := 0; i < 3; i++ { dest[offset] = byte(p.Unknown9[i]) offset++ } - - // Write EyeType array for i := 0; i < 3; i++ { dest[offset] = byte(p.EyeType[i]) offset++ } - - // Write EarType array for i := 0; i < 3; i++ { dest[offset] = byte(p.EarType[i]) offset++ } - - // Write EyeBrowType array for i := 0; i < 3; i++ { dest[offset] = byte(p.EyeBrowType[i]) offset++ } - - // Write CheekType array for i := 0; i < 3; i++ { dest[offset] = byte(p.CheekType[i]) offset++ } - - // Write LipType array for i := 0; i < 3; i++ { dest[offset] = byte(p.LipType[i]) offset++ } - - // Write ChinType array for i := 0; i < 3; i++ { dest[offset] = byte(p.ChinType[i]) offset++ } - - // Write NoseType array for i := 0; i < 3; i++ { dest[offset] = byte(p.NoseType[i]) offset++ } - - // Write BodySize dest[offset] = byte(p.BodySize) offset++ - - // Write BumpScale dest[offset] = byte(p.BumpScale) offset++ - - // Write Mount binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Mount)) offset += 2 - - // Write MountColor1 array for i := 0; i < 3; i++ { dest[offset] = byte(p.MountColor1[i]) offset++ } - - // Write MountColor2 array for i := 0; i < 3; i++ { dest[offset] = byte(p.MountColor2[i]) offset++ } - - // Write HairColor1 array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairColor1[i]) offset++ } - - // Write HairColor2 array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairColor2[i]) offset++ } - - // Write HairColor3 array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairColor3[i]) offset++ } - - // Write Flags dest[offset] = byte(p.Flags) offset++ - return offset } // Size returns the serialized size of the packet func (p *CharSelectProfile) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 4 + size += 4 + size += 2 + uint32(len(p.Name)) + size += 1 + size += 1 + size += 4 + size += 2 + uint32(len(p.Zone)) + size += 4 + size += 4 + size += 4 + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Zonename2)) + size += 2 + uint32(len(p.Zonedesc)) + size += 1 + size += 2 + size += uint32(3) + size += uint32(3) + size += uint32(21) * 8 + size += 2 + size += uint32(3) + size += uint32(3) + size += 2 + size += uint32(3) + size += uint32(3) + size += 2 + size += uint32(3) + size += uint32(3) + size += 2 + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += 1 + size += 1 + size += 2 + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += 1 + return size } // CharSelectProfileV373 represents packet structure for client version 373 @@ -1514,96 +1433,56 @@ type CharSelectProfileV373 struct { // Serialize writes the packet data to the provided buffer func (p *CharSelectProfileV373) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Charid binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Charid)) offset += 4 - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - - // Write Race dest[offset] = byte(p.Race) offset++ - - // Write Class dest[offset] = byte(p.Class) offset++ - - // Write Level binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Level)) offset += 4 - - // Write Zone as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Zone))) offset += 2 copy(dest[offset:], []byte(p.Zone)) offset += uint32(len(p.Zone)) - - // Write Unknown1 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown1)) offset += 4 - - // Write Unknown2 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown2)) offset += 4 - - // Write CreatedDate binary.LittleEndian.PutUint32(dest[offset:], uint32(p.CreatedDate)) offset += 4 - - // Write LastPlayed binary.LittleEndian.PutUint32(dest[offset:], uint32(p.LastPlayed)) offset += 4 - - // Write Unknown3 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown3)) offset += 4 - - // Write Unknown4 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown4)) offset += 4 - - // Write Zonename2 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Zonename2))) offset += 2 copy(dest[offset:], []byte(p.Zonename2)) offset += uint32(len(p.Zonename2)) - - // Write Zonedesc as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Zonedesc))) offset += 2 copy(dest[offset:], []byte(p.Zonedesc)) offset += uint32(len(p.Zonedesc)) - - // Write Version dest[offset] = byte(p.Version) offset++ - - // Write RaceType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.RaceType)) offset += 2 - - // Write SkinColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.SkinColor[i]) offset++ } - - // Write EyeColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.EyeColor[i]) offset++ } - - // Write Equip array for i := 0; i < 21; i++ { binary.LittleEndian.PutUint16(dest[offset:], p.Equip[i].Type) offset += 2 @@ -1616,171 +1495,162 @@ func (p *CharSelectProfileV373) Serialize(dest []byte) uint32 { dest[offset+2] = p.Equip[i].Highlight.B offset += 3 } - - // Write HairType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.HairType)) offset += 2 - - // Write HairTypeColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairTypeColor[i]) offset++ } - - // Write HairTypeHighlightColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairTypeHighlightColor[i]) offset++ } - - // Write HairFaceType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.HairFaceType)) offset += 2 - - // Write HairFaceColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairFaceColor[i]) offset++ } - - // Write HairFaceHighlightColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairFaceHighlightColor[i]) offset++ } - - // Write ChestType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.ChestType)) offset += 2 - - // Write ShirtColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.ShirtColor[i]) offset++ } - - // Write UnknownChestColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.UnknownChestColor[i]) offset++ } - - // Write LegsType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.LegsType)) offset += 2 - - // Write PantsColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.PantsColor[i]) offset++ } - - // Write UnknownLegsColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.UnknownLegsColor[i]) offset++ } - - // Write Unknown9 array for i := 0; i < 3; i++ { dest[offset] = byte(p.Unknown9[i]) offset++ } - - // Write EyeType array for i := 0; i < 3; i++ { dest[offset] = byte(p.EyeType[i]) offset++ } - - // Write EarType array for i := 0; i < 3; i++ { dest[offset] = byte(p.EarType[i]) offset++ } - - // Write EyeBrowType array for i := 0; i < 3; i++ { dest[offset] = byte(p.EyeBrowType[i]) offset++ } - - // Write CheekType array for i := 0; i < 3; i++ { dest[offset] = byte(p.CheekType[i]) offset++ } - - // Write LipType array for i := 0; i < 3; i++ { dest[offset] = byte(p.LipType[i]) offset++ } - - // Write ChinType array for i := 0; i < 3; i++ { dest[offset] = byte(p.ChinType[i]) offset++ } - - // Write NoseType array for i := 0; i < 3; i++ { dest[offset] = byte(p.NoseType[i]) offset++ } - - // Write BodySize dest[offset] = byte(p.BodySize) offset++ - - // Write BumpScale dest[offset] = byte(p.BumpScale) offset++ - - // Write Mount binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Mount)) offset += 2 - - // Write MountColor1 array for i := 0; i < 3; i++ { dest[offset] = byte(p.MountColor1[i]) offset++ } - - // Write MountColor2 array for i := 0; i < 3; i++ { dest[offset] = byte(p.MountColor2[i]) offset++ } - - // Write HairColor1 array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairColor1[i]) offset++ } - - // Write HairColor2 array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairColor2[i]) offset++ } - - // Write HairColor3 array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairColor3[i]) offset++ } - - // Write Flags dest[offset] = byte(p.Flags) offset++ - return offset } // Size returns the serialized size of the packet func (p *CharSelectProfileV373) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 4 + size += 4 + size += 2 + uint32(len(p.Name)) + size += 1 + size += 1 + size += 4 + size += 2 + uint32(len(p.Zone)) + size += 4 + size += 4 + size += 4 + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Zonename2)) + size += 2 + uint32(len(p.Zonedesc)) + size += 1 + size += 2 + size += uint32(3) + size += uint32(3) + size += uint32(21) * 8 + size += 2 + size += uint32(3) + size += uint32(3) + size += 2 + size += uint32(3) + size += uint32(3) + size += 2 + size += uint32(3) + size += uint32(3) + size += 2 + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += 1 + size += 1 + size += 2 + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += 1 + return size } // CharSelectProfileV546 represents packet structure for client version 546 @@ -1862,104 +1732,60 @@ type CharSelectProfileV546 struct { // Serialize writes the packet data to the provided buffer func (p *CharSelectProfileV546) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Charid binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Charid)) offset += 4 - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - - // Write Race dest[offset] = byte(p.Race) offset++ - - // Write Class dest[offset] = byte(p.Class) offset++ - - // Write Gender dest[offset] = byte(p.Gender) offset++ - - // Write Level binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Level)) offset += 4 - - // Write Zone as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Zone))) offset += 2 copy(dest[offset:], []byte(p.Zone)) offset += uint32(len(p.Zone)) - - // Write Unknown1 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown1)) offset += 4 - - // Write Unknown2 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown2)) offset += 4 - - // Write CreatedDate binary.LittleEndian.PutUint32(dest[offset:], uint32(p.CreatedDate)) offset += 4 - - // Write LastPlayed binary.LittleEndian.PutUint32(dest[offset:], uint32(p.LastPlayed)) offset += 4 - - // Write Unknown3 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown3)) offset += 4 - - // Write Unknown4 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown4)) offset += 4 - - // Write Zonename2 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Zonename2))) offset += 2 copy(dest[offset:], []byte(p.Zonename2)) offset += uint32(len(p.Zonename2)) - - // Write Zonedesc as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Zonedesc))) offset += 2 copy(dest[offset:], []byte(p.Zonedesc)) offset += uint32(len(p.Zonedesc)) - - // Write Unknown5 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown5)) offset += 4 - - // Write Version dest[offset] = byte(p.Version) offset++ - - // Write RaceType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.RaceType)) offset += 2 - - // Write SkinColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.SkinColor[i]) offset++ } - - // Write EyeColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.EyeColor[i]) offset++ } - - // Write Equip array for i := 0; i < 23; i++ { binary.LittleEndian.PutUint16(dest[offset:], p.Equip[i].Type) offset += 2 @@ -1972,291 +1798,263 @@ func (p *CharSelectProfileV546) Serialize(dest []byte) uint32 { dest[offset+2] = p.Equip[i].Highlight.B offset += 3 } - - // Write HairType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.HairType)) offset += 2 - - // Write HairTypeColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairTypeColor[i]) offset++ } - - // Write HairTypeHighlightColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairTypeHighlightColor[i]) offset++ } - - // Write HairFaceType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.HairFaceType)) offset += 2 - - // Write HairFaceColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairFaceColor[i]) offset++ } - - // Write HairFaceHighlightColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairFaceHighlightColor[i]) offset++ } - - // Write ChestType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.ChestType)) offset += 2 - - // Write ShirtColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.ShirtColor[i]) offset++ } - - // Write UnknownChestColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.UnknownChestColor[i]) offset++ } - - // Write LegsType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.LegsType)) offset += 2 - - // Write PantsColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.PantsColor[i]) offset++ } - - // Write UnknownLegsColor array for i := 0; i < 3; i++ { dest[offset] = byte(p.UnknownLegsColor[i]) offset++ } - - // Write Unknown9 array for i := 0; i < 3; i++ { dest[offset] = byte(p.Unknown9[i]) offset++ } - - // Write EyeType array for i := 0; i < 3; i++ { dest[offset] = byte(p.EyeType[i]) offset++ } - - // Write EarType array for i := 0; i < 3; i++ { dest[offset] = byte(p.EarType[i]) offset++ } - - // Write EyeBrowType array for i := 0; i < 3; i++ { dest[offset] = byte(p.EyeBrowType[i]) offset++ } - - // Write CheekType array for i := 0; i < 3; i++ { dest[offset] = byte(p.CheekType[i]) offset++ } - - // Write LipType array for i := 0; i < 3; i++ { dest[offset] = byte(p.LipType[i]) offset++ } - - // Write ChinType array for i := 0; i < 3; i++ { dest[offset] = byte(p.ChinType[i]) offset++ } - - // Write NoseType array for i := 0; i < 3; i++ { dest[offset] = byte(p.NoseType[i]) offset++ } - - // Write BodySize dest[offset] = byte(p.BodySize) offset++ - - // Write BumpScale dest[offset] = byte(p.BumpScale) offset++ - - // Write Mount binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Mount)) offset += 2 - - // Write MountColor1 array for i := 0; i < 3; i++ { dest[offset] = byte(p.MountColor1[i]) offset++ } - - // Write MountColor2 array for i := 0; i < 3; i++ { dest[offset] = byte(p.MountColor2[i]) offset++ } - - // Write HairColor1 array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairColor1[i]) offset++ } - - // Write HairColor2 array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairColor2[i]) offset++ } - - // Write HairColor3 array for i := 0; i < 3; i++ { dest[offset] = byte(p.HairColor3[i]) offset++ } - - // Write Unknown11 array for i := 0; i < 10; i++ { dest[offset] = p.Unknown11[i] offset++ } - - // Write SogaRaceType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.SogaRaceType)) offset += 2 - - // Write SogaSkinColorx dest[offset] = p.SogaSkinColorx.R dest[offset+1] = p.SogaSkinColorx.G dest[offset+2] = p.SogaSkinColorx.B offset += 3 - - // Write SogaEyeColor dest[offset] = p.SogaEyeColor.R dest[offset+1] = p.SogaEyeColor.G dest[offset+2] = p.SogaEyeColor.B offset += 3 - - // Write Unknown12 array for i := 0; i < 3; i++ { dest[offset] = p.Unknown12[i] offset++ } - - // Write SogaEyeType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaEyeType[i]) offset++ } - - // Write SogaEarType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaEarType[i]) offset++ } - - // Write SogaEyeBrowType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaEyeBrowType[i]) offset++ } - - // Write SogaCheekType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaCheekType[i]) offset++ } - - // Write SogaLipType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaLipType[i]) offset++ } - - // Write SogaChinType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaChinType[i]) offset++ } - - // Write SogaNoseType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaNoseType[i]) offset++ } - - // Write SogaHairColor1 dest[offset] = p.SogaHairColor1.R dest[offset+1] = p.SogaHairColor1.G dest[offset+2] = p.SogaHairColor1.B offset += 3 - - // Write SogaChestType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.SogaChestType)) offset += 2 - - // Write SogaHairColor2 dest[offset] = p.SogaHairColor2.R dest[offset+1] = p.SogaHairColor2.G dest[offset+2] = p.SogaHairColor2.B offset += 3 - - // Write SogaHairColor3 dest[offset] = p.SogaHairColor3.R dest[offset+1] = p.SogaHairColor3.G dest[offset+2] = p.SogaHairColor3.B offset += 3 - - // Write SogaHairType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.SogaHairType)) offset += 2 - - // Write SogaHairTypeColor dest[offset] = p.SogaHairTypeColor.R dest[offset+1] = p.SogaHairTypeColor.G dest[offset+2] = p.SogaHairTypeColor.B offset += 3 - - // Write SogaHairTypeHighlightColor dest[offset] = p.SogaHairTypeHighlightColor.R dest[offset+1] = p.SogaHairTypeHighlightColor.G dest[offset+2] = p.SogaHairTypeHighlightColor.B offset += 3 - - // Write SogaHairFaceType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.SogaHairFaceType)) offset += 2 - - // Write SogaHairFaceColor dest[offset] = p.SogaHairFaceColor.R dest[offset+1] = p.SogaHairFaceColor.G dest[offset+2] = p.SogaHairFaceColor.B offset += 3 - - // Write SogaHairFaceHighlightColor dest[offset] = p.SogaHairFaceHighlightColor.R dest[offset+1] = p.SogaHairFaceHighlightColor.G dest[offset+2] = p.SogaHairFaceHighlightColor.B offset += 3 - return offset } // Size returns the serialized size of the packet func (p *CharSelectProfileV546) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 4 + size += 4 + size += 2 + uint32(len(p.Name)) + size += 1 + size += 1 + size += 1 + size += 4 + size += 2 + uint32(len(p.Zone)) + size += 4 + size += 4 + size += 4 + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Zonename2)) + size += 2 + uint32(len(p.Zonedesc)) + size += 4 + size += 1 + size += 2 + size += uint32(3) + size += uint32(3) + size += uint32(23) * 8 + size += 2 + size += uint32(3) + size += uint32(3) + size += 2 + size += uint32(3) + size += uint32(3) + size += 2 + size += uint32(3) + size += uint32(3) + size += 2 + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += 1 + size += 1 + size += 2 + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(10) + size += 2 + size += 3 + size += 3 + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += 3 + size += 2 + size += 3 + size += 3 + size += 2 + size += 3 + size += 3 + size += 2 + size += 3 + size += 3 + return size } // CharSelectProfileV562 represents packet structure for client version 562 @@ -2320,132 +2118,76 @@ type CharSelectProfileV562 struct { // Serialize writes the packet data to the provided buffer func (p *CharSelectProfileV562) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Version binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Version)) offset += 4 - - // Write Charid binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Charid)) offset += 4 - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - - // Write Unknown dest[offset] = byte(p.Unknown) offset++ - - // Write Race dest[offset] = byte(p.Race) offset++ - - // Write Class dest[offset] = byte(p.Class) offset++ - - // Write Gender dest[offset] = byte(p.Gender) offset++ - - // Write Level binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Level)) offset += 4 - - // Write Zone as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Zone))) offset += 2 copy(dest[offset:], []byte(p.Zone)) offset += uint32(len(p.Zone)) - - // Write Unknown1 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown1)) offset += 4 - - // Write Unknown2 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown2)) offset += 4 - - // Write CreatedDate binary.LittleEndian.PutUint32(dest[offset:], uint32(p.CreatedDate)) offset += 4 - - // Write LastPlayed binary.LittleEndian.PutUint32(dest[offset:], uint32(p.LastPlayed)) offset += 4 - - // Write Unknown3 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown3)) offset += 4 - - // Write Unknown4 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown4)) offset += 4 - - // Write Zonename2 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Zonename2))) offset += 2 copy(dest[offset:], []byte(p.Zonename2)) offset += uint32(len(p.Zonename2)) - - // Write Zonedesc as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Zonedesc))) offset += 2 copy(dest[offset:], []byte(p.Zonedesc)) offset += uint32(len(p.Zonedesc)) - - // Write Unknown5 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown5)) offset += 4 - - // Write ServerName as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.ServerName))) offset += 2 copy(dest[offset:], []byte(p.ServerName)) offset += uint32(len(p.ServerName)) - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown6 array for i := 0; i < 2; i++ { dest[offset] = p.Unknown6[i] offset++ } - - // Write Unknown7 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown7)) offset += 4 - - // Write Unknown8 dest[offset] = byte(p.Unknown8) offset++ - - // Write RaceType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.RaceType)) offset += 2 - - // Write SkinColor dest[offset] = p.SkinColor.R dest[offset+1] = p.SkinColor.G dest[offset+2] = p.SkinColor.B offset += 3 - - // Write EyeColor dest[offset] = p.EyeColor.R dest[offset+1] = p.EyeColor.G dest[offset+2] = p.EyeColor.B offset += 3 - - // Write Equip array for i := 0; i < 25; i++ { binary.LittleEndian.PutUint16(dest[offset:], p.Equip[i].Type) offset += 2 @@ -2458,159 +2200,161 @@ func (p *CharSelectProfileV562) Serialize(dest []byte) uint32 { dest[offset+2] = p.Equip[i].Highlight.B offset += 3 } - - // Write HairType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.HairType)) offset += 2 - - // Write HairTypeColor dest[offset] = p.HairTypeColor.R dest[offset+1] = p.HairTypeColor.G dest[offset+2] = p.HairTypeColor.B offset += 3 - - // Write HairTypeHighlightColor dest[offset] = p.HairTypeHighlightColor.R dest[offset+1] = p.HairTypeHighlightColor.G dest[offset+2] = p.HairTypeHighlightColor.B offset += 3 - - // Write HairFaceType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.HairFaceType)) offset += 2 - - // Write HairFaceColor dest[offset] = p.HairFaceColor.R dest[offset+1] = p.HairFaceColor.G dest[offset+2] = p.HairFaceColor.B offset += 3 - - // Write HairFaceHighlightColor dest[offset] = p.HairFaceHighlightColor.R dest[offset+1] = p.HairFaceHighlightColor.G dest[offset+2] = p.HairFaceHighlightColor.B offset += 3 - - // Write ChestType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.ChestType)) offset += 2 - - // Write ShirtColor dest[offset] = p.ShirtColor.R dest[offset+1] = p.ShirtColor.G dest[offset+2] = p.ShirtColor.B offset += 3 - - // Write UnknownChestColor dest[offset] = p.UnknownChestColor.R dest[offset+1] = p.UnknownChestColor.G dest[offset+2] = p.UnknownChestColor.B offset += 3 - - // Write LegsType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.LegsType)) offset += 2 - - // Write PantsColor dest[offset] = p.PantsColor.R dest[offset+1] = p.PantsColor.G dest[offset+2] = p.PantsColor.B offset += 3 - - // Write UnknownLegsColor dest[offset] = p.UnknownLegsColor.R dest[offset+1] = p.UnknownLegsColor.G dest[offset+2] = p.UnknownLegsColor.B offset += 3 - - // Write Unknown9 dest[offset] = p.Unknown9.R dest[offset+1] = p.Unknown9.G dest[offset+2] = p.Unknown9.B offset += 3 - - // Write EyeType array for i := 0; i < 3; i++ { dest[offset] = byte(p.EyeType[i]) offset++ } - - // Write EarType array for i := 0; i < 3; i++ { dest[offset] = byte(p.EarType[i]) offset++ } - - // Write EyeBrowType array for i := 0; i < 3; i++ { dest[offset] = byte(p.EyeBrowType[i]) offset++ } - - // Write CheekType array for i := 0; i < 3; i++ { dest[offset] = byte(p.CheekType[i]) offset++ } - - // Write LipType array for i := 0; i < 3; i++ { dest[offset] = byte(p.LipType[i]) offset++ } - - // Write ChinType array for i := 0; i < 3; i++ { dest[offset] = byte(p.ChinType[i]) offset++ } - - // Write NoseType array for i := 0; i < 3; i++ { dest[offset] = byte(p.NoseType[i]) offset++ } - - // Write BodySize dest[offset] = byte(p.BodySize) offset++ - - // Write Unknown10 array for i := 0; i < 9; i++ { dest[offset] = p.Unknown10[i] offset++ } - - // Write HairColor1 dest[offset] = p.HairColor1.R dest[offset+1] = p.HairColor1.G dest[offset+2] = p.HairColor1.B offset += 3 - - // Write HairColor2 dest[offset] = p.HairColor2.R dest[offset+1] = p.HairColor2.G dest[offset+2] = p.HairColor2.B offset += 3 - - // Write Unknown11 array for i := 0; i < 13; i++ { dest[offset] = p.Unknown11[i] offset++ } - - // Write Unknown15 array for i := 0; i < 7; i++ { dest[offset] = p.Unknown15[i] offset++ } - return offset } // Size returns the serialized size of the packet func (p *CharSelectProfileV562) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Name)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 4 + size += 2 + uint32(len(p.Zone)) + size += 4 + size += 4 + size += 4 + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Zonename2)) + size += 2 + uint32(len(p.Zonedesc)) + size += 4 + size += 2 + uint32(len(p.ServerName)) + size += 4 + size += uint32(2) + size += 4 + size += 1 + size += 2 + size += 3 + size += 3 + size += uint32(25) * 8 + size += 2 + size += 3 + size += 3 + size += 2 + size += 3 + size += 3 + size += 2 + size += 3 + size += 3 + size += 2 + size += 3 + size += 3 + size += 3 + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += 1 + size += uint32(9) + size += 3 + size += 3 + size += uint32(13) + size += uint32(7) + return size } // CharSelectProfileV887 represents packet structure for client version 887 @@ -2700,140 +2444,80 @@ type CharSelectProfileV887 struct { // Serialize writes the packet data to the provided buffer func (p *CharSelectProfileV887) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Version binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Version)) offset += 4 - - // Write Charid binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Charid)) offset += 4 - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - - // Write Unknown dest[offset] = byte(p.Unknown) offset++ - - // Write Race dest[offset] = byte(p.Race) offset++ - - // Write Class dest[offset] = byte(p.Class) offset++ - - // Write Gender dest[offset] = byte(p.Gender) offset++ - - // Write Level binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Level)) offset += 4 - - // Write Zone as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Zone))) offset += 2 copy(dest[offset:], []byte(p.Zone)) offset += uint32(len(p.Zone)) - - // Write Unknown1 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown1)) offset += 4 - - // Write Unknown2 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown2)) offset += 4 - - // Write CreatedDate binary.LittleEndian.PutUint32(dest[offset:], uint32(p.CreatedDate)) offset += 4 - - // Write LastPlayed binary.LittleEndian.PutUint32(dest[offset:], uint32(p.LastPlayed)) offset += 4 - - // Write Unknown3 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown3)) offset += 4 - - // Write Unknown4 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown4)) offset += 4 - - // Write Zonename2 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Zonename2))) offset += 2 copy(dest[offset:], []byte(p.Zonename2)) offset += uint32(len(p.Zonename2)) - - // Write Zonedesc as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Zonedesc))) offset += 2 copy(dest[offset:], []byte(p.Zonedesc)) offset += uint32(len(p.Zonedesc)) - - // Write Unknown5 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown5)) offset += 4 - - // Write ServerName as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.ServerName))) offset += 2 copy(dest[offset:], []byte(p.ServerName)) offset += uint32(len(p.ServerName)) - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown6 array for i := 0; i < 2; i++ { dest[offset] = p.Unknown6[i] offset++ } - - // Write Unknown7 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown7)) offset += 4 - - // Write TradeskillClass dest[offset] = byte(p.TradeskillClass) offset++ - - // Write TradeskillLevel binary.LittleEndian.PutUint32(dest[offset:], uint32(p.TradeskillLevel)) offset += 4 - - // Write Unknown8 dest[offset] = byte(p.Unknown8) offset++ - - // Write RaceType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.RaceType)) offset += 2 - - // Write SkinColor dest[offset] = p.SkinColor.R dest[offset+1] = p.SkinColor.G dest[offset+2] = p.SkinColor.B offset += 3 - - // Write EyeColor dest[offset] = p.EyeColor.R dest[offset+1] = p.EyeColor.G dest[offset+2] = p.EyeColor.B offset += 3 - - // Write Equip array for i := 0; i < 25; i++ { binary.LittleEndian.PutUint16(dest[offset:], p.Equip[i].Type) offset += 2 @@ -2846,293 +2530,273 @@ func (p *CharSelectProfileV887) Serialize(dest []byte) uint32 { dest[offset+2] = p.Equip[i].Highlight.B offset += 3 } - - // Write HairType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.HairType)) offset += 2 - - // Write HairTypeColor dest[offset] = p.HairTypeColor.R dest[offset+1] = p.HairTypeColor.G dest[offset+2] = p.HairTypeColor.B offset += 3 - - // Write HairTypeHighlightColor dest[offset] = p.HairTypeHighlightColor.R dest[offset+1] = p.HairTypeHighlightColor.G dest[offset+2] = p.HairTypeHighlightColor.B offset += 3 - - // Write HairFaceType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.HairFaceType)) offset += 2 - - // Write HairFaceColor dest[offset] = p.HairFaceColor.R dest[offset+1] = p.HairFaceColor.G dest[offset+2] = p.HairFaceColor.B offset += 3 - - // Write HairFaceHighlightColor dest[offset] = p.HairFaceHighlightColor.R dest[offset+1] = p.HairFaceHighlightColor.G dest[offset+2] = p.HairFaceHighlightColor.B offset += 3 - - // Write WingType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.WingType)) offset += 2 - - // Write WingColor1 dest[offset] = p.WingColor1.R dest[offset+1] = p.WingColor1.G dest[offset+2] = p.WingColor1.B offset += 3 - - // Write WingColor2 dest[offset] = p.WingColor2.R dest[offset+1] = p.WingColor2.G dest[offset+2] = p.WingColor2.B offset += 3 - - // Write ChestType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.ChestType)) offset += 2 - - // Write ShirtColor dest[offset] = p.ShirtColor.R dest[offset+1] = p.ShirtColor.G dest[offset+2] = p.ShirtColor.B offset += 3 - - // Write UnknownChestColor dest[offset] = p.UnknownChestColor.R dest[offset+1] = p.UnknownChestColor.G dest[offset+2] = p.UnknownChestColor.B offset += 3 - - // Write LegsType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.LegsType)) offset += 2 - - // Write PantsColor dest[offset] = p.PantsColor.R dest[offset+1] = p.PantsColor.G dest[offset+2] = p.PantsColor.B offset += 3 - - // Write UnknownLegsColor dest[offset] = p.UnknownLegsColor.R dest[offset+1] = p.UnknownLegsColor.G dest[offset+2] = p.UnknownLegsColor.B offset += 3 - - // Write Unknown9 dest[offset] = p.Unknown9.R dest[offset+1] = p.Unknown9.G dest[offset+2] = p.Unknown9.B offset += 3 - - // Write EyeType array for i := 0; i < 3; i++ { dest[offset] = byte(p.EyeType[i]) offset++ } - - // Write EarType array for i := 0; i < 3; i++ { dest[offset] = byte(p.EarType[i]) offset++ } - - // Write EyeBrowType array for i := 0; i < 3; i++ { dest[offset] = byte(p.EyeBrowType[i]) offset++ } - - // Write CheekType array for i := 0; i < 3; i++ { dest[offset] = byte(p.CheekType[i]) offset++ } - - // Write LipType array for i := 0; i < 3; i++ { dest[offset] = byte(p.LipType[i]) offset++ } - - // Write ChinType array for i := 0; i < 3; i++ { dest[offset] = byte(p.ChinType[i]) offset++ } - - // Write NoseType array for i := 0; i < 3; i++ { dest[offset] = byte(p.NoseType[i]) offset++ } - - // Write BodySize dest[offset] = byte(p.BodySize) offset++ - - // Write Unknown10 array for i := 0; i < 9; i++ { dest[offset] = p.Unknown10[i] offset++ } - - // Write HairColor1 dest[offset] = p.HairColor1.R dest[offset+1] = p.HairColor1.G dest[offset+2] = p.HairColor1.B offset += 3 - - // Write HairColor2 dest[offset] = p.HairColor2.R dest[offset+1] = p.HairColor2.G dest[offset+2] = p.HairColor2.B offset += 3 - - // Write Unknown11 array for i := 0; i < 13; i++ { dest[offset] = p.Unknown11[i] offset++ } - - // Write SogaRaceType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.SogaRaceType)) offset += 2 - - // Write SogaSkinColor dest[offset] = p.SogaSkinColor.R dest[offset+1] = p.SogaSkinColor.G dest[offset+2] = p.SogaSkinColor.B offset += 3 - - // Write SogaEyeColor dest[offset] = p.SogaEyeColor.R dest[offset+1] = p.SogaEyeColor.G dest[offset+2] = p.SogaEyeColor.B offset += 3 - - // Write Unknown12 array for i := 0; i < 3; i++ { dest[offset] = p.Unknown12[i] offset++ } - - // Write SogaEyeType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaEyeType[i]) offset++ } - - // Write SogaEarType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaEarType[i]) offset++ } - - // Write SogaEyeBrowType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaEyeBrowType[i]) offset++ } - - // Write SogaCheekType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaCheekType[i]) offset++ } - - // Write SogaLipType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaLipType[i]) offset++ } - - // Write SogaChinType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaChinType[i]) offset++ } - - // Write SogaNoseType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaNoseType[i]) offset++ } - - // Write Unknown13 binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Unknown13)) offset += 2 - - // Write SogaHairColor1 dest[offset] = p.SogaHairColor1.R dest[offset+1] = p.SogaHairColor1.G dest[offset+2] = p.SogaHairColor1.B offset += 3 - - // Write SogaHairColor2 dest[offset] = p.SogaHairColor2.R dest[offset+1] = p.SogaHairColor2.G dest[offset+2] = p.SogaHairColor2.B offset += 3 - - // Write Unknown14 dest[offset] = p.Unknown14.R dest[offset+1] = p.Unknown14.G dest[offset+2] = p.Unknown14.B offset += 3 - - // Write SogaHairType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.SogaHairType)) offset += 2 - - // Write SogaHairTypeColor dest[offset] = p.SogaHairTypeColor.R dest[offset+1] = p.SogaHairTypeColor.G dest[offset+2] = p.SogaHairTypeColor.B offset += 3 - - // Write SogaHairTypeHighlightColor dest[offset] = p.SogaHairTypeHighlightColor.R dest[offset+1] = p.SogaHairTypeHighlightColor.G dest[offset+2] = p.SogaHairTypeHighlightColor.B offset += 3 - - // Write SogaHairFaceType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.SogaHairFaceType)) offset += 2 - - // Write SogaHairFaceColor dest[offset] = p.SogaHairFaceColor.R dest[offset+1] = p.SogaHairFaceColor.G dest[offset+2] = p.SogaHairFaceColor.B offset += 3 - - // Write SogaHairFaceHighlightColor dest[offset] = p.SogaHairFaceHighlightColor.R dest[offset+1] = p.SogaHairFaceHighlightColor.G dest[offset+2] = p.SogaHairFaceHighlightColor.B offset += 3 - - // Write Unknown15 array for i := 0; i < 7; i++ { dest[offset] = p.Unknown15[i] offset++ } - return offset } // Size returns the serialized size of the packet func (p *CharSelectProfileV887) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Name)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 4 + size += 2 + uint32(len(p.Zone)) + size += 4 + size += 4 + size += 4 + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Zonename2)) + size += 2 + uint32(len(p.Zonedesc)) + size += 4 + size += 2 + uint32(len(p.ServerName)) + size += 4 + size += uint32(2) + size += 4 + size += 1 + size += 4 + size += 1 + size += 2 + size += 3 + size += 3 + size += uint32(25) * 8 + size += 2 + size += 3 + size += 3 + size += 2 + size += 3 + size += 3 + size += 2 + size += 3 + size += 3 + size += 2 + size += 3 + size += 3 + size += 2 + size += 3 + size += 3 + size += 3 + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += 1 + size += uint32(9) + size += 3 + size += 3 + size += uint32(13) + size += 2 + size += 3 + size += 3 + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += 2 + size += 3 + size += 3 + size += 3 + size += 2 + size += 3 + size += 3 + size += 2 + size += 3 + size += 3 + size += uint32(7) + return size } // CharSelectProfileV60085 represents packet structure for client version 60085 @@ -3222,140 +2886,80 @@ type CharSelectProfileV60085 struct { // Serialize writes the packet data to the provided buffer func (p *CharSelectProfileV60085) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write Version binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Version)) offset += 4 - - // Write Charid binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Charid)) offset += 4 - - // Write ServerId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ServerId)) offset += 4 - - // Write Name as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Name))) offset += 2 copy(dest[offset:], []byte(p.Name)) offset += uint32(len(p.Name)) - - // Write Unknown dest[offset] = byte(p.Unknown) offset++ - - // Write Race dest[offset] = byte(p.Race) offset++ - - // Write Class dest[offset] = byte(p.Class) offset++ - - // Write Gender dest[offset] = byte(p.Gender) offset++ - - // Write Level binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Level)) offset += 4 - - // Write Zone as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Zone))) offset += 2 copy(dest[offset:], []byte(p.Zone)) offset += uint32(len(p.Zone)) - - // Write Unknown1 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown1)) offset += 4 - - // Write Unknown2 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown2)) offset += 4 - - // Write CreatedDate binary.LittleEndian.PutUint32(dest[offset:], uint32(p.CreatedDate)) offset += 4 - - // Write LastPlayed binary.LittleEndian.PutUint32(dest[offset:], uint32(p.LastPlayed)) offset += 4 - - // Write Unknown3 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown3)) offset += 4 - - // Write Unknown4 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown4)) offset += 4 - - // Write Zonename2 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Zonename2))) offset += 2 copy(dest[offset:], []byte(p.Zonename2)) offset += uint32(len(p.Zonename2)) - - // Write Zonedesc as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Zonedesc))) offset += 2 copy(dest[offset:], []byte(p.Zonedesc)) offset += uint32(len(p.Zonedesc)) - - // Write Unknown5 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown5)) offset += 4 - - // Write ServerName as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.ServerName))) offset += 2 copy(dest[offset:], []byte(p.ServerName)) offset += uint32(len(p.ServerName)) - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown6 array for i := 0; i < 2; i++ { dest[offset] = p.Unknown6[i] offset++ } - - // Write Unknown7 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown7)) offset += 4 - - // Write TradeskillClass dest[offset] = byte(p.TradeskillClass) offset++ - - // Write TradeskillLevel binary.LittleEndian.PutUint32(dest[offset:], uint32(p.TradeskillLevel)) offset += 4 - - // Write Unknown8 dest[offset] = byte(p.Unknown8) offset++ - - // Write RaceType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.RaceType)) offset += 2 - - // Write SkinColor dest[offset] = p.SkinColor.R dest[offset+1] = p.SkinColor.G dest[offset+2] = p.SkinColor.B offset += 3 - - // Write EyeColor dest[offset] = p.EyeColor.R dest[offset+1] = p.EyeColor.G dest[offset+2] = p.EyeColor.B offset += 3 - - // Write Equip array for i := 0; i < 25; i++ { binary.LittleEndian.PutUint16(dest[offset:], p.Equip[i].Type) offset += 2 @@ -3368,293 +2972,273 @@ func (p *CharSelectProfileV60085) Serialize(dest []byte) uint32 { dest[offset+2] = p.Equip[i].Highlight.B offset += 3 } - - // Write HairType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.HairType)) offset += 2 - - // Write HairTypeColor dest[offset] = p.HairTypeColor.R dest[offset+1] = p.HairTypeColor.G dest[offset+2] = p.HairTypeColor.B offset += 3 - - // Write HairTypeHighlightColor dest[offset] = p.HairTypeHighlightColor.R dest[offset+1] = p.HairTypeHighlightColor.G dest[offset+2] = p.HairTypeHighlightColor.B offset += 3 - - // Write HairFaceType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.HairFaceType)) offset += 2 - - // Write HairFaceColor dest[offset] = p.HairFaceColor.R dest[offset+1] = p.HairFaceColor.G dest[offset+2] = p.HairFaceColor.B offset += 3 - - // Write HairFaceHighlightColor dest[offset] = p.HairFaceHighlightColor.R dest[offset+1] = p.HairFaceHighlightColor.G dest[offset+2] = p.HairFaceHighlightColor.B offset += 3 - - // Write WingType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.WingType)) offset += 2 - - // Write WingColor1 dest[offset] = p.WingColor1.R dest[offset+1] = p.WingColor1.G dest[offset+2] = p.WingColor1.B offset += 3 - - // Write WingColor2 dest[offset] = p.WingColor2.R dest[offset+1] = p.WingColor2.G dest[offset+2] = p.WingColor2.B offset += 3 - - // Write ChestType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.ChestType)) offset += 2 - - // Write ShirtColor dest[offset] = p.ShirtColor.R dest[offset+1] = p.ShirtColor.G dest[offset+2] = p.ShirtColor.B offset += 3 - - // Write UnknownChestColor dest[offset] = p.UnknownChestColor.R dest[offset+1] = p.UnknownChestColor.G dest[offset+2] = p.UnknownChestColor.B offset += 3 - - // Write LegsType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.LegsType)) offset += 2 - - // Write PantsColor dest[offset] = p.PantsColor.R dest[offset+1] = p.PantsColor.G dest[offset+2] = p.PantsColor.B offset += 3 - - // Write UnknownLegsColor dest[offset] = p.UnknownLegsColor.R dest[offset+1] = p.UnknownLegsColor.G dest[offset+2] = p.UnknownLegsColor.B offset += 3 - - // Write Unknown9 dest[offset] = p.Unknown9.R dest[offset+1] = p.Unknown9.G dest[offset+2] = p.Unknown9.B offset += 3 - - // Write EyeType array for i := 0; i < 3; i++ { dest[offset] = byte(p.EyeType[i]) offset++ } - - // Write EarType array for i := 0; i < 3; i++ { dest[offset] = byte(p.EarType[i]) offset++ } - - // Write EyeBrowType array for i := 0; i < 3; i++ { dest[offset] = byte(p.EyeBrowType[i]) offset++ } - - // Write CheekType array for i := 0; i < 3; i++ { dest[offset] = byte(p.CheekType[i]) offset++ } - - // Write LipType array for i := 0; i < 3; i++ { dest[offset] = byte(p.LipType[i]) offset++ } - - // Write ChinType array for i := 0; i < 3; i++ { dest[offset] = byte(p.ChinType[i]) offset++ } - - // Write NoseType array for i := 0; i < 3; i++ { dest[offset] = byte(p.NoseType[i]) offset++ } - - // Write BodySize dest[offset] = byte(p.BodySize) offset++ - - // Write Unknown10 array for i := 0; i < 9; i++ { dest[offset] = p.Unknown10[i] offset++ } - - // Write HairColor1 dest[offset] = p.HairColor1.R dest[offset+1] = p.HairColor1.G dest[offset+2] = p.HairColor1.B offset += 3 - - // Write HairColor2 dest[offset] = p.HairColor2.R dest[offset+1] = p.HairColor2.G dest[offset+2] = p.HairColor2.B offset += 3 - - // Write Unknown11 array for i := 0; i < 13; i++ { dest[offset] = p.Unknown11[i] offset++ } - - // Write SogaRaceType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.SogaRaceType)) offset += 2 - - // Write SogaSkinColor dest[offset] = p.SogaSkinColor.R dest[offset+1] = p.SogaSkinColor.G dest[offset+2] = p.SogaSkinColor.B offset += 3 - - // Write SogaEyeColor dest[offset] = p.SogaEyeColor.R dest[offset+1] = p.SogaEyeColor.G dest[offset+2] = p.SogaEyeColor.B offset += 3 - - // Write Unknown12 array for i := 0; i < 3; i++ { dest[offset] = p.Unknown12[i] offset++ } - - // Write SogaEyeType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaEyeType[i]) offset++ } - - // Write SogaEarType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaEarType[i]) offset++ } - - // Write SogaEyeBrowType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaEyeBrowType[i]) offset++ } - - // Write SogaCheekType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaCheekType[i]) offset++ } - - // Write SogaLipType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaLipType[i]) offset++ } - - // Write SogaChinType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaChinType[i]) offset++ } - - // Write SogaNoseType array for i := 0; i < 3; i++ { dest[offset] = byte(p.SogaNoseType[i]) offset++ } - - // Write Unknown13 binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Unknown13)) offset += 2 - - // Write SogaHairColor1 dest[offset] = p.SogaHairColor1.R dest[offset+1] = p.SogaHairColor1.G dest[offset+2] = p.SogaHairColor1.B offset += 3 - - // Write SogaHairColor2 dest[offset] = p.SogaHairColor2.R dest[offset+1] = p.SogaHairColor2.G dest[offset+2] = p.SogaHairColor2.B offset += 3 - - // Write Unknown14 dest[offset] = p.Unknown14.R dest[offset+1] = p.Unknown14.G dest[offset+2] = p.Unknown14.B offset += 3 - - // Write SogaHairType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.SogaHairType)) offset += 2 - - // Write SogaHairTypeColor dest[offset] = p.SogaHairTypeColor.R dest[offset+1] = p.SogaHairTypeColor.G dest[offset+2] = p.SogaHairTypeColor.B offset += 3 - - // Write SogaHairTypeHighlightColor dest[offset] = p.SogaHairTypeHighlightColor.R dest[offset+1] = p.SogaHairTypeHighlightColor.G dest[offset+2] = p.SogaHairTypeHighlightColor.B offset += 3 - - // Write SogaHairFaceType binary.LittleEndian.PutUint16(dest[offset:], uint16(p.SogaHairFaceType)) offset += 2 - - // Write SogaHairFaceColor dest[offset] = p.SogaHairFaceColor.R dest[offset+1] = p.SogaHairFaceColor.G dest[offset+2] = p.SogaHairFaceColor.B offset += 3 - - // Write SogaHairFaceHighlightColor dest[offset] = p.SogaHairFaceHighlightColor.R dest[offset+1] = p.SogaHairFaceHighlightColor.G dest[offset+2] = p.SogaHairFaceHighlightColor.B offset += 3 - - // Write Unknown15 array for i := 0; i < 7; i++ { dest[offset] = p.Unknown15[i] offset++ } - return offset } // Size returns the serialized size of the packet func (p *CharSelectProfileV60085) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Name)) + size += 1 + size += 1 + size += 1 + size += 1 + size += 4 + size += 2 + uint32(len(p.Zone)) + size += 4 + size += 4 + size += 4 + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Zonename2)) + size += 2 + uint32(len(p.Zonedesc)) + size += 4 + size += 2 + uint32(len(p.ServerName)) + size += 4 + size += uint32(2) + size += 4 + size += 1 + size += 4 + size += 1 + size += 2 + size += 3 + size += 3 + size += uint32(25) * 8 + size += 2 + size += 3 + size += 3 + size += 2 + size += 3 + size += 3 + size += 2 + size += 3 + size += 3 + size += 2 + size += 3 + size += 3 + size += 2 + size += 3 + size += 3 + size += 3 + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += 1 + size += uint32(9) + size += 3 + size += 3 + size += uint32(13) + size += 2 + size += 3 + size += 3 + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += uint32(3) + size += 2 + size += 3 + size += 3 + size += 3 + size += 2 + size += 3 + size += 3 + size += 2 + size += 3 + size += 3 + size += uint32(7) + return size } // LSLoginReplyMsg represents packet structure for OP_LoginReplyMsg @@ -3670,41 +3254,35 @@ type LSLoginReplyMsg struct { // Serialize writes the packet data to the provided buffer func (p *LSLoginReplyMsg) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write LoginResponse dest[offset] = byte(p.LoginResponse) offset++ - - // Write WorldName as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.WorldName))) offset += 2 copy(dest[offset:], []byte(p.WorldName)) offset += uint32(len(p.WorldName)) - - // Write ParentalControlFlag dest[offset] = byte(p.ParentalControlFlag) offset++ - - // Write ParentalControlTimer array for i := 0; i < 2; i++ { binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ParentalControlTimer[i])) offset += 4 } - - // Write ParentalControlNext binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ParentalControlNext)) offset += 4 - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - return offset } // Size returns the serialized size of the packet func (p *LSLoginReplyMsg) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 2 + uint32(len(p.WorldName)) + size += 1 + size += uint32(2) * 4 + size += 4 + size += 4 + return size } // LSLoginReplyMsgV284 represents packet structure for OP_LoginReplyMsg @@ -3745,82 +3323,52 @@ type LSLoginReplyMsgV284 struct { // Serialize writes the packet data to the provided buffer func (p *LSLoginReplyMsgV284) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write LoginResponse dest[offset] = byte(p.LoginResponse) offset++ - - // Write Unknown as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown))) offset += 2 copy(dest[offset:], []byte(p.Unknown)) offset += uint32(len(p.Unknown)) - - // Write ParentalControlFlag dest[offset] = byte(p.ParentalControlFlag) offset++ - - // Write ParentalControlTimer binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ParentalControlTimer)) offset += 4 - - // Write Unknown2 array for i := 0; i < 8; i++ { dest[offset] = p.Unknown2[i] offset++ } - - // Write CacheSettingAccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.CacheSettingAccountId)) offset += 4 - - // Write Unknown3 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown3))) offset += 2 copy(dest[offset:], []byte(p.Unknown3)) offset += uint32(len(p.Unknown3)) - - // Write ResetAppearance dest[offset] = byte(p.ResetAppearance) offset++ - - // Write DoNotForceSoga dest[offset] = byte(p.DoNotForceSoga) offset++ - - // Write Unknown5 binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Unknown5)) offset += 2 - - // Write Unknown6 dest[offset] = byte(p.Unknown6) offset++ - - // Write Unknown7 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown7)) offset += 4 - - // Write Unknown8 array for i := 0; i < 2; i++ { dest[offset] = p.Unknown8[i] offset++ } - - // Write Unknown10 dest[offset] = byte(p.Unknown10) offset++ - - // Write NumClassItems + if p.Unknown10 != 0 { dest[offset] = byte(p.NumClassItems) offset++ - - // Write ClassItems array (dynamic size) + } + if p.Unknown10 != 0 { for _, elem := range p.ClassItems { dest[offset] = elem.ClassId offset++ dest[offset] = elem.NumItems offset++ - // Write nested StartingItems array for _, nestedElem := range elem.StartingItems { binary.LittleEndian.PutUint16(dest[offset:], nestedElem.ModelId) offset += 2 @@ -3838,28 +3386,63 @@ func (p *LSLoginReplyMsgV284) Serialize(dest []byte) uint32 { dest[offset+1] = nestedElem.ModelHighlightColor.G dest[offset+2] = nestedElem.ModelHighlightColor.B offset += 3 - } - } - - // Write UnknownArray2Size + } dest[offset] = byte(p.UnknownArray2Size) offset++ - - // Write UnknownArray2 array (dynamic size) for _, elem := range p.UnknownArray2 { binary.LittleEndian.PutUint32(dest[offset:], elem.Array2Unknown) offset += 4 - } - return offset } // Size returns the serialized size of the packet func (p *LSLoginReplyMsgV284) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 2 + uint32(len(p.Unknown)) + size += 1 + size += 4 + size += uint32(8) + size += 4 + size += 2 + uint32(len(p.Unknown3)) + size += 1 + size += 1 + size += 2 + size += 1 + size += 4 + size += uint32(2) + size += 1 + if p.Unknown10 != 0 { + size += 1 + } + if p.Unknown10 != 0 { + for _, elem := range p.ClassItems { + _ = elem + size += 1 + size += 1 + for _, nestedElem := range elem.StartingItems { + _ = nestedElem + size += 2 + size += 1 + size += 1 + size += 1 + size += 3 + size += 3 + + } + + } + } + size += 1 + for _, elem := range p.UnknownArray2 { + _ = elem + size += 4 + + } + return size } // LSLoginReplyMsgV843 represents packet structure for OP_LoginReplyMsg @@ -3903,94 +3486,58 @@ type LSLoginReplyMsgV843 struct { // Serialize writes the packet data to the provided buffer func (p *LSLoginReplyMsgV843) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write LoginResponse dest[offset] = byte(p.LoginResponse) offset++ - - // Write Unknown as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown))) offset += 2 copy(dest[offset:], []byte(p.Unknown)) offset += uint32(len(p.Unknown)) - - // Write ParentalControlFlag dest[offset] = byte(p.ParentalControlFlag) offset++ - - // Write ParentalControlTimer binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ParentalControlTimer)) offset += 4 - - // Write Unknown2 array for i := 0; i < 8; i++ { dest[offset] = p.Unknown2[i] offset++ } - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown3 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown3))) offset += 2 copy(dest[offset:], []byte(p.Unknown3)) offset += uint32(len(p.Unknown3)) - - // Write ResetAppearance dest[offset] = byte(p.ResetAppearance) offset++ - - // Write DoNotForceSoga dest[offset] = byte(p.DoNotForceSoga) offset++ - - // Write Unknown4 dest[offset] = byte(p.Unknown4) offset++ - - // Write Unknown5 binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Unknown5)) offset += 2 - - // Write Unknown6 dest[offset] = byte(p.Unknown6) offset++ - - // Write Unknown7 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown7)) offset += 4 - - // Write RaceUnknown dest[offset] = byte(p.RaceUnknown) offset++ - - // Write Unknown8 array for i := 0; i < 3; i++ { dest[offset] = p.Unknown8[i] offset++ } - - // Write Unknown9 dest[offset] = byte(p.Unknown9) offset++ - - // Write Unknown10 dest[offset] = byte(p.Unknown10) offset++ - - // Write NumClassItems + if p.Unknown10 != 0 { dest[offset] = byte(p.NumClassItems) offset++ - - // Write ClassItems array (dynamic size) + } + if p.Unknown10 != 0 { for _, elem := range p.ClassItems { dest[offset] = elem.ClassId offset++ dest[offset] = elem.NumItems offset++ - // Write nested StartingItems array for _, nestedElem := range elem.StartingItems { binary.LittleEndian.PutUint16(dest[offset:], nestedElem.ModelId) offset += 2 @@ -4008,28 +3555,66 @@ func (p *LSLoginReplyMsgV843) Serialize(dest []byte) uint32 { dest[offset+1] = nestedElem.ModelHighlightColor.G dest[offset+2] = nestedElem.ModelHighlightColor.B offset += 3 - } - } - - // Write UnknownArray2Size + } dest[offset] = byte(p.UnknownArray2Size) offset++ - - // Write UnknownArray2 array (dynamic size) for _, elem := range p.UnknownArray2 { binary.LittleEndian.PutUint32(dest[offset:], elem.Array2Unknown) offset += 4 - } - return offset } // Size returns the serialized size of the packet func (p *LSLoginReplyMsgV843) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 2 + uint32(len(p.Unknown)) + size += 1 + size += 4 + size += uint32(8) + size += 4 + size += 2 + uint32(len(p.Unknown3)) + size += 1 + size += 1 + size += 1 + size += 2 + size += 1 + size += 4 + size += 1 + size += uint32(3) + size += 1 + size += 1 + if p.Unknown10 != 0 { + size += 1 + } + if p.Unknown10 != 0 { + for _, elem := range p.ClassItems { + _ = elem + size += 1 + size += 1 + for _, nestedElem := range elem.StartingItems { + _ = nestedElem + size += 2 + size += 1 + size += 1 + size += 1 + size += 3 + size += 3 + + } + + } + } + size += 1 + for _, elem := range p.UnknownArray2 { + _ = elem + size += 4 + + } + return size } // LSLoginReplyMsgV1096 represents packet structure for OP_LoginReplyMsg @@ -4079,96 +3664,60 @@ type LSLoginReplyMsgV1096 struct { // Serialize writes the packet data to the provided buffer func (p *LSLoginReplyMsgV1096) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write LoginResponse dest[offset] = byte(p.LoginResponse) offset++ - - // Write Unknown as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown))) offset += 2 copy(dest[offset:], []byte(p.Unknown)) offset += uint32(len(p.Unknown)) - - // Write ParentalControlFlag dest[offset] = byte(p.ParentalControlFlag) offset++ - - // Write ParentalControlTimer binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ParentalControlTimer)) offset += 4 - - // Write Unknown2 array for i := 0; i < 8; i++ { dest[offset] = p.Unknown2[i] offset++ } - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown3 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown3))) offset += 2 copy(dest[offset:], []byte(p.Unknown3)) offset += uint32(len(p.Unknown3)) - - // Write ResetAppearance dest[offset] = byte(p.ResetAppearance) offset++ - - // Write DoNotForceSoga dest[offset] = byte(p.DoNotForceSoga) offset++ - - // Write Unknown4 dest[offset] = byte(p.Unknown4) offset++ - - // Write Unknown5 binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Unknown5)) offset += 2 - - // Write Unknown6 array for i := 0; i < 5; i++ { dest[offset] = p.Unknown6[i] offset++ } - - // Write Unknown7 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown7)) offset += 4 - - // Write RaceUnknown dest[offset] = byte(p.RaceUnknown) offset++ - - // Write Unknown8 array for i := 0; i < 3; i++ { dest[offset] = p.Unknown8[i] offset++ } - - // Write Unknown9 dest[offset] = byte(p.Unknown9) offset++ - - // Write Unknown10 dest[offset] = byte(p.Unknown10) offset++ - - // Write NumClassItems + if p.Unknown10 != 0 { dest[offset] = byte(p.NumClassItems) offset++ - - // Write ClassItems array (dynamic size) + } + if p.Unknown10 != 0 { for _, elem := range p.ClassItems { dest[offset] = elem.ClassId offset++ dest[offset] = elem.NumItems offset++ - // Write nested StartingItems array for _, nestedElem := range elem.StartingItems { binary.LittleEndian.PutUint16(dest[offset:], nestedElem.ModelId) offset += 2 @@ -4186,56 +3735,88 @@ func (p *LSLoginReplyMsgV1096) Serialize(dest []byte) uint32 { dest[offset+1] = nestedElem.ModelHighlightColor.G dest[offset+2] = nestedElem.ModelHighlightColor.B offset += 3 - } - } - - // Write UnknownArray2Size + } dest[offset] = byte(p.UnknownArray2Size) offset++ - - // Write UnknownArray2 array (dynamic size) for _, elem := range p.UnknownArray2 { binary.LittleEndian.PutUint32(dest[offset:], elem.Array2Unknown) offset += 4 - } - - // Write Unknown11 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown11)) offset += 4 - - // Write SubLevel binary.LittleEndian.PutUint32(dest[offset:], uint32(p.SubLevel)) offset += 4 - - // Write RaceFlag binary.LittleEndian.PutUint32(dest[offset:], uint32(p.RaceFlag)) offset += 4 - - // Write ClassFlag binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ClassFlag)) offset += 4 - - // Write Password as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Password))) offset += 2 copy(dest[offset:], []byte(p.Password)) offset += uint32(len(p.Password)) - - // Write Username as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Username))) offset += 2 copy(dest[offset:], []byte(p.Username)) offset += uint32(len(p.Username)) - return offset } // Size returns the serialized size of the packet func (p *LSLoginReplyMsgV1096) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 2 + uint32(len(p.Unknown)) + size += 1 + size += 4 + size += uint32(8) + size += 4 + size += 2 + uint32(len(p.Unknown3)) + size += 1 + size += 1 + size += 1 + size += 2 + size += uint32(5) + size += 4 + size += 1 + size += uint32(3) + size += 1 + size += 1 + if p.Unknown10 != 0 { + size += 1 + } + if p.Unknown10 != 0 { + for _, elem := range p.ClassItems { + _ = elem + size += 1 + size += 1 + for _, nestedElem := range elem.StartingItems { + _ = nestedElem + size += 2 + size += 1 + size += 1 + size += 1 + size += 3 + size += 3 + + } + + } + } + size += 1 + for _, elem := range p.UnknownArray2 { + _ = elem + size += 4 + + } + size += 4 + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Password)) + size += 2 + uint32(len(p.Username)) + return size } // LSLoginReplyMsgV1142 represents packet structure for OP_LoginReplyMsg @@ -4286,100 +3867,62 @@ type LSLoginReplyMsgV1142 struct { // Serialize writes the packet data to the provided buffer func (p *LSLoginReplyMsgV1142) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write LoginResponse dest[offset] = byte(p.LoginResponse) offset++ - - // Write Unknown as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown))) offset += 2 copy(dest[offset:], []byte(p.Unknown)) offset += uint32(len(p.Unknown)) - - // Write ParentalControlFlag dest[offset] = byte(p.ParentalControlFlag) offset++ - - // Write ParentalControlTimer binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ParentalControlTimer)) offset += 4 - - // Write Unknown2 array for i := 0; i < 8; i++ { dest[offset] = p.Unknown2[i] offset++ } - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown3 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown3))) offset += 2 copy(dest[offset:], []byte(p.Unknown3)) offset += uint32(len(p.Unknown3)) - - // Write ResetAppearance dest[offset] = byte(p.ResetAppearance) offset++ - - // Write DoNotForceSoga dest[offset] = byte(p.DoNotForceSoga) offset++ - - // Write Unknown4 dest[offset] = byte(p.Unknown4) offset++ - - // Write Unknown5 binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Unknown5)) offset += 2 - - // Write Unknown6 array for i := 0; i < 5; i++ { dest[offset] = p.Unknown6[i] offset++ } - - // Write Unknown7 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown7)) offset += 4 - - // Write Unknown7a binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown7a)) offset += 4 - - // Write RaceUnknown dest[offset] = byte(p.RaceUnknown) offset++ - - // Write Unknown8 array for i := 0; i < 3; i++ { dest[offset] = p.Unknown8[i] offset++ } - - // Write Unknown9 dest[offset] = byte(p.Unknown9) offset++ - - // Write Unknown10 dest[offset] = byte(p.Unknown10) offset++ - - // Write NumClassItems + if p.Unknown10 != 0 { dest[offset] = byte(p.NumClassItems) offset++ - - // Write ClassItems array (dynamic size) + } + if p.Unknown10 != 0 { for _, elem := range p.ClassItems { dest[offset] = elem.ClassId offset++ dest[offset] = elem.NumItems offset++ - // Write nested StartingItems array for _, nestedElem := range elem.StartingItems { binary.LittleEndian.PutUint16(dest[offset:], nestedElem.ModelId) offset += 2 @@ -4397,56 +3940,89 @@ func (p *LSLoginReplyMsgV1142) Serialize(dest []byte) uint32 { dest[offset+1] = nestedElem.ModelHighlightColor.G dest[offset+2] = nestedElem.ModelHighlightColor.B offset += 3 - } - } - - // Write UnknownArray2Size + } dest[offset] = byte(p.UnknownArray2Size) offset++ - - // Write UnknownArray2 array (dynamic size) for _, elem := range p.UnknownArray2 { binary.LittleEndian.PutUint32(dest[offset:], elem.Array2Unknown) offset += 4 - } - - // Write Unknown11 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown11)) offset += 4 - - // Write SubLevel binary.LittleEndian.PutUint32(dest[offset:], uint32(p.SubLevel)) offset += 4 - - // Write RaceFlag binary.LittleEndian.PutUint32(dest[offset:], uint32(p.RaceFlag)) offset += 4 - - // Write ClassFlag binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ClassFlag)) offset += 4 - - // Write Password as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Password))) offset += 2 copy(dest[offset:], []byte(p.Password)) offset += uint32(len(p.Password)) - - // Write Username as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Username))) offset += 2 copy(dest[offset:], []byte(p.Username)) offset += uint32(len(p.Username)) - return offset } // Size returns the serialized size of the packet func (p *LSLoginReplyMsgV1142) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 2 + uint32(len(p.Unknown)) + size += 1 + size += 4 + size += uint32(8) + size += 4 + size += 2 + uint32(len(p.Unknown3)) + size += 1 + size += 1 + size += 1 + size += 2 + size += uint32(5) + size += 4 + size += 4 + size += 1 + size += uint32(3) + size += 1 + size += 1 + if p.Unknown10 != 0 { + size += 1 + } + if p.Unknown10 != 0 { + for _, elem := range p.ClassItems { + _ = elem + size += 1 + size += 1 + for _, nestedElem := range elem.StartingItems { + _ = nestedElem + size += 2 + size += 1 + size += 1 + size += 1 + size += 3 + size += 3 + + } + + } + } + size += 1 + for _, elem := range p.UnknownArray2 { + _ = elem + size += 4 + + } + size += 4 + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Password)) + size += 2 + uint32(len(p.Username)) + return size } // LSLoginReplyMsgV1188 represents packet structure for OP_LoginReplyMsg @@ -4498,100 +4074,62 @@ type LSLoginReplyMsgV1188 struct { // Serialize writes the packet data to the provided buffer func (p *LSLoginReplyMsgV1188) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write LoginResponse dest[offset] = byte(p.LoginResponse) offset++ - - // Write Unknown as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown))) offset += 2 copy(dest[offset:], []byte(p.Unknown)) offset += uint32(len(p.Unknown)) - - // Write ParentalControlFlag dest[offset] = byte(p.ParentalControlFlag) offset++ - - // Write ParentalControlTimer binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ParentalControlTimer)) offset += 4 - - // Write Unknown2 array for i := 0; i < 8; i++ { dest[offset] = p.Unknown2[i] offset++ } - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown3 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown3))) offset += 2 copy(dest[offset:], []byte(p.Unknown3)) offset += uint32(len(p.Unknown3)) - - // Write ResetAppearance dest[offset] = byte(p.ResetAppearance) offset++ - - // Write DoNotForceSoga dest[offset] = byte(p.DoNotForceSoga) offset++ - - // Write Unknown4 dest[offset] = byte(p.Unknown4) offset++ - - // Write Unknown5 binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Unknown5)) offset += 2 - - // Write Unknown6 array for i := 0; i < 5; i++ { dest[offset] = p.Unknown6[i] offset++ } - - // Write Unknown7 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown7)) offset += 4 - - // Write Unknown7a binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown7a)) offset += 4 - - // Write RaceUnknown dest[offset] = byte(p.RaceUnknown) offset++ - - // Write Unknown8 array for i := 0; i < 3; i++ { dest[offset] = p.Unknown8[i] offset++ } - - // Write Unknown9 dest[offset] = byte(p.Unknown9) offset++ - - // Write Unknown10 dest[offset] = byte(p.Unknown10) offset++ - - // Write NumClassItems + if p.Unknown10 != 0 { dest[offset] = byte(p.NumClassItems) offset++ - - // Write ClassItems array (dynamic size) + } + if p.Unknown10 != 0 { for _, elem := range p.ClassItems { dest[offset] = elem.ClassId offset++ dest[offset] = elem.NumItems offset++ - // Write nested StartingItems array for _, nestedElem := range elem.StartingItems { binary.LittleEndian.PutUint16(dest[offset:], nestedElem.ModelId) offset += 2 @@ -4609,62 +4147,94 @@ func (p *LSLoginReplyMsgV1188) Serialize(dest []byte) uint32 { dest[offset+1] = nestedElem.ModelHighlightColor.G dest[offset+2] = nestedElem.ModelHighlightColor.B offset += 3 - } - } - - // Write UnknownArray2Size + } dest[offset] = byte(p.UnknownArray2Size) offset++ - - // Write UnknownArray2 array (dynamic size) for _, elem := range p.UnknownArray2 { binary.LittleEndian.PutUint32(dest[offset:], elem.Array2Unknown) offset += 4 - } - - // Write Unknown11 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown11)) offset += 4 - - // Write SubLevel binary.LittleEndian.PutUint32(dest[offset:], uint32(p.SubLevel)) offset += 4 - - // Write RaceFlag binary.LittleEndian.PutUint32(dest[offset:], uint32(p.RaceFlag)) offset += 4 - - // Write ClassFlag binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ClassFlag)) offset += 4 - - // Write Password as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Password))) offset += 2 copy(dest[offset:], []byte(p.Password)) offset += uint32(len(p.Password)) - - // Write Username as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Username))) offset += 2 copy(dest[offset:], []byte(p.Username)) offset += uint32(len(p.Username)) - - // Write Unknown12 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown12))) offset += 2 copy(dest[offset:], []byte(p.Unknown12)) offset += uint32(len(p.Unknown12)) - return offset } // Size returns the serialized size of the packet func (p *LSLoginReplyMsgV1188) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 2 + uint32(len(p.Unknown)) + size += 1 + size += 4 + size += uint32(8) + size += 4 + size += 2 + uint32(len(p.Unknown3)) + size += 1 + size += 1 + size += 1 + size += 2 + size += uint32(5) + size += 4 + size += 4 + size += 1 + size += uint32(3) + size += 1 + size += 1 + if p.Unknown10 != 0 { + size += 1 + } + if p.Unknown10 != 0 { + for _, elem := range p.ClassItems { + _ = elem + size += 1 + size += 1 + for _, nestedElem := range elem.StartingItems { + _ = nestedElem + size += 2 + size += 1 + size += 1 + size += 1 + size += 3 + size += 3 + + } + + } + } + size += 1 + for _, elem := range p.UnknownArray2 { + _ = elem + size += 4 + + } + size += 4 + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Password)) + size += 2 + uint32(len(p.Username)) + size += 2 + uint32(len(p.Unknown12)) + return size } // LSLoginReplyMsgV57080 represents packet structure for OP_LoginReplyMsg @@ -4740,100 +4310,62 @@ type LSLoginReplyMsgV57080 struct { // Serialize writes the packet data to the provided buffer func (p *LSLoginReplyMsgV57080) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write LoginResponse dest[offset] = byte(p.LoginResponse) offset++ - - // Write Unknown as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown))) offset += 2 copy(dest[offset:], []byte(p.Unknown)) offset += uint32(len(p.Unknown)) - - // Write ParentalControlFlag dest[offset] = byte(p.ParentalControlFlag) offset++ - - // Write ParentalControlTimer binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ParentalControlTimer)) offset += 4 - - // Write Unknown2 array for i := 0; i < 8; i++ { dest[offset] = p.Unknown2[i] offset++ } - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown3 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown3))) offset += 2 copy(dest[offset:], []byte(p.Unknown3)) offset += uint32(len(p.Unknown3)) - - // Write ResetAppearance dest[offset] = byte(p.ResetAppearance) offset++ - - // Write DoNotForceSoga dest[offset] = byte(p.DoNotForceSoga) offset++ - - // Write Unknown4 dest[offset] = byte(p.Unknown4) offset++ - - // Write Unknown5 binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Unknown5)) offset += 2 - - // Write Unknown6 array for i := 0; i < 5; i++ { dest[offset] = p.Unknown6[i] offset++ } - - // Write Unknown7 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown7)) offset += 4 - - // Write Unknown7a binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown7a)) offset += 4 - - // Write RaceUnknown dest[offset] = byte(p.RaceUnknown) offset++ - - // Write Unknown8 array for i := 0; i < 3; i++ { dest[offset] = p.Unknown8[i] offset++ } - - // Write Unknown9 dest[offset] = byte(p.Unknown9) offset++ - - // Write Unknown10 dest[offset] = byte(p.Unknown10) offset++ - - // Write NumClassItems + if p.Unknown10 != 0 { dest[offset] = byte(p.NumClassItems) offset++ - - // Write ClassItems array (dynamic size) + } + if p.Unknown10 != 0 { for _, elem := range p.ClassItems { dest[offset] = elem.ClassId offset++ dest[offset] = elem.NumItems offset++ - // Write nested StartingItems array for _, nestedElem := range elem.StartingItems { binary.LittleEndian.PutUint32(dest[offset:], nestedElem.ModelId) offset += 4 @@ -4851,125 +4383,83 @@ func (p *LSLoginReplyMsgV57080) Serialize(dest []byte) uint32 { dest[offset+1] = nestedElem.ModelHighlightColor.G dest[offset+2] = nestedElem.ModelHighlightColor.B offset += 3 - } - } - - // Write UnknownArray2Size + } dest[offset] = byte(p.UnknownArray2Size) offset++ - - // Write UnknownArray2 array (dynamic size) for _, elem := range p.UnknownArray2 { binary.LittleEndian.PutUint32(dest[offset:], elem.Array2Unknown) offset += 4 - } - - // Write Unknown11 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown11)) offset += 4 - - // Write SubLevel binary.LittleEndian.PutUint32(dest[offset:], uint32(p.SubLevel)) offset += 4 - - // Write RaceFlag binary.LittleEndian.PutUint32(dest[offset:], uint32(p.RaceFlag)) offset += 4 - - // Write ClassFlag binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ClassFlag)) offset += 4 - - // Write Password as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Password))) offset += 2 copy(dest[offset:], []byte(p.Password)) offset += uint32(len(p.Password)) - - // Write Username as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Username))) offset += 2 copy(dest[offset:], []byte(p.Username)) offset += uint32(len(p.Username)) - - // Write Service as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Service))) offset += 2 copy(dest[offset:], []byte(p.Service)) offset += uint32(len(p.Service)) - - // Write Web1 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Web1))) offset += 2 copy(dest[offset:], []byte(p.Web1)) offset += uint32(len(p.Web1)) - - // Write Web2 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Web2))) offset += 2 copy(dest[offset:], []byte(p.Web2)) offset += uint32(len(p.Web2)) - - // Write Web3 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Web3))) offset += 2 copy(dest[offset:], []byte(p.Web3)) offset += uint32(len(p.Web3)) - - // Write Web4 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Web4))) offset += 2 copy(dest[offset:], []byte(p.Web4)) offset += uint32(len(p.Web4)) - - // Write Web5 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Web5))) offset += 2 copy(dest[offset:], []byte(p.Web5)) offset += uint32(len(p.Web5)) - - // Write Web6 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Web6))) offset += 2 copy(dest[offset:], []byte(p.Web6)) offset += uint32(len(p.Web6)) - - // Write Web7 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Web7))) offset += 2 copy(dest[offset:], []byte(p.Web7)) offset += uint32(len(p.Web7)) - - // Write Web8 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Web8))) offset += 2 copy(dest[offset:], []byte(p.Web8)) offset += uint32(len(p.Web8)) - - // Write Web9 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Web9))) offset += 2 copy(dest[offset:], []byte(p.Web9)) offset += uint32(len(p.Web9)) - - // Write Unknown12 dest[offset] = byte(p.Unknown12) offset++ - - // Write Lvl90NumClassItems + if p.Unknown10 != 0 { dest[offset] = byte(p.Lvl90NumClassItems) offset++ - - // Write Lvl90ClassItems array (dynamic size) + } + if p.Unknown10 != 0 { for _, elem := range p.Lvl90ClassItems { dest[offset] = elem.ClassId offset++ dest[offset] = elem.NumItems offset++ - // Write nested StartingItems array for _, nestedElem := range elem.StartingItems { binary.LittleEndian.PutUint32(dest[offset:], nestedElem.ModelId) offset += 4 @@ -4987,23 +4477,104 @@ func (p *LSLoginReplyMsgV57080) Serialize(dest []byte) uint32 { dest[offset+1] = nestedElem.ModelHighlightColor.G dest[offset+2] = nestedElem.ModelHighlightColor.B offset += 3 - } - } - - // Write Unknown13 array + } for i := 0; i < 5; i++ { dest[offset] = p.Unknown13[i] offset++ } - return offset } // Size returns the serialized size of the packet func (p *LSLoginReplyMsgV57080) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 2 + uint32(len(p.Unknown)) + size += 1 + size += 4 + size += uint32(8) + size += 4 + size += 2 + uint32(len(p.Unknown3)) + size += 1 + size += 1 + size += 1 + size += 2 + size += uint32(5) + size += 4 + size += 4 + size += 1 + size += uint32(3) + size += 1 + size += 1 + if p.Unknown10 != 0 { + size += 1 + } + if p.Unknown10 != 0 { + for _, elem := range p.ClassItems { + _ = elem + size += 1 + size += 1 + for _, nestedElem := range elem.StartingItems { + _ = nestedElem + size += 4 + size += 1 + size += 1 + size += 1 + size += 3 + size += 3 + + } + + } + } + size += 1 + for _, elem := range p.UnknownArray2 { + _ = elem + size += 4 + + } + size += 4 + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Password)) + size += 2 + uint32(len(p.Username)) + size += 2 + uint32(len(p.Service)) + size += 2 + uint32(len(p.Web1)) + size += 2 + uint32(len(p.Web2)) + size += 2 + uint32(len(p.Web3)) + size += 2 + uint32(len(p.Web4)) + size += 2 + uint32(len(p.Web5)) + size += 2 + uint32(len(p.Web6)) + size += 2 + uint32(len(p.Web7)) + size += 2 + uint32(len(p.Web8)) + size += 2 + uint32(len(p.Web9)) + size += 1 + if p.Unknown10 != 0 { + size += 1 + } + if p.Unknown10 != 0 { + for _, elem := range p.Lvl90ClassItems { + _ = elem + size += 1 + size += 1 + for _, nestedElem := range elem.StartingItems { + _ = nestedElem + size += 4 + size += 1 + size += 1 + size += 1 + size += 3 + size += 3 + + } + + } + } + size += uint32(5) + return size } // LSLoginReplyMsgV60100 represents packet structure for OP_LoginReplyMsg @@ -5082,92 +4653,58 @@ type LSLoginReplyMsgV60100 struct { // Serialize writes the packet data to the provided buffer func (p *LSLoginReplyMsgV60100) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write LoginResponse dest[offset] = byte(p.LoginResponse) offset++ - - // Write Unknown as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown))) offset += 2 copy(dest[offset:], []byte(p.Unknown)) offset += uint32(len(p.Unknown)) - - // Write ParentalControlFlag dest[offset] = byte(p.ParentalControlFlag) offset++ - - // Write ParentalControlTimer binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ParentalControlTimer)) offset += 4 - - // Write Unknown2 array for i := 0; i < 8; i++ { dest[offset] = p.Unknown2[i] offset++ } - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown3 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown3))) offset += 2 copy(dest[offset:], []byte(p.Unknown3)) offset += uint32(len(p.Unknown3)) - - // Write ResetAppearance dest[offset] = byte(p.ResetAppearance) offset++ - - // Write DoNotForceSoga dest[offset] = byte(p.DoNotForceSoga) offset++ - - // Write Unknown5 binary.LittleEndian.PutUint64(dest[offset:], uint64(p.Unknown5)) offset += 8 - - // Write Unknown7 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown7)) offset += 4 - - // Write Unknown7a binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Unknown7a)) offset += 2 - - // Write RaceUnknown dest[offset] = byte(p.RaceUnknown) offset++ - - // Write Unknown8 array for i := 0; i < 3; i++ { dest[offset] = p.Unknown8[i] offset++ } - - // Write Unknown9 array for i := 0; i < 3; i++ { dest[offset] = p.Unknown9[i] offset++ } - - // Write Unknown10 dest[offset] = byte(p.Unknown10) offset++ - - // Write NumClassItems + if p.Unknown10 != 0 { dest[offset] = byte(p.NumClassItems) offset++ - - // Write ClassItems array (dynamic size) + } + if p.Unknown10 != 0 { for _, elem := range p.ClassItems { dest[offset] = elem.ClassId offset++ dest[offset] = elem.NumItems offset++ - // Write nested StartingItems array for _, nestedElem := range elem.StartingItems { binary.LittleEndian.PutUint32(dest[offset:], nestedElem.ModelId) offset += 4 @@ -5185,71 +4722,47 @@ func (p *LSLoginReplyMsgV60100) Serialize(dest []byte) uint32 { dest[offset+1] = nestedElem.ModelHighlightColor.G dest[offset+2] = nestedElem.ModelHighlightColor.B offset += 3 - } - } - - // Write UnknownArray2Size + } dest[offset] = byte(p.UnknownArray2Size) offset++ - - // Write UnknownArray2 array (dynamic size) for _, elem := range p.UnknownArray2 { binary.LittleEndian.PutUint32(dest[offset:], elem.Array2Unknown) offset += 4 - } - - // Write Unknown11 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown11)) offset += 4 - - // Write SubLevel binary.LittleEndian.PutUint32(dest[offset:], uint32(p.SubLevel)) offset += 4 - - // Write RaceFlag binary.LittleEndian.PutUint32(dest[offset:], uint32(p.RaceFlag)) offset += 4 - - // Write ClassFlag binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ClassFlag)) offset += 4 - - // Write Password as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Password))) offset += 2 copy(dest[offset:], []byte(p.Password)) offset += uint32(len(p.Password)) - - // Write Username as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Username))) offset += 2 copy(dest[offset:], []byte(p.Username)) offset += uint32(len(p.Username)) - - // Write Service as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Service))) offset += 2 copy(dest[offset:], []byte(p.Service)) offset += uint32(len(p.Service)) - - // Write Unknown12 dest[offset] = byte(p.Unknown12) offset++ - - // Write Lvl90NumClassItems + if p.Unknown12 != 0 { dest[offset] = byte(p.Lvl90NumClassItems) offset++ - - // Write Lvl90ClassItems array (dynamic size) + } + if p.Unknown12 != 0 { for _, elem := range p.Lvl90ClassItems { dest[offset] = elem.ClassId offset++ dest[offset] = elem.NumItems offset++ - // Write nested StartingItems array for _, nestedElem := range elem.StartingItems { binary.LittleEndian.PutUint32(dest[offset:], nestedElem.ModelId) offset += 4 @@ -5267,26 +4780,21 @@ func (p *LSLoginReplyMsgV60100) Serialize(dest []byte) uint32 { dest[offset+1] = nestedElem.ModelHighlightColor.G dest[offset+2] = nestedElem.ModelHighlightColor.B offset += 3 - } - } - - // Write Unknown13 + } dest[offset] = byte(p.Unknown13) offset++ - - // Write TimeLockedNumClassItems + if p.Unknown13 != 0 { dest[offset] = byte(p.TimeLockedNumClassItems) offset++ - - // Write TimeLockedClassItems array (dynamic size) + } + if p.Unknown13 != 0 { for _, elem := range p.TimeLockedClassItems { dest[offset] = elem.ClassId offset++ dest[offset] = elem.NumItems offset++ - // Write nested StartingItems array for _, nestedElem := range elem.StartingItems { binary.LittleEndian.PutUint32(dest[offset:], nestedElem.ModelId) offset += 4 @@ -5304,23 +4812,115 @@ func (p *LSLoginReplyMsgV60100) Serialize(dest []byte) uint32 { dest[offset+1] = nestedElem.ModelHighlightColor.G dest[offset+2] = nestedElem.ModelHighlightColor.B offset += 3 - } - } - - // Write Unknown14 array + } for i := 0; i < 13; i++ { dest[offset] = p.Unknown14[i] offset++ } - return offset } // Size returns the serialized size of the packet func (p *LSLoginReplyMsgV60100) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 2 + uint32(len(p.Unknown)) + size += 1 + size += 4 + size += uint32(8) + size += 4 + size += 2 + uint32(len(p.Unknown3)) + size += 1 + size += 1 + size += 8 + size += 4 + size += 2 + size += 1 + size += uint32(3) + size += uint32(3) + size += 1 + if p.Unknown10 != 0 { + size += 1 + } + if p.Unknown10 != 0 { + for _, elem := range p.ClassItems { + _ = elem + size += 1 + size += 1 + for _, nestedElem := range elem.StartingItems { + _ = nestedElem + size += 4 + size += 1 + size += 1 + size += 1 + size += 3 + size += 3 + + } + + } + } + size += 1 + for _, elem := range p.UnknownArray2 { + _ = elem + size += 4 + + } + size += 4 + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Password)) + size += 2 + uint32(len(p.Username)) + size += 2 + uint32(len(p.Service)) + size += 1 + if p.Unknown12 != 0 { + size += 1 + } + if p.Unknown12 != 0 { + for _, elem := range p.Lvl90ClassItems { + _ = elem + size += 1 + size += 1 + for _, nestedElem := range elem.StartingItems { + _ = nestedElem + size += 4 + size += 1 + size += 1 + size += 1 + size += 3 + size += 3 + + } + + } + } + size += 1 + if p.Unknown13 != 0 { + size += 1 + } + if p.Unknown13 != 0 { + for _, elem := range p.TimeLockedClassItems { + _ = elem + size += 1 + size += 1 + for _, nestedElem := range elem.StartingItems { + _ = nestedElem + size += 4 + size += 1 + size += 1 + size += 1 + size += 3 + size += 3 + + } + + } + } + size += uint32(13) + return size } // LSLoginReplyMsgV63181 represents packet structure for OP_LoginReplyMsg @@ -5402,108 +5002,68 @@ type LSLoginReplyMsgV63181 struct { // Serialize writes the packet data to the provided buffer func (p *LSLoginReplyMsgV63181) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write LoginResponse dest[offset] = byte(p.LoginResponse) offset++ - - // Write Unknown as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown))) offset += 2 copy(dest[offset:], []byte(p.Unknown)) offset += uint32(len(p.Unknown)) - - // Write ParentalControlFlag dest[offset] = byte(p.ParentalControlFlag) offset++ - - // Write ParentalControlTimer binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ParentalControlTimer)) offset += 4 - - // Write Unknown2 array for i := 0; i < 8; i++ { dest[offset] = p.Unknown2[i] offset++ } - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown3 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown3))) offset += 2 copy(dest[offset:], []byte(p.Unknown3)) offset += uint32(len(p.Unknown3)) - - // Write ResetAppearance dest[offset] = byte(p.ResetAppearance) offset++ - - // Write DoNotForceSoga dest[offset] = byte(p.DoNotForceSoga) offset++ - - // Write Unknown4 dest[offset] = byte(p.Unknown4) offset++ - - // Write Unknown5 binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Unknown5)) offset += 2 - - // Write Unknown6 array for i := 0; i < 5; i++ { dest[offset] = p.Unknown6[i] offset++ } - - // Write Unknown6a array for i := 0; i < 8; i++ { dest[offset] = p.Unknown6a[i] offset++ } - - // Write Unknown7 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown7)) offset += 4 - - // Write Unknown7a binary.LittleEndian.PutUint16(dest[offset:], uint16(p.Unknown7a)) offset += 2 - - // Write RaceUnknown dest[offset] = byte(p.RaceUnknown) offset++ - - // Write Unknown8 array for i := 0; i < 3; i++ { dest[offset] = p.Unknown8[i] offset++ } - - // Write Unknown9 array for i := 0; i < 3; i++ { dest[offset] = p.Unknown9[i] offset++ } - - // Write Unknown10 dest[offset] = byte(p.Unknown10) offset++ - - // Write NumClassItems + if p.Unknown10 != 0 { dest[offset] = byte(p.NumClassItems) offset++ - - // Write ClassItems array (dynamic size) + } + if p.Unknown10 != 0 { for _, elem := range p.ClassItems { dest[offset] = elem.ClassId offset++ dest[offset] = elem.NumItems offset++ - // Write nested StartingItems array for _, nestedElem := range elem.StartingItems { binary.LittleEndian.PutUint32(dest[offset:], nestedElem.ModelId) offset += 4 @@ -5521,71 +5081,47 @@ func (p *LSLoginReplyMsgV63181) Serialize(dest []byte) uint32 { dest[offset+1] = nestedElem.ModelHighlightColor.G dest[offset+2] = nestedElem.ModelHighlightColor.B offset += 3 - } - } - - // Write UnknownArray2Size + } dest[offset] = byte(p.UnknownArray2Size) offset++ - - // Write UnknownArray2 array (dynamic size) for _, elem := range p.UnknownArray2 { binary.LittleEndian.PutUint32(dest[offset:], elem.Array2Unknown) offset += 4 - } - - // Write Unknown11 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown11)) offset += 4 - - // Write SubLevel binary.LittleEndian.PutUint32(dest[offset:], uint32(p.SubLevel)) offset += 4 - - // Write RaceFlag binary.LittleEndian.PutUint32(dest[offset:], uint32(p.RaceFlag)) offset += 4 - - // Write ClassFlag binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ClassFlag)) offset += 4 - - // Write Password as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Password))) offset += 2 copy(dest[offset:], []byte(p.Password)) offset += uint32(len(p.Password)) - - // Write Username as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Username))) offset += 2 copy(dest[offset:], []byte(p.Username)) offset += uint32(len(p.Username)) - - // Write Service as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Service))) offset += 2 copy(dest[offset:], []byte(p.Service)) offset += uint32(len(p.Service)) - - // Write Unknown12 dest[offset] = byte(p.Unknown12) offset++ - - // Write Lvl90NumClassItems + if p.Unknown12 != 0 { dest[offset] = byte(p.Lvl90NumClassItems) offset++ - - // Write Lvl90ClassItems array (dynamic size) + } + if p.Unknown12 != 0 { for _, elem := range p.Lvl90ClassItems { dest[offset] = elem.ClassId offset++ dest[offset] = elem.NumItems offset++ - // Write nested StartingItems array for _, nestedElem := range elem.StartingItems { binary.LittleEndian.PutUint32(dest[offset:], nestedElem.ModelId) offset += 4 @@ -5603,26 +5139,21 @@ func (p *LSLoginReplyMsgV63181) Serialize(dest []byte) uint32 { dest[offset+1] = nestedElem.ModelHighlightColor.G dest[offset+2] = nestedElem.ModelHighlightColor.B offset += 3 - } - } - - // Write Unknown13 + } dest[offset] = byte(p.Unknown13) offset++ - - // Write TimeLockedNumClassItems + if p.Unknown13 != 0 { dest[offset] = byte(p.TimeLockedNumClassItems) offset++ - - // Write TimeLockedClassItems array (dynamic size) + } + if p.Unknown13 != 0 { for _, elem := range p.TimeLockedClassItems { dest[offset] = elem.ClassId offset++ dest[offset] = elem.NumItems offset++ - // Write nested StartingItems array for _, nestedElem := range elem.StartingItems { binary.LittleEndian.PutUint32(dest[offset:], nestedElem.ModelId) offset += 4 @@ -5640,23 +5171,118 @@ func (p *LSLoginReplyMsgV63181) Serialize(dest []byte) uint32 { dest[offset+1] = nestedElem.ModelHighlightColor.G dest[offset+2] = nestedElem.ModelHighlightColor.B offset += 3 - } - } - - // Write Unknown14 array + } for i := 0; i < 9; i++ { dest[offset] = p.Unknown14[i] offset++ } - return offset } // Size returns the serialized size of the packet func (p *LSLoginReplyMsgV63181) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 2 + uint32(len(p.Unknown)) + size += 1 + size += 4 + size += uint32(8) + size += 4 + size += 2 + uint32(len(p.Unknown3)) + size += 1 + size += 1 + size += 1 + size += 2 + size += uint32(5) + size += uint32(8) + size += 4 + size += 2 + size += 1 + size += uint32(3) + size += uint32(3) + size += 1 + if p.Unknown10 != 0 { + size += 1 + } + if p.Unknown10 != 0 { + for _, elem := range p.ClassItems { + _ = elem + size += 1 + size += 1 + for _, nestedElem := range elem.StartingItems { + _ = nestedElem + size += 4 + size += 1 + size += 1 + size += 1 + size += 3 + size += 3 + + } + + } + } + size += 1 + for _, elem := range p.UnknownArray2 { + _ = elem + size += 4 + + } + size += 4 + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Password)) + size += 2 + uint32(len(p.Username)) + size += 2 + uint32(len(p.Service)) + size += 1 + if p.Unknown12 != 0 { + size += 1 + } + if p.Unknown12 != 0 { + for _, elem := range p.Lvl90ClassItems { + _ = elem + size += 1 + size += 1 + for _, nestedElem := range elem.StartingItems { + _ = nestedElem + size += 4 + size += 1 + size += 1 + size += 1 + size += 3 + size += 3 + + } + + } + } + size += 1 + if p.Unknown13 != 0 { + size += 1 + } + if p.Unknown13 != 0 { + for _, elem := range p.TimeLockedClassItems { + _ = elem + size += 1 + size += 1 + for _, nestedElem := range elem.StartingItems { + _ = nestedElem + size += 4 + size += 1 + size += 1 + size += 1 + size += 3 + size += 3 + + } + + } + } + size += uint32(9) + return size } // LSLoginReplyMsgV65534 represents packet structure for OP_LoginReplyMsg @@ -5733,82 +5359,52 @@ type LSLoginReplyMsgV65534 struct { // Serialize writes the packet data to the provided buffer func (p *LSLoginReplyMsgV65534) Serialize(dest []byte) uint32 { offset := uint32(0) - - // Write LoginResponse dest[offset] = byte(p.LoginResponse) offset++ - - // Write WorldName as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.WorldName))) offset += 2 copy(dest[offset:], []byte(p.WorldName)) offset += uint32(len(p.WorldName)) - - // Write ParentalControlFlag dest[offset] = byte(p.ParentalControlFlag) offset++ - - // Write ParentalControlTimer binary.LittleEndian.PutUint64(dest[offset:], uint64(p.ParentalControlTimer)) offset += 8 - - // Write Unknown2 binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown2)) offset += 4 - - // Write AccountId binary.LittleEndian.PutUint32(dest[offset:], uint32(p.AccountId)) offset += 4 - - // Write Unknown3 as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Unknown3))) offset += 2 copy(dest[offset:], []byte(p.Unknown3)) offset += uint32(len(p.Unknown3)) - - // Write ResetAppearance dest[offset] = byte(p.ResetAppearance) offset++ - - // Write DoNotForceSoga dest[offset] = byte(p.DoNotForceSoga) offset++ - - // Write Unknown4 as 32-bit length-prefixed string binary.LittleEndian.PutUint32(dest[offset:], uint32(len(p.Unknown4))) offset += 4 copy(dest[offset:], []byte(p.Unknown4)) offset += uint32(len(p.Unknown4)) - - // Write Unknown7 as 32-bit length-prefixed string binary.LittleEndian.PutUint32(dest[offset:], uint32(len(p.Unknown7))) offset += 4 copy(dest[offset:], []byte(p.Unknown7)) offset += uint32(len(p.Unknown7)) - - // Write RaceUnknown binary.LittleEndian.PutUint32(dest[offset:], uint32(p.RaceUnknown)) offset += 4 - - // Write Unknown8 dest[offset] = byte(p.Unknown8) offset++ - - // Write Unknown10 dest[offset] = byte(p.Unknown10) offset++ - - // Write NumClassItems + if p.Unknown10 != 0 { dest[offset] = byte(p.NumClassItems) offset++ - - // Write ClassItems array (dynamic size) + } + if p.Unknown10 != 0 { for _, elem := range p.ClassItems { dest[offset] = elem.ClassId offset++ dest[offset] = elem.NumItems offset++ - // Write nested StartingItems array for _, nestedElem := range elem.StartingItems { binary.LittleEndian.PutUint32(dest[offset:], nestedElem.ModelId) offset += 4 @@ -5826,71 +5422,49 @@ func (p *LSLoginReplyMsgV65534) Serialize(dest []byte) uint32 { dest[offset+1] = nestedElem.ModelHighlightColor.G dest[offset+2] = nestedElem.ModelHighlightColor.B offset += 3 - } - } - - // Write UnknownArray2Size + } dest[offset] = byte(p.UnknownArray2Size) offset++ - - // Write UnknownArray2 array (dynamic size) + if p.UnknownArray2Size != 0 { for _, elem := range p.UnknownArray2 { binary.LittleEndian.PutUint32(dest[offset:], elem.Array2Unknown) offset += 4 - } - - // Write Unknown11 + } binary.LittleEndian.PutUint32(dest[offset:], uint32(p.Unknown11)) offset += 4 - - // Write SubLevel binary.LittleEndian.PutUint32(dest[offset:], uint32(p.SubLevel)) offset += 4 - - // Write RaceFlag binary.LittleEndian.PutUint32(dest[offset:], uint32(p.RaceFlag)) offset += 4 - - // Write ClassFlag binary.LittleEndian.PutUint32(dest[offset:], uint32(p.ClassFlag)) offset += 4 - - // Write Password as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Password))) offset += 2 copy(dest[offset:], []byte(p.Password)) offset += uint32(len(p.Password)) - - // Write Username as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Username))) offset += 2 copy(dest[offset:], []byte(p.Username)) offset += uint32(len(p.Username)) - - // Write Service as 16-bit length-prefixed string binary.LittleEndian.PutUint16(dest[offset:], uint16(len(p.Service))) offset += 2 copy(dest[offset:], []byte(p.Service)) offset += uint32(len(p.Service)) - - // Write Unknown12 dest[offset] = byte(p.Unknown12) offset++ - - // Write Lvl90NumClassItems + if p.Unknown12 != 0 { dest[offset] = byte(p.Lvl90NumClassItems) offset++ - - // Write Lvl90ClassItems array (dynamic size) + } + if p.Unknown12 != 0 { for _, elem := range p.Lvl90ClassItems { dest[offset] = elem.ClassId offset++ dest[offset] = elem.NumItems offset++ - // Write nested StartingItems array for _, nestedElem := range elem.StartingItems { binary.LittleEndian.PutUint32(dest[offset:], nestedElem.ModelId) offset += 4 @@ -5908,26 +5482,21 @@ func (p *LSLoginReplyMsgV65534) Serialize(dest []byte) uint32 { dest[offset+1] = nestedElem.ModelHighlightColor.G dest[offset+2] = nestedElem.ModelHighlightColor.B offset += 3 - } - } - - // Write Unknown13 + } dest[offset] = byte(p.Unknown13) offset++ - - // Write TimeLockedNumClassItems + if p.Unknown13 != 0 { dest[offset] = byte(p.TimeLockedNumClassItems) offset++ - - // Write TimeLockedClassItems array (dynamic size) + } + if p.Unknown13 != 0 { for _, elem := range p.TimeLockedClassItems { dest[offset] = elem.ClassId offset++ dest[offset] = elem.NumItems offset++ - // Write nested StartingItems array for _, nestedElem := range elem.StartingItems { binary.LittleEndian.PutUint32(dest[offset:], nestedElem.ModelId) offset += 4 @@ -5945,26 +5514,122 @@ func (p *LSLoginReplyMsgV65534) Serialize(dest []byte) uint32 { dest[offset+1] = nestedElem.ModelHighlightColor.G dest[offset+2] = nestedElem.ModelHighlightColor.B offset += 3 - } - } - - // Write Unknown14 array + } for i := 0; i < 13; i++ { dest[offset] = p.Unknown14[i] offset++ } - return offset } // Size returns the serialized size of the packet func (p *LSLoginReplyMsgV65534) Size() uint32 { - return types.CalculateSize(p) + size := uint32(0) + size += 1 + size += 2 + uint32(len(p.WorldName)) + size += 1 + size += 8 + size += 4 + size += 4 + size += 2 + uint32(len(p.Unknown3)) + size += 1 + size += 1 + size += 4 + uint32(len(p.Unknown4)) + size += 4 + uint32(len(p.Unknown7)) + size += 4 + size += 1 + size += 1 + if p.Unknown10 != 0 { + size += 1 + } + if p.Unknown10 != 0 { + for _, elem := range p.ClassItems { + _ = elem + size += 1 + size += 1 + for _, nestedElem := range elem.StartingItems { + _ = nestedElem + size += 4 + size += 1 + size += 1 + size += 1 + size += 3 + size += 3 + + } + + } + } + size += 1 + if p.UnknownArray2Size != 0 { + for _, elem := range p.UnknownArray2 { + _ = elem + size += 4 + + } + } + size += 4 + size += 4 + size += 4 + size += 4 + size += 2 + uint32(len(p.Password)) + size += 2 + uint32(len(p.Username)) + size += 2 + uint32(len(p.Service)) + size += 1 + if p.Unknown12 != 0 { + size += 1 + } + if p.Unknown12 != 0 { + for _, elem := range p.Lvl90ClassItems { + _ = elem + size += 1 + size += 1 + for _, nestedElem := range elem.StartingItems { + _ = nestedElem + size += 4 + size += 1 + size += 1 + size += 1 + size += 3 + size += 3 + + } + + } + } + size += 1 + if p.Unknown13 != 0 { + size += 1 + } + if p.Unknown13 != 0 { + for _, elem := range p.TimeLockedClassItems { + _ = elem + size += 1 + size += 1 + for _, nestedElem := range elem.StartingItems { + _ = nestedElem + size += 4 + size += 1 + size += 1 + size += 1 + size += 3 + size += 3 + + } + + } + } + size += uint32(13) + return size } + + + +