Merge branch 'develop' into sdk
This commit is contained in:
commit
ce2a139da2
@ -40,7 +40,7 @@ func (f *BanMgr) IsBanned(userId int64) bool {
|
|||||||
if !banned {
|
if !banned {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return Info.EndTime > GoUtil.Now() || Info.EndTime == 0 // 如果EndTime为0,表示永久封禁
|
return Info.EndTime > GoUtil.Now() || Info.EndTime == -1 // 如果EndTime为0,表示永久封禁
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *BanMgr) BanUser(userId int64, endTime int64, reason string) {
|
func (f *BanMgr) BanUser(userId int64, endTime int64, reason string) {
|
||||||
|
|||||||
@ -772,6 +772,7 @@ func (ad *GameLogic) RegisterNetWorkFunc() {
|
|||||||
RegisterMsgProcessFunc("ReqFriendTimeLine", ReqFriendTimeLine) // 请求好友时间线
|
RegisterMsgProcessFunc("ReqFriendTimeLine", ReqFriendTimeLine) // 请求好友时间线
|
||||||
RegisterMsgProcessFunc("ReqFriendRecommend", ReqFriendRecommend) // 获取推荐好友
|
RegisterMsgProcessFunc("ReqFriendRecommend", ReqFriendRecommend) // 获取推荐好友
|
||||||
RegisterMsgProcessFunc("ReqFriendTLUpvote", ReqFriendTLUpvote) // 请求时间线点赞
|
RegisterMsgProcessFunc("ReqFriendTLUpvote", ReqFriendTLUpvote) // 请求时间线点赞
|
||||||
|
RegisterMsgProcessFunc("ReqFriendTReward", ReqFriendTReward) // 请求时间线点赞
|
||||||
RegisterMsgProcessFunc("ReqAddNpc", ReqAddNpc) // 增加npc
|
RegisterMsgProcessFunc("ReqAddNpc", ReqAddNpc) // 增加npc
|
||||||
RegisterMsgProcessFunc("ReqWishApply", ReqWishApply) // 同意好友心愿单请求
|
RegisterMsgProcessFunc("ReqWishApply", ReqWishApply) // 同意好友心愿单请求
|
||||||
RegisterMsgProcessFunc("ReqFriendByCode", ReqFriendByCode) // 根据邀请码查询好友
|
RegisterMsgProcessFunc("ReqFriendByCode", ReqFriendByCode) // 根据邀请码查询好友
|
||||||
|
|||||||
@ -780,6 +780,7 @@ func (p *Player) LoginBackData() {
|
|||||||
p.PushClientRes(p.PlayMod.mod_list.Item.BackData())
|
p.PushClientRes(p.PlayMod.mod_list.Item.BackData())
|
||||||
p.PushClientRes(p.GetPlayerBaseMod().BackAsset())
|
p.PushClientRes(p.GetPlayerBaseMod().BackAsset())
|
||||||
p.PushClientRes(p.PlayMod.mod_list.Kv.BackData())
|
p.PushClientRes(p.PlayMod.mod_list.Kv.BackData())
|
||||||
|
p.PushClientRes(p.PlayMod.mod_list.Friend.BubbleBackData())
|
||||||
p.BackDataActivity()
|
p.BackDataActivity()
|
||||||
BackChampship(p)
|
BackChampship(p)
|
||||||
BackUserInfo(p)
|
BackUserInfo(p)
|
||||||
@ -922,6 +923,7 @@ func (p *Player) AddLog(Uid int, Type int, Param string, Time int64) {
|
|||||||
Id: int32(Id),
|
Id: int32(Id),
|
||||||
Time: int32(Time),
|
Time: int32(Time),
|
||||||
},
|
},
|
||||||
|
Bubble: FriendMod.GetBubbble(Id),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2679,6 +2679,34 @@ func ReqFriendTLUpvote(player *Player, buf []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ReqFriendTReward(player *Player, buf []byte) error {
|
||||||
|
req := &msg.ReqFriendTReward{}
|
||||||
|
proto.Unmarshal(buf, req)
|
||||||
|
FriendMod := player.PlayMod.getFriendMod()
|
||||||
|
Items, err := FriendMod.GetReward(int(req.Id))
|
||||||
|
if err != nil {
|
||||||
|
player.SendErrClienRes(&msg.ResFriendTReward{
|
||||||
|
Code: msg.RES_CODE_FAIL,
|
||||||
|
Msg: err.Error(),
|
||||||
|
})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = player.HandleItem(Items, msg.ITEM_POP_LABEL_FriendTReward.String())
|
||||||
|
if err != nil {
|
||||||
|
player.SendErrClienRes(&msg.ResFriendTReward{
|
||||||
|
Code: msg.RES_CODE_FAIL,
|
||||||
|
Msg: err.Error(),
|
||||||
|
})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
player.PlayMod.save()
|
||||||
|
player.PushClientRes(&msg.ResFriendTReward{
|
||||||
|
Code: msg.RES_CODE_SUCCESS,
|
||||||
|
Id: req.Id,
|
||||||
|
})
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func ReqChampshipRankReward(player *Player, buf []byte) error {
|
func ReqChampshipRankReward(player *Player, buf []byte) error {
|
||||||
MyLastRank := G_GameLogicPtr.ChampshipMgr.getLastMyRank(int(player.M_DwUin))
|
MyLastRank := G_GameLogicPtr.ChampshipMgr.getLastMyRank(int(player.M_DwUin))
|
||||||
ChampshipMod := player.PlayMod.getChampshipMod()
|
ChampshipMod := player.PlayMod.getChampshipMod()
|
||||||
|
|||||||
@ -238,16 +238,7 @@ func ReqAdminBan(args []interface{}) error {
|
|||||||
res := make(map[string]interface{})
|
res := make(map[string]interface{})
|
||||||
res["Code"] = 0
|
res["Code"] = 0
|
||||||
res["Msg"] = "ok"
|
res["Msg"] = "ok"
|
||||||
player := G_GameLogicPtr.GetPlayer(req.Uid)
|
G_GameLogicPtr.BanMgr.BanUser(req.Uid, int64(req.Time), req.Reason)
|
||||||
if player == nil {
|
|
||||||
res["Code"] = 1
|
|
||||||
res["Msg"] = "player not found"
|
|
||||||
AdminPlayerBack(a, res)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
player.lock.Lock()
|
|
||||||
defer player.lock.Unlock()
|
|
||||||
G_GameLogicPtr.BanMgr.BanUser(player.M_DwUin, int64(req.Time), req.Reason)
|
|
||||||
AdminPlayerBack(a, res)
|
AdminPlayerBack(a, res)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import (
|
|||||||
cardCfg "server/conf/card"
|
cardCfg "server/conf/card"
|
||||||
"server/game/mod/card"
|
"server/game/mod/card"
|
||||||
"server/game/mod/item"
|
"server/game/mod/item"
|
||||||
|
"server/msg"
|
||||||
)
|
)
|
||||||
|
|
||||||
type FriendMod struct {
|
type FriendMod struct {
|
||||||
@ -17,8 +18,15 @@ type FriendMod struct {
|
|||||||
Card map[string]*card.CardInfo // 收到的申请交换
|
Card map[string]*card.CardInfo // 收到的申请交换
|
||||||
Log []*LogInfo // 日志
|
Log []*LogInfo // 日志
|
||||||
AutoId int
|
AutoId int
|
||||||
Id int64 // 已同步msg ID
|
Id int64 // 已同步msg ID
|
||||||
Npc []int // npc id
|
Npc []int // npc id
|
||||||
|
Bubble map[int]*BubbleInfo // 气泡
|
||||||
|
}
|
||||||
|
|
||||||
|
type BubbleInfo struct {
|
||||||
|
Id int // 气泡ID
|
||||||
|
Time int64 // 气泡时间
|
||||||
|
Type int
|
||||||
}
|
}
|
||||||
|
|
||||||
type FriendInfo struct {
|
type FriendInfo struct {
|
||||||
@ -94,6 +102,7 @@ type LogInfo struct {
|
|||||||
Time int64
|
Time int64
|
||||||
Param string
|
Param string
|
||||||
Upvote bool // 点赞
|
Upvote bool // 点赞
|
||||||
|
Reward bool // 是否已领取奖励
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FriendMod) InitData() {
|
func (f *FriendMod) InitData() {
|
||||||
@ -112,6 +121,9 @@ func (f *FriendMod) InitData() {
|
|||||||
if f.NewFriendList == nil {
|
if f.NewFriendList == nil {
|
||||||
f.NewFriendList = make(map[int]*FriendInfo)
|
f.NewFriendList = make(map[int]*FriendInfo)
|
||||||
}
|
}
|
||||||
|
if f.Bubble == nil {
|
||||||
|
f.Bubble = make(map[int]*BubbleInfo)
|
||||||
|
}
|
||||||
if len(f.FriendList) > 0 && len(f.NewFriendList) == 0 {
|
if len(f.FriendList) > 0 && len(f.NewFriendList) == 0 {
|
||||||
for k := range f.FriendList {
|
for k := range f.FriendList {
|
||||||
f.NewFriendList[k] = &FriendInfo{
|
f.NewFriendList[k] = &FriendInfo{
|
||||||
@ -257,12 +269,47 @@ func (f *FriendMod) AddLog(Uid, Type int, Param string) int {
|
|||||||
Time: GoUtil.Now(),
|
Time: GoUtil.Now(),
|
||||||
Param: Param,
|
Param: Param,
|
||||||
})
|
})
|
||||||
|
switch Type {
|
||||||
|
case LOG_TYPE_HANDBOOK_UPVOTE:
|
||||||
|
f.AddBubble(f.AutoId, Type)
|
||||||
|
case LOG_TYPE_PLAYROOM_UPVOTE:
|
||||||
|
f.AddBubble(f.AutoId, Type)
|
||||||
|
}
|
||||||
if len(f.Log) > 30 {
|
if len(f.Log) > 30 {
|
||||||
f.Log = f.Log[len(f.Log)-30:]
|
f.Log = f.Log[len(f.Log)-30:]
|
||||||
}
|
}
|
||||||
return f.AutoId
|
return f.AutoId
|
||||||
}
|
}
|
||||||
|
func (f *FriendMod) AddBubble(Id, Type int) {
|
||||||
|
f.Bubble[Id] = &BubbleInfo{
|
||||||
|
Id: Id,
|
||||||
|
Time: GoUtil.Now(),
|
||||||
|
Type: Type,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *FriendMod) GetBubbble(Id int) *msg.FriendBubbleInfo {
|
||||||
|
if v, ok := f.Bubble[Id]; ok {
|
||||||
|
return &msg.FriendBubbleInfo{
|
||||||
|
Id: int32(v.Id),
|
||||||
|
Type: int32(v.Type),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *FriendMod) BubbleBackData() *msg.ResFriendBubble {
|
||||||
|
rs := make([]*msg.FriendBubbleInfo, 0, len(f.Bubble))
|
||||||
|
for _, v := range f.Bubble {
|
||||||
|
rs = append(rs, &msg.FriendBubbleInfo{
|
||||||
|
Id: int32(v.Id),
|
||||||
|
Type: int32(v.Type),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return &msg.ResFriendBubble{
|
||||||
|
Bubble: rs,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (f *FriendMod) ResetGoldCardEx() {
|
func (f *FriendMod) ResetGoldCardEx() {
|
||||||
for _, v := range f.Card {
|
for _, v := range f.Card {
|
||||||
@ -287,7 +334,25 @@ func (f *FriendMod) Upvote(Id int) ([]*item.Item, int, error) {
|
|||||||
return nil, 0, fmt.Errorf("already upvote")
|
return nil, 0, fmt.Errorf("already upvote")
|
||||||
}
|
}
|
||||||
info.Upvote = true
|
info.Upvote = true
|
||||||
return []*item.Item{item.NewItem(item.ITEM_ENERGY_ID, 1)}, info.Uid, nil
|
return []*item.Item{item.NewItem(item.ITEM_ENERGY_ID, 5)}, info.Uid, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *FriendMod) GetReward(Id int) ([]*item.Item, error) {
|
||||||
|
info, ok := f.Bubble[Id]
|
||||||
|
if !ok {
|
||||||
|
return nil, fmt.Errorf("bubble not exist")
|
||||||
|
}
|
||||||
|
reward := []*item.Item{}
|
||||||
|
switch info.Type {
|
||||||
|
case LOG_TYPE_HANDBOOK_UPVOTE:
|
||||||
|
reward = append(reward, item.NewItem(item.ITEM_ENERGY_ID, 5))
|
||||||
|
case LOG_TYPE_PLAYROOM_UPVOTE:
|
||||||
|
reward = append(reward, item.NewItem(item.ITEM_ENERGY_ID, 5))
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("log type not support")
|
||||||
|
}
|
||||||
|
delete(f.Bubble, Id)
|
||||||
|
return reward, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FriendMod) AddWishApply(Uid int64) error {
|
func (f *FriendMod) AddWishApply(Uid int64) error {
|
||||||
|
|||||||
@ -839,7 +839,7 @@ func (p *PlayroomMod) GiveUpvote(Uid int) ([]*item.Item, error) {
|
|||||||
return nil, fmt.Errorf("upvote already")
|
return nil, fmt.Errorf("upvote already")
|
||||||
}
|
}
|
||||||
p.UpvoteList = append(p.UpvoteList, Uid)
|
p.UpvoteList = append(p.UpvoteList, Uid)
|
||||||
return []*item.Item{item.NewItem(item.ITEM_ENERGY_ID, 10)}, nil
|
return []*item.Item{item.NewItem(item.ITEM_ENERGY_ID, 5)}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PlayroomMod) AddUpvote() {
|
func (p *PlayroomMod) AddUpvote() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user