mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 23:54:33 +01:00
Per anti-patterns.md item #9, guild-related SQL was scattered across ~15 handler files with no repository abstraction. Following the same pattern established by CharacterRepository, this centralizes all guilds, guild_characters, and guild_applications table access into a single GuildRepository (~30 methods). guild_model.go and handlers_guild_member.go are trimmed to types and pure business logic only. All handler files (guild_*, festa, mail, house, mercenary, rengoku) now call s.server.guildRepo methods instead of direct DB queries or methods on domain objects.
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
package channelserver
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// GuildMember represents a guild member with role and stats.
|
|
type GuildMember struct {
|
|
GuildID uint32 `db:"guild_id"`
|
|
CharID uint32 `db:"character_id"`
|
|
JoinedAt *time.Time `db:"joined_at"`
|
|
Souls uint32 `db:"souls"`
|
|
RPToday uint16 `db:"rp_today"`
|
|
RPYesterday uint16 `db:"rp_yesterday"`
|
|
Name string `db:"name"`
|
|
IsApplicant bool `db:"is_applicant"`
|
|
OrderIndex uint16 `db:"order_index"`
|
|
LastLogin uint32 `db:"last_login"`
|
|
Recruiter bool `db:"recruiter"`
|
|
AvoidLeadership bool `db:"avoid_leadership"`
|
|
IsLeader bool `db:"is_leader"`
|
|
HR uint16 `db:"hr"`
|
|
GR uint16 `db:"gr"`
|
|
WeaponID uint16 `db:"weapon_id"`
|
|
WeaponType uint8 `db:"weapon_type"`
|
|
}
|
|
|
|
func (gm *GuildMember) CanRecruit() bool {
|
|
if gm.Recruiter {
|
|
return true
|
|
}
|
|
if gm.OrderIndex <= 3 {
|
|
return true
|
|
}
|
|
if gm.IsLeader {
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (gm *GuildMember) IsSubLeader() bool {
|
|
return gm.OrderIndex <= 3
|
|
}
|