All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
feat(controller): 增强命令注册逻辑并修复试炼塔关卡限制 - 在命令注册时检查重复方法,如果存在则panic提示错误 - 移除CurrentFreshStage和CurrentStage的默认值设置逻辑 - 添加关卡等级验证,确保用户不能挑战超过最大关卡数的关卡 - 修复试炼之塔和勇者之塔的关卡计算逻辑 fix(item): 修复道具
159 lines
5.6 KiB
Go
159 lines
5.6 KiB
Go
package fight
|
||
|
||
import (
|
||
"blazing/logic/service/common"
|
||
_ "blazing/logic/service/fight/boss"
|
||
_ "blazing/logic/service/fight/effect"
|
||
)
|
||
|
||
// 野怪对战包
|
||
type FightNpcMonsterInboundInfo struct {
|
||
Head common.TomeeHeader `cmd:"2408" struc:"skip"`
|
||
// Number 地图刷新怪物结构体对应的序号(1-9的位置序号)
|
||
|
||
Number uint32 `fieldDesc:"地图刷新怪物结构体对应的序号 1 - 9 的位置序号" `
|
||
}
|
||
type ChallengeBossInboundInfo struct {
|
||
Head common.TomeeHeader `cmd:"2411" struc:"skip"`
|
||
BossId uint32 `json:"bossId"`
|
||
}
|
||
type NullOutboundInfo struct {
|
||
}
|
||
|
||
type S2C_ChoiceLevelRequestInfo struct {
|
||
CurFightLevel uint32 `json:"curFightLevel"` // 当前战斗层数
|
||
BossLen uint32 `struc:"sizeof=BossID"`
|
||
BossID []uint32 `json:"bossId"` // 下一层的精灵id数组
|
||
}
|
||
|
||
// 准备战斗包
|
||
type ReadyToFightInboundInfo struct {
|
||
Head common.TomeeHeader `cmd:"2404" struc:"skip"`
|
||
}
|
||
|
||
// 战斗逃跑
|
||
type EscapeFightInboundInfo struct {
|
||
Head common.TomeeHeader `cmd:"2410" struc:"skip"`
|
||
}
|
||
|
||
// 精灵王
|
||
type StartPetWarInboundInfo struct {
|
||
Head common.TomeeHeader `cmd:"2431" struc:"skip"`
|
||
}
|
||
type StartTwarInboundInfo struct {
|
||
Head common.TomeeHeader `cmd:"2429|2415|2425" struc:"skip"`
|
||
}
|
||
type ARENA_SET_OWENR struct {
|
||
Head common.TomeeHeader `cmd:"2417" struc:"skip"`
|
||
}
|
||
type ARENA_FIGHT_OWENR struct {
|
||
Head common.TomeeHeader `cmd:"2418" struc:"skip"`
|
||
}
|
||
|
||
type ARENA_GET_INFO struct {
|
||
Head common.TomeeHeader `cmd:"2419" struc:"skip"`
|
||
}
|
||
|
||
type ARENA_UPFIGHT struct {
|
||
Head common.TomeeHeader `cmd:"2420" struc:"skip"`
|
||
}
|
||
type ARENA_OWENR_ACCE struct {
|
||
Head common.TomeeHeader `cmd:"2422" struc:"skip"`
|
||
}
|
||
|
||
// 表示"宠物王加入"的入站消息数据
|
||
type PetKingJoinInboundInfo struct {
|
||
Head common.TomeeHeader `cmd:"2413" struc:"skip"`
|
||
Type uint32 // 战斗类型:5=单精灵,6=多精灵,11=精灵大师赛 (对应Java的@UInt long type)
|
||
FightType uint32 // 仅当Type为11时有效 (对应Java的@UInt long fightType)
|
||
}
|
||
|
||
// HandleFightInviteInboundInfo 处理战斗邀请的入站消息
|
||
|
||
type HandleFightInviteInboundInfo struct {
|
||
Head common.TomeeHeader `cmd:"2403" struc:"skip"`
|
||
UserID uint32 `json:"userId" codec:"userId,uint"` // 邀请我对战人的userid
|
||
Flag uint32 `json:"flag" codec:"flag,uint"` // 1为同意对战 0为取消对战
|
||
Mode uint32 `json:"mode" codec:"mode,uint"` // 战斗类型 1 = 1v1 2 = 6v6
|
||
}
|
||
|
||
type InviteToFightInboundInfo struct {
|
||
Head common.TomeeHeader `cmd:"2401" struc:"skip"`
|
||
|
||
UserID uint32
|
||
|
||
// Mode 战斗类型 1 = 1v1 2 = 6v6
|
||
Mode uint32
|
||
}
|
||
type InviteFightCancelInboundInfo struct {
|
||
Head common.TomeeHeader `cmd:"2402" struc:"skip"`
|
||
}
|
||
|
||
// 2502的回复包 PVP邀请消息
|
||
type NoteHandleFightInviteOutboundInfo struct {
|
||
UserID uint32
|
||
Nickname string `struc:"[16]byte"` // 固定长度16字节
|
||
Result uint32 // 0=拒绝 1=同意 2=在线超6小时 3=无出战精灵 4=不在线
|
||
}
|
||
|
||
type UseSkillInInfo struct {
|
||
Head common.TomeeHeader `cmd:"2405" struc:"skip"`
|
||
// 技能id,
|
||
SkillId uint32
|
||
}
|
||
type ChangePetInboundInfo struct {
|
||
Head common.TomeeHeader `cmd:"2407" struc:"skip"`
|
||
// CatchTime 捕捉时间
|
||
CatchTime uint32 `json:"catchTime"`
|
||
}
|
||
type CatchMonsterInboundInfo struct {
|
||
Head common.TomeeHeader `cmd:"2409" struc:"skip"`
|
||
// CapsuleId 胶囊id
|
||
|
||
CapsuleId uint32 `json:"capsuleId" fieldDescription:"胶囊id" uint:"true"`
|
||
}
|
||
|
||
type LoadPercentInboundInfo struct {
|
||
Head common.TomeeHeader `cmd:"2441" struc:"skip"`
|
||
Percent uint32 `fieldDescription:"加载百分比"`
|
||
}
|
||
|
||
// UsePetItemInboundInfo 对应Java的UsePetItemInboundInfo,实现InboundMessage接口
|
||
type UsePetItemInboundInfo struct {
|
||
Head common.TomeeHeader `cmd:"2406" struc:"skip"`
|
||
// 字段首字母大写以导出(对应Java的可访问性,配合@Data的getter/setter)
|
||
CatchTime uint32 `description:"精灵捕获时间" codec:"catchTime"` // @UInt long 对应Go的uint32(无符号64位)
|
||
ItemId uint32 `description:"使用的物品ID" codec:"itemId"` // 结构体标签模拟@FieldDescription和@AutoCodec注解
|
||
Reversed1 uint32 `description:"填充字段 0" codec:"reversed1"` // reversed1对应原Java的填充字段
|
||
}
|
||
type ChatInfo struct {
|
||
Head common.TomeeHeader `cmd:"50002" struc:"skip"`
|
||
Reserve uint32 `json:"reserve" fieldDescription:"填充 默认值为0" uint:"true"` // @UInt long reserve,无符号长整数
|
||
MessageLen uint32 `struc:"sizeof=Message"`
|
||
Message string `json:"message" fieldDescription:"消息内容, 结束符为utf-8的数字0"` // 消息内容,包含utf-8空字符('\x00')作为结束符
|
||
}
|
||
type C2S_FRESH_CHOICE_FIGHT_LEVEL struct {
|
||
Head common.TomeeHeader `cmd:"2428|2414" struc:"skip"`
|
||
|
||
Level uint `json:"level"` // 若使用JSON序列化,添加tag;若用protobuf可替换为对应的tag
|
||
}
|
||
type C2S_OPEN_DARKPORTAL struct {
|
||
Head common.TomeeHeader `cmd:"2424" struc:"skip"`
|
||
|
||
Level uint32 `json:"level"` // 若使用JSON序列化,添加tag;若用protobuf可替换为对应的tag
|
||
}
|
||
type S2C_OPEN_DARKPORTAL struct {
|
||
CurBossID uint32 `json:"curBossID"`
|
||
}
|
||
|
||
type S2C_FreshChoiceLevelRequestInfo struct {
|
||
// CurFightLevel 当前战斗层数(对应前端 curFightLevel 字段)
|
||
CurFightLevel uint32 `json:"curFightLevel"` // JSON序列化tag,保证字段名与前端一致
|
||
BossIdLen uint32 `struc:"sizeof=BossId"`
|
||
// BossId 当前层数的精灵ID数组(对应前端 bossId 字段,C# List<uint> 对应Go []uint切片)
|
||
BossId []uint32 `json:"bossId"`
|
||
}
|
||
type FRESH_LEAVE_FIGHT_LEVEL struct {
|
||
Head common.TomeeHeader `cmd:"2430|2416|2426" struc:"skip"`
|
||
}
|