1
This commit is contained in:
commit
eff5f21d6d
@ -54,6 +54,9 @@ func (this *App) Update() {
|
||||
} else {
|
||||
handler := cs.GetNetMsgHandler(hdr.MsgId)
|
||||
if handler != nil {
|
||||
if !f5.IsOnlineEnv() {
|
||||
f5.GetSysLog().Info("%s %s", q5.GetTypeName(hdr.Msg), q5.EncodeJson(hdr.Msg))
|
||||
}
|
||||
switch handler.HandlerId {
|
||||
case PLAYER_MGR_HANDLER_ID:
|
||||
cs.DispatchMsg(handler, hdr, playerMgr)
|
||||
|
@ -389,6 +389,10 @@ func (this *SMApprove) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMApprove)
|
||||
}
|
||||
|
||||
func (this *SMApproveJoinGuildNotify) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMApproveJoinGuildNotify)
|
||||
}
|
||||
|
||||
func (this *CMReject) GetNetMsgId() uint16 {
|
||||
return uint16(CMMessageIdE__CMReject)
|
||||
}
|
||||
|
@ -227,57 +227,60 @@ const (
|
||||
SMMessageIdE__SMSetAvatar SMMessageIdE = 137
|
||||
SMMessageIdE__SMSetJoinCond SMMessageIdE = 138
|
||||
SMMessageIdE__SMRecommendGuildList SMMessageIdE = 139
|
||||
// 聊天相关
|
||||
SMMessageIdE__SMUpdateChatRedPointNotify SMMessageIdE = 200
|
||||
SMMessageIdE__SMChatMsgNotify SMMessageIdE = 201
|
||||
SMMessageIdE__SMUpdateRedPointNotify SMMessageIdE = 202
|
||||
SMMessageIdE__SMUpdatePrivateChatRedPointNotify SMMessageIdE = 203
|
||||
SMMessageIdE__SMUpdateChatChannelLastId SMMessageIdE = 204
|
||||
// 聊天相关通知
|
||||
SMMessageIdE__SMUpdateChatRedPointNotify SMMessageIdE = 1000
|
||||
SMMessageIdE__SMChatMsgNotify SMMessageIdE = 1001
|
||||
SMMessageIdE__SMUpdateRedPointNotify SMMessageIdE = 1002
|
||||
SMMessageIdE__SMUpdatePrivateChatRedPointNotify SMMessageIdE = 1003
|
||||
SMMessageIdE__SMUpdateChatChannelLastId SMMessageIdE = 1004
|
||||
// 公会相关通知
|
||||
SMMessageIdE__SMApproveJoinGuildNotify SMMessageIdE = 1010
|
||||
)
|
||||
|
||||
// Enum value maps for SMMessageIdE.
|
||||
var (
|
||||
SMMessageIdE_name = map[int32]string{
|
||||
101: "_SMPing",
|
||||
102: "_SMRpcError",
|
||||
103: "_SMLogin",
|
||||
104: "_SMReconnect",
|
||||
105: "_SMSearchUserByAccountId",
|
||||
106: "_SMSearchUser",
|
||||
107: "_SMAddFriendRequest",
|
||||
108: "_SMAcceptFriendRequest",
|
||||
109: "_SMRejectFriendRequest",
|
||||
110: "_SMListPendingFriendRequest",
|
||||
111: "_SMListFriend",
|
||||
112: "_SMDeleteFriendShip",
|
||||
113: "_SMAddBlacklist",
|
||||
114: "_SMRemoveBlacklist",
|
||||
116: "_SMBlacklist",
|
||||
120: "_SMGuildInfo",
|
||||
121: "_SMCreateGuild",
|
||||
122: "_SMApplyToGuild",
|
||||
123: "_SMApprove",
|
||||
124: "_SMReject",
|
||||
125: "_SMLeaveGuild",
|
||||
126: "_SMDismissMember",
|
||||
127: "_SMPromoteMember",
|
||||
128: "_SMDemoteMember",
|
||||
129: "_SMDisband",
|
||||
130: "_SMSearchGuilds",
|
||||
131: "_SMApplyList",
|
||||
132: "_SMGuildLogs",
|
||||
133: "_SMSetNotice",
|
||||
134: "_SMSetMemberLevel",
|
||||
135: "_SMGuildMembersList",
|
||||
136: "_SMSetName",
|
||||
137: "_SMSetAvatar",
|
||||
138: "_SMSetJoinCond",
|
||||
139: "_SMRecommendGuildList",
|
||||
200: "_SMUpdateChatRedPointNotify",
|
||||
201: "_SMChatMsgNotify",
|
||||
202: "_SMUpdateRedPointNotify",
|
||||
203: "_SMUpdatePrivateChatRedPointNotify",
|
||||
204: "_SMUpdateChatChannelLastId",
|
||||
101: "_SMPing",
|
||||
102: "_SMRpcError",
|
||||
103: "_SMLogin",
|
||||
104: "_SMReconnect",
|
||||
105: "_SMSearchUserByAccountId",
|
||||
106: "_SMSearchUser",
|
||||
107: "_SMAddFriendRequest",
|
||||
108: "_SMAcceptFriendRequest",
|
||||
109: "_SMRejectFriendRequest",
|
||||
110: "_SMListPendingFriendRequest",
|
||||
111: "_SMListFriend",
|
||||
112: "_SMDeleteFriendShip",
|
||||
113: "_SMAddBlacklist",
|
||||
114: "_SMRemoveBlacklist",
|
||||
116: "_SMBlacklist",
|
||||
120: "_SMGuildInfo",
|
||||
121: "_SMCreateGuild",
|
||||
122: "_SMApplyToGuild",
|
||||
123: "_SMApprove",
|
||||
124: "_SMReject",
|
||||
125: "_SMLeaveGuild",
|
||||
126: "_SMDismissMember",
|
||||
127: "_SMPromoteMember",
|
||||
128: "_SMDemoteMember",
|
||||
129: "_SMDisband",
|
||||
130: "_SMSearchGuilds",
|
||||
131: "_SMApplyList",
|
||||
132: "_SMGuildLogs",
|
||||
133: "_SMSetNotice",
|
||||
134: "_SMSetMemberLevel",
|
||||
135: "_SMGuildMembersList",
|
||||
136: "_SMSetName",
|
||||
137: "_SMSetAvatar",
|
||||
138: "_SMSetJoinCond",
|
||||
139: "_SMRecommendGuildList",
|
||||
1000: "_SMUpdateChatRedPointNotify",
|
||||
1001: "_SMChatMsgNotify",
|
||||
1002: "_SMUpdateRedPointNotify",
|
||||
1003: "_SMUpdatePrivateChatRedPointNotify",
|
||||
1004: "_SMUpdateChatChannelLastId",
|
||||
1010: "_SMApproveJoinGuildNotify",
|
||||
}
|
||||
SMMessageIdE_value = map[string]int32{
|
||||
"_SMPing": 101,
|
||||
@ -315,11 +318,12 @@ var (
|
||||
"_SMSetAvatar": 137,
|
||||
"_SMSetJoinCond": 138,
|
||||
"_SMRecommendGuildList": 139,
|
||||
"_SMUpdateChatRedPointNotify": 200,
|
||||
"_SMChatMsgNotify": 201,
|
||||
"_SMUpdateRedPointNotify": 202,
|
||||
"_SMUpdatePrivateChatRedPointNotify": 203,
|
||||
"_SMUpdateChatChannelLastId": 204,
|
||||
"_SMUpdateChatRedPointNotify": 1000,
|
||||
"_SMChatMsgNotify": 1001,
|
||||
"_SMUpdateRedPointNotify": 1002,
|
||||
"_SMUpdatePrivateChatRedPointNotify": 1003,
|
||||
"_SMUpdateChatChannelLastId": 1004,
|
||||
"_SMApproveJoinGuildNotify": 1010,
|
||||
}
|
||||
)
|
||||
|
||||
@ -417,7 +421,7 @@ var file_cs_msgid_proto_rawDesc = []byte{
|
||||
0x76, 0x61, 0x74, 0x61, 0x72, 0x10, 0x89, 0x01, 0x12, 0x13, 0x0a, 0x0e, 0x5f, 0x43, 0x4d, 0x53,
|
||||
0x65, 0x74, 0x4a, 0x6f, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x64, 0x10, 0x8a, 0x01, 0x12, 0x1a, 0x0a,
|
||||
0x15, 0x5f, 0x43, 0x4d, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x47, 0x75, 0x69,
|
||||
0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x10, 0x8b, 0x01, 0x2a, 0x92, 0x07, 0x0a, 0x0d, 0x53, 0x4d,
|
||||
0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x10, 0x8b, 0x01, 0x2a, 0xb2, 0x07, 0x0a, 0x0d, 0x53, 0x4d,
|
||||
0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x64, 0x5f, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x5f,
|
||||
0x53, 0x4d, 0x50, 0x69, 0x6e, 0x67, 0x10, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x5f, 0x53, 0x4d, 0x52,
|
||||
0x70, 0x63, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x66, 0x12, 0x0c, 0x0a, 0x08, 0x5f, 0x53, 0x4d,
|
||||
@ -466,15 +470,17 @@ var file_cs_msgid_proto_rawDesc = []byte{
|
||||
0x01, 0x12, 0x1a, 0x0a, 0x15, 0x5f, 0x53, 0x4d, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e,
|
||||
0x64, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x10, 0x8b, 0x01, 0x12, 0x20, 0x0a,
|
||||
0x1b, 0x5f, 0x53, 0x4d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x74, 0x52, 0x65,
|
||||
0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x10, 0xc8, 0x01, 0x12,
|
||||
0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x10, 0xe8, 0x07, 0x12,
|
||||
0x15, 0x0a, 0x10, 0x5f, 0x53, 0x4d, 0x43, 0x68, 0x61, 0x74, 0x4d, 0x73, 0x67, 0x4e, 0x6f, 0x74,
|
||||
0x69, 0x66, 0x79, 0x10, 0xc9, 0x01, 0x12, 0x1c, 0x0a, 0x17, 0x5f, 0x53, 0x4d, 0x55, 0x70, 0x64,
|
||||
0x69, 0x66, 0x79, 0x10, 0xe9, 0x07, 0x12, 0x1c, 0x0a, 0x17, 0x5f, 0x53, 0x4d, 0x55, 0x70, 0x64,
|
||||
0x61, 0x74, 0x65, 0x52, 0x65, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66,
|
||||
0x79, 0x10, 0xca, 0x01, 0x12, 0x27, 0x0a, 0x22, 0x5f, 0x53, 0x4d, 0x55, 0x70, 0x64, 0x61, 0x74,
|
||||
0x79, 0x10, 0xea, 0x07, 0x12, 0x27, 0x0a, 0x22, 0x5f, 0x53, 0x4d, 0x55, 0x70, 0x64, 0x61, 0x74,
|
||||
0x65, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x74, 0x52, 0x65, 0x64, 0x50,
|
||||
0x6f, 0x69, 0x6e, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x10, 0xcb, 0x01, 0x12, 0x1f, 0x0a,
|
||||
0x6f, 0x69, 0x6e, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x10, 0xeb, 0x07, 0x12, 0x1f, 0x0a,
|
||||
0x1a, 0x5f, 0x53, 0x4d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x74, 0x43, 0x68,
|
||||
0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4c, 0x61, 0x73, 0x74, 0x49, 0x64, 0x10, 0xcc, 0x01, 0x42, 0x06,
|
||||
0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4c, 0x61, 0x73, 0x74, 0x49, 0x64, 0x10, 0xec, 0x07, 0x12, 0x1e,
|
||||
0x0a, 0x19, 0x5f, 0x53, 0x4d, 0x41, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x65, 0x4a, 0x6f, 0x69, 0x6e,
|
||||
0x47, 0x75, 0x69, 0x6c, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x10, 0xf2, 0x07, 0x42, 0x06,
|
||||
0x5a, 0x04, 0x2e, 0x3b, 0x63, 0x73,
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -223,16 +223,16 @@ func (gm *GuildMgr) ApplyToGuild(guildId int64, applicantAccountId string, cb fu
|
||||
}
|
||||
|
||||
// Approve 同意申请者加入公会
|
||||
func (gm *GuildMgr) Approve(operatorAccountId, accountId string, cb func(errCode int32, errMsg string)) {
|
||||
func (gm *GuildMgr) Approve(operatorAccountId, accountId string, cb func(errCode int32, errMsg string, guild *Guild)) {
|
||||
guild := gm.GetGuildByAccountId(operatorAccountId)
|
||||
if guild == nil {
|
||||
cb(ERR_CODE_GUILD_NO_EXISTS, "Approve guild no exists")
|
||||
cb(ERR_CODE_GUILD_NO_EXISTS, "Approve guild no exists", nil)
|
||||
return
|
||||
}
|
||||
|
||||
// 默认为审核加入
|
||||
if guild.JoinCond != JoinCondDefault {
|
||||
cb(ERR_CODE_JOINED_GUILD, "Approve joined guild")
|
||||
cb(ERR_CODE_JOINED_GUILD, "Approve joined guild", nil)
|
||||
return
|
||||
}
|
||||
|
||||
@ -240,13 +240,13 @@ func (gm *GuildMgr) Approve(operatorAccountId, accountId string, cb func(errCode
|
||||
operatorMember := guild.GetMember(operatorAccountId)
|
||||
err := gm.CheckOperatorPerm(operatorMember, GuildMemberLevelViceLeader)
|
||||
if err != nil {
|
||||
cb(ERR_CODE_GUILD_OPERATOR_MEMBER_NO_PERM, "Approve operator member no perm")
|
||||
cb(ERR_CODE_GUILD_OPERATOR_MEMBER_NO_PERM, "Approve operator member no perm", nil)
|
||||
return
|
||||
}
|
||||
|
||||
// 是否加入其他公会
|
||||
if gm.CheckJoinGuild(accountId) {
|
||||
cb(ERR_CODE_JOINED_GUILD, "Approve joined guild")
|
||||
cb(ERR_CODE_JOINED_GUILD, "Approve joined guild", nil)
|
||||
return
|
||||
}
|
||||
|
||||
@ -254,25 +254,25 @@ func (gm *GuildMgr) Approve(operatorAccountId, accountId string, cb func(errCode
|
||||
// 是否在申请队列中
|
||||
pendingReqStatus := guild.GetPendingReqStatus(accountId)
|
||||
if pendingReqStatus < 0 {
|
||||
cb(ERR_CODE_GUILD_PENDING_REQUEST_NO_EXISTS, "Approve pending request no exists")
|
||||
cb(ERR_CODE_GUILD_PENDING_REQUEST_NO_EXISTS, "Approve pending request no exists", nil)
|
||||
return
|
||||
}
|
||||
|
||||
if guild.IsFull() {
|
||||
cb(ERR_CODE_GUILD_MEMBER_FULL, "Approve guild member full")
|
||||
cb(ERR_CODE_GUILD_MEMBER_FULL, "Approve guild member full", nil)
|
||||
return
|
||||
}
|
||||
newMember := &GuildMember{AccountId: accountId, Level: GuildMemberLevelDefault}
|
||||
gm.upsertGuildMember(guildId, newMember, func(err error) {
|
||||
if err != nil {
|
||||
cb(ERR_CODE_UPDATE_GUILD_MEMBER_DB_FAIL, "Approve update guild member db error")
|
||||
cb(ERR_CODE_UPDATE_GUILD_MEMBER_DB_FAIL, "Approve update guild member db error", nil)
|
||||
return
|
||||
}
|
||||
guild.AddMember(newMember)
|
||||
gm.AddUserGuild(accountId, guildId)
|
||||
gm.updatePendingReqs(guildId, accountId, PendingReqIsJoinGuildStatusJoined, func(err error) {
|
||||
if err != nil {
|
||||
cb(ERR_CODE_UPDATE_GUILD_PENDING_REQUEST_DB_FAIL, "Approve db error")
|
||||
cb(ERR_CODE_UPDATE_GUILD_PENDING_REQUEST_DB_FAIL, "Approve db error", nil)
|
||||
return
|
||||
}
|
||||
|
||||
@ -292,7 +292,7 @@ func (gm *GuildMgr) Approve(operatorAccountId, accountId string, cb func(errCode
|
||||
prop,
|
||||
)
|
||||
|
||||
cb(ERR_CODE_OK, "Approve ok")
|
||||
cb(ERR_CODE_OK, "Approve ok", guild)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ func (p *Player) CMSearchUser(hdr *f5.MsgHdr, msg *cs.CMSearchUser) {
|
||||
rspMsg.Users = append(rspMsg.Users, friend)
|
||||
}
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ func (p *Player) CMSearchUserByAccountId(hdr *f5.MsgHdr, msg *cs.CMSearchUserByA
|
||||
}
|
||||
}
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ func (p *Player) CMListPendingFriendRequest(hdr *f5.MsgHdr, msg *cs.CMListPendin
|
||||
}
|
||||
|
||||
f5.GetSysLog().Info("CMListPendingFriendRequest count:%d\n", len(rspMsg.Users))
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
}
|
||||
|
||||
// CMListFriend 我的好友列表
|
||||
@ -152,7 +152,7 @@ func (p *Player) CMListFriend(hdr *f5.MsgHdr, msg *cs.CMListFriend) {
|
||||
}
|
||||
|
||||
f5.GetSysLog().Info("CMListFriend finished accountId:%s, friends count:%d\n", accountId, len(rspMsg.Users))
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
}
|
||||
|
||||
// CMBlacklist 黑名单列表
|
||||
@ -186,7 +186,7 @@ func (p *Player) CMBlacklist(hdr *f5.MsgHdr, msg *cs.CMBlacklist) {
|
||||
}
|
||||
// TODO debug print users
|
||||
f5.GetSysLog().Info("CMBlacklist users count:%d\n", len(rspMsg.Users))
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
}
|
||||
|
||||
// CMAddFriendRequest 添加好友请求
|
||||
@ -201,7 +201,7 @@ func (p *Player) CMAddFriendRequest(hdr *f5.MsgHdr, msg *cs.CMAddFriendRequest)
|
||||
rspMsg.Errmsg = &errMsg
|
||||
} else {
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ func (p *Player) CMAcceptFriendRequest(hdr *f5.MsgHdr, msg *cs.CMAcceptFriendReq
|
||||
rspMsg.Errmsg = &errMsg
|
||||
} else {
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@ -233,7 +233,7 @@ func (p *Player) CMRejectFriendRequest(hdr *f5.MsgHdr, msg *cs.CMRejectFriendReq
|
||||
rspMsg.Errmsg = &errMsg
|
||||
} else {
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@ -246,7 +246,7 @@ func (p *Player) CMDeleteFriendShip(hdr *f5.MsgHdr, msg *cs.CMDeleteFriendShip)
|
||||
rspMsg := new(cs.SMDeleteFriendShip)
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@ func (p *Player) CMAddBlacklist(hdr *f5.MsgHdr, msg *cs.CMAddBlacklist) {
|
||||
rspMsg.Errmsg = &errMsg
|
||||
} else {
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@ -278,7 +278,7 @@ func (p *Player) CMRemoveBlacklist(hdr *f5.MsgHdr, msg *cs.CMRemoveBlacklist) {
|
||||
rspMsg.Errmsg = &errMsg
|
||||
} else {
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@ -344,14 +344,14 @@ func (p *Player) CMGuildInfo(hdr *f5.MsgHdr, msg *cs.CMGuildInfo) {
|
||||
if guild != nil {
|
||||
rspMsg.Guild = p.FillMFGuild(guild)
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
}
|
||||
|
||||
// CMRecommendGuildList 推荐公会列表
|
||||
func (p *Player) CMRecommendGuildList(hdr *f5.MsgHdr, msg *cs.CMRecommendGuildList) {
|
||||
rspMsg := new(cs.SMRecommendGuildList)
|
||||
rspMsg.RecommendGuilds = p.FillMFGuilds(guildMgr.RandomGuilds())
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
}
|
||||
|
||||
// CMCreateGuild 创建公会
|
||||
@ -366,7 +366,7 @@ func (p *Player) CMCreateGuild(hdr *f5.MsgHdr, msg *cs.CMCreateGuild) {
|
||||
} else {
|
||||
rspMsg.Guild = p.FillMFGuild(guild)
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@ -380,7 +380,7 @@ func (p *Player) CMApplyToGuild(hdr *f5.MsgHdr, msg *cs.CMApplyToGuild) {
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
},
|
||||
)
|
||||
}
|
||||
@ -413,20 +413,29 @@ func (p *Player) CMApplyList(hdr *f5.MsgHdr, msg *cs.CMApplyList) {
|
||||
rspMsg.Members = append(rspMsg.Members, member)
|
||||
}
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
}
|
||||
|
||||
// CMApprove 同意申请者加入公会
|
||||
func (p *Player) CMApprove(hdr *f5.MsgHdr, msg *cs.CMApprove) {
|
||||
guildMgr.Approve(
|
||||
p.accountId, msg.GetApplicantAccountId(),
|
||||
func(errCode int32, errMsg string) {
|
||||
func(errCode int32, errMsg string, guild *Guild) {
|
||||
rspMsg := new(cs.SMApprove)
|
||||
if errCode != 0 {
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
if guild != nil {
|
||||
target := playerMgr.GetPlayerByAccountId(msg.GetApplicantAccountId())
|
||||
if target != nil {
|
||||
rspNotify := new(cs.SMApproveJoinGuildNotify)
|
||||
rspNotify.GuildId = &guild.GuildId
|
||||
rspNotify.Name = &guild.Name
|
||||
target.SendMsg(rspNotify)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
@ -441,7 +450,7 @@ func (p *Player) CMReject(hdr *f5.MsgHdr, msg *cs.CMReject) {
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
},
|
||||
)
|
||||
}
|
||||
@ -456,7 +465,7 @@ func (p *Player) CMLeaveGuild(hdr *f5.MsgHdr, msg *cs.CMLeaveGuild) {
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
},
|
||||
)
|
||||
}
|
||||
@ -472,7 +481,7 @@ func (p *Player) CMDismissMember(hdr *f5.MsgHdr, msg *cs.CMDismissMember) {
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
},
|
||||
)
|
||||
}
|
||||
@ -489,7 +498,7 @@ func (p *Player) CMSetMemberLevel(hdr *f5.MsgHdr, msg *cs.CMSetMemberLevel) {
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@ -504,7 +513,7 @@ func (p *Player) CMPromoteMember(hdr *f5.MsgHdr, msg *cs.CMPromoteMember) {
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@ -519,7 +528,7 @@ func (p *Player) CMDemoteMember(hdr *f5.MsgHdr, msg *cs.CMDemoteMember) {
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@ -533,7 +542,7 @@ func (p *Player) CMDisband(hdr *f5.MsgHdr, msg *cs.CMDisband) {
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@ -548,7 +557,7 @@ func (p *Player) CMSetNotice(hdr *f5.MsgHdr, msg *cs.CMSetNotice) {
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@ -563,7 +572,7 @@ func (p *Player) CMSetAvatar(hdr *f5.MsgHdr, msg *cs.CMSetAvatar) {
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@ -578,7 +587,7 @@ func (p *Player) CMSetName(hdr *f5.MsgHdr, msg *cs.CMSetName) {
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@ -594,7 +603,7 @@ func (p *Player) CMSetJoinCond(hdr *f5.MsgHdr, msg *cs.CMSetJoinCond) {
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
})
|
||||
}
|
||||
|
||||
@ -616,29 +625,37 @@ func (p *Player) CMGuildMembersList(hdr *f5.MsgHdr, msg *cs.CMGuildMembersList)
|
||||
}
|
||||
}
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
}
|
||||
|
||||
// CMSearchGuilds 搜索公会
|
||||
func (p *Player) CMSearchGuilds(hdr *f5.MsgHdr, msg *cs.CMSearchGuilds) {
|
||||
sinceId := msg.GetSinceId()
|
||||
name := msg.GetName()
|
||||
guildMgr.SearchGuild(sinceId, name, func(errCode int32, errMsg string, lastId int64, guildIds []int64) {
|
||||
rspMsg := new(cs.SMSearchGuilds)
|
||||
if errCode != 0 {
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
} else {
|
||||
for _, guildId := range guildIds {
|
||||
guild := guildMgr.GetGuild(guildId)
|
||||
if guild != nil {
|
||||
rspMsg.Guilds = append(rspMsg.Guilds, p.FillMFGuild(guild))
|
||||
}
|
||||
}
|
||||
rspMsg := new(cs.SMSearchGuilds)
|
||||
for _, guild := range guildMgr.guilds {
|
||||
if guild.Name == msg.GetName() {
|
||||
rspMsg.Guilds = append(rspMsg.Guilds, p.FillMFGuild(guild))
|
||||
break
|
||||
}
|
||||
f5.GetSysLog().Info("CMSearchGuilds since:%, name[%s], result:%d \n", sinceId, msg.GetName(), len(rspMsg.Guilds))
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
})
|
||||
}
|
||||
f5.GetSysLog().Info("CMSearchGuilds name[%s], result:%d \n", msg.GetName(), len(rspMsg.Guilds))
|
||||
p.SendMsg(rspMsg)
|
||||
// Like search
|
||||
//guildMgr.SearchGuild(sinceId, name, func(errCode int32, errMsg string, lastId int64, guildIds []int64) {
|
||||
// rspMsg := new(cs.SMSearchGuilds)
|
||||
// if errCode != 0 {
|
||||
// rspMsg.Errcode = &errCode
|
||||
// rspMsg.Errmsg = &errMsg
|
||||
// } else {
|
||||
// for _, guildId := range guildIds {
|
||||
// guild := guildMgr.GetGuild(guildId)
|
||||
// if guild != nil {
|
||||
// rspMsg.Guilds = append(rspMsg.Guilds, p.FillMFGuild(guild))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// f5.GetSysLog().Info("CMSearchGuilds since:%, name[%s], result:%d \n", sinceId, msg.GetName(), len(rspMsg.Guilds))
|
||||
// p.SendMsg(rspMsg)
|
||||
//})
|
||||
}
|
||||
|
||||
// CMGuildLogs 请求公会日志
|
||||
@ -646,7 +663,7 @@ func (p *Player) CMGuildLogs(hdr *f5.MsgHdr, msg *cs.CMGuildLogs) {
|
||||
rspMsg := new(cs.SMGuildLogs)
|
||||
guild := guildMgr.GetGuildByAccountId(p.accountId)
|
||||
if guild == nil {
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
return
|
||||
}
|
||||
for _, g := range guildMgr.GetGuildLogs(guild.GetGuildId()) {
|
||||
@ -658,7 +675,7 @@ func (p *Player) CMGuildLogs(hdr *f5.MsgHdr, msg *cs.CMGuildLogs) {
|
||||
}
|
||||
rspMsg.GuildLogs = append(rspMsg.GuildLogs, guildLog)
|
||||
}
|
||||
wspListener.sendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
p.SendMsg(rspMsg)
|
||||
}
|
||||
|
||||
func (p *Player) FillMFGuildMember(member *GuildMember) *cs.MFGuildMember {
|
||||
|
@ -93,10 +93,13 @@ enum SMMessageId_e
|
||||
_SMSetJoinCond = 138;
|
||||
_SMRecommendGuildList = 139;
|
||||
|
||||
// 聊天相关
|
||||
_SMUpdateChatRedPointNotify = 200;
|
||||
_SMChatMsgNotify = 201;
|
||||
_SMUpdateRedPointNotify = 202;
|
||||
_SMUpdatePrivateChatRedPointNotify = 203;
|
||||
_SMUpdateChatChannelLastId = 204;
|
||||
// 聊天相关通知
|
||||
_SMUpdateChatRedPointNotify = 1000;
|
||||
_SMChatMsgNotify = 1001;
|
||||
_SMUpdateRedPointNotify = 1002;
|
||||
_SMUpdatePrivateChatRedPointNotify = 1003;
|
||||
_SMUpdateChatChannelLastId = 1004;
|
||||
|
||||
// 公会相关通知
|
||||
_SMApproveJoinGuildNotify = 1010;
|
||||
}
|
||||
|
@ -438,6 +438,13 @@ message SMApprove
|
||||
optional string errmsg = 2;
|
||||
}
|
||||
|
||||
// 收到批准加入公会
|
||||
message SMApproveJoinGuildNotify
|
||||
{
|
||||
optional int64 guild_id = 1;
|
||||
optional string name = 2;
|
||||
}
|
||||
|
||||
// 请求拒绝加入公会
|
||||
message CMReject
|
||||
{
|
||||
|
@ -157,6 +157,9 @@ func (this *WSPListener) parseNetPkt() {
|
||||
|
||||
func (this *WSPListener) sendProxyMsg(conn net.Conn, socketHandle uint16, msg proto.Message) {
|
||||
netMsg := msg.(f5.NetMsg)
|
||||
if !f5.IsOnlineEnv() {
|
||||
f5.GetSysLog().Info("%s %s", q5.GetTypeName(msg), q5.EncodeJson(msg))
|
||||
}
|
||||
msgData, err := proto.Marshal(msg)
|
||||
if err != nil {
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user