All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
``` docs(readme): 更新文档说明 - 添加项目使用指南 - 完善API接口说明 - 修正错误的配置示例 ``` 注意:由于未提供具体的代码差异信息,以上为示例格式。实际使用时请根据具体的代码变更内容填写相应的type、scope、subject和body信息。
240 lines
7.3 KiB
Go
240 lines
7.3 KiB
Go
package info
|
||
|
||
import (
|
||
"blazing/modules/player/model"
|
||
|
||
"github.com/tnnmigga/enum"
|
||
)
|
||
|
||
type ChangePetInfo struct {
|
||
// UserId 米米号,野怪为0
|
||
UserId uint32 `json:"userId"`
|
||
// ActorIndex 当前发生切宠的战斗位
|
||
ActorIndex uint32 `json:"actorIndex"`
|
||
// PetId 切换上场的精灵编号
|
||
ID uint32 `fieldDesc:"当前对战精灵ID" `
|
||
// PetName 精灵名字,固定16字节长度
|
||
Name string `struc:"[16]byte"`
|
||
// Level 切换上场的精灵等级
|
||
Level uint32 `json:"level"`
|
||
// Hp 切换上场的精灵当前生命值
|
||
Hp uint32 `json:"hp"`
|
||
// MaxHp 切换上场的精灵最大生命值
|
||
MaxHp uint32 `json:"maxHp"`
|
||
CatchTime uint32 `fieldDesc:"捕捉时间" `
|
||
}
|
||
type NoteInviteToFightOutboundInfo struct {
|
||
UserID uint32 `codec:"true"`
|
||
Nick string `struc:"[16]byte" default:"seer" json:"nick"` // 16字节昵称
|
||
// Mode 战斗模式 1 = 1v1 2 = 6v6
|
||
|
||
Mode uint32 `codec:"true"`
|
||
}
|
||
|
||
type S2C_NOTE_HANDLE_FIGHT_INVITE struct {
|
||
// UserID 对方的userid
|
||
UserID uint32
|
||
|
||
Nick string `struc:"[16]byte" default:"seer" json:"nick"` // 16字节昵称
|
||
// Result 处理结果
|
||
// 0=对方拒绝了对战
|
||
// 1=对方同意了对战
|
||
// 2=对方在线时长超过6小时
|
||
// 3=对方没有可出战的精灵
|
||
// 4=对方不在线
|
||
Result uint32
|
||
}
|
||
type Fightinfo struct {
|
||
///PlayerID uint32
|
||
// 战斗模式 1 = 1v1 2 = 6v6 3大乱斗 0 什么都不做
|
||
Mode uint32
|
||
//Type uint32 //战斗类型
|
||
|
||
Status uint32
|
||
FightType uint32
|
||
}
|
||
type RPCFightinfo struct {
|
||
Type int //加入还是退出
|
||
PlayerID uint32
|
||
// 战斗模式 1 = 1v1 2 = 6v6 3大乱斗 0 什么都不做
|
||
Mode uint32
|
||
//Type uint32 //战斗类型
|
||
|
||
Status uint32
|
||
// FightType uint32
|
||
}
|
||
type RPCFightStartinfo struct {
|
||
Serverid int // 非0表示rpc跨服
|
||
PlayerID uint32
|
||
// 战斗模式 1 = 1v1 2 = 6v6 3大乱斗 0 什么都不做
|
||
Mode uint32
|
||
//Type uint32 //战斗类型
|
||
|
||
Status uint32
|
||
}
|
||
|
||
// FightPetInfo 战斗精灵信息结构体,FightPetInfo类
|
||
type FightPetInfo struct {
|
||
// 用户ID(野怪为0)
|
||
UserID uint32 `fieldDesc:"用户ID 野怪为0" `
|
||
// ActorIndex 当前战斗位下标
|
||
ActorIndex uint32 `json:"actorIndex"`
|
||
// ControllerUserID 当前战斗位绑定的操作者
|
||
ControllerUserID uint32 `json:"controllerUserId"`
|
||
|
||
// 当前对战精灵ID
|
||
ID uint32 `fieldDesc:"当前对战精灵ID" `
|
||
|
||
Name string `struc:"[16]byte"`
|
||
// 精灵的捕获时间
|
||
CatchTime uint32 `fieldDesc:"精灵的捕获时间" `
|
||
|
||
// 当前HP
|
||
Hp uint32 `fieldDesc:"当前HP" `
|
||
|
||
// 最大HP
|
||
MaxHp uint32 `fieldDesc:"最大HP" `
|
||
|
||
// 当前等级
|
||
Level uint32 `fieldDesc:"当前等级" `
|
||
|
||
// 精灵是否能捕捉(1为能捕捉,0为不能捕捉),
|
||
Catchable uint32 `fieldDesc:"精灵是否能捕捉. 1为能捕捉 0为不能捕捉" `
|
||
//能力提升属性
|
||
Prop [6]int8
|
||
}
|
||
|
||
func NewAttackValue(userid uint32) *model.AttackValue {
|
||
return &model.AttackValue{
|
||
UserID: userid,
|
||
ActorIndex: 0,
|
||
TargetIndex: 0,
|
||
SkillID: 0,
|
||
AttackTime: 0,
|
||
LostHp: 0,
|
||
GainHp: 0,
|
||
RemainHp: 0,
|
||
MaxHp: 0,
|
||
State: 0,
|
||
SkillList: []model.SkillInfo{},
|
||
IsCritical: 0,
|
||
Status: [20]int8{},
|
||
Prop: [6]int8{},
|
||
Offensive: 0,
|
||
}
|
||
}
|
||
|
||
type WeakenedS struct {
|
||
Stack int8 `struc:"skip"`
|
||
Round int8
|
||
}
|
||
|
||
// 定义战斗状态枚举
|
||
// EnumPetStatus:宠物战斗异常/增益状态枚举,值范围 0-255
|
||
var PetStatus = enum.New[struct {
|
||
// 无状态(默认值)
|
||
NULL EnumPetStatus `enum:"255"`
|
||
// 麻痹:行动概率降低,有概率无法出手
|
||
Paralysis EnumPetStatus `enum:"0"`
|
||
// 中毒:每回合损失一定比例体力,持续至解除
|
||
Poisoned EnumPetStatus `enum:"1"`
|
||
// 烧伤:每回合损失体力,物理攻击威力降低50%
|
||
Burned EnumPetStatus `enum:"2"`
|
||
// 吸血:攻击时吸取对方体力回复自身(比例生效)
|
||
DrainHP EnumPetStatus `enum:"3"`
|
||
// 被吸血:自身体力被对方攻击时按比例被吸取
|
||
DrainedHP EnumPetStatus `enum:"4"`
|
||
// 冻伤:每回合损失体力,有概率无法行动,火系攻击可解除
|
||
Frozen EnumPetStatus `enum:"5"`
|
||
// 害怕:本回合完全无法进行攻击类操作
|
||
Fear EnumPetStatus `enum:"6"`
|
||
// 疲惫:连续使用同一技能后触发,暂时无法使用该技能
|
||
Tired EnumPetStatus `enum:"7"`
|
||
// 睡眠:无法行动,持续1-3回合后苏醒,受攻击可提前解除
|
||
Sleep EnumPetStatus `enum:"8"`
|
||
// 石化:无法行动,受到攻击时有概率解除,否则持续至回合结束
|
||
Petrified EnumPetStatus `enum:"9"`
|
||
// 混乱:行动时有概率攻击自身,持续若干回合后解除
|
||
Confused EnumPetStatus `enum:"10"`
|
||
// 衰弱:全属性降低,伤害输出减少,受治疗效果降低
|
||
Weakened EnumPetStatus `enum:"11"`
|
||
// 山神守护:免疫大部分异常状态,受到的所有伤害降低
|
||
MountainGodGuard EnumPetStatus `enum:"12"`
|
||
// 易燃:受到火系伤害翻倍,持续3回合或被火系攻击命中后解除
|
||
Flammable EnumPetStatus `enum:"13"`
|
||
// 狂暴:攻击属性提升,防御属性降低,无法自主选择攻击目标
|
||
Berserk EnumPetStatus `enum:"14"`
|
||
// 冰封:完全无法行动,持续固定回合数,仅特定技能可解除
|
||
IceBound EnumPetStatus `enum:"15"`
|
||
// 流血:每回合损失固定比例体力,无视部分防御效果
|
||
Bleeding EnumPetStatus `enum:"16"`
|
||
// 免疫能力下降:不会被敌方技能降低攻击/防御/速度等属性
|
||
ImmuneToStatDrop EnumPetStatus `enum:"17"`
|
||
// 免疫异常状态:不会被附加麻痹/中毒/烧伤等所有异常状态
|
||
ImmuneToAbnormal EnumPetStatus `enum:"18"`
|
||
// 瘫痪:完全无法行动,比麻痹效果更强,无概率解除
|
||
Paralyzed EnumPetStatus `enum:"19"`
|
||
// 失明:命中概率大幅降低,技能命中率下降
|
||
Blind EnumPetStatus `enum:"20"`
|
||
}]()
|
||
|
||
// 枚举类型别名(根据实际枚举库要求定义)
|
||
type EnumPetStatus = byte
|
||
|
||
// 精灵的能力提升
|
||
type PropDict struct {
|
||
Attack int8
|
||
Defence int8
|
||
SpecialAttack int8
|
||
SpecialDefence int8
|
||
|
||
Speed int8
|
||
Accuracy int8
|
||
}
|
||
|
||
// BattleLevels 战斗属性等级结构体,对应原6字节数组
|
||
|
||
// NoteUseSkillOutboundInfo 战斗技能使用通知的出站信息结构体
|
||
type NoteUseSkillOutboundInfo struct {
|
||
FirstAttackInfo model.AttackValue // 本轮先手方精灵在释放技能结束后的状态
|
||
SecondAttackInfo model.AttackValue // 本轮后手方精灵在释放技能结束后的状态
|
||
}
|
||
|
||
type FightStartOutboundInfo struct {
|
||
IsCanAuto uint32 `fieldDesc:"是否自动 默认给0 怀疑是自动战斗器使用的" `
|
||
|
||
Info1Len uint32 `struc:"sizeof=Info1"`
|
||
// 我方当前战斗精灵信息(前端通过userid判断是否为我方)
|
||
Info1 []FightPetInfo
|
||
|
||
Info2Len uint32 `struc:"sizeof=Info2"`
|
||
// 对方当前战斗精灵信息(前端通过userid判断是否为我方)
|
||
Info2 []FightPetInfo
|
||
}
|
||
|
||
type S2C_2404 struct {
|
||
// 用户ID(野怪为0)
|
||
UserID uint32 `fieldDesc:"userID 如果为野怪则为0" `
|
||
}
|
||
type S2C_50005 struct {
|
||
//奖励称号
|
||
Title uint32
|
||
}
|
||
|
||
// FightOverInfo 战斗结束信息结构体 2506
|
||
|
||
type CatchMonsterOutboundInfo struct {
|
||
// CatchTime 捕捉时间
|
||
|
||
CatchTime uint32 `json:"catchTime" `
|
||
// PetId 宠物编号
|
||
|
||
PetId uint32 `json:"petId" `
|
||
}
|
||
type LoadPercentOutboundInfo struct {
|
||
// 玩家userId,使用结构体标签模拟注解
|
||
Id uint32 `fieldDescription:"玩家userId" autoCodec:"true"`
|
||
// 加载百分比,使用结构体标签模拟注解
|
||
Percent uint32 `fieldDescription:"加载百分比" autoCodec:"true"`
|
||
}
|