好友打招呼
This commit is contained in:
parent
4c59b75e17
commit
5df375128c
@ -49,6 +49,7 @@ func (f *FriendMgr) Init() {
|
||||
f.RegisterHandler(msg.HANDLE_TYPE_REFUSE, f.sendToPlayer)
|
||||
f.RegisterHandler(msg.HANDLE_TYPE_INVITE_ADD_FRIEND, f.sendToPlayer)
|
||||
f.RegisterHandler(msg.HANDLE_TYPE_INVITE_FRIEND, f.sendToPlayer)
|
||||
f.RegisterHandler(msg.HANDLE_TYPE_FRIEND_GREETING_REPLY, f.sendToPlayer)
|
||||
|
||||
// 卡牌消息
|
||||
f.RegisterHandler(msg.HANDLE_TYPE_REQ_CARD, f.sendToPlayer)
|
||||
|
||||
@ -806,17 +806,18 @@ func (ad *GameLogic) RegisterNetWorkFunc() {
|
||||
RegisterMsgProcessFunc("ReqCatTrickReward", ReqCatTrickReward) //小猫戏法获取奖励
|
||||
|
||||
// #region 好友
|
||||
RegisterMsgProcessFunc("ReqFriendList", ReqFriendList) // 请求好友列表
|
||||
RegisterMsgProcessFunc("ReqFriendApply", ReqFriendApply) // 请求申请好友列表
|
||||
RegisterMsgProcessFunc("ReqFriendCardMsg", ReqFriendCardMsg) // 请求好友卡牌申请列表
|
||||
RegisterMsgProcessFunc("ReqWishApplyList", ReqWishApplyList) // 请求好友心愿单申请列表
|
||||
RegisterMsgProcessFunc("ReqFriendTimeLine", ReqFriendTimeLine) // 请求好友时间线
|
||||
RegisterMsgProcessFunc("ReqFriendRecommend", ReqFriendRecommend) // 获取推荐好友
|
||||
RegisterMsgProcessFunc("ReqFriendTLUpvote", ReqFriendTLUpvote) // 请求时间线点赞
|
||||
RegisterMsgProcessFunc("ReqFriendTReward", ReqFriendTReward) // 请求时间线点赞
|
||||
RegisterMsgProcessFunc("ReqAddNpc", ReqAddNpc) // 增加npc
|
||||
RegisterMsgProcessFunc("ReqWishApply", ReqWishApply) // 同意好友心愿单请求
|
||||
RegisterMsgProcessFunc("ReqFriendByCode", ReqFriendByCode) // 根据邀请码查询好友
|
||||
RegisterMsgProcessFunc("ReqFriendList", ReqFriendList) // 请求好友列表
|
||||
RegisterMsgProcessFunc("ReqFriendApply", ReqFriendApply) // 请求申请好友列表
|
||||
RegisterMsgProcessFunc("ReqFriendCardMsg", ReqFriendCardMsg) // 请求好友卡牌申请列表
|
||||
RegisterMsgProcessFunc("ReqWishApplyList", ReqWishApplyList) // 请求好友心愿单申请列表
|
||||
RegisterMsgProcessFunc("ReqFriendTimeLine", ReqFriendTimeLine) // 请求好友时间线
|
||||
RegisterMsgProcessFunc("ReqFriendRecommend", ReqFriendRecommend) // 获取推荐好友
|
||||
RegisterMsgProcessFunc("ReqFriendTLUpvote", ReqFriendTLUpvote) // 请求时间线点赞
|
||||
RegisterMsgProcessFunc("ReqFriendTReward", ReqFriendTReward) // 请求时间线点赞
|
||||
RegisterMsgProcessFunc("ReqAddNpc", ReqAddNpc) // 增加npc
|
||||
RegisterMsgProcessFunc("ReqWishApply", ReqWishApply) // 同意好友心愿单请求
|
||||
RegisterMsgProcessFunc("ReqFriendByCode", ReqFriendByCode) // 根据邀请码查询好友
|
||||
RegisterMsgProcessFunc("ReqFriendReplyHandle", ReqFriendReplyHandle) // 回复好友信息
|
||||
|
||||
RegisterMsgProcessFunc("ReqSearchPlayer", ReqSearchPlayer) // 搜索好友
|
||||
RegisterMsgProcessFunc("ReqApplyFriend", ReqApplyFriend) // 申请好友
|
||||
|
||||
@ -375,6 +375,13 @@ func handle(p *Player, m *msg.Msg) error {
|
||||
return nil
|
||||
}
|
||||
CatnipMod.Growth(CatnipGrowthInfo.GameId, CatnipGrowthInfo.Growth)
|
||||
case msg.HANDLE_TYPE_FRIEND_GREETING_REPLY:
|
||||
FriendMod := p.PlayMod.getFriendMod()
|
||||
if v, ok := m.Extra.(friend.ReplyInfo); ok {
|
||||
FriendMod.AddReplyInfo(v.Uid, v.Type, v.Param)
|
||||
FriendLogBackData(p)
|
||||
}
|
||||
|
||||
default:
|
||||
log.Debug("uid : %d, handle msg type : %d not exist", p.M_DwUin, m.Type)
|
||||
}
|
||||
@ -551,8 +558,22 @@ func FriendLogBackData(p *Player) {
|
||||
Upvote: v.Upvote,
|
||||
})
|
||||
}
|
||||
var reply []*proto.ResFriendReply
|
||||
for _, v := range FriendMod.ReplyList {
|
||||
ps := G_GameLogicPtr.GetResSimplePlayerByUid(v.Uid)
|
||||
reply = append(reply, &proto.ResFriendReply{
|
||||
Player: ps,
|
||||
Type: int32(v.Type),
|
||||
Param: v.Param,
|
||||
Id: int32(v.Id),
|
||||
Status: int32(v.Status),
|
||||
AddTime: v.AddTime,
|
||||
EndTime: v.EndTime,
|
||||
})
|
||||
}
|
||||
p.PushClientRes(&proto.ResFriendTimeLine{
|
||||
Log: log,
|
||||
Log: log,
|
||||
Reply: reply,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -1789,6 +1789,7 @@ func ReqAgreeFriend(player *Player, buf []byte) error {
|
||||
}
|
||||
FriendMgrSend(m)
|
||||
FriendMod.AddFriend(Uid)
|
||||
FriendMod.AddReplyInfo(Uid, friend.REPLY_TYPE_GREETING, "")
|
||||
player.PushClientRes(&msg.ResAgreeFriend{
|
||||
Code: msg.RES_CODE_SUCCESS,
|
||||
Uid: req.Uid,
|
||||
@ -1800,6 +1801,7 @@ func ReqAgreeFriend(player *Player, buf []byte) error {
|
||||
})
|
||||
player.AddLog(Uid, friend.LOG_TYPE_FRIEND_BECOME, "", GoUtil.Now())
|
||||
FriendApplyBackData(player)
|
||||
FriendLogBackData(player)
|
||||
PlayroomMod := player.PlayMod.getPlayroomMod()
|
||||
BaseMod := player.PlayMod.getBaseMod()
|
||||
PlayroomMod.AddRoomPointAdd(BaseMod.GetLevel())
|
||||
@ -5226,3 +5228,39 @@ func ReqActPassReward(player *Player, buf []byte) error {
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
func ReqFriendReplyHandle(player *Player, buf []byte) error {
|
||||
req := &msg.ReqFriendReplyHandle{}
|
||||
proto.Unmarshal(buf, req)
|
||||
FriendMod := player.PlayMod.getFriendMod()
|
||||
ReplyInfo := FriendMod.ReplyFriend(int(req.LogId))
|
||||
if ReplyInfo == nil {
|
||||
player.SendErrClienRes(&msg.ResFriendReplyHandle{
|
||||
Code: msg.RES_CODE_FAIL,
|
||||
Msg: "reply info not exist",
|
||||
})
|
||||
return fmt.Errorf("reply info not exist")
|
||||
}
|
||||
|
||||
switch ReplyInfo.Type {
|
||||
case friend.REPLY_TYPE_GREETING:
|
||||
ReplyData := friend.ReplyInfo{
|
||||
Uid: int(player.M_DwUin),
|
||||
Type: friend.REPLY_TYPE_GREETING_Get,
|
||||
Param: req.Param,
|
||||
}
|
||||
FriendMgrSend(&MsqMod.Msg{
|
||||
From: int(player.M_DwUin),
|
||||
To: int(ReplyInfo.Uid),
|
||||
Type: MsqMod.HANDLE_TYPE_FRIEND_GREETING_REPLY,
|
||||
SendT: GoUtil.Now(),
|
||||
Extra: ReplyData,
|
||||
})
|
||||
}
|
||||
FriendLogBackData(player)
|
||||
player.PushClientRes(&msg.ResFriendReplyHandle{
|
||||
Code: msg.RES_CODE_SUCCESS,
|
||||
LogId: req.LogId,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -22,6 +22,18 @@ type FriendMod struct {
|
||||
Npc []int // npc id
|
||||
Bubble map[int]*BubbleInfo // 气泡
|
||||
ActivityLog []*ActLogInfo // 活动日志
|
||||
ReplyList []*ReplyInfo // 好友回复列表
|
||||
}
|
||||
|
||||
type ReplyInfo struct {
|
||||
Id int
|
||||
Uid int
|
||||
Type int
|
||||
Param string
|
||||
Status int
|
||||
AddTime int64
|
||||
ReplyTime int64
|
||||
EndTime int64
|
||||
}
|
||||
|
||||
type ActLogInfo struct {
|
||||
@ -53,6 +65,11 @@ type ApplyInfo struct {
|
||||
Uid int64
|
||||
}
|
||||
|
||||
const (
|
||||
REPLY_TYPE_GREETING = 1 // 问候
|
||||
REPLY_TYPE_GREETING_Get = 2 // 收到问候
|
||||
)
|
||||
|
||||
// 24小时内与玩家进行过以下互动的用户,若被选中参加本次宠物宝藏,在其头像旁添加礼物盒
|
||||
const (
|
||||
INTERACT_TYPE_VISIT = 1 // 拜访过玩家的Pet Playroom并进行过小游戏或点赞的用户
|
||||
@ -474,3 +491,28 @@ func (f *FriendMod) GetActLogLast() *ActLogInfo {
|
||||
}
|
||||
return f.ActivityLog[len(f.ActivityLog)-1]
|
||||
}
|
||||
|
||||
func (f *FriendMod) AddReplyInfo(Uid int, Type int, Param string) {
|
||||
f.AutoId++
|
||||
EndTime := GoUtil.Now() + 24*3600
|
||||
f.ReplyList = append(f.ReplyList, &ReplyInfo{
|
||||
Id: f.AutoId,
|
||||
Uid: Uid,
|
||||
Type: Type,
|
||||
Param: Param,
|
||||
Status: 0,
|
||||
AddTime: GoUtil.Now(),
|
||||
EndTime: EndTime,
|
||||
})
|
||||
}
|
||||
|
||||
func (f *FriendMod) ReplyFriend(LogId int) *ReplyInfo {
|
||||
for _, v := range f.ReplyList {
|
||||
if v.Id == LogId {
|
||||
v.Status = 1
|
||||
v.ReplyTime = GoUtil.Now()
|
||||
return v
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -104,6 +104,8 @@ const (
|
||||
|
||||
HANDLE_TYPE_VAR_EXPIRE_SET // 设置全服过期数据
|
||||
HANDLE_TYPE_VAR_EXPIRE_GET // 获取全服过期数据
|
||||
|
||||
HANDLE_TYPE_FRIEND_GREETING_REPLY // 好友问候回复
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user