mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 15:43:49 +01:00
chore: apply gofmt formatting
This commit is contained in:
@@ -139,8 +139,8 @@ func TestGetAchData_ValueAccumulation(t *testing.T) {
|
||||
|
||||
func TestGetAchData_NextValueByLevel(t *testing.T) {
|
||||
tests := []struct {
|
||||
level uint8
|
||||
wantNext uint16
|
||||
level uint8
|
||||
wantNext uint16
|
||||
approxScore int32
|
||||
}{
|
||||
{0, 5, 0},
|
||||
|
||||
@@ -311,4 +311,3 @@ func TestEmptyHandlers_NoDb(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,13 +44,13 @@ import (
|
||||
|
||||
// Config holds configuration parameters for creating a new channel server.
|
||||
type Config struct {
|
||||
ID uint16 // Channel server ID (unique identifier)
|
||||
Logger *zap.Logger // Logger instance for this channel server
|
||||
DB *sqlx.DB // Database connection pool
|
||||
ID uint16 // Channel server ID (unique identifier)
|
||||
Logger *zap.Logger // Logger instance for this channel server
|
||||
DB *sqlx.DB // Database connection pool
|
||||
DiscordBot *discordbot.DiscordBot // Optional Discord bot for chat integration
|
||||
ErupeConfig *config.Config // Global Erupe configuration
|
||||
Name string // Display name for the server (shown in broadcasts)
|
||||
Enable bool // Whether this server is enabled
|
||||
ErupeConfig *config.Config // Global Erupe configuration
|
||||
Name string // Display name for the server (shown in broadcasts)
|
||||
Enable bool // Whether this server is enabled
|
||||
}
|
||||
|
||||
// userBinaryPartID is a composite key for identifying a specific part of a user's binary data.
|
||||
@@ -86,15 +86,15 @@ type Server struct {
|
||||
erupeConfig *config.Config // Global configuration
|
||||
|
||||
// Connection management
|
||||
acceptConns chan net.Conn // Channel for new accepted connections
|
||||
deleteConns chan net.Conn // Channel for connections to be cleaned up
|
||||
sessions map[net.Conn]*Session // Active sessions keyed by connection
|
||||
listener net.Listener // TCP listener (created when Server.Start is called)
|
||||
isShuttingDown bool // Shutdown flag to stop goroutines gracefully
|
||||
acceptConns chan net.Conn // Channel for new accepted connections
|
||||
deleteConns chan net.Conn // Channel for connections to be cleaned up
|
||||
sessions map[net.Conn]*Session // Active sessions keyed by connection
|
||||
listener net.Listener // TCP listener (created when Server.Start is called)
|
||||
isShuttingDown bool // Shutdown flag to stop goroutines gracefully
|
||||
|
||||
// Stage (game room) management
|
||||
stagesLock sync.RWMutex // Protects stages map (RWMutex for concurrent reads)
|
||||
stages map[string]*Stage // Active stages keyed by stage ID string
|
||||
stagesLock sync.RWMutex // Protects stages map (RWMutex for concurrent reads)
|
||||
stages map[string]*Stage // Active stages keyed by stage ID string
|
||||
|
||||
// Localization
|
||||
dict map[string]string // Language string mappings for server messages
|
||||
@@ -105,9 +105,9 @@ type Server struct {
|
||||
userBinaryParts map[userBinaryPartID][]byte // Chunked binary data by character
|
||||
|
||||
// Semaphore (multiplayer coordination) management
|
||||
semaphoreLock sync.RWMutex // Protects semaphore map and semaphoreIndex
|
||||
semaphore map[string]*Semaphore // Active semaphores keyed by semaphore ID
|
||||
semaphoreIndex uint32 // Auto-incrementing ID for new semaphores (starts at 7)
|
||||
semaphoreLock sync.RWMutex // Protects semaphore map and semaphoreIndex
|
||||
semaphore map[string]*Semaphore // Active semaphores keyed by semaphore ID
|
||||
semaphoreIndex uint32 // Auto-incrementing ID for new semaphores (starts at 7)
|
||||
|
||||
// Optional integrations
|
||||
discordBot *discordbot.DiscordBot // Discord bot for chat relay (nil if disabled)
|
||||
|
||||
@@ -48,32 +48,32 @@ type Session struct {
|
||||
sync.Mutex // Protects session state during concurrent handler execution
|
||||
|
||||
// Core connection and logging
|
||||
logger *zap.Logger // Logger with connection address
|
||||
server *Server // Parent server reference
|
||||
rawConn net.Conn // Underlying TCP connection
|
||||
cryptConn *network.CryptConn // Encrypted connection wrapper
|
||||
sendPackets chan packet // Outbound packet queue (buffered, size 20)
|
||||
clientContext *clientctx.ClientContext // Client version and capabilities
|
||||
lastPacket time.Time // Timestamp of last received packet (for timeout detection)
|
||||
logger *zap.Logger // Logger with connection address
|
||||
server *Server // Parent server reference
|
||||
rawConn net.Conn // Underlying TCP connection
|
||||
cryptConn *network.CryptConn // Encrypted connection wrapper
|
||||
sendPackets chan packet // Outbound packet queue (buffered, size 20)
|
||||
clientContext *clientctx.ClientContext // Client version and capabilities
|
||||
lastPacket time.Time // Timestamp of last received packet (for timeout detection)
|
||||
|
||||
// Stage (game area) state
|
||||
userEnteredStage bool // Whether player has entered any stage during this session
|
||||
stageID string // Current stage ID string (e.g., "sl1Ns200p0a0u0")
|
||||
stage *Stage // Pointer to current stage object
|
||||
reservationStage *Stage // Stage reserved for quest (used by unreserve packet)
|
||||
stagePass string // Temporary password storage for password-protected stages
|
||||
userEnteredStage bool // Whether player has entered any stage during this session
|
||||
stageID string // Current stage ID string (e.g., "sl1Ns200p0a0u0")
|
||||
stage *Stage // Pointer to current stage object
|
||||
reservationStage *Stage // Stage reserved for quest (used by unreserve packet)
|
||||
stagePass string // Temporary password storage for password-protected stages
|
||||
stageMoveStack *stringstack.StringStack // Navigation history for "back" functionality
|
||||
|
||||
// Player identity and state
|
||||
charID uint32 // Character ID for this session
|
||||
Name string // Character name (for debugging/logging)
|
||||
prevGuildID uint32 // Last guild ID queried (cached for InfoGuild)
|
||||
token string // Authentication token from sign server
|
||||
logKey []byte // Logging encryption key
|
||||
sessionStart int64 // Session start timestamp (Unix time)
|
||||
courses []mhfcourse.Course // Active Monster Hunter courses (buffs/subscriptions)
|
||||
kqf []byte // Key Quest Flags (quest progress tracking)
|
||||
kqfOverride bool // Whether KQF is being overridden
|
||||
charID uint32 // Character ID for this session
|
||||
Name string // Character name (for debugging/logging)
|
||||
prevGuildID uint32 // Last guild ID queried (cached for InfoGuild)
|
||||
token string // Authentication token from sign server
|
||||
logKey []byte // Logging encryption key
|
||||
sessionStart int64 // Session start timestamp (Unix time)
|
||||
courses []mhfcourse.Course // Active Monster Hunter courses (buffs/subscriptions)
|
||||
kqf []byte // Key Quest Flags (quest progress tracking)
|
||||
kqfOverride bool // Whether KQF is being overridden
|
||||
|
||||
// Quest/event coordination
|
||||
semaphore *Semaphore // Semaphore for quest/event participation (if in a coordinated activity)
|
||||
|
||||
@@ -13,10 +13,10 @@ import (
|
||||
// other players in the same stage. Each object has an owner, position, and
|
||||
// unique ID for client-server synchronization.
|
||||
type Object struct {
|
||||
sync.RWMutex // Protects object state during updates
|
||||
id uint32 // Unique object ID (see NextObjectID for ID generation)
|
||||
ownerCharID uint32 // Character ID of the player who placed this object
|
||||
x, y, z float32 // 3D position coordinates
|
||||
sync.RWMutex // Protects object state during updates
|
||||
id uint32 // Unique object ID (see NextObjectID for ID generation)
|
||||
ownerCharID uint32 // Character ID of the player who placed this object
|
||||
x, y, z float32 // 3D position coordinates
|
||||
}
|
||||
|
||||
// stageBinaryKey is a composite key for identifying a specific piece of stage binary data.
|
||||
|
||||
Reference in New Issue
Block a user