update
This commit is contained in:
parent
c9a04e6d81
commit
b7700786c8
@ -31,7 +31,7 @@ type configureComp struct {
|
|||||||
favorability map[string]*cfg.GameFavorabilityData
|
favorability map[string]*cfg.GameFavorabilityData
|
||||||
favorLvExp map[string][]int32 // key 英雄id value 每级升级所需要的经验值
|
favorLvExp map[string][]int32 // key 英雄id value 每级升级所需要的经验值
|
||||||
friend map[int64][]*cfg.GameFriendsData
|
friend map[int64][]*cfg.GameFriendsData
|
||||||
heroFetter map[string][]int32 // key 英雄id value 羁绊id
|
heroFetter map[string]map[int32]int32 // key 英雄id value 羁绊id
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,12 +72,15 @@ func (this *configureComp) SetFriendData() {
|
|||||||
this.hlock.Lock()
|
this.hlock.Lock()
|
||||||
defer this.hlock.Unlock()
|
defer this.hlock.Unlock()
|
||||||
this.friend = make(map[int64][]*cfg.GameFriendsData, 0)
|
this.friend = make(map[int64][]*cfg.GameFriendsData, 0)
|
||||||
this.heroFetter = make(map[string][]int32)
|
this.heroFetter = make(map[string]map[int32]int32)
|
||||||
if _configure, ok := v.(*cfg.GameFriends); ok {
|
if _configure, ok := v.(*cfg.GameFriends); ok {
|
||||||
for _, v1 := range _configure.GetDataList() {
|
for _, v1 := range _configure.GetDataList() {
|
||||||
key := int64(v1.FriendId)<<8 + int64(v1.FriendsLv)
|
key := int64(v1.FriendId)<<8 + int64(v1.FriendsLv)
|
||||||
this.friend[key] = append(this.friend[key], v1)
|
this.friend[key] = append(this.friend[key], v1)
|
||||||
this.heroFetter[v1.Hid] = append(this.heroFetter[v1.Hid], v1.FriendId)
|
if _, ok := this.heroFetter[v1.Hid]; !ok {
|
||||||
|
this.heroFetter[v1.Hid] = make(map[int32]int32, 0)
|
||||||
|
}
|
||||||
|
this.heroFetter[v1.Hid][v1.FriendId] = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -92,7 +95,7 @@ func (this *configureComp) GetFriendData(id int32, lv int32) []*cfg.GameFriendsD
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 通过英雄获取当前英雄的所有羁绊ID
|
// 通过英雄获取当前英雄的所有羁绊ID
|
||||||
func (this *configureComp) GetHeroFetterID(hid string) []int32 {
|
func (this *configureComp) GetHeroFetterID(hid string) map[int32]int32 {
|
||||||
return this.heroFetter[hid]
|
return this.heroFetter[hid]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ func (this *Library) CheckFetter(uid string, hid string) (dbLibrary []*pb.DBLibr
|
|||||||
} else { // 有这条羁绊数据
|
} else { // 有这条羁绊数据
|
||||||
|
|
||||||
if _, ok := list.Herofetter[hid]; !ok {
|
if _, ok := list.Herofetter[hid]; !ok {
|
||||||
if _d := this.CheckHeroFetter(uid, hid); _d == nil {
|
if _d := this.CheckHeroFetter(uid, hid); _d != nil {
|
||||||
list.Herofetter[hid] = _d.Id
|
list.Herofetter[hid] = _d.Id
|
||||||
fetter = append(fetter, _d)
|
fetter = append(fetter, _d)
|
||||||
}
|
}
|
||||||
@ -180,7 +180,7 @@ func (this *Library) CheckHeroFetter(uid string, hid string) (obj *pb.DBHeroFett
|
|||||||
}
|
}
|
||||||
if !bFound { // 创建一条英雄数据
|
if !bFound { // 创建一条英雄数据
|
||||||
if obj, err = this.createHeroFetter(uid, hid); err != nil {
|
if obj, err = this.createHeroFetter(uid, hid); err != nil {
|
||||||
obj = nil
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user