好友气泡优化
This commit is contained in:
parent
00321f9016
commit
d4ab008991
@ -61,6 +61,7 @@ type BubbleInfo struct {
|
||||
Time int64 // 气泡时间
|
||||
Type int
|
||||
ItemList []*item.Item // 奖励物品
|
||||
Uid int // 相关玩家uid
|
||||
}
|
||||
|
||||
type FriendInfo struct {
|
||||
@ -263,6 +264,19 @@ func (f *FriendMod) version() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if f.Version == 1 {
|
||||
f.Version = 2
|
||||
for _, v := range f.Bubble {
|
||||
if v.Uid == 0 {
|
||||
for _, log := range f.Log {
|
||||
if log.Id == v.Id {
|
||||
v.Uid = log.Uid
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 零点更新
|
||||
@ -521,11 +535,11 @@ func (f *FriendMod) AddLog(uid, ltype int, param string, send int64) int {
|
||||
})
|
||||
switch ltype {
|
||||
case LOG_TYPE_HANDBOOK_UPVOTE, LOG_TYPE_PLAYROOM_UPVOTE:
|
||||
f.AddBubble(f.AutoId, ltype, nil)
|
||||
f.AddBubble(f.AutoId, uid, ltype, nil)
|
||||
case LOG_TYPE_TREASURE_HELP:
|
||||
itemNum := GoUtil.RandNum(2, 5)
|
||||
items := []*item.Item{item.NewItem(item.ITEM_STAR_ID, itemNum)}
|
||||
f.AddBubble(f.AutoId, ltype, items)
|
||||
f.AddBubble(f.AutoId, uid, ltype, items)
|
||||
}
|
||||
if len(f.Log) > 30 {
|
||||
f.Log = f.Log[len(f.Log)-30:]
|
||||
@ -534,9 +548,10 @@ func (f *FriendMod) AddLog(uid, ltype int, param string, send int64) int {
|
||||
}
|
||||
|
||||
// 增加气泡
|
||||
func (f *FriendMod) AddBubble(id, bType int, items []*item.Item) {
|
||||
func (f *FriendMod) AddBubble(id, uid, bType int, items []*item.Item) {
|
||||
f.Bubble[id] = &BubbleInfo{
|
||||
Id: id,
|
||||
Uid: uid,
|
||||
Time: GoUtil.Now(),
|
||||
Type: bType,
|
||||
ItemList: items,
|
||||
@ -550,6 +565,7 @@ func (f *FriendMod) GetBubble(id int) *msg.FriendBubbleInfo {
|
||||
Id: int32(v.Id),
|
||||
Type: int32(v.Type),
|
||||
Items: item.ItemToMsg(v.ItemList),
|
||||
Uid: int64(v.Uid),
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@ -562,6 +578,7 @@ func (f *FriendMod) BubbleBackData() *msg.ResFriendBubble {
|
||||
Id: int32(v.Id),
|
||||
Type: int32(v.Type),
|
||||
Items: item.ItemToMsg(v.ItemList),
|
||||
Uid: int64(v.Uid),
|
||||
})
|
||||
}
|
||||
return &msg.ResFriendBubble{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user