diff --git a/internal/packets/ls_structs/CreateCharacterReply.go b/internal/packets/ls_structs/CreateCharacterReply.go new file mode 100644 index 0000000..0be1dda --- /dev/null +++ b/internal/packets/ls_structs/CreateCharacterReply.go @@ -0,0 +1,26 @@ +package ls_structs + +import "eq2emu/internal/common" + +// CreateCharacterReply for client version 1 +type CreateCharacterReplyV1 struct { + AccountID uint32 `eq2:"int32"` + Response uint8 `eq2:"int8"` + Name common.EQ2String16 `eq2:"string16"` +} + +// CreateCharacterReply for client version 1189 +type CreateCharacterReplyV1189 struct { + AccountID uint32 `eq2:"int32"` + Unknown uint32 `eq2:"int32"` + Response uint8 `eq2:"int8"` + Name common.EQ2String16 `eq2:"string16"` +} + +// CreateCharacterReply for client version 60085 +type CreateCharacterReplyV60085 struct { + AccountID uint32 `eq2:"int32"` + Unknown uint32 `eq2:"int32"` + Response uint8 `eq2:"int8"` + Name common.EQ2String16 `eq2:"string16"` +} diff --git a/internal/packets/ls_structs/DeleteCharacterRequest.go b/internal/packets/ls_structs/DeleteCharacterRequest.go new file mode 100644 index 0000000..604802f --- /dev/null +++ b/internal/packets/ls_structs/DeleteCharacterRequest.go @@ -0,0 +1,10 @@ +package ls_structs + +import "eq2emu/internal/common" + +type DeleteCharacterRequest struct { + CharID uint32 `eq2:"int32"` + ServerID uint32 `eq2:"int32"` + Unknown uint32 `eq2:"int32"` + Name common.EQ2String16 `eq2:"string16"` +} diff --git a/internal/packets/ls_structs/DeleteCharacterResponse.go b/internal/packets/ls_structs/DeleteCharacterResponse.go new file mode 100644 index 0000000..6708574 --- /dev/null +++ b/internal/packets/ls_structs/DeleteCharacterResponse.go @@ -0,0 +1,12 @@ +package ls_structs + +import "eq2emu/internal/common" + +type DeleteCharacterResponse struct { + Response uint8 `eq2:"int8"` + ServerID uint32 `eq2:"int32"` + CharID uint32 `eq2:"int32"` + AccountID uint32 `eq2:"int32"` + Name common.EQ2String16 `eq2:"string16"` + MaxCharacters uint32 `eq2:"int32"` +} diff --git a/internal/packets/ls_structs/LoginByNumRequest.go b/internal/packets/ls_structs/LoginByNumRequest.go new file mode 100644 index 0000000..b810ffd --- /dev/null +++ b/internal/packets/ls_structs/LoginByNumRequest.go @@ -0,0 +1,28 @@ +package ls_structs + +// LoginByNumRequestV1 - Client Version 1 +type LoginByNumRequestV1 struct { + AccountID uint32 `eq2:"int32"` + AccessCode uint32 `eq2:"int32"` + Version uint16 `eq2:"int16"` + Unknown2 []uint32 `eq2:"int32,len=5"` +} + +// LoginByNumRequestV562 - Client Version 562 +type LoginByNumRequestV562 struct { + AccountID uint32 `eq2:"int32"` + AccessCode uint32 `eq2:"int32"` + Unknown uint32 `eq2:"int32"` + Version uint16 `eq2:"int16"` + Unknown2 []uint32 `eq2:"int32,len=5"` +} + +// LoginByNumRequestV1208 - Client Version 1208 +type LoginByNumRequestV1208 struct { + AccountID uint32 `eq2:"int32"` + AccessCode uint32 `eq2:"int32"` + Unknown1 uint32 `eq2:"int32"` + Unknown2 uint16 `eq2:"int16"` + Version uint16 `eq2:"int16"` + Unknown3 []uint32 `eq2:"int32,len=6"` +} diff --git a/internal/packets/ls_structs/LoginReplyMsg.go b/internal/packets/ls_structs/LoginReplyMsg.go index 43771dc..6e07b4b 100644 --- a/internal/packets/ls_structs/LoginReplyMsg.go +++ b/internal/packets/ls_structs/LoginReplyMsg.go @@ -2,16 +2,6 @@ package ls_structs import "eq2emu/internal/common" -// StartingItem represents equipment/item data for character creation -type StartingItem struct { - ModelID uint32 `eq2:"int32"` - SlotID uint8 `eq2:"int8"` - UseColor uint8 `eq2:"int8"` - UseHighlightColor uint8 `eq2:"int8"` - ModelColor common.EQ2Color `eq2:"color"` - ModelHighlightColor common.EQ2Color `eq2:"color"` -} - // StartingItemV1 for older client versions (int16 model_id) type StartingItemV1 struct { ModelID uint16 `eq2:"int16"` @@ -36,13 +26,8 @@ type ClassItemV1 struct { StartingItems []StartingItemV1 `eq2:"array,arraysize=NumItems"` } -// UnknownArray2Item represents items in the second unknown array -type UnknownArray2Item struct { - Array2Unknown uint32 `eq2:"int32"` -} - -// LS_LoginReplyMsgV1 - Client version 1 -type LS_LoginReplyMsgV1 struct { +// LoginReplyMsgV1 - Client version 1 +type LoginReplyMsgV1 struct { LoginResponse uint8 `eq2:"int8"` WorldName common.EQ2String16 `eq2:"string16"` ParentalControlFlag uint8 `eq2:"int8"` @@ -51,8 +36,8 @@ type LS_LoginReplyMsgV1 struct { AccountID uint32 `eq2:"int32"` } -// LS_LoginReplyMsgV284 - Client version 284 -type LS_LoginReplyMsgV284 struct { +// LoginReplyMsgV284 - Client version 284 +type LoginReplyMsgV284 struct { LoginResponse uint8 `eq2:"int8"` Unknown common.EQ2String16 `eq2:"string16"` ParentalControlFlag uint8 `eq2:"int8"` @@ -74,7 +59,7 @@ type LS_LoginReplyMsgV284 struct { } // LS_LoginReplyMsgV843 - Client version 843 -type LS_LoginReplyMsgV843 struct { +type LoginReplyMsgV843 struct { LoginResponse uint8 `eq2:"int8"` Unknown common.EQ2String16 `eq2:"string16"` ParentalControlFlag uint8 `eq2:"int8"` @@ -99,7 +84,7 @@ type LS_LoginReplyMsgV843 struct { } // LS_LoginReplyMsgV1096 - Client version 1096 -type LS_LoginReplyMsgV1096 struct { +type LoginReplyMsgV1096 struct { LoginResponse uint8 `eq2:"int8"` Unknown common.EQ2String16 `eq2:"string16"` ParentalControlFlag uint8 `eq2:"int8"` @@ -129,8 +114,8 @@ type LS_LoginReplyMsgV1096 struct { Username common.EQ2String16 `eq2:"string16"` } -// LS_LoginReplyMsgV1142 - Client version 1142 -type LS_LoginReplyMsgV1142 struct { +// LoginReplyMsgV1142 - Client version 1142 +type LoginReplyMsgV1142 struct { LoginResponse uint8 `eq2:"int8"` Unknown common.EQ2String16 `eq2:"string16"` ParentalControlFlag uint8 `eq2:"int8"` @@ -161,8 +146,8 @@ type LS_LoginReplyMsgV1142 struct { Username common.EQ2String16 `eq2:"string16"` } -// LS_LoginReplyMsgV1188 - Client version 1188 -type LS_LoginReplyMsgV1188 struct { +// LoginReplyMsgV1188 - Client version 1188 +type LoginReplyMsgV1188 struct { LoginResponse uint8 `eq2:"int8"` Unknown common.EQ2String16 `eq2:"string16"` ParentalControlFlag uint8 `eq2:"int8"` @@ -194,8 +179,8 @@ type LS_LoginReplyMsgV1188 struct { Unknown12 common.EQ2String16 `eq2:"string16"` } -// LS_LoginReplyMsgV57080 - Client version 57080 -type LS_LoginReplyMsgV57080 struct { +// LoginReplyMsgV57080 - Client version 57080 +type LoginReplyMsgV57080 struct { LoginResponse uint8 `eq2:"int8"` Unknown common.EQ2String16 `eq2:"string16"` ParentalControlFlag uint8 `eq2:"int8"` @@ -240,8 +225,8 @@ type LS_LoginReplyMsgV57080 struct { Unknown13 []uint8 `eq2:"int8,len=5"` } -// LS_LoginReplyMsgV60100 - Client version 60100 -type LS_LoginReplyMsgV60100 struct { +// LoginReplyMsgV60100 - Client version 60100 +type LoginReplyMsgV60100 struct { LoginResponse uint8 `eq2:"int8"` Unknown common.EQ2String16 `eq2:"string16"` ParentalControlFlag uint8 `eq2:"int8"` @@ -278,8 +263,8 @@ type LS_LoginReplyMsgV60100 struct { Unknown14 []uint8 `eq2:"int8,len=13"` } -// LS_LoginReplyMsgV63181 - Client version 63181 -type LS_LoginReplyMsgV63181 struct { +// LoginReplyMsgV63181 - Client version 63181 +type LoginReplyMsgV63181 struct { LoginResponse uint8 `eq2:"int8"` Unknown common.EQ2String16 `eq2:"string16"` ParentalControlFlag uint8 `eq2:"int8"` @@ -319,8 +304,8 @@ type LS_LoginReplyMsgV63181 struct { Unknown14 []uint8 `eq2:"int8,len=9"` } -// LS_LoginReplyMsgV65534 - Client version 65534 (latest) -type LS_LoginReplyMsgV65534 struct { +// LoginReplyMsgV65534 - Client version 65534 (latest) +type LoginReplyMsgV65534 struct { LoginResponse uint8 `eq2:"int8"` WorldName common.EQ2String16 `eq2:"string16"` ParentalControlFlag uint8 `eq2:"int8"` diff --git a/internal/packets/ls_structs/LoginRequest.go b/internal/packets/ls_structs/LoginRequest.go new file mode 100644 index 0000000..a2d6a1a --- /dev/null +++ b/internal/packets/ls_structs/LoginRequest.go @@ -0,0 +1,42 @@ +package ls_structs + +import "eq2emu/internal/common" + +// LoginRequest for client version 1 +type LoginRequestV1 struct { + SessionID common.EQ2String16 `eq2:"string16"` + SessionRecycleToken common.EQ2String16 `eq2:"string16"` + Username common.EQ2String16 `eq2:"string16"` + Password common.EQ2String16 `eq2:"string16"` + AcctNum uint32 `eq2:"int32"` + PassCode uint32 `eq2:"int32"` + Version uint16 `eq2:"int16"` +} + +// LoginRequest for client version 562 +type LoginRequestV562 struct { + AccessCode common.EQ2String16 `eq2:"string16"` + Unknown1 common.EQ2String16 `eq2:"string16"` + Username common.EQ2String16 `eq2:"string16"` + Password common.EQ2String16 `eq2:"string16"` + Unknown2 []uint8 `eq2:"int8,len=8"` + Unknown3 []uint8 `eq2:"int8,len=2"` + Version uint32 `eq2:"int32"` + Unknown3b uint16 `eq2:"int16"` + Unknown4 uint32 `eq2:"int32"` +} + +// LoginRequest for client version 1208 +type LoginRequestV1208 struct { + AccessCode common.EQ2String16 `eq2:"string16"` + Unknown1 common.EQ2String16 `eq2:"string16"` + Username common.EQ2String16 `eq2:"string16"` + Password common.EQ2String16 `eq2:"string16"` + Unknown2 []uint8 `eq2:"int8,len=8"` + Unknown3 []uint8 `eq2:"int8,len=2"` + Version uint16 `eq2:"int16"` + Unknown4 uint8 `eq2:"int8"` + Unknown5 []uint32 `eq2:"int32,len=3"` + Unknown6 uint16 `eq2:"int16"` + Unknown7 common.EQ2String16 `eq2:"string16"` +} diff --git a/internal/packets/ls_structs/LoginResponse.go b/internal/packets/ls_structs/LoginResponse.go new file mode 100644 index 0000000..47b3ad9 --- /dev/null +++ b/internal/packets/ls_structs/LoginResponse.go @@ -0,0 +1,180 @@ +package ls_structs + +import "eq2emu/internal/common" + +// LoginResponse for client version 1 +type LoginResponseV1 struct { + ReplyCode uint8 `eq2:"int8"` + Unknown01 uint16 `eq2:"int16"` + Unknown02 uint8 `eq2:"int8"` + Unknown03 int32 `eq2:"sint32"` + Unknown04 int32 `eq2:"sint32"` + Unknown05 int32 `eq2:"sint32"` + AccountID uint32 `eq2:"int32"` + Unknown06 uint16 `eq2:"int16"` + Unknown07 uint8 `eq2:"int8"` + Unknown08 uint8 `eq2:"int8"` + Unknown09 uint32 `eq2:"int32"` + Unknown10 uint8 `eq2:"int8"` + Unknown11 uint32 `eq2:"int32"` + Unknown12 uint8 `eq2:"int8"` +} + +// LoginResponse for client version 546 +type LoginResponseV546 struct { + ReplyCode uint8 `eq2:"int8"` + Unknown uint16 `eq2:"int16"` + Unknown01 uint8 `eq2:"int8"` + Unknown03 int32 `eq2:"sint32"` + Unknown04 int32 `eq2:"sint32"` + Unknown15 []uint8 `eq2:"int8,len=11"` + Unknown02 uint8 `eq2:"int8"` +} + +// LoginResponse for client version 561 +type LoginResponseV561 struct { + ReplyCode uint8 `eq2:"int8"` + Unknown01 []uint8 `eq2:"int8,len=22"` + Unknown02 uint8 `eq2:"int8"` + Unknown03 int32 `eq2:"sint32"` + Unknown04 int32 `eq2:"sint32"` + Unknown05 int32 `eq2:"sint32"` + AccountID uint32 `eq2:"int32"` + Unknown06 []uint8 `eq2:"int8,len=7"` + Unknown07 uint32 `eq2:"int32"` + Unknown08 uint32 `eq2:"int32"` + Unknown09 uint32 `eq2:"int32"` + Unknown10 uint32 `eq2:"int32"` +} + +// LoginResponse for client version 1096 +type LoginResponseV1096 struct { + ReplyCode uint8 `eq2:"int8"` + Unknown01 []uint8 `eq2:"int8,len=22"` + Unknown02 uint8 `eq2:"int8"` + Unknown03 int32 `eq2:"sint32"` + Unknown04 int32 `eq2:"sint32"` + Unknown05 int32 `eq2:"sint32"` + AccountID uint32 `eq2:"int32"` + Unknown06 []uint8 `eq2:"int8,len=7"` + Unknown07 uint32 `eq2:"int32"` + Unknown08 uint32 `eq2:"int32"` + Unknown09 uint32 `eq2:"int32"` + Unknown10 uint32 `eq2:"int32"` +} + +// LoginResponse for client version 1144 +type LoginResponseV1144 struct { + ReplyCode uint8 `eq2:"int8"` + Unknown01 []uint8 `eq2:"int8,len=22"` + Unknown02 uint8 `eq2:"int8"` + Unknown03 int32 `eq2:"sint32"` + Unknown04 int32 `eq2:"sint32"` + Unknown05 int32 `eq2:"sint32"` + AccountID uint32 `eq2:"int32"` + Unknown06 []uint8 `eq2:"int8,len=15"` + Unknown07 uint32 `eq2:"int32"` + Unknown08 uint32 `eq2:"int32"` + Unknown09 uint32 `eq2:"int32"` + Unknown10 uint32 `eq2:"int32"` +} + +// LoginResponse for client version 1153 +type LoginResponseV1153 struct { + ReplyCode uint8 `eq2:"int8"` + Unknown01 []uint8 `eq2:"int8,len=22"` + Unknown02 uint8 `eq2:"int8"` + Unknown03 int32 `eq2:"sint32"` + Unknown04 int32 `eq2:"sint32"` + Unknown05 int32 `eq2:"sint32"` + AccountID uint32 `eq2:"int32"` + Unknown06 []uint8 `eq2:"int8,len=7"` + Unknown07 uint32 `eq2:"int32"` + Unknown08 uint32 `eq2:"int32"` + Unknown09 uint32 `eq2:"int32"` + Unknown10 uint32 `eq2:"int32"` + Unknown11 uint32 `eq2:"int32"` +} + +// LoginResponse for client version 1193 +type LoginResponseV1193 struct { + ReplyCode uint8 `eq2:"int8"` + Unknown01 []uint8 `eq2:"int8,len=22"` + Unknown02 uint8 `eq2:"int8"` + Unknown03 int32 `eq2:"sint32"` + Unknown04 int32 `eq2:"sint32"` + Unknown05 int32 `eq2:"sint32"` + AccountID uint32 `eq2:"int32"` + Unknown06 []uint8 `eq2:"int8,len=7"` + Unknown07 uint32 `eq2:"int32"` + Unknown08 uint32 `eq2:"int32"` + Unknown09 uint32 `eq2:"int32"` + Unknown10 uint32 `eq2:"int32"` + Unknown11 uint32 `eq2:"int32"` + Unknown12 uint16 `eq2:"int16"` +} + +// ClassItems represents class-specific starting items +type ClassItems struct { + ClassID uint8 `eq2:"int8"` + NumItems uint8 `eq2:"int8"` + StartingItems []StartingItem `eq2:"array,arraysize=NumItems"` +} + +// LoginResponse for client version 60100 - most complex version +type LoginResponseV60100 struct { + LoginResponse uint8 `eq2:"int8"` + Unknown common.EQ2String16 `eq2:"string16"` + ParentalControlFlag uint8 `eq2:"int8"` + ParentalControlTimer uint32 `eq2:"int32"` + Unknown2 []uint8 `eq2:"int8,len=8"` + AccountID uint32 `eq2:"int32"` + Unknown3 common.EQ2String16 `eq2:"string16"` + ResetAppearance uint8 `eq2:"int8"` + DoNotForceSoga uint8 `eq2:"int8"` + Unknown4 uint8 `eq2:"int8"` + Unknown5 uint16 `eq2:"int16"` + Unknown6 []uint8 `eq2:"int8,len=5"` + Unknown7 uint32 `eq2:"int32"` + Unknown7a uint16 `eq2:"int16"` + RaceUnknown uint8 `eq2:"int8"` + Unknown8 []uint8 `eq2:"int8,len=3"` + Unknown9 []uint8 `eq2:"int8,len=3"` + Unknown10 uint8 `eq2:"int8"` + NumClassItems uint8 `eq2:"int8,ifvariableset=Unknown10"` + ClassItems []ClassItems `eq2:"array,arraysize=NumClassItems,ifvariableset=Unknown10"` + UnknownArray2Size uint8 `eq2:"int8"` + UnknownArray2 []UnknownArray2Item `eq2:"array,arraysize=UnknownArray2Size"` + Unknown11 uint32 `eq2:"int32"` + SubLevel uint32 `eq2:"int32"` + RaceFlag uint32 `eq2:"int32"` + ClassFlag uint32 `eq2:"int32"` + Password common.EQ2String16 `eq2:"string16"` + Username common.EQ2String16 `eq2:"string16"` + Service common.EQ2String16 `eq2:"string16"` + Unknown12 uint8 `eq2:"int8"` + Lvl90NumClassItems uint8 `eq2:"int8,ifvariableset=Unknown12"` + Lvl90ClassItems []ClassItems `eq2:"array,arraysize=Lvl90NumClassItems,ifvariableset=Unknown12"` + Unknown13 uint8 `eq2:"int8"` + TimeLockedNumClassItems uint8 `eq2:"int8,ifvariableset=Unknown13"` + TimeLockedClassItems []ClassItems `eq2:"array,arraysize=TimeLockedNumClassItems,ifvariableset=Unknown13"` + Unknown14 []uint8 `eq2:"int8,len=13"` +} + +// LoginResponse for client version 57048 +type LoginResponseV57048 struct { + ReplyCode uint8 `eq2:"int8"` + Unknown01 []uint8 `eq2:"int8,len=22"` + Unknown02 uint8 `eq2:"int8"` + Unknown03 int32 `eq2:"sint32"` + Unknown04 int32 `eq2:"sint32"` + Unknown05 int32 `eq2:"sint32"` + AccountID uint32 `eq2:"int32"` + Unknown06 []uint8 `eq2:"int8,len=7"` + Unknown07 uint32 `eq2:"int32"` + Unknown08 uint32 `eq2:"int32"` + Unknown09 uint32 `eq2:"int32"` + Unknown10 uint32 `eq2:"int32"` + Unknown11 uint32 `eq2:"int32"` + Unknown12 []uint32 `eq2:"int32,len=5"` +} diff --git a/internal/packets/ls_structs/PlayRequest.go b/internal/packets/ls_structs/PlayRequest.go new file mode 100644 index 0000000..34a93e3 --- /dev/null +++ b/internal/packets/ls_structs/PlayRequest.go @@ -0,0 +1,16 @@ +package ls_structs + +import "eq2emu/internal/common" + +// PlayRequest for client version 1 +type PlayRequestV1 struct { + CharID uint32 `eq2:"int32"` + Name common.EQ2String16 `eq2:"string16"` +} + +// PlayRequest for client version 284 +type PlayRequestV284 struct { + CharID uint32 `eq2:"int32"` + ServerID uint32 `eq2:"int32"` + Unknown []uint8 `eq2:"int8,len=3"` +} diff --git a/internal/packets/ls_structs/PlayResponse.go b/internal/packets/ls_structs/PlayResponse.go new file mode 100644 index 0000000..22a0b66 --- /dev/null +++ b/internal/packets/ls_structs/PlayResponse.go @@ -0,0 +1,42 @@ +package ls_structs + +import "eq2emu/internal/common" + +// PlayResponse for client version 1 +type PlayResponseV1 struct { + Response uint8 `eq2:"int8"` + Server common.EQ2String8 `eq2:"string8"` + Port uint16 `eq2:"int16"` + AccountID uint32 `eq2:"int32"` + AccessCode uint32 `eq2:"int32"` +} + +// PlayResponse for client version 1096 +type PlayResponseV1096 struct { + Response uint8 `eq2:"int8"` + Unknown1 uint16 `eq2:"int16"` + Server common.EQ2String8 `eq2:"string8"` + Port uint16 `eq2:"int16"` + AccountID uint32 `eq2:"int32"` + AccessCode uint32 `eq2:"int32"` +} + +// PlayResponse for client version 60085 +type PlayResponseV60085 struct { + Response uint8 `eq2:"int8"` + Unknown1 []uint16 `eq2:"int16,len=3"` + Server common.EQ2String8 `eq2:"string8"` + Port uint16 `eq2:"int16"` + AccountID uint32 `eq2:"int32"` + AccessCode uint32 `eq2:"int32"` +} + +// PlayResponse for client version 60099 +type PlayResponseV60099 struct { + Response uint8 `eq2:"int8"` + Unknown1 []uint16 `eq2:"int16,len=3"` + Server common.EQ2String8 `eq2:"string8"` + Port uint16 `eq2:"int16"` + AccountID uint32 `eq2:"int32"` + AccessCode uint32 `eq2:"int32"` +} diff --git a/internal/packets/ls_structs/WorldList.go b/internal/packets/ls_structs/WorldList.go new file mode 100644 index 0000000..5b27a3c --- /dev/null +++ b/internal/packets/ls_structs/WorldList.go @@ -0,0 +1,131 @@ +package ls_structs + +import "eq2emu/internal/common" + +// World for client version 1 +type WorldV1 struct { + ID uint32 `eq2:"int32"` + Name common.EQ2String16 `eq2:"string16"` + Online uint8 `eq2:"int8"` + Locked uint8 `eq2:"int8"` + Unknown2 uint8 `eq2:"int8"` + Unknown3 uint8 `eq2:"int8"` + Load uint8 `eq2:"int8"` +} + +// WorldList for client version 1 +type WorldListV1 struct { + NumWorlds uint8 `eq2:"int8"` + WorldList []WorldV1 `eq2:"array,arraysize=NumWorlds"` +} + +// World for client version 373 +type WorldV373 struct { + ID uint32 `eq2:"int32"` + Name common.EQ2String16 `eq2:"string16"` + Tag uint8 `eq2:"int8"` + Locked uint8 `eq2:"int8"` + Hidden uint8 `eq2:"int8"` + Unknown uint8 `eq2:"int8"` + NumPlayers uint16 `eq2:"int16"` + Load uint8 `eq2:"int8"` + NumberOnlineFlag uint8 `eq2:"int8"` + AllowedRaces uint32 `eq2:"int32"` +} + +// WorldList for client version 373 +type WorldListV373 struct { + NumWorlds uint8 `eq2:"int8"` + WorldList []WorldV373 `eq2:"array,arraysize=NumWorlds"` +} + +// World for client version 546 +type WorldV546 struct { + ID uint32 `eq2:"int32"` + Name common.EQ2String16 `eq2:"string16"` + Name2 common.EQ2String16 `eq2:"string16"` + Tag uint8 `eq2:"int8"` + Locked uint8 `eq2:"int8"` + Hidden uint8 `eq2:"int8"` + Unknown uint8 `eq2:"int8"` + NumPlayers uint16 `eq2:"int16"` + Load uint8 `eq2:"int8"` + NumberOnlineFlag uint8 `eq2:"int8"` + Unknown2 uint8 `eq2:"int8"` + AllowedRaces uint32 `eq2:"int32"` +} + +// WorldList for client version 546 +type WorldListV546 struct { + NumWorlds uint8 `eq2:"int8"` + WorldList []WorldV546 `eq2:"array,arraysize=NumWorlds"` +} + +// World for client version 562 +type WorldV562 struct { + ID uint32 `eq2:"int32"` + Name common.EQ2String16 `eq2:"string16"` + Name2 common.EQ2String16 `eq2:"string16"` + Tag uint8 `eq2:"int8"` + Locked uint8 `eq2:"int8"` + Hidden uint8 `eq2:"int8"` + Unknown uint8 `eq2:"int8"` + NumPlayers uint16 `eq2:"int16"` + Load uint8 `eq2:"int8"` + NumberOnlineFlag uint8 `eq2:"int8"` + FeatureSet []uint8 `eq2:"int8,len=2"` + AllowedRaces uint32 `eq2:"int32"` +} + +// WorldList for client version 562 +type WorldListV562 struct { + NumWorlds uint8 `eq2:"int8"` + WorldList []WorldV562 `eq2:"array,arraysize=NumWorlds"` + Unknown2 uint8 `eq2:"int8"` +} + +// World for client version 60114 +type WorldV60114 struct { + ID uint32 `eq2:"int32"` + Name common.EQ2String16 `eq2:"string16"` + Name2 common.EQ2String16 `eq2:"string16"` + Tag uint8 `eq2:"int8"` + Locked uint8 `eq2:"int8"` + Hidden uint8 `eq2:"int8"` + Unknown uint8 `eq2:"int8"` + NumPlayers uint16 `eq2:"int16"` + Load uint8 `eq2:"int8"` + NumberOnlineFlag uint8 `eq2:"int8"` + FeatureSet []uint8 `eq2:"int8,len=2"` + AllowedRaces uint32 `eq2:"int32"` +} + +// WorldList for client version 60114 +type WorldListV60114 struct { + NumWorlds uint8 `eq2:"int8"` + WorldList []WorldV60114 `eq2:"array,arraysize=NumWorlds"` + Unknown2 uint8 `eq2:"int8"` +} + +// World for client version 65534 +type WorldV65534 struct { + ID uint32 `eq2:"int32"` + Name common.EQ2String16 `eq2:"string16"` + Name2 common.EQ2String16 `eq2:"string16"` + Tag uint8 `eq2:"int8"` + Locked uint8 `eq2:"int8"` + Hidden uint8 `eq2:"int8"` + Unknown uint8 `eq2:"int8"` + NumPlayers uint16 `eq2:"int16"` + Load uint8 `eq2:"int8"` + NumberOnlineFlag uint8 `eq2:"int8"` + FeatureSet []uint8 `eq2:"int8,len=3"` + AllowedRaces uint32 `eq2:"int32"` +} + +// WorldList for client version 65534 +type WorldListV65534 struct { + NumWorlds uint8 `eq2:"int8"` + WorldList []WorldV65534 `eq2:"array,arraysize=NumWorlds"` + Unknown2 uint8 `eq2:"int8"` +} diff --git a/internal/packets/ls_structs/WorldUpdate.go b/internal/packets/ls_structs/WorldUpdate.go new file mode 100644 index 0000000..82ef9cb --- /dev/null +++ b/internal/packets/ls_structs/WorldUpdate.go @@ -0,0 +1,9 @@ +package ls_structs + +type WorldUpdate struct { + ServerID uint32 `eq2:"int32"` + Up uint8 `eq2:"int8"` + Locked uint8 `eq2:"int8"` + Unknown1 uint8 `eq2:"int8"` + Unknown2 uint8 `eq2:"int8"` +} diff --git a/internal/packets/ls_structs/common.go b/internal/packets/ls_structs/common.go new file mode 100644 index 0000000..7f9f715 --- /dev/null +++ b/internal/packets/ls_structs/common.go @@ -0,0 +1,88 @@ +package ls_structs + +import ( + "eq2emu/internal/common" + "eq2emu/internal/packets/parser" + "reflect" +) + +type UnknownArray2Item struct { + Array2Unknown uint32 `eq2:"int32"` +} + +// StartingItem represents equipment items for character creation +type StartingItem struct { + ModelID uint32 `eq2:"int32"` + SlotID uint8 `eq2:"int8"` + UseColor uint8 `eq2:"int8"` + UseHighlightColor uint8 `eq2:"int8"` + ModelColor common.EQ2Color `eq2:"color"` + ModelHighlightColor common.EQ2Color `eq2:"color"` +} + +func RegisterLoginServerStructs(registry *parser.VersionRegistry) { + // CreateCharacterReply + registry.RegisterStruct("CreateCharacterReply", "1", reflect.TypeOf(CreateCharacterReplyV1{})) + registry.RegisterStruct("CreateCharacterReply", "1189", reflect.TypeOf(CreateCharacterReplyV1189{})) + registry.RegisterStruct("CreateCharacterReply", "60085", reflect.TypeOf(CreateCharacterReplyV60085{})) + + // DeleteCharacterRequest + registry.RegisterStruct("DeleteCharacterRequest", "1", reflect.TypeOf(DeleteCharacterRequest{})) + + // DeleteCharacterResponse + registry.RegisterStruct("DeleteCharacterResponse", "1", reflect.TypeOf(DeleteCharacterResponse{})) + + // LoginRequest + registry.RegisterStruct("LoginRequest", "1", reflect.TypeOf(LoginRequestV1{})) + registry.RegisterStruct("LoginRequest", "562", reflect.TypeOf(LoginRequestV562{})) + registry.RegisterStruct("LoginRequest", "1208", reflect.TypeOf(LoginRequestV1208{})) + + // LoginResponse + registry.RegisterStruct("LoginResponse", "1", reflect.TypeOf(LoginResponseV1{})) + registry.RegisterStruct("LoginResponse", "546", reflect.TypeOf(LoginResponseV546{})) + registry.RegisterStruct("LoginResponse", "561", reflect.TypeOf(LoginResponseV561{})) + registry.RegisterStruct("LoginResponse", "1096", reflect.TypeOf(LoginResponseV1096{})) + registry.RegisterStruct("LoginResponse", "1144", reflect.TypeOf(LoginResponseV1144{})) + registry.RegisterStruct("LoginResponse", "1153", reflect.TypeOf(LoginResponseV1153{})) + registry.RegisterStruct("LoginResponse", "1193", reflect.TypeOf(LoginResponseV1193{})) + registry.RegisterStruct("LoginResponse", "57048", reflect.TypeOf(LoginResponseV57048{})) + registry.RegisterStruct("LoginResponse", "60100", reflect.TypeOf(LoginResponseV60100{})) + + // PlayRequest + registry.RegisterStruct("PlayRequest", "1", reflect.TypeOf(PlayRequestV1{})) + registry.RegisterStruct("PlayRequest", "284", reflect.TypeOf(PlayRequestV284{})) + + // PlayResponse + registry.RegisterStruct("PlayResponse", "1", reflect.TypeOf(PlayResponseV1{})) + registry.RegisterStruct("PlayResponse", "1096", reflect.TypeOf(PlayResponseV1096{})) + registry.RegisterStruct("PlayResponse", "60085", reflect.TypeOf(PlayResponseV60085{})) + registry.RegisterStruct("PlayResponse", "60099", reflect.TypeOf(PlayResponseV60099{})) + + // WorldList + registry.RegisterStruct("WorldList", "1", reflect.TypeOf(WorldListV1{})) + registry.RegisterStruct("WorldList", "373", reflect.TypeOf(WorldListV373{})) + registry.RegisterStruct("WorldList", "546", reflect.TypeOf(WorldListV546{})) + registry.RegisterStruct("WorldList", "562", reflect.TypeOf(WorldListV562{})) + registry.RegisterStruct("WorldList", "60114", reflect.TypeOf(WorldListV60114{})) + registry.RegisterStruct("WorldList", "65534", reflect.TypeOf(WorldListV65534{})) + + // WorldUpdate + registry.RegisterStruct("WorldUpdate", "1", reflect.TypeOf(WorldUpdate{})) + + // LoginReplyMsg + registry.RegisterStruct("LoginReplyMsg", "1", reflect.TypeOf(LoginReplyMsgV1{})) + registry.RegisterStruct("LoginReplyMsg", "284", reflect.TypeOf(LoginReplyMsgV284{})) + registry.RegisterStruct("LoginReplyMsg", "843", reflect.TypeOf(LoginReplyMsgV843{})) + registry.RegisterStruct("LoginReplyMsg", "1096", reflect.TypeOf(LoginReplyMsgV1096{})) + registry.RegisterStruct("LoginReplyMsg", "1142", reflect.TypeOf(LoginReplyMsgV1142{})) + registry.RegisterStruct("LoginReplyMsg", "1188", reflect.TypeOf(LoginReplyMsgV1188{})) + registry.RegisterStruct("LoginReplyMsg", "57080", reflect.TypeOf(LoginReplyMsgV57080{})) + registry.RegisterStruct("LoginReplyMsg", "60100", reflect.TypeOf(LoginReplyMsgV60100{})) + registry.RegisterStruct("LoginReplyMsg", "63181", reflect.TypeOf(LoginReplyMsgV63181{})) + registry.RegisterStruct("LoginReplyMsg", "65534", reflect.TypeOf(LoginReplyMsgV65534{})) + + // LoginByNumRequest + registry.RegisterStruct("LoginByNumRequest", "1", reflect.TypeOf(LoginByNumRequestV1{})) + registry.RegisterStruct("LoginByNumRequest", "562", reflect.TypeOf(LoginByNumRequestV562{})) + registry.RegisterStruct("LoginByNumRequest", "1208", reflect.TypeOf(LoginByNumRequestV1208{})) +}