54 lines
1.2 KiB
Go
54 lines
1.2 KiB
Go
package data
|
|
|
|
import json "github.com/json-iterator/go"
|
|
|
|
type SkillBuff struct {
|
|
Id int `json:"id"`
|
|
TargetType int `json:"target_type"`
|
|
TargetArgs []int `json:"target_args"`
|
|
RangeType int `json:"range_type"`
|
|
RangeNum int `json:"range_num"`
|
|
PriorityType []int `json:"priority_type"`
|
|
PriorityArgs []int `json:"priority_args"`
|
|
BuffType int `json:"buff_type"`
|
|
BuffArgs []int `json:"buff_args"`
|
|
DurationType int `json:"durationType"`
|
|
Duration int `json:"duration"`
|
|
EffectId string `json:"effectId"`
|
|
CanMerge bool `json:"can_merge"`
|
|
CanCover bool `json:"can_cover"`
|
|
CanStack bool `json:"can_stack"`
|
|
CanClean bool `json:"can_clean"`
|
|
}
|
|
|
|
type SkillBuffTable struct {
|
|
l []*SkillBuff
|
|
m map[int]*SkillBuff
|
|
}
|
|
|
|
func (this *SkillBuffTable) load(buf []byte) error {
|
|
var err = json.Unmarshal(buf, &this.l)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
this.m = make(map[int]*SkillBuff)
|
|
for i := range this.l {
|
|
this.m[this.l[i].Id] = this.l[i]
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (this *SkillBuffTable) List() []*SkillBuff {
|
|
return this.l
|
|
}
|
|
|
|
//func (this *SkillBuffTable) Get(i int) *SkillBuff {
|
|
// return this.l[i]
|
|
//}
|
|
|
|
func (this *SkillBuffTable) Find(id int) *SkillBuff {
|
|
return this.m[id]
|
|
}
|