enter

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2025 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClanMaxMemberCount = 50 // 社团最大成员数量
)

Variables

View Source
var MaxCachePlayerTime = 10 // 最大玩家缓存时间 单位:分钟
View Source
var MaxCacheYostarClanTime = 30 // 最大玩家缓存时间 单位:分
View Source
var MaxPlayerNum int64 = 0 // 最大在线玩家

Functions

func AddArenaBattleRank

func AddArenaBattleRank(rank int64) bool

AddArenaBattleRank 将排名添加到战斗进行中的列表

func AddEnterTicket

func AddEnterTicket(accountServerId, yostarUID int64, ticker string) bool

AddEnterTicket 添加EnterTicket

func AddSession

func AddSession(x *Session) bool

AddSession 添加Session

func AddYostarMail

func AddYostarMail(mail *dbstruct.YostarMail) bool

func CheckArenaBattle

func CheckArenaBattle(ticker *time.Ticker, attackRank, defenceRank int64)

CheckArenaBattle 检查战斗是否结束/释放锁!!!!!!!!

func CheckArenaBattleRank

func CheckArenaBattleRank(rank int64) bool

CheckArenaBattleRank 判断角色是否正在战斗中

func Close

func Close()

Close 保存全部玩家数据

func DelAllYostarMail

func DelAllYostarMail() error

func DelArenaBattleRank

func DelArenaBattleRank(rank int64) bool

DelArenaBattleRank 战斗结束删除队列

func DelEnterTicket

func DelEnterTicket(ticker string) bool

DelEnterTicket 删除Ticket,如果此Ticket存在返回true,不存在返回false

func DelSession

func DelSession(accountServerId int64) bool

DelSession 删除指定在线玩家-有锁

func DelYostarClan

func DelYostarClan(serverId int64) bool

func DelYostarMail

func DelYostarMail(mailId int64) error

func GetAllEnterTicketInfo

func GetAllEnterTicketInfo() map[string]*TicketInfo

GetAllEnterTicketInfo 获取全部登录信息

func GetAllSession

func GetAllSession() map[int64]*Session

GetAllSession 获取全部在线玩家-有锁

func GetAllYostarClan

func GetAllYostarClan() map[int64]*YostarClan

GetAllYostarClan 获取全部缓存社团-有锁

func GetYostarMail

func GetYostarMail() map[int64]*dbstruct.YostarMail

func InitEnterSet

func InitEnterSet()

func TaskUpDiskPlayerData

func TaskUpDiskPlayerData() bool

TaskUpDiskPlayerData 将磁盘中的二进制玩家数据写入数据库中

func UpAllPlayerBin

func UpAllPlayerBin()

UpAllPlayerBin 保存全部玩家数据

Types

type AccountFriend

type AccountFriend struct {
	Uid                     int64          `json:"uid"`
	AutoAcceptFriendRequest bool           `json:"auto_accept_friend_request"` // 是否自动同意好友申请
	FriendList              map[int64]bool `json:"friend_list"`                // 好友列表
	ReceivedList            map[int64]bool `json:"received_list"`              // 被申请好友列表
	SendReceivedList        map[int64]bool `json:"send_received_list"`         // 发送的好友申请列表
	BlockedList             map[int64]bool `json:"blocked_list"`               // 黑名单列表
}

func (*AccountFriend) GetFriendList

func (x *AccountFriend) GetFriendList() map[int64]bool

func (*AccountFriend) GetYostarFriend

func (x *AccountFriend) GetYostarFriend() *dbstruct.YostarFriend

GetYostarFriend 预处理db数据

type ArenaInfo

type ArenaInfo struct {
	ArenaUserList   []*ArenaUser
	BattleArenaUser *ArenaUser // 被打的玩家
}

type ArenaUser

type ArenaUser struct {
	IsNpc       bool  // 是否是机器人
	Uid         int64 // 玩家情况下的uid
	Index       int64 // 机器人情况下的index/conf
	CharacterId int64 // 机器人情况下
	Rank        int64 // 排名
}

type ClanAccount

type ClanAccount struct {
	Uid             int64 `json:"uid"`
	SocialGrade     int32 `json:"socialGrade"`     //  职位
	JoinTime        int64 `json:"joinTime"`        // 加入时间
	LastLoginTime   int64 `json:"lastLoginTime"`   // 上次访问时间
	AttendanceCount int64 `json:"attendanceCount"` // 出席天数
	ApplicantTime   int64 `json:"applicantTime"`   // 申请时间
}

func (*ClanAccount) GetAttendanceCount

func (x *ClanAccount) GetAttendanceCount() int64

func (*ClanAccount) GetJoinDate

func (x *ClanAccount) GetJoinDate() mx.MxTime

func (*ClanAccount) GetLastLoginTime

func (x *ClanAccount) GetLastLoginTime() mx.MxTime

func (*ClanAccount) GetSocialGrade

func (x *ClanAccount) GetSocialGrade() int32

func (*ClanAccount) SetLastLoginTime

func (x *ClanAccount) SetLastLoginTime()

type EnterSet

type EnterSet struct {
	SessionMap     map[int64]*Session             // 玩家信息-缓存
	EnterTicketMap map[string]*TicketInfo         // 登录通行证字典-缓存
	MailMap        map[int64]*dbstruct.YostarMail // 全服邮件
	YostarClan     map[int64]*YostarClan          // 全部缓存社团
	YostarClanHash map[string]int64
}

func (*EnterSet) Check

func (e *EnterSet) Check()

type Mission

type Mission struct {
	MissionByCompleteConditionType map[string]map[int64]*sro.MissionInfo
	SyncMission                    map[int64]*sro.MissionInfo // 待同步的任务列表
}

func (*Mission) AddMissionSync

func (x *Mission) AddMissionSync(info *sro.MissionInfo)

func (*Mission) MissionFinishNum

func (x *Mission) MissionFinishNum(t proto.MissionCompleteConditionType, bin *sro.MissionInfo, num int64)

计数类型的完成条件

type Session

type Session struct {
	AccountServerId int64
	YostarUID       int64
	MxToken         string
	ActiveTime      time.Time // 上次活跃时间
	LastUpTime      time.Time // 上次保存时间
	AccountState    proto.AccountState
	PlayerBin       *sro.PlayerBin // 玩家数据
	Actions         map[proto.ServerNotificationFlag]bool
	AccountFriend   *AccountFriend
	Mission         *Mission
	Toast           []*Toast
	PlayerHash      map[int64]any

	Error proto.WebAPIErrorCode
	// contains filtered or unexported fields
}

func GetAllSessionList

func GetAllSessionList() []*Session

GetAllSessionList 获取全部在线玩家-列表

func GetSessionByAccountServerId

func GetSessionByAccountServerId(accountServerId int64) *Session

GetSessionByAccountServerId 获取指定在线玩家

func GetSessionBySessionKey

func GetSessionBySessionKey(sessionKey *proto.SessionKey) *Session

GetSessionBySessionKey 获取指定在线玩家

func GetSessionByUid

func GetSessionByUid(uid int64) *Session

GetSessionByUid 此接口的用处是拉取玩家数据,包括在数据库中的

func NewSession

func NewSession(accountServerId int64) *Session

func (*Session) AddMissionByCompleteConditionType

func (x *Session) AddMissionByCompleteConditionType(info *sro.CategoryMissionInfo)

func (*Session) AddPlayerHash

func (x *Session) AddPlayerHash(k int64, v any) bool

AddPlayerHash 写入数据到哈希表中

func (*Session) DelPlayerHash

func (x *Session) DelPlayerHash(k int64) bool

func (*Session) FinishMission

func (x *Session) FinishMission(t proto.MissionCompleteConditionType, num int64, parameter []int64)

func (*Session) GenArenaUserList

func (x *Session) GenArenaUserList(seasonId int64)

GenArenaUserList 生成预战斗三人表

func (*Session) GetArenaInfo

func (x *Session) GetArenaInfo() *ArenaInfo

func (*Session) GetArenaUserByIndex

func (x *Session) GetArenaUserByIndex(index int32) *ArenaUser

func (*Session) GetArenaUserList

func (x *Session) GetArenaUserList() []*ArenaUser

func (*Session) GetBattleArenaUser

func (x *Session) GetBattleArenaUser() *ArenaUser

func (*Session) GetCharacterByKeyId

func (x *Session) GetCharacterByKeyId(k int64) *sro.CharacterInfo

func (*Session) GetEquipmentByKeyId

func (x *Session) GetEquipmentByKeyId(k int64) *sro.EquipmentInfo

func (*Session) GetFriendInfo

func (x *Session) GetFriendInfo() *AccountFriend

func (*Session) GetItemByKeyId

func (x *Session) GetItemByKeyId(k int64) *sro.ItemInfo

func (*Session) GetMission

func (x *Session) GetMission() *Mission

func (*Session) GetMissionByCompleteConditionType

func (x *Session) GetMissionByCompleteConditionType() map[string]map[int64]*sro.MissionInfo

func (*Session) GetMissionSync

func (x *Session) GetMissionSync() map[int64]*sro.MissionInfo

func (*Session) GetPbBinData

func (x *Session) GetPbBinData() []byte

GetPbBinData 将玩家pb数据转二进制数据

func (*Session) GetYostarGame

func (x *Session) GetYostarGame() *dbstruct.YostarGame

GetYostarGame 将玩家数据转成数据库格式

func (*Session) MissionReward

func (x *Session) MissionReward(info *sro.MissionInfo)

func (*Session) NewMissionSync

func (x *Session) NewMissionSync()

func (*Session) SetBattleArenaUser

func (x *Session) SetBattleArenaUser(au *ArenaUser)

type TicketInfo

type TicketInfo struct {
	AccountServerId int64
	YostarUID       int64
	Ticket          string
	EndTime         time.Time
}

func GetEnterTicketInfo

func GetEnterTicketInfo(ticker string) *TicketInfo

GetEnterTicketInfo 通过ticker获取登录信息

type Toast

type Toast struct {
	Text      string
	BeginDate mx.MxTime
	EndDate   mx.MxTime
}

type YostarClan

type YostarClan struct {
	ServerId         int64                  `json:"serverId"`
	ActiveTime       time.Time              `json:"-"` // 上次活跃时间
	LastUpTime       time.Time              `json:"-"` // 上次保存时间
	ClanName         string                 `json:"clanName"`
	AllAccount       map[int64]*ClanAccount `json:"allAccount"` // 账号id
	President        int64                  `json:"president"`  // 主席账号id
	JoinOption       int32                  `json:"joinOption"`
	Notice           string                 `json:"notice"`
	ApplicantAccount map[int64]*ClanAccount `json:"applicantAccount"` // 申请者
}

func DbGetYostarClan

func DbGetYostarClan(ycId int64) (*YostarClan, error)

DbGetYostarClan 从db拉取数据

func DbGetYostarClanByClanName

func DbGetYostarClanByClanName(clanName string) (*YostarClan, error)

DbGetYostarClanByClanName 从db拉取数据

func GetAllYostarClanList

func GetAllYostarClanList() []*YostarClan

GetAllYostarClanList 获取全部缓存社团

func GetYostarClanByClanName

func GetYostarClanByClanName(clanName string) *YostarClan

func GetYostarClanByServerId

func GetYostarClanByServerId(ycId int64) (yc *YostarClan)

GetYostarClanByServerId 拉取社团消息

func (*YostarClan) AddAccount

func (x *YostarClan) AddAccount(uid int64, socialGrade int32) bool

func (*YostarClan) AddApplicantAccount

func (x *YostarClan) AddApplicantAccount(uid int64) bool

func (*YostarClan) GetAllAccount

func (x *YostarClan) GetAllAccount() map[int64]*ClanAccount

func (*YostarClan) GetAllApplicantAccount

func (x *YostarClan) GetAllApplicantAccount() map[int64]*ClanAccount

func (*YostarClan) GetClanAccount

func (x *YostarClan) GetClanAccount(uid int64) *ClanAccount

func (*YostarClan) GetMemberCount

func (x *YostarClan) GetMemberCount() int64

func (*YostarClan) GetYostarClan

func (x *YostarClan) GetYostarClan() *dbstruct.YostarClan

GetYostarClan 预处理db数据

func (*YostarClan) RemoveAccount

func (x *YostarClan) RemoveAccount(uid int64) bool

func (*YostarClan) RemoveApplicantAccount

func (x *YostarClan) RemoveApplicantAccount(uid int64)

func (*YostarClan) SetJoinOption

func (x *YostarClan) SetJoinOption(joinOption int32) bool

func (*YostarClan) SetNotice

func (x *YostarClan) SetNotice(notice string) bool

func (*YostarClan) SetPresident

func (x *YostarClan) SetPresident(uid int64) bool

func (*YostarClan) UpDate

func (x *YostarClan) UpDate() error

UpDate 将玩家数据保存到数据库

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL