package game

import (
	"encoding/gob"
	mergeCluster "server/cluster"
	"server/game/mod/activity"
	"server/game/mod/card"
	"server/game/mod/friend"
	"server/game/mod/item"
	limitedTimeEvent "server/game/mod/limited_time_event"
	"server/game/mod/msg"
	proto "server/msg"
	"sync"
)

type PlayerSimpleData struct {
	Uid         int
	Name        string
	Avatar      int
	Level       int
	Face        int
	Decorate    int
	Star        int
	Login       int64
	Loginout    int64
	FaceBook    string
	FaceBookPic string
	Playroom    map[int]int
	Chess       []int
	WorkStart   int64
	Chip        int
	PetName     string
	Emoji       map[int]int
	Friend      []int
	Upvote      int
	DressSet    map[int]int
	CardInfo    []int
	ActLog      *friend.ActLogInfo
	Physiology  map[int]int
	Lang        int
	Account     string
}

type VarGoldCard struct {
	Four int
	Five int
}

type VarOpration struct {
	Type int
	Key  string
	Data interface{}
	Code int
}

type VarUserData struct {
	Upvote int
	Chip   int
	Kiss   int
	mu     sync.Mutex
}

type VarExpireData struct {
	D  interface{}
	T  int64 // 过期时间戳
	U  int64 // 最后更新时间
	mu sync.Mutex
}

type CatnipPartner struct {
	Uid     int
	Partner int
	GameId  int
	EndTime int64
}

const (
	ACT_STATUS_NOT_START = 0
	ACT_STATUS_START     = 1
	ACT_STATUS_END       = 2
)

type ActivityInfo struct {
	StartT int64
	EndT   int64
	Id     int
	Type   int
	Title  string
	Name   string
	Status int
	Info   interface{}
}

type ChargeExtra struct {
	Type     int   // 充值类型
	Uid      int64 // 充值用户
	ChargeId int   // 充值id
}

type GameResult struct {
	T     int // 游戏类型
	R     int // 1:赢 2:输 3:平
	Emoji int // 表情
}

type CatnipMsg struct {
	ActivityId  int
	GameId      int
	Growth      int // 增长值
	FriendItems int // 赠送好友的道具数量
}

type CatnipLock struct {
	Uid     int // 玩家ID
	Partner int // 伙伴ID
	GameId  int // 游戏ID
	End     int
}

func register() {
	gob.Register(card.CardInfo{})
	gob.Register(item.Item{})
	gob.Register(friend.ReplyInfo{})
	gob.Register(&msg.Msg{})
	gob.Register(&mergeCluster.ClusterJoinData{})
	gob.Register(&limitedTimeEvent.MoneyCat{})
	gob.Register(&limitedTimeEvent.LuckyCat{})
	gob.Register(&limitedTimeEvent.PaybackDay{})
	gob.Register(&msg.HandbookMsg{})
	gob.Register(&limitedTimeEvent.CatTrick{})
	gob.Register(&VarOpration{})
	gob.Register(&VarUserData{})
	gob.Register(&ActivityInfo{})
	gob.Register(&ChargeExtra{})
	gob.Register(CatnipMsg{})
	gob.Register(&CatnipLock{})
	gob.Register(CRank{})
	gob.Register(&proto.ResChampshipRank{})
	gob.Register(&proto.ResChampshipPreRank{})
	gob.Register(card.CardInfo{})
	gob.Register(item.Item{})
	gob.Register([]*item.Item{}) // 注册 []*item.Item 类型
	gob.Register(friend.ReplyInfo{})
	gob.Register(GameResult{})
	gob.Register(map[string]interface{}{})
	gob.Register(&MessageData{})
	gob.Register(&MessageList{})
	gob.Register(&activity.Gift{})
	gob.Register(&VarGoldCard{})
	gob.Register(&VarExpireData{})
	gob.Register(msg.VarData{})
}
