refactor(fight/xmlres): 重构效果参数处理逻辑,新增JSON解析支持并优化战斗伤害计算
This commit is contained in:
21
common/data/xmlres/effectarg.go
Normal file
21
common/data/xmlres/effectarg.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package xmlres
|
||||
|
||||
type EffectArg struct {
|
||||
SideEffects struct {
|
||||
SideEffect []struct {
|
||||
ID int `json:"ID"`
|
||||
SideEffectArgcount int `json:"SideEffectArgcount"`
|
||||
SideEffectArg string `json:"SideEffectArg,omitempty"`
|
||||
} `json:"SideEffect"`
|
||||
} `json:"SideEffects"`
|
||||
}
|
||||
|
||||
var EffectArgs map[int]int
|
||||
|
||||
func init() {
|
||||
EffectArgs = make(map[int]int)
|
||||
for _, t := range EffectArgsConfig.SideEffects.SideEffect {
|
||||
EffectArgs[t.ID] = t.SideEffectArgcount
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package xmlres
|
||||
|
||||
import (
|
||||
"blazing/common/utils"
|
||||
"encoding/json"
|
||||
"os"
|
||||
|
||||
"github.com/ECUST-XX/xml"
|
||||
@@ -23,11 +24,21 @@ func getXml[T any](path string) T {
|
||||
|
||||
return xmls
|
||||
}
|
||||
func getJson[T any](path string) T {
|
||||
|
||||
// 解析XML到结构体
|
||||
var xmls T
|
||||
t1 := gfile.GetBytes(path)
|
||||
json.Unmarshal(t1, &xmls)
|
||||
|
||||
return xmls
|
||||
}
|
||||
|
||||
var (
|
||||
MapConfig Maps //地图配置
|
||||
ItemsConfig Items //物品配置
|
||||
TalkConfig TalkCount //任务配置
|
||||
MapConfig Maps //地图配置
|
||||
ItemsConfig Items //物品配置
|
||||
EffectArgsConfig EffectArg //arg参数
|
||||
TalkConfig TalkCount //任务配置
|
||||
//Monster MonsterRoot //野怪配置
|
||||
MonsterMap map[int]TMapConfig
|
||||
//Skill MovesTbl //技能配置
|
||||
@@ -44,7 +55,7 @@ func initfile() {
|
||||
path = path1 + "/public/config/"
|
||||
MapConfig = getXml[Maps](path + "210.xml")
|
||||
ItemsConfig = getXml[Items](path + "43.xml")
|
||||
|
||||
EffectArgsConfig = getJson[EffectArg](path + "side_effect.json")
|
||||
ItemsMAP = utils.ToMap[Item, int](ItemsConfig.Items, func(m Item) int {
|
||||
return m.ID
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ type Effect62 struct {
|
||||
func init() {
|
||||
input.InitSkillEffect(62, &Effect62{
|
||||
EffectNode: node.EffectNode{
|
||||
ArgSize: 1,
|
||||
Owner: true,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ type Effect67 struct {
|
||||
func init() {
|
||||
input.InitSkillEffect(67, &Effect67{
|
||||
EffectNode: node.EffectNode{
|
||||
ArgSize: 1,
|
||||
Owner: true,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -11,9 +11,7 @@ import (
|
||||
|
||||
func init() {
|
||||
input.InitSkillEffect(9, &Effect9{
|
||||
EffectNode: node.EffectNode{
|
||||
ArgSize: 2,
|
||||
},
|
||||
EffectNode: node.EffectNode{},
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -16,9 +16,7 @@ func init() {
|
||||
func NewEffectStat(b bool) input.Effect {
|
||||
|
||||
return &EffectStat{
|
||||
node.EffectNode{
|
||||
ArgSize: 3,
|
||||
},
|
||||
node.EffectNode{},
|
||||
b,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package fight
|
||||
|
||||
import (
|
||||
"blazing/common/data/xmlres"
|
||||
"blazing/logic/service/common"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
@@ -12,7 +13,6 @@ import (
|
||||
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/mohae/deepcopy"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
type FightC struct {
|
||||
@@ -377,7 +377,7 @@ func (f *FightC) parseskill(attacker, defender *input.Input, id *SelectSkillActi
|
||||
|
||||
if ok { //获取成功
|
||||
|
||||
args := t.GetArgSize()
|
||||
args := xmlres.EffectArgs[v]
|
||||
eff := deepcopy.Copy(t).(input.Effect)
|
||||
eff.SetArgs(temparg[:args]) //设置入参
|
||||
|
||||
@@ -437,7 +437,8 @@ func (f *FightC) processSkillAttack(attacker, defender *input.Input, a *SelectSk
|
||||
if attacker.AttackValue.AttackTime > 0 { //如果命中
|
||||
f.parseskill(attacker, defender, a) //命中后解析effect
|
||||
spower := a.Skill.CalculatePower(defender.CurrentPet)
|
||||
attacker.Damage = spower
|
||||
damage := attacker.GetDamageEffect(1)
|
||||
damage.Stack(int(spower.IntPart()))
|
||||
attacker.Exec(func(t input.Effect) bool { //计算暴击率加成
|
||||
|
||||
t.IsCrit(defender, a.Skill)
|
||||
@@ -445,12 +446,13 @@ func (f *FightC) processSkillAttack(attacker, defender *input.Input, a *SelectSk
|
||||
return attacker.AttackValue.IsCritical == 0
|
||||
})
|
||||
if attacker.AttackValue.IsCritical == 1 {
|
||||
attacker.Damage = attacker.Damage.Mul(decimal.NewFromInt(2)) //暴击翻倍
|
||||
damage.Stack(int(spower.IntPart() * 2)) //暴击翻倍
|
||||
|
||||
}
|
||||
if uint32(attacker.Damage.IntPart()) > defender.CurrentPet.Info.Hp {
|
||||
if uint32(damage.Stack()) > defender.CurrentPet.Info.Hp {
|
||||
defender.CurrentPet.Info.Hp = 0
|
||||
} else {
|
||||
defender.CurrentPet.Info.Hp = defender.CurrentPet.Info.Hp - uint32(attacker.Damage.IntPart())
|
||||
defender.CurrentPet.Info.Hp = defender.CurrentPet.Info.Hp - uint32(damage.Stack())
|
||||
}
|
||||
|
||||
// 扣减防御方血量
|
||||
@@ -512,7 +514,7 @@ func (f *FightC) enterturn(fattack, sattack BattleActionI) {
|
||||
skill.Skill.Info.PP-- //减少PP
|
||||
}
|
||||
fmt.Println(i,
|
||||
"玩家技能伤害:", attacker.Damage,
|
||||
"玩家技能伤害:", attacker.GetDamageEffect(1),
|
||||
"自身剩余血量:", attacker.CurrentPet.Info.Hp,
|
||||
"对手剩余血量:", defender.CurrentPet.Info.Hp,
|
||||
)
|
||||
@@ -546,9 +548,9 @@ func (f *FightC) enterturn(fattack, sattack BattleActionI) {
|
||||
}
|
||||
ret.FAttack.RemainHp = int32(f.First.CurrentPet.Info.Hp)
|
||||
|
||||
ret.FAttack.LostHp = uint32(f.First.Damage.IntPart()) //先手方造成血量
|
||||
ret.FAttack.LostHp = uint32(f.First.GetDamageEffect(1).Stack()) //先手方造成血量
|
||||
ret.SAttack.RemainHp = int32(f.Second.CurrentPet.Info.Hp)
|
||||
ret.SAttack.LostHp = uint32(f.Second.Damage.IntPart()) //后手方造成血量
|
||||
ret.SAttack.LostHp = uint32(f.Second.GetDamageEffect(1).Stack()) //后手方造成血量
|
||||
|
||||
for i := 0; i < 6; i++ { //堆叠属性提升
|
||||
ret.FAttack.Prop[i] = int8(attacker.GetProp(i, true))
|
||||
@@ -557,12 +559,12 @@ func (f *FightC) enterturn(fattack, sattack BattleActionI) {
|
||||
for i := 0; i < 20; i++ { //堆叠状态剩余回合
|
||||
ate, ok := attacker.GetStatusEffect(i)
|
||||
if ok {
|
||||
ret.FAttack.Status[i] = int8(ate.Duration(0))
|
||||
ret.FAttack.Status[i] = int8(ate.Duration())
|
||||
}
|
||||
|
||||
dte, ok := defender.GetStatusEffect(i)
|
||||
if ok {
|
||||
ret.FAttack.Status[i] = int8(dte.Duration(0))
|
||||
ret.FAttack.Status[i] = int8(dte.Duration())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/mohae/deepcopy"
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
type Input struct {
|
||||
@@ -21,9 +20,9 @@ type Input struct {
|
||||
*info.AttackValue
|
||||
FightC common.FightI
|
||||
// info.BattleActionI
|
||||
Effects []Effect //effects 实际上全局就是effect无限回合 //effects容器 技能的
|
||||
Damage decimal.Decimal //造成伤害
|
||||
First bool //是否先手
|
||||
Effects []Effect //effects 实际上全局就是effect无限回合 //effects容器 技能的
|
||||
//Damage decimal.Decimal //造成伤害
|
||||
First bool //是否先手
|
||||
}
|
||||
|
||||
func NewInput(c common.FightI, p common.PlayerI) *Input {
|
||||
@@ -75,7 +74,7 @@ func (i *Input) GetStatusBonus() float64 {
|
||||
t, ok := i.GetStatusEffect(statusIdx)
|
||||
|
||||
// 检查状态是否存在(数组中值为1表示存在该状态)
|
||||
if ok && t.Stack(0) > 0 {
|
||||
if ok && t.Stack() > 0 {
|
||||
if bonus, exists := statusBonuses[info.EnumBattleStatus(statusIdx)]; exists && bonus > maxBonus {
|
||||
maxBonus = bonus
|
||||
}
|
||||
|
||||
@@ -67,11 +67,12 @@ type Effect interface {
|
||||
// PreBattleEnd() bool //战斗结束前
|
||||
// OnBattleEnd() bool //战斗结束
|
||||
|
||||
Duration(int) int
|
||||
//回合数,然后次数另外维护
|
||||
Duration(...int) int
|
||||
ID() int
|
||||
GetArgSize() int
|
||||
|
||||
Alive() bool
|
||||
Stack(int) int
|
||||
Stack(...int) int
|
||||
GetMaxStack() int
|
||||
NotALive()
|
||||
GetOwner() bool // 技能属主,比如寄生和镇魂歌,属主是对方)
|
||||
@@ -98,12 +99,12 @@ func (c *Input) GetProp(id int, istue bool) int {
|
||||
if ok {
|
||||
if id < 5 {
|
||||
if istue {
|
||||
return t.Stack(0)
|
||||
return t.Stack()
|
||||
}
|
||||
return info.CalculateRealValue(int(c.CurrentPet.Info.Prop[id]), t.Stack(0))
|
||||
return info.CalculateRealValue(int(c.CurrentPet.Info.Prop[id]), t.Stack())
|
||||
}
|
||||
//命中就直接返回
|
||||
return t.Stack(0)
|
||||
return t.Stack()
|
||||
}
|
||||
|
||||
//todo 插入获取后函数
|
||||
@@ -115,12 +116,13 @@ func InitDamageEffect(id int, t Effect) {
|
||||
NodeM[id+4000000] = t
|
||||
}
|
||||
|
||||
func (c *Input) GetDamageEffect(id int) (Effect, bool) {
|
||||
// 1为红伤
|
||||
func (c *Input) GetDamageEffect(id int) Effect {
|
||||
|
||||
//todo 获取前GetEffect
|
||||
ret, ok := NodeM[id+4000000]
|
||||
ret, _ := NodeM[id+4000000]
|
||||
|
||||
return ret, ok
|
||||
return ret
|
||||
//todo 获取后GetEffect
|
||||
}
|
||||
|
||||
@@ -168,13 +170,13 @@ func (c *Input) AddEffect(e Effect) {
|
||||
for _, eff := range c.Effects {
|
||||
if eff.ID() == e.ID() {
|
||||
//设置输入源
|
||||
if eff.Stack(0) < eff.GetMaxStack() { //如果小于最大叠层
|
||||
eff.Stack(eff.Stack(0)) //获取到当前叠层数然后叠加
|
||||
if eff.Stack() < eff.GetMaxStack() { //如果小于最大叠层
|
||||
eff.Stack(eff.Stack()) //获取到当前叠层数然后叠加
|
||||
} else {
|
||||
|
||||
//这里,说明是延续回合效果
|
||||
|
||||
eff.Duration(eff.Duration(0))
|
||||
eff.Duration(eff.Duration())
|
||||
}
|
||||
|
||||
return
|
||||
@@ -222,7 +224,7 @@ func (c *Input) CancelTurn(efftype bool) {
|
||||
|
||||
slice := c.Effects
|
||||
for i := 0; i < len(slice); {
|
||||
if slice[i].Duration(0) > 0 { //false是自身,true是对方,反转后为真就是自己的
|
||||
if slice[i].Duration() > 0 { //false是自身,true是对方,反转后为真就是自己的
|
||||
slice = append(slice[:i], slice[i+1:]...)
|
||||
} else {
|
||||
i++
|
||||
|
||||
@@ -13,9 +13,9 @@ type EffectNode struct {
|
||||
//次数相当于重写回合
|
||||
duration int // 默认为-1 持续回合/次(0 = 即时生效,>0 = 回合数 ,负数是永久) \
|
||||
|
||||
Input *input.Input
|
||||
stacks int // 当前层数
|
||||
ArgSize int
|
||||
Input *input.Input
|
||||
stacks int // 当前层数
|
||||
|
||||
MaxStack int // 最大叠加层数 ,正常都是不允许叠加的,除了衰弱特殊效果 ,异常和能力的叠层
|
||||
SideEffectArgs []int // 附加效果参数
|
||||
Owner bool //是否作用自身
|
||||
@@ -51,9 +51,9 @@ func (this *EffectNode) SetOwner(b bool) {
|
||||
this.Owner = b
|
||||
|
||||
}
|
||||
func (this *EffectNode) Stack(t int) int {
|
||||
if t != 0 {
|
||||
this.stacks = t
|
||||
func (this *EffectNode) Stack(t ...int) int {
|
||||
if len(t) > 0 {
|
||||
this.stacks = t[0]
|
||||
}
|
||||
|
||||
return this.stacks
|
||||
@@ -64,8 +64,10 @@ func (this *EffectNode) GetMaxStack() int {
|
||||
return this.MaxStack
|
||||
|
||||
}
|
||||
func (this *EffectNode) Duration(t int) int {
|
||||
|
||||
func (this *EffectNode) Duration(t ...int) int {
|
||||
if len(t) > 0 {
|
||||
this.duration = t[0]
|
||||
}
|
||||
return this.duration
|
||||
|
||||
}
|
||||
@@ -80,11 +82,7 @@ func (this *EffectNode) SetInput(args *input.Input) {
|
||||
this.Input = args
|
||||
|
||||
}
|
||||
func (this *EffectNode) GetArgSize() int {
|
||||
|
||||
return this.ArgSize
|
||||
|
||||
}
|
||||
func (this *EffectNode) AttackTime(*input.Input, *input.Input) bool {
|
||||
|
||||
return true
|
||||
|
||||
@@ -242,7 +242,7 @@ func (p *Player) ItemAdd(t []model.SingleItemInfo) {
|
||||
}
|
||||
|
||||
}
|
||||
p.Service.ItemAdd(ttt)
|
||||
p.Service.ItemAdd(ttt...)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -54,75 +54,79 @@ type PlayerInfo struct {
|
||||
ExpPool int64 `struc:"skip" json:"exp_pool"` // 累计经验池
|
||||
LastResetTime time.Time `struc:"skip" json:"last_reset_time"` // 重置时间,比如电池和每日任务
|
||||
// OutInfo 字段
|
||||
UserID uint32 `struc:"uint32" json:"user_id"` // 米米号 通过sid拿到
|
||||
RegisterTime uint32 `struc:"uint32" json:"register_time"` // 注册时间(秒时间戳)
|
||||
Nick string `struc:"[16]byte" default:"seer" json:"nick"` // 16字节昵称
|
||||
Vip uint16 `struc:"uint16" json:"vip"` // 固定0
|
||||
Viped uint16 `struc:"uint16" default:"15" json:"viped"` // 固定15
|
||||
DSFlag uint32 `struc:"uint32" json:"ds_flag"` // 固定0
|
||||
Color uint32 `struc:"uint32" json:"color"` // 机器人颜色RGB颜色值(uint32,实际为3个uint8)
|
||||
Texture uint32 `struc:"uint32" json:"texture"` // 固定0
|
||||
Energy uint32 `struc:"uint32" default:"3000" json:"energy"` // 固定3000
|
||||
Coins uint32 `struc:"uint32" json:"coins"` // 赛尔豆
|
||||
FightBadge uint32 `struc:"uint32" json:"fight_badge"` // 固定0
|
||||
MapID uint32 `struc:"uint32" default:"1" json:"map_id"` // 上线地图ID
|
||||
Pos Pos `json:"pos"` // 坐标
|
||||
TimeToday uint32 `struc:"uint32" default:"0" json:"time_today"` // 已消耗时间(秒)
|
||||
TimeLimit uint32 `struc:"uint32" default:"43200" json:"time_limit"` // 总电池限制(秒)
|
||||
IsClothHalfDay byte `struc:"byte" json:"is_cloth_half_day"` // 活动标志0/1
|
||||
IsRoomHalfDay byte `struc:"byte" json:"is_room_half_day"` // 活动标志0/1
|
||||
IFortressHalfDay byte `struc:"byte" json:"i_fortress_half_day"` // 活动标志0/1
|
||||
IsHQHalfDay byte `struc:"byte" json:"is_hq_half_day"` // 活动标志0/1
|
||||
LoginCount uint32 `struc:"uint32" json:"login_count"` // 固定0
|
||||
Inviter uint32 `struc:"uint32" json:"inviter"` // 固定0
|
||||
NewInviteeCount uint32 `struc:"uint32" json:"new_invitee_count"` // 固定0
|
||||
VipLevel uint32 `struc:"uint32" default:"8" json:"vip_level"` // 固定8
|
||||
VipValue uint32 `struc:"uint32" default:"80000" json:"vip_value"` // 固定80000
|
||||
VipStage uint32 `struc:"uint32" default:"1" json:"vip_stage"` // 超no的外形等级建议固定1
|
||||
AutoCharge uint32 `struc:"uint32" default:"1" json:"auto_charge"` // nono是否自动充电
|
||||
VipEndTime uint32 `struc:"uint32" default:"4294967295" json:"vip_end_time"` // 超no的结束时间建议尽可能大
|
||||
FreshManBonus uint32 `struc:"uint32" json:"fresh_man_bonus"` // 邀请活动建议先给固定值0
|
||||
NonoChipList [80]byte `struc:"[80]byte" json:"nono_chip_list"` // 超no芯片列表
|
||||
DailyResArr [50]byte `struc:"[50]byte" default:"0" json:"daily_res_arr"` // 每日任务状态 40+是谱尼的
|
||||
TeacherID uint32 `struc:"uint32" json:"teacher_id"` // 教官id
|
||||
StudentID uint32 `struc:"uint32" json:"student_id"` // 学员id
|
||||
GraduationCount uint32 `struc:"uint32" default:"0" json:"graduation_count"` // 毕业人数
|
||||
MaxPuniLv uint32 `struc:"uint32" default:"0" json:"max_puni_lv"` // 默认0, 虚无 元素 能量 生命 轮回 永恒 圣洁 最高为8
|
||||
PetMaxLevel uint32 `struc:"uint32" json:"pet_max_level"` // 精灵最高等级
|
||||
AllPetNumber uint32 `struc:"uint32" json:"all_pet_number"` // 精灵数量
|
||||
MonKingWin uint32 `struc:"uint32" json:"mon_king_win"` // 精灵王胜场
|
||||
CurrentStage uint32 `struc:"uint32" json:"current_stage"` // 勇者之塔层数
|
||||
MaxStage uint32 `struc:"uint32" json:"max_stage"` // 试炼之塔最高层
|
||||
CurrentFreshStage uint32 `struc:"uint32" json:"current_fresh_stage"` // 当前试炼层数
|
||||
MaxFreshStage uint32 `struc:"uint32" json:"max_fresh_stage"` // 最高试炼层
|
||||
MaxArenaWins uint32 `struc:"uint32" json:"max_arena_wins"` // 星际擂台连胜
|
||||
TwoTimes uint32 `struc:"uint32" default:"0" json:"two_times"` // 双倍经验加速器剩余使用次数
|
||||
ThreeTimes uint32 `struc:"uint32" default:"0" json:"three_times"` // 三倍经验加速器剩余使用次数
|
||||
AutoFight uint32 `struc:"uint32" default:"0" json:"auto_fight"` // 是否自动战斗
|
||||
AutoFightTime uint32 `struc:"uint32" default:"0" json:"auto_fight_time"` // 自动战斗剩余的场次
|
||||
EnergyTime uint32 `struc:"uint32" default:"0" json:"energy_time"` // 能量吸收仪剩余次数
|
||||
LearnTimes uint32 `struc:"uint32" default:"0" json:"learn_times"` // 学习力吸收仪剩余次数
|
||||
MonBattleMedal uint32 `struc:"uint32" default:"0" json:"mon_battle_medal"` // 默认0
|
||||
RecordCount uint32 `struc:"uint32" default:"0" json:"record_count"` // 默认0
|
||||
ObtainTm uint32 `struc:"uint32" default:"0" json:"obtain_tm"` // 默认0
|
||||
SoulBeadItemID uint32 `struc:"uint32" json:"soul_bead_item_id"` // 当前元神珠id
|
||||
ExpireTm uint32 `struc:"uint32" default:"0" json:"expire_tm"` // 默认0
|
||||
FuseTimes uint32 `struc:"uint32" default:"0" json:"fuse_times"` // 默认0
|
||||
HasNono uint32 `struc:"uint32" default:"1" json:"has_nono"` // 玩家是否有nono
|
||||
SuperNono uint32 `struc:"uint32" default:"1" json:"super_nono"` // 玩家是否有超能nono
|
||||
NonoState uint32 `struc:"uint32" default:"4294967295" json:"nono_state"` // 默认-1
|
||||
NonoColor uint32 `struc:"uint32" json:"nono_color"` // nono颜色
|
||||
NonoNick string `struc:"[16]byte" default:"nono" json:"nono_nick"` // nono名字(16字节)
|
||||
TeamInfo TeamInfo `struc:"struct" json:"team_info"` // 战队信息24字节
|
||||
TeamPkInfo TeamPKInfo `struc:"struct" json:"team_pk_info"` // 8字节
|
||||
Reserved byte `struc:"byte" json:"reserved"` // 1字节无内容
|
||||
Badge uint32 `struc:"uint32" default:"0" json:"badge"` // 默认0
|
||||
Reserved1 [27]byte `struc:"[27]byte" default:"3" json:"reserved1"` // 27字节默认3
|
||||
TaskList [500]byte `struc:"[500]byte" default:"0" json:"task_list"` // 任务状态数组500字节,默认3
|
||||
PetListCount uint32 `struc:"sizeof=PetList" json:"pet_list_count"` // 精灵列表长度
|
||||
PetList []PetInfo ` json:"pet_list"` // 精灵背包内信息
|
||||
ClothesCount uint32 `struc:"sizeof=Clothes" json:"clothes_count"` // 穿戴装备数量
|
||||
Clothes []PeopleItemInfo ` json:"clothes"` // 穿戴装备
|
||||
UserID uint32 `struc:"uint32" json:"user_id"` // 米米号 通过sid拿到
|
||||
RegisterTime uint32 `struc:"uint32" json:"register_time"` // 注册时间(秒时间戳)
|
||||
Nick string `struc:"[16]byte" default:"seer" json:"nick"` // 16字节昵称
|
||||
Vip uint16 `struc:"uint16" json:"vip"` // 固定0
|
||||
Viped uint16 `struc:"uint16" default:"15" json:"viped"` // 固定15
|
||||
DSFlag uint32 `struc:"uint32" json:"ds_flag"` // 固定0
|
||||
Color uint32 `struc:"uint32" json:"color"` // 机器人颜色RGB颜色值(uint32,实际为3个uint8)
|
||||
Texture uint32 `struc:"uint32" json:"texture"` // 固定0
|
||||
Energy uint32 `struc:"uint32" default:"3000" json:"energy"` // 固定3000
|
||||
Coins uint32 `struc:"uint32" json:"coins"` // 赛尔豆
|
||||
FightBadge uint32 `struc:"uint32" json:"fight_badge"` // 固定0
|
||||
MapID uint32 `struc:"uint32" default:"1" json:"map_id"` // 上线地图ID
|
||||
Pos Pos `json:"pos"` // 坐标
|
||||
TimeToday uint32 `struc:"uint32" default:"0" json:"time_today"` // 已消耗时间(秒)
|
||||
TimeLimit uint32 `struc:"uint32" default:"43200" json:"time_limit"` // 总电池限制(秒)
|
||||
IsClothHalfDay byte `struc:"byte" json:"is_cloth_half_day"` // 活动标志0/1
|
||||
IsRoomHalfDay byte `struc:"byte" json:"is_room_half_day"` // 活动标志0/1
|
||||
IFortressHalfDay byte `struc:"byte" json:"i_fortress_half_day"` // 活动标志0/1
|
||||
IsHQHalfDay byte `struc:"byte" json:"is_hq_half_day"` // 活动标志0/1
|
||||
LoginCount uint32 `struc:"uint32" json:"login_count"` // 固定0
|
||||
Inviter uint32 `struc:"uint32" json:"inviter"` // 固定0
|
||||
NewInviteeCount uint32 `struc:"uint32" json:"new_invitee_count"` // 固定0
|
||||
VipLevel uint32 `struc:"uint32" default:"8" json:"vip_level"` // 固定8
|
||||
VipValue uint32 `struc:"uint32" default:"80000" json:"vip_value"` // 固定80000
|
||||
VipStage uint32 `struc:"uint32" default:"1" json:"vip_stage"` // 超no的外形等级建议固定1
|
||||
AutoCharge uint32 `struc:"uint32" default:"1" json:"auto_charge"` // nono是否自动充电
|
||||
VipEndTime uint32 `struc:"uint32" default:"4294967295" json:"vip_end_time"` // 超no的结束时间建议尽可能大
|
||||
FreshManBonus uint32 `struc:"uint32" json:"fresh_man_bonus"` // 邀请活动建议先给固定值0
|
||||
NonoChipList [80]byte `struc:"[80]byte" json:"nono_chip_list"` // 超no芯片列表
|
||||
DailyResArr [50]byte `struc:"[50]byte" default:"0" json:"daily_res_arr"` // 每日任务状态 40+是谱尼的
|
||||
Study struct {
|
||||
TeacherID uint32 `struc:"uint32" json:"teacher_id"` // 教官id
|
||||
|
||||
StudentID uint32 `struc:"uint32" json:"student_id"` // 学员id
|
||||
GraduationCount uint32 `struc:"uint32" default:"0" json:"graduation_count"` // 毕业人数
|
||||
}
|
||||
|
||||
MaxPuniLv uint32 `struc:"uint32" default:"0" json:"max_puni_lv"` // 默认0, 虚无 元素 能量 生命 轮回 永恒 圣洁 最高为8
|
||||
PetMaxLevel uint32 `struc:"uint32" json:"pet_max_level"` // 精灵最高等级
|
||||
AllPetNumber uint32 `struc:"uint32" json:"all_pet_number"` // 精灵数量
|
||||
MonKingWin uint32 `struc:"uint32" json:"mon_king_win"` // 精灵王胜场
|
||||
CurrentStage uint32 `struc:"uint32" json:"current_stage"` // 勇者之塔层数
|
||||
MaxStage uint32 `struc:"uint32" json:"max_stage"` // 试炼之塔最高层
|
||||
CurrentFreshStage uint32 `struc:"uint32" json:"current_fresh_stage"` // 当前试炼层数
|
||||
MaxFreshStage uint32 `struc:"uint32" json:"max_fresh_stage"` // 最高试炼层
|
||||
MaxArenaWins uint32 `struc:"uint32" json:"max_arena_wins"` // 星际擂台连胜
|
||||
TwoTimes uint32 `struc:"uint32" default:"0" json:"two_times"` // 双倍经验加速器剩余使用次数
|
||||
ThreeTimes uint32 `struc:"uint32" default:"0" json:"three_times"` // 三倍经验加速器剩余使用次数
|
||||
AutoFight uint32 `struc:"uint32" default:"0" json:"auto_fight"` // 是否自动战斗
|
||||
AutoFightTime uint32 `struc:"uint32" default:"0" json:"auto_fight_time"` // 自动战斗剩余的场次
|
||||
EnergyTime uint32 `struc:"uint32" default:"0" json:"energy_time"` // 能量吸收仪剩余次数
|
||||
LearnTimes uint32 `struc:"uint32" default:"0" json:"learn_times"` // 学习力吸收仪剩余次数
|
||||
MonBattleMedal uint32 `struc:"uint32" default:"0" json:"mon_battle_medal"` // 默认0
|
||||
RecordCount uint32 `struc:"uint32" default:"0" json:"record_count"` // 默认0
|
||||
ObtainTm uint32 `struc:"uint32" default:"0" json:"obtain_tm"` // 默认0
|
||||
SoulBeadItemID uint32 `struc:"uint32" json:"soul_bead_item_id"` // 当前元神珠id
|
||||
ExpireTm uint32 `struc:"uint32" default:"0" json:"expire_tm"` // 默认0
|
||||
FuseTimes uint32 `struc:"uint32" default:"0" json:"fuse_times"` // 默认0
|
||||
HasNono uint32 `struc:"uint32" default:"1" json:"has_nono"` // 玩家是否有nono
|
||||
SuperNono uint32 `struc:"uint32" default:"1" json:"super_nono"` // 玩家是否有超能nono
|
||||
NonoState uint32 `struc:"uint32" default:"4294967295" json:"nono_state"` // 默认-1
|
||||
NonoColor uint32 `struc:"uint32" json:"nono_color"` // nono颜色
|
||||
NonoNick string `struc:"[16]byte" default:"nono" json:"nono_nick"` // nono名字(16字节)
|
||||
TeamInfo TeamInfo `struc:"struct" json:"team_info"` // 战队信息24字节
|
||||
TeamPkInfo TeamPKInfo `struc:"struct" json:"team_pk_info"` // 8字节
|
||||
Reserved byte `struc:"byte" json:"reserved"` // 1字节无内容
|
||||
Badge uint32 `struc:"uint32" default:"0" json:"badge"` // 默认0
|
||||
Reserved1 [27]byte `struc:"[27]byte" default:"3" json:"reserved1"` // 27字节默认3
|
||||
TaskList [500]byte `struc:"[500]byte" default:"0" json:"task_list"` // 任务状态数组500字节,默认3
|
||||
PetListCount uint32 `struc:"sizeof=PetList" json:"pet_list_count"` // 精灵列表长度
|
||||
PetList []PetInfo ` json:"pet_list"` // 精灵背包内信息
|
||||
ClothesCount uint32 `struc:"sizeof=Clothes" json:"clothes_count"` // 穿戴装备数量
|
||||
Clothes []PeopleItemInfo ` json:"clothes"` // 穿戴装备
|
||||
}
|
||||
|
||||
// TableName PlayerInfo's table name
|
||||
|
||||
@@ -29,7 +29,7 @@ func (s *UserService) Item(t func(map[uint32]model.SingleItemInfo) bool) {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
func (s *UserService) ItemAdd(t []model.SingleItemInfo) {
|
||||
func (s *UserService) ItemAdd(t ...model.SingleItemInfo) {
|
||||
|
||||
s.Item(func(rer map[uint32]model.SingleItemInfo) bool {
|
||||
for _, v := range t {
|
||||
|
||||
Reference in New Issue
Block a user