94 lines
2.1 KiB
Go
94 lines
2.1 KiB
Go
package chat
|
|
|
|
import (
|
|
"sync"
|
|
"time"
|
|
)
|
|
|
|
// Channel represents a chat channel with membership and message routing capabilities
|
|
type Channel struct {
|
|
mu sync.RWMutex
|
|
name string
|
|
password string
|
|
channelType int
|
|
levelRestriction int32
|
|
raceRestriction int32
|
|
classRestriction int32
|
|
members []int32 // Character IDs
|
|
discordEnabled bool
|
|
created time.Time
|
|
}
|
|
|
|
// ChannelMessage represents a message sent to a channel
|
|
type ChannelMessage struct {
|
|
SenderID int32
|
|
SenderName string
|
|
Message string
|
|
LanguageID int32
|
|
ChannelName string
|
|
Timestamp time.Time
|
|
IsEmote bool
|
|
IsOOC bool
|
|
}
|
|
|
|
// ChannelMember represents a member in a channel
|
|
type ChannelMember struct {
|
|
CharacterID int32
|
|
CharacterName string
|
|
Level int32
|
|
Race int32
|
|
Class int32
|
|
JoinedAt time.Time
|
|
}
|
|
|
|
// ChannelInfo provides basic channel information for client lists
|
|
type ChannelInfo struct {
|
|
Name string
|
|
HasPassword bool
|
|
MemberCount int
|
|
LevelRestriction int32
|
|
RaceRestriction int32
|
|
ClassRestriction int32
|
|
ChannelType int
|
|
}
|
|
|
|
// ChatChannelData represents persistent channel data from database
|
|
type ChatChannelData struct {
|
|
Name string
|
|
Password string
|
|
LevelRestriction int32
|
|
ClassRestriction int32
|
|
RaceRestriction int32
|
|
}
|
|
|
|
// ChatManager manages all chat channels and operations
|
|
type ChatManager struct {
|
|
mu sync.RWMutex
|
|
channels map[string]*Channel
|
|
database ChannelDatabase
|
|
|
|
// Integration interfaces
|
|
clientManager ClientManager
|
|
playerManager PlayerManager
|
|
languageProcessor LanguageProcessor
|
|
}
|
|
|
|
// ChatStatistics provides statistics about chat system usage
|
|
type ChatStatistics struct {
|
|
TotalChannels int
|
|
WorldChannels int
|
|
CustomChannels int
|
|
TotalMembers int
|
|
MessagesPerHour int
|
|
ActiveChannels int
|
|
}
|
|
|
|
// ChannelFilter provides filtering options for channel lists
|
|
type ChannelFilter struct {
|
|
MinLevel int32
|
|
MaxLevel int32
|
|
Race int32
|
|
Class int32
|
|
IncludeCustom bool
|
|
IncludeWorld bool
|
|
} |