mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
style: run gofmt across entire codebase
330 non-vendor files had minor formatting inconsistencies (comment alignment, whitespace). No logic changes.
This commit is contained in:
@@ -12,9 +12,9 @@ import (
|
||||
|
||||
// ServerEntry represents a channel server from the entrance server response.
|
||||
type ServerEntry struct {
|
||||
IP string
|
||||
Port uint16
|
||||
Name string
|
||||
IP string
|
||||
Port uint16
|
||||
Name string
|
||||
}
|
||||
|
||||
// DoEntrance connects to the entrance server and retrieves the server list.
|
||||
@@ -93,8 +93,8 @@ func parseServerEntries(data []byte, entryCount uint16) ([]ServerEntry, error) {
|
||||
_ = bf.ReadUint16() // serverIdx | 16
|
||||
_ = bf.ReadUint16() // 0
|
||||
channelCount := bf.ReadUint16()
|
||||
_ = bf.ReadUint8() // Type
|
||||
_ = bf.ReadUint8() // Season/rotation
|
||||
_ = bf.ReadUint8() // Type
|
||||
_ = bf.ReadUint8() // Season/rotation
|
||||
|
||||
// G1+ recommended flag
|
||||
_ = bf.ReadUint8()
|
||||
@@ -118,11 +118,11 @@ func parseServerEntries(data []byte, entryCount uint16) ([]ServerEntry, error) {
|
||||
// Read channel entries (14 x uint16 = 28 bytes each)
|
||||
for j := uint16(0); j < channelCount; j++ {
|
||||
port := bf.ReadUint16()
|
||||
_ = bf.ReadUint16() // channelIdx | 16
|
||||
_ = bf.ReadUint16() // maxPlayers
|
||||
_ = bf.ReadUint16() // currentPlayers
|
||||
_ = bf.ReadUint16() // channelIdx | 16
|
||||
_ = bf.ReadUint16() // maxPlayers
|
||||
_ = bf.ReadUint16() // currentPlayers
|
||||
_ = bf.ReadBytes(18) // remaining channel fields (9 x uint16: 6 zeros + unk319 + unk254 + unk255)
|
||||
_ = bf.ReadUint16() // 12345
|
||||
_ = bf.ReadUint16() // 12345
|
||||
|
||||
serverIP := ip.String()
|
||||
// Convert 127.0.0.1 representation
|
||||
|
||||
@@ -48,8 +48,8 @@ func BuildEnumerateStagePacket(ackHandle uint32, prefix string) []byte {
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint16(MSG_SYS_ENUMERATE_STAGE)
|
||||
bf.WriteUint32(ackHandle)
|
||||
bf.WriteUint8(1) // Always 1
|
||||
bf.WriteUint8(uint8(len(prefix) + 1)) // Length including null terminator
|
||||
bf.WriteUint8(1) // Always 1
|
||||
bf.WriteUint8(uint8(len(prefix) + 1)) // Length including null terminator
|
||||
bf.WriteNullTerminatedBytes([]byte(prefix))
|
||||
bf.WriteBytes([]byte{0x00, 0x10})
|
||||
return bf.Data()
|
||||
@@ -68,8 +68,8 @@ func BuildEnterStagePacket(ackHandle uint32, stageID string) []byte {
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint16(MSG_SYS_ENTER_STAGE)
|
||||
bf.WriteUint32(ackHandle)
|
||||
bf.WriteUint8(0) // IsQuest = false
|
||||
bf.WriteUint8(uint8(len(stageID) + 1)) // Length including null terminator
|
||||
bf.WriteUint8(0) // IsQuest = false
|
||||
bf.WriteUint8(uint8(len(stageID) + 1)) // Length including null terminator
|
||||
bf.WriteNullTerminatedBytes([]byte(stageID))
|
||||
bf.WriteBytes([]byte{0x00, 0x10})
|
||||
return bf.Data()
|
||||
@@ -182,13 +182,13 @@ func BuildChatPayload(chatType uint8, message, senderName string) []byte {
|
||||
sjisMsg := stringsupport.UTF8ToSJIS(message)
|
||||
sjisName := stringsupport.UTF8ToSJIS(senderName)
|
||||
bf := byteframe.NewByteFrame()
|
||||
bf.WriteUint8(0) // Unk0
|
||||
bf.WriteUint8(chatType) // Type
|
||||
bf.WriteUint16(0) // Flags
|
||||
bf.WriteUint16(uint16(len(sjisName) + 1)) // SenderName length (+ null term)
|
||||
bf.WriteUint16(uint16(len(sjisMsg) + 1)) // Message length (+ null term)
|
||||
bf.WriteNullTerminatedBytes(sjisMsg) // Message
|
||||
bf.WriteNullTerminatedBytes(sjisName) // SenderName
|
||||
bf.WriteUint8(0) // Unk0
|
||||
bf.WriteUint8(chatType) // Type
|
||||
bf.WriteUint16(0) // Flags
|
||||
bf.WriteUint16(uint16(len(sjisName) + 1)) // SenderName length (+ null term)
|
||||
bf.WriteUint16(uint16(len(sjisMsg) + 1)) // Message length (+ null term)
|
||||
bf.WriteNullTerminatedBytes(sjisMsg) // Message
|
||||
bf.WriteNullTerminatedBytes(sjisName) // SenderName
|
||||
return bf.Data()
|
||||
}
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
|
||||
// SignResult holds the parsed response from a successful DSGN sign-in.
|
||||
type SignResult struct {
|
||||
TokenID uint32
|
||||
TokenString string // 16 raw bytes as string
|
||||
Timestamp uint32
|
||||
TokenID uint32
|
||||
TokenString string // 16 raw bytes as string
|
||||
Timestamp uint32
|
||||
EntranceAddr string
|
||||
CharIDs []uint32
|
||||
CharIDs []uint32
|
||||
}
|
||||
|
||||
// DoSign connects to the sign server and performs a DSGN login.
|
||||
@@ -62,9 +62,9 @@ func parseSignResponse(data []byte) (*SignResult, error) {
|
||||
return nil, fmt.Errorf("sign failed with code %d", resultCode)
|
||||
}
|
||||
|
||||
patchCount := rbf.ReadUint8() // patch server count (usually 2)
|
||||
_ = rbf.ReadUint8() // entrance server count (usually 1)
|
||||
charCount := rbf.ReadUint8() // character count
|
||||
patchCount := rbf.ReadUint8() // patch server count (usually 2)
|
||||
_ = rbf.ReadUint8() // entrance server count (usually 1)
|
||||
charCount := rbf.ReadUint8() // character count
|
||||
|
||||
result := &SignResult{}
|
||||
result.TokenID = rbf.ReadUint32()
|
||||
@@ -87,13 +87,13 @@ func parseSignResponse(data []byte) (*SignResult, error) {
|
||||
charID := rbf.ReadUint32()
|
||||
result.CharIDs = append(result.CharIDs, charID)
|
||||
|
||||
_ = rbf.ReadUint16() // HR
|
||||
_ = rbf.ReadUint16() // WeaponType
|
||||
_ = rbf.ReadUint32() // LastLogin
|
||||
_ = rbf.ReadUint8() // IsFemale
|
||||
_ = rbf.ReadUint8() // IsNewCharacter
|
||||
_ = rbf.ReadUint8() // Old GR
|
||||
_ = rbf.ReadUint8() // Use uint16 GR flag
|
||||
_ = rbf.ReadUint16() // HR
|
||||
_ = rbf.ReadUint16() // WeaponType
|
||||
_ = rbf.ReadUint32() // LastLogin
|
||||
_ = rbf.ReadUint8() // IsFemale
|
||||
_ = rbf.ReadUint8() // IsNewCharacter
|
||||
_ = rbf.ReadUint8() // Old GR
|
||||
_ = rbf.ReadUint8() // Use uint16 GR flag
|
||||
_ = rbf.ReadBytes(16) // Character name (padded)
|
||||
_ = rbf.ReadBytes(32) // Unk desc string (padded)
|
||||
// ZZ mode: additional fields
|
||||
|
||||
Reference in New Issue
Block a user