- 移除 common/data/socket 目录下的大部分文件 - 新增 service 目录,将 Player 和 Conn 结构体移至该目录 - 更新 LogicClient 中的方法签名,使用 service 包的类型 - 重构 Controller 中的方法,适应新的 service 包结构
147 lines
6.8 KiB
Go
147 lines
6.8 KiB
Go
package info
|
||
|
||
import (
|
||
"blazing/modules/blazing/model"
|
||
"fmt"
|
||
)
|
||
|
||
// FightPetInfo 战斗精灵信息结构体,FightPetInfo类
|
||
type FightPetInfo struct {
|
||
// 用户ID(野怪为0),@UInt long
|
||
UserID uint32 `fieldDesc:"用户ID 野怪为0" `
|
||
|
||
// 当前对战精灵ID,@UInt long
|
||
ID uint32 `fieldDesc:"当前对战精灵ID" `
|
||
|
||
Name string `struc:"[16]byte"`
|
||
// 精灵的捕获时间,@UInt long
|
||
CatchTime uint32 `fieldDesc:"精灵的捕获时间" `
|
||
|
||
// 当前HP,@UInt long
|
||
Hp uint32 `fieldDesc:"当前HP" `
|
||
|
||
// 最大HP,@UInt long
|
||
MaxHp uint32 `fieldDesc:"最大HP" `
|
||
|
||
// 当前等级,@UInt long
|
||
Level uint32 `fieldDesc:"当前等级" `
|
||
|
||
// 精灵是否能捕捉(1为能捕捉,0为不能捕捉),@UInt long
|
||
Catchable uint32 `fieldDesc:"精灵是否能捕捉. 1为能捕捉 0为不能捕捉" `
|
||
|
||
// 战斗属性等级数组(6个单字节)
|
||
// byte[],固定长度6,存储buff等级、攻击、速度等属性
|
||
BattleLV [6]byte `fieldDesc:"这里实际上应该是6个单字节byte, 内容为buff等级 攻击 速度 特攻 防御 特防 命中等.但具体顺序未知可能需要测试. 具体数值为1-6等级" serialize:"fixedLength=6,type=byteArray"`
|
||
}
|
||
|
||
// AttackValue 战斗中的攻击数值信息
|
||
type AttackValue struct {
|
||
UserID uint32 `json:"userId" fieldDescription:"玩家的米米号 与野怪对战userid = 0"`
|
||
SkillID uint32 `json:"skillId" fieldDescription:"使用技能的id"`
|
||
AttackTime uint32 `json:"attackTime" fieldDescription:"是否击中 如果为0 则miss 如果为1 则击中"`
|
||
LostHp uint32 `json:"lostHp" fieldDescription:"我方造成的伤害"`
|
||
GainHp uint32 `json:"gainHp" fieldDescription:"我方获得血量"`
|
||
RemainHp uint32 `json:"remainHp" fieldDescription:"我方剩余血量"`
|
||
MaxHp uint32 `json:"maxHp" fieldDescription:"我方最大血量"`
|
||
State uint32 `json:"state" fieldDescription:"固定值0 需要后续测试"`
|
||
SkillList []model.SkillInfo `json:"skillList" fieldDescription:"根据精灵的数据插入技能 最多4条 不定长"`
|
||
IsCritical uint32 `json:"isCritical" fieldDescription:"是否暴击"`
|
||
Status [20]byte `json:"status" fieldDescription:"20个字节 各种状态: 0:\"麻痹\",1:\"中毒\",2:\"烧伤\",4:\"寄生\",5:\"冻伤\",6:\"害怕\",7:\"疲惫\",8:\"睡眠\",9:\"石化\",10:\"混乱\",15:\"冰封\",16:\"流血\""`
|
||
BattleLv [6]byte `json:"battleLv" fieldDescription:"6个单字节byte, 内容为buff等级 攻击 速度 特攻 防御 特防命中等. 但具体顺序未知可能需要测试. 具体数值为1-6等级"`
|
||
// OwnerMaxShield uint32 `json:"ownerMaxShield" fieldDescription:"我方最大护盾"`
|
||
// OwnerCurrentShield uint32 `json:"ownerCurrentShield" fieldDescription:"我方当前护盾"`
|
||
}
|
||
|
||
// NoteUseSkillOutboundInfo 战斗技能使用通知的出站信息结构体
|
||
type NoteUseSkillOutboundInfo struct {
|
||
FirstAttackInfo AttackValue // 本轮先手的精灵在释放技能结束后的状态
|
||
SecondAttackInfo AttackValue // 本轮后手的精灵在释放技能结束后的状态
|
||
}
|
||
|
||
type FightStartOutboundInfo struct {
|
||
// @UInt long类型
|
||
IsCanAuto uint32 `fieldDesc:"是否自动 默认给0 怀疑是自动战斗器使用的" `
|
||
|
||
// 当前战斗精灵信息1(前端通过userid判断是否为我方)
|
||
Info1 FightPetInfo `fieldDesc:"当前战斗精灵的信息 可能不准.看前端代码是以userid来判断哪个结构体是我方的" serialize:"struct"`
|
||
|
||
// 当前战斗精灵信息2(前端通过userid判断是否为我方)
|
||
Info2 FightPetInfo `fieldDesc:"当前战斗精灵的信息 可能不准.看前端代码是以userid来判断哪个结构体是我方的" serialize:"struct"`
|
||
}
|
||
|
||
type FightUserInfo struct {
|
||
// 用户ID(野怪为0),@UInt long
|
||
UserID uint32 `fieldDesc:"userID 如果为野怪则为0" `
|
||
|
||
// 玩家名称(野怪为UTF-8的'-',固定16字节)
|
||
// 使用[16]byte存储固定长度的字节数组
|
||
Nick string `struc:"[16]byte"`
|
||
}
|
||
|
||
// NoteReadyToFightInfo 战斗准备就绪消息结构体,NoteReadyToFightInfo
|
||
type NoteReadyToFightInfo struct {
|
||
MAXPET uint32 `struc:"skip"` //,最大精灵数
|
||
//战斗发起者ID
|
||
OwnerID uint32 `struc:"skip"`
|
||
|
||
AFinished bool `struc:"skip"`
|
||
BFinished bool `struc:"skip"`
|
||
// 战斗类型ID(与野怪战斗为3,与人战斗为1,前端似乎未使用)
|
||
// @UInt long
|
||
FightId EnumBattleMode `fieldDesc:"战斗类型ID 但前端好像没有用到 与野怪战斗为3,与人战斗似乎是1" `
|
||
|
||
// 我方信息
|
||
OurInfo FightUserInfo `fieldDesc:"我方信息" serialize:"struct"`
|
||
// Our *socket.Player `struc:"skip"`
|
||
OurPetListLen uint32 `struc:"sizeof=OurPetList"`
|
||
// 我方携带精灵的信息
|
||
// ArrayList<ReadyFightPetInfo>,使用切片模拟动态列表
|
||
OurPetList []ReadyFightPetInfo `fieldDesc:"我方携带精灵的信息" serialize:"lengthFirst,lengthType=uint16,type=structArray"`
|
||
|
||
// 对方信息
|
||
OpponentInfo FightUserInfo `fieldDesc:"对方信息" serialize:"struct"`
|
||
//Opp *socket.Player `struc:"skip"`
|
||
OpponentPetListLen uint32 `struc:"sizeof=OpponentPetList"`
|
||
// 敌方的精灵信息
|
||
// 野怪战斗时:客户端接收此包前已生成精灵PetInfo,将部分信息写入该列表
|
||
OpponentPetList []ReadyFightPetInfo `fieldDesc:"敌方的精灵信息 如果是野怪 那么再给客户端发送这个包体时就提前生成好了这只精灵的PetInfo,然后把从PetInfo中把部分信息写入到这个敌方的精灵信息中再发送这个包结构体" serialize:"lengthFirst,lengthType=uint16,type=structArray"`
|
||
}
|
||
|
||
// 当A和B都 这时候给双方回复开始战斗包
|
||
func (t *NoteReadyToFightInfo) onBothFinished() {
|
||
fmt.Println("A和B都已完成,触发onBothFinished")
|
||
}
|
||
|
||
// ReadyFightPetInfo 准备战斗的精灵信息结构体,ReadyFightPetInfo类
|
||
type ReadyFightPetInfo struct {
|
||
// 精灵ID,@UInt long
|
||
ID uint32 `fieldDesc:"精灵ID" `
|
||
|
||
// 精灵等级,@UInt long
|
||
Level uint32 `fieldDesc:"精灵等级" `
|
||
|
||
// 精灵当前HP,@UInt long
|
||
Hp uint32 `fieldDesc:"精灵HP" `
|
||
|
||
// 精灵最大HP,@UInt long
|
||
MaxHp uint32 `fieldDesc:"最大HP" `
|
||
SkillListLen uint32
|
||
// 技能信息列表(固定4个元素,技能ID和剩余PP,无技能则为0)
|
||
// List<SkillInfo>,初始化容量为4
|
||
SkillList [4]model.SkillInfo `fieldDesc:"技能信息 技能ID跟剩余PP 固定32字节 没有给0" serialize:"fixedLength=4,type=structArray"`
|
||
|
||
// 精灵捕获时间,@UInt long
|
||
CatchTime uint32 `fieldDesc:"精灵捕获时间" `
|
||
|
||
// 捕捉地图(固定给0),@UInt long
|
||
CatchMap uint32 `fieldDesc:"捕捉地图 给0" `
|
||
|
||
// 固定给0,@UInt long
|
||
CatchRect uint32 `fieldDesc:"给0" `
|
||
|
||
// 固定给0,@UInt long
|
||
CatchLevel uint32 `fieldDesc:"给0" `
|
||
SkinID uint32 `fieldDesc:"精灵皮肤ID" `
|
||
Shiny uint32 `fieldDesc:"精灵是否闪" `
|
||
}
|