Game

package
v0.0.0-...-348a65b Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

记录战斗关键数据并储存,用于战斗结算和重连重新开启战斗

Index

Constants

This section is empty.

Variables

View Source
var SNOWFLAKE *alg.SnowflakeWorker // 雪花唯一id生成器

Functions

This section is empty.

Types

type Avatar

type Avatar struct {
	AvatarId          uint32           // 角色id
	Exp               uint32           // 经验
	Level             uint32           // 等级
	Type              proto.AvatarType // 角色状态
	FirstMetTimestamp uint64           // 获得时间戳
	Promotion         uint32           // 突破等阶
	Rank              uint32           // 命座
	Hp                uint32           // 血量
	SpBar             *SpBarInfo       // 能量
	SkilltreeList     []*Skilltree     // 技能等级数据 [id]level
	EquipmentUniqueId uint32           // 装备光锥
	TakenRewards      []uint32         // 已领取的突破奖励
	BuffList          uint32           // 开启战斗的buff
}

type Battle

type Battle struct {
	BattleId         uint32                // 战斗ID
	Wave             uint32                // 次数
	EventID          uint32                // 怪物群实体id
	LogicRandomSeed  uint32                // 逻辑随机种子
	RoundsLimit      uint32                // 回合限制
	StaminaCost      uint32                // 扣除体力
	DisplayItemList  []*Material           // 奖励物品
	BuffList         []*proto.BattleBuff   // Buff列表
	BattleAvatarList []*proto.BattleAvatar // 战斗角色列表
}

type DbAvatar

type DbAvatar struct {
	Avatar         map[uint32]*Avatar
	MainAvatar     proto.HeroBasicType // 默认主角
	MainAvatarList []uint32            // 主角们
}

type DbItem

type DbItem struct {
	RelicMap     map[uint32]*Relic     // 遗器
	EquipmentMap map[uint32]*Equipment // 光锥
	MaterialMap  map[uint32]*Material  // 材料
	HeadIcon     []uint32              // 头像
}

type DbLineUp

type DbLineUp struct {
	LineUpList   []*LineUp
	MainLineUp   uint32 // 当前上场队伍
	MainAvatarId uint32 // 当前上场角色
}

type DbScene

type DbScene struct {
	EntryId uint32 //
}

type Dbgacha

type Dbgacha struct {
	GachaMap map[uint32]*Num // [GachaType]*CeilingNum
}

type EntityList

type EntityList struct {
	Entity  uint32 // 实体Id
	GroupId uint32 // 地图块
}

type Equipment

type Equipment struct {
	Tid          uint32 // id
	UniqueId     uint32 // 唯一ID
	Exp          uint32
	Level        uint32
	Promotion    uint32
	BaseAvatarId uint32 // 装备角色
	IsProtected  bool   // 是否锁定
	Rank         uint32 // 命座?
}

type Game

type Game struct {
	IsToken        bool // 是否通过token验证
	Uid            uint32
	Seed           uint64
	NetMsgInput    chan *NetMsg
	KcpConn        *kcp.UDPSession
	LastActiveTime int64 // 最近一次的活跃时间
	// 玩家数据
	Player *PlayerData
	// 密钥
	XorKey []byte
}

func (*Game) AddAvatar

func (g *Game) AddAvatar(avatarId uint32)

func (*Game) AddEquipment

func (g *Game) AddEquipment(tid uint32)

func (*Game) AddGachaItem

func (g *Game) AddGachaItem(id uint32) (bool, bool)

func (*Game) AddHeadIcon

func (g *Game) AddHeadIcon(headIconId uint32)

func (*Game) AddMaterial

func (g *Game) AddMaterial(tid, num uint32)

func (*Game) AddPalyerData

func (g *Game) AddPalyerData(uid uint32) *PlayerData

初始化账号数据

func (*Game) AddRelic

func (g *Game) AddRelic(tid uint32)

func (*Game) AddTrailblazerExp

func (g *Game) AddTrailblazerExp(num uint32)

func (*Game) AutoUpDataPlayer

func (g *Game) AutoUpDataPlayer()

func (*Game) AvatarExpUpCsReq

func (g *Game) AvatarExpUpCsReq(payloadMsg []byte)

func (*Game) AvatarPlayerSyncScNotify

func (g *Game) AvatarPlayerSyncScNotify(avatarId uint32)

func (*Game) BattleSyncLineupNotify

func (g *Game) BattleSyncLineupNotify(index uint32)

队伍更新通知

func (*Game) ChangeLineupLeaderCsReq

func (g *Game) ChangeLineupLeaderCsReq(payloadMsg []byte)

func (*Game) ChangePlayer

func (g *Game) ChangePlayer()

func (*Game) DecodePayloadToProto

func (g *Game) DecodePayloadToProto(cmdId uint16, msg []byte) (protoObj pb.Message)

func (*Game) DelEquipmentPlayerSyncScNotify

func (g *Game) DelEquipmentPlayerSyncScNotify(equipmentList []uint32)

func (*Game) DelMaterialPlayerSyncScNotify

func (g *Game) DelMaterialPlayerSyncScNotify(pileItem []*Material)

func (*Game) DoGachaCsReq

func (g *Game) DoGachaCsReq(payloadMsg []byte)

func (*Game) DressAvatarCsReq

func (g *Game) DressAvatarCsReq(payloadMsg []byte)

func (*Game) DressAvatarPlayerSyncScNotify

func (g *Game) DressAvatarPlayerSyncScNotify(avatarId, equipmentUniqueId uint32)

光锥交换通知

func (*Game) EnterSceneByServerScNotify

func (g *Game) EnterSceneByServerScNotify(entryId, teleportId uint32)

通知客户端进入场景

func (*Game) EnterSceneCsReq

func (g *Game) EnterSceneCsReq(payloadMsg []byte)

func (*Game) EquipmentPlayerSyncScNotify

func (g *Game) EquipmentPlayerSyncScNotify(tid, uniqueId uint32)

func (*Game) ExchangeHcoinCsReq

func (g *Game) ExchangeHcoinCsReq(payloadMsg []byte)

func (*Game) ExpUpEquipmentCsReq

func (g *Game) ExpUpEquipmentCsReq(payloadMsg []byte)

func (*Game) GMRegisterMessage

func (g *Game) GMRegisterMessage(cmdId uint16, payloadMsg pb.Message)

func (*Game) GachaRandom

func (g *Game) GachaRandom(gachaId uint32) uint32

func (*Game) GetAvatarHp

func (g *Game) GetAvatarHp(avatarId uint32) uint32

func (*Game) GetBattleIdGuid

func (g *Game) GetBattleIdGuid() uint32

func (*Game) GetCurChallengeCsReq

func (g *Game) GetCurChallengeCsReq(payloadMsg []byte)

func (*Game) GetFirstTalkNpcCsReq

func (g *Game) GetFirstTalkNpcCsReq()

func (*Game) GetGacha

func (g *Game) GetGacha(gachaId uint32) *Num

func (*Game) GetMailCsReq

func (g *Game) GetMailCsReq()

func (*Game) GetNextGameObjectGuid

func (g *Game) GetNextGameObjectGuid() uint64

func (*Game) GetProbability

func (g *Game) GetProbability(gachaId uint32) (uint32, uint32)

func (*Game) GetQuestDataCsReq

func (g *Game) GetQuestDataCsReq(payloadMsg []byte)

func (*Game) GetRogueInfoCsReq

func (g *Game) GetRogueInfoCsReq(payloadMsg []byte)

func (*Game) GetRogueScoreRewardInfoCsReq

func (g *Game) GetRogueScoreRewardInfoCsReq()

func (*Game) GetRogueTalentInfoCsReq

func (g *Game) GetRogueTalentInfoCsReq()

func (*Game) GetSceneAvatarId

func (g *Game) GetSceneAvatarId() uint32

func (*Game) GetShopListCsReq

func (g *Game) GetShopListCsReq()

func (*Game) GetSkilltree

func (g *Game) GetSkilltree(avatarId uint32) []*proto.AvatarSkillTree

func (*Game) GmGive

func (g *Game) GmGive(payloadMsg pb.Message)

func (*Game) GmWorldLevel

func (g *Game) GmWorldLevel(payloadMsg pb.Message)

func (*Game) HandleGetActivityScheduleConfigCsReq

func (g *Game) HandleGetActivityScheduleConfigCsReq(payloadMsg []byte)

func (*Game) HandleGetAllLineupDataCsReq

func (g *Game) HandleGetAllLineupDataCsReq(payloadMsg []byte)

func (*Game) HandleGetArchiveDataCsReq

func (g *Game) HandleGetArchiveDataCsReq(payloadMsg []byte)

func (*Game) HandleGetAssistHistoryCsReq

func (g *Game) HandleGetAssistHistoryCsReq()

func (*Game) HandleGetAvatarDataCsReq

func (g *Game) HandleGetAvatarDataCsReq(payloadMsg []byte)

func (*Game) HandleGetBagCsReq

func (g *Game) HandleGetBagCsReq(payloadMsg []byte)

func (*Game) HandleGetBasicInfoCsReq

func (g *Game) HandleGetBasicInfoCsReq()

func (*Game) HandleGetChallengeCsReq

func (g *Game) HandleGetChallengeCsReq(payloadMsg []byte)

func (*Game) HandleGetChatEmojiListCsReq

func (g *Game) HandleGetChatEmojiListCsReq(payloadMsg []byte)

func (*Game) HandleGetCurLineupDataCsReq

func (g *Game) HandleGetCurLineupDataCsReq(payloadMsg []byte)

func (*Game) HandleGetCurSceneInfoCsReq

func (g *Game) HandleGetCurSceneInfoCsReq(payloadMsg []byte)

客户端登录需要的包,不是传送的通知包

func (*Game) HandleGetEnteredSceneCsReq

func (g *Game) HandleGetEnteredSceneCsReq(payloadMsg []byte)

func (*Game) HandleGetFriendLoginInfoCsReq

func (g *Game) HandleGetFriendLoginInfoCsReq(payloadMsg []byte)

func (*Game) HandleGetGachaCeilingCsReq

func (g *Game) HandleGetGachaCeilingCsReq(payloadMsg []byte)

func (*Game) HandleGetGachaInfoCsReq

func (g *Game) HandleGetGachaInfoCsReq(payloadMsg []byte)

func (*Game) HandleGetHeroBasicTypeInfoCsReq

func (g *Game) HandleGetHeroBasicTypeInfoCsReq(payloadMsg []byte)

func (*Game) HandleGetJukeboxDataCsReq

func (g *Game) HandleGetJukeboxDataCsReq(payloadMsg []byte)

func (*Game) HandleGetMissionStatusCsReq

func (g *Game) HandleGetMissionStatusCsReq(payloadMsg []byte)

func (*Game) HandleGetPhoneDataCsReq

func (g *Game) HandleGetPhoneDataCsReq(payloadMsg []byte)

func (*Game) HandleGetPlayerBoardDataCsReq

func (g *Game) HandleGetPlayerBoardDataCsReq(payloadMsg []byte)

func (*Game) HandleGetRogueHandbookDataCsReq

func (g *Game) HandleGetRogueHandbookDataCsReq(payloadMsg []byte)

func (*Game) HandleJoinLineupCsReq

func (g *Game) HandleJoinLineupCsReq(payloadMsg []byte)

func (*Game) HandlePlayerHeartBeatCsReq

func (g *Game) HandlePlayerHeartBeatCsReq(payloadMsg []byte)

func (*Game) HandlePlayerLoginCsReq

func (g *Game) HandlePlayerLoginCsReq(payloadMsg []byte)

func (*Game) HandlePlayerLoginFinishCsReq

func (g *Game) HandlePlayerLoginFinishCsReq(payloadMsg []byte)

func (*Game) HandleQueryProductInfoCsReq

func (g *Game) HandleQueryProductInfoCsReq(payloadMsg []byte)

func (*Game) HandleSwapLineupCsReq

func (g *Game) HandleSwapLineupCsReq(payloadMsg []byte)

func (*Game) HandleSwitchLineupIndexCsReq

func (g *Game) HandleSwitchLineupIndexCsReq(payloadMsg []byte)

func (*Game) HanldeGetSceneMapInfoCsReq

func (g *Game) HanldeGetSceneMapInfoCsReq(payloadMsg []byte)

func (*Game) InteractPropCsReq

func (g *Game) InteractPropCsReq()

func (*Game) KickPlayer

func (g *Game) KickPlayer() error

func (*Game) LeaveRogueCsReq

func (g *Game) LeaveRogueCsReq(payloadMsg []byte)

func (*Game) MaterialPlayerSyncScNotify

func (g *Game) MaterialPlayerSyncScNotify(tid uint32)

func (*Game) PVEBattleResultCsReq

func (g *Game) PVEBattleResultCsReq(payloadMsg []byte)

func (*Game) PlayerLogoutCsReq

func (g *Game) PlayerLogoutCsReq()

账号离线

func (*Game) PlayerPlayerSyncScNotify

func (g *Game) PlayerPlayerSyncScNotify()

角色状态改变时需要发送通知

func (*Game) PromoteAvatarCsReq

func (g *Game) PromoteAvatarCsReq(payloadMsg []byte)

func (*Game) PromoteEquipmentCsReq

func (g *Game) PromoteEquipmentCsReq(payloadMsg []byte)

func (*Game) QuitLineupCsReq

func (g *Game) QuitLineupCsReq(payloadMsg []byte)

func (*Game) QuitRogueCsReq

func (g *Game) QuitRogueCsReq(payloadMsg []byte)

func (*Game) RankUpAvatarCsReq

func (g *Game) RankUpAvatarCsReq(payloadMsg []byte)

func (*Game) RankUpEquipmentCsReq

func (g *Game) RankUpEquipmentCsReq(payloadMsg []byte)

func (*Game) RegisterMessage

func (g *Game) RegisterMessage(cmdId uint16, payloadMsg []byte)

func (*Game) RelicPlayerSyncScNotify

func (g *Game) RelicPlayerSyncScNotify(tid, uniqueId uint32)

func (*Game) RelicScenePlaneEventScNotify

func (g *Game) RelicScenePlaneEventScNotify(uniqueId uint32)

func (*Game) ReplaceLineupCsReq

func (g *Game) ReplaceLineupCsReq(payloadMsg []byte)

func (*Game) SceneCastSkillCsReq

func (g *Game) SceneCastSkillCsReq(payloadMsg []byte)

func (*Game) SceneEntityMoveCsReq

func (g *Game) SceneEntityMoveCsReq(payloadMsg []byte)

func (*Game) SceneEntityMoveScNotify

func (g *Game) SceneEntityMoveScNotify()

当前坐标通知

func (*Game) SceneGroupRefreshScNotify

func (g *Game) SceneGroupRefreshScNotify()

func (*Game) ScenePlaneEventScNotify

func (g *Game) ScenePlaneEventScNotify(id, num uint32)

func (*Game) Send

func (g *Game) Send(cmdid uint16, playerMsg pb.Message)

func (*Game) SetClientPausedCsReq

func (g *Game) SetClientPausedCsReq()

func (*Game) SetGameplayBirthdayCsReq

func (g *Game) SetGameplayBirthdayCsReq(payloadMsg []byte)

func (*Game) SetHeadIconCsReq

func (g *Game) SetHeadIconCsReq(payloadMsg []byte)

func (*Game) SetHeroBasicTypeCsReq

func (g *Game) SetHeroBasicTypeCsReq(payloadMsg []byte)

func (*Game) SetLineupNameCsReq

func (g *Game) SetLineupNameCsReq(payloadMsg []byte)

func (*Game) SetNicknameCsReq

func (g *Game) SetNicknameCsReq(payloadMsg []byte)

func (*Game) SetSignatureCsReq

func (g *Game) SetSignatureCsReq(payloadMsg []byte)

func (*Game) StaminaInfoScNotify

func (g *Game) StaminaInfoScNotify()

func (*Game) StartCocoonStageCsReq

func (g *Game) StartCocoonStageCsReq(payloadMsg []byte)

func (*Game) StartRogueCsReq

func (g *Game) StartRogueCsReq(payloadMsg []byte)

func (*Game) SubtractMaterial

func (g *Game) SubtractMaterial(tid, num uint32)

func (*Game) SwapLineup

func (g *Game) SwapLineup(index, src_slot, dst_slot uint32)

交换角色

func (*Game) SyncClientResVersionCsReq

func (g *Game) SyncClientResVersionCsReq(payloadMsg []byte)

func (*Game) SyncLineupNotify

func (g *Game) SyncLineupNotify(index uint32)

队伍更新通知

func (*Game) TakePromotionRewardCsReq

func (g *Game) TakePromotionRewardCsReq(payloadMsg []byte)

func (*Game) TextJoinQueryCsReq

func (g *Game) TextJoinQueryCsReq()

func (*Game) UnDbLineUp

func (g *Game) UnDbLineUp(index uint32, Slot uint32, avatarId uint32)

队伍更新

func (*Game) UnlockSkilltreeCsReq

func (g *Game) UnlockSkilltreeCsReq(payloadMsg []byte)

func (*Game) UpDataPlayer

func (g *Game) UpDataPlayer() error

type LineUp

type LineUp struct {
	Name         string
	AvatarIdList []uint32
}

type Material

type Material struct {
	Tid uint32 // id
	Num uint32 // 个数
}

type NetMsg

type NetMsg struct {
	G         *Game
	CmdId     uint16
	PlayerMsg pb.Message
	Type      string
}

type Num

type Num struct {
	CeilingNum               uint32 // 抽取次数
	Pity4                    uint32 // 几抽未四星up
	FailedFeaturedItemPulls4 bool
	FailedFeaturedItemPulls5 bool // 是否保底
}

type PlayerData

type PlayerData struct {
	PlayerId   uint32             // 玩家uid
	NickName   string             // 昵称
	Level      uint32             // 玩家等级
	Exp        uint32             // 玩家经验
	WorldLevel uint32             // 世界等级
	Mcoin      uint32             // 氪金的
	Signature  string             // 签名
	HeadImage  uint32             // 头像
	Birthday   uint32             // 生日
	DbScene    *DbScene           // 场景
	Pos        *Vector            // 存档坐标
	Rot        *Vector            // 存档朝向
	DbAvatar   *DbAvatar          // 角色数据
	DbLineUp   *DbLineUp          // 队伍
	DbItem     *DbItem            // 背包
	DbGacha    *Dbgacha           // 卡池抽取情况
	Battle     map[uint32]*Battle // 正在进行的战斗
	// 下面是在线数据
	BattleId              uint32                 `json:"-"` // 战斗id
	EntityBattleId        uint32                 `json:"-"` // 攻击实体id
	IsPaused              bool                   `json:"-"` // 是否暂停
	GameObjectGuidCounter uint64                 `json:"-"` // 游戏对象guid计数器
	IsNickName            bool                   `json:"-"` // 是否修改昵称
	EntityList            map[uint32]*EntityList `json:"-"` // 实体ID映射表
	IsRogue               bool                   `json:"-"` // 是否正在进行模拟宇宙
}

func NewAvatar

func NewAvatar(data *PlayerData, mainAvatar proto.HeroBasicType) *PlayerData

func NewDbLineUp

func NewDbLineUp(data *PlayerData) *PlayerData

func NewGaCha

func NewGaCha(data *PlayerData) *PlayerData

func NewItem

func NewItem(data *PlayerData) *PlayerData

func NewScene

func NewScene(data *PlayerData) *PlayerData

type Relic

type Relic struct {
	Tid          uint32 // id
	UniqueId     uint32 // 唯一ID
	Exp          uint32
	Level        uint32
	MainAffixId  uint32        // 主词条
	RelicAffix   []*RelicAffix // 词条
	BaseAvatarId uint32        // 装备角色
	IsProtected  bool          // 是否锁定
}

type RelicAffix

type RelicAffix struct {
	AffixId uint32
	Cnt     uint32
	Step    uint32
}

type Rogue

type Rogue struct {
}

type Skilltree

type Skilltree struct {
	PointId uint32
	Level   uint32
}

type SpBarInfo

type SpBarInfo struct {
	CurSp uint32
	MaxSp uint32
}

type Vector

type Vector struct {
	X int
	Y int
	Z int
}

Jump to

Keyboard shortcuts

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