更新公会成员通知
This commit is contained in:
parent
9b13566736
commit
fcdf6c0c61
@ -365,6 +365,10 @@ func (this *SMApplyToGuild) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMApplyToGuild)
|
||||
}
|
||||
|
||||
func (this *SMApplyToGuildNotify) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMApplyToGuildNotify)
|
||||
}
|
||||
|
||||
func (this *CMApplyList) GetNetMsgId() uint16 {
|
||||
return uint16(CMMessageIdE__CMApplyList)
|
||||
}
|
||||
@ -401,6 +405,10 @@ func (this *SMLeaveGuild) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMLeaveGuild)
|
||||
}
|
||||
|
||||
func (this *SMLeaveGuildNotify) GetNetMsgId() uint16 {
|
||||
return uint16(SMMessageIdE__SMLeaveGuildNotify)
|
||||
}
|
||||
|
||||
func (this *CMDismissMember) GetNetMsgId() uint16 {
|
||||
return uint16(CMMessageIdE__CMDismissMember)
|
||||
}
|
||||
|
@ -229,6 +229,8 @@ const (
|
||||
SMMessageIdE__SMApproveJoinGuildNotify SMMessageIdE = 1010
|
||||
SMMessageIdE__SMDismissMemberNotify SMMessageIdE = 1011
|
||||
SMMessageIdE__SMSetMemberLevelNotify SMMessageIdE = 1012
|
||||
SMMessageIdE__SMApplyToGuildNotify SMMessageIdE = 1013
|
||||
SMMessageIdE__SMLeaveGuildNotify SMMessageIdE = 1014
|
||||
)
|
||||
|
||||
// Enum value maps for SMMessageIdE.
|
||||
@ -275,6 +277,8 @@ var (
|
||||
1010: "_SMApproveJoinGuildNotify",
|
||||
1011: "_SMDismissMemberNotify",
|
||||
1012: "_SMSetMemberLevelNotify",
|
||||
1013: "_SMApplyToGuildNotify",
|
||||
1014: "_SMLeaveGuildNotify",
|
||||
}
|
||||
SMMessageIdE_value = map[string]int32{
|
||||
"_SMPing": 101,
|
||||
@ -318,6 +322,8 @@ var (
|
||||
"_SMApproveJoinGuildNotify": 1010,
|
||||
"_SMDismissMemberNotify": 1011,
|
||||
"_SMSetMemberLevelNotify": 1012,
|
||||
"_SMApplyToGuildNotify": 1013,
|
||||
"_SMLeaveGuildNotify": 1014,
|
||||
}
|
||||
)
|
||||
|
||||
@ -412,7 +418,7 @@ var file_cs_msgid_proto_rawDesc = []byte{
|
||||
0x53, 0x65, 0x74, 0x41, 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, 0xc1, 0x07,
|
||||
0x64, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x10, 0x8b, 0x01, 0x2a, 0xf7, 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,
|
||||
@ -473,7 +479,10 @@ var file_cs_msgid_proto_rawDesc = []byte{
|
||||
0x6d, 0x69, 0x73, 0x73, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79,
|
||||
0x10, 0xf3, 0x07, 0x12, 0x1c, 0x0a, 0x17, 0x5f, 0x53, 0x4d, 0x53, 0x65, 0x74, 0x4d, 0x65, 0x6d,
|
||||
0x62, 0x65, 0x72, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x10, 0xf4,
|
||||
0x07, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x63, 0x73,
|
||||
0x07, 0x12, 0x1a, 0x0a, 0x15, 0x5f, 0x53, 0x4d, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x47,
|
||||
0x75, 0x69, 0x6c, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x10, 0xf5, 0x07, 0x12, 0x18, 0x0a,
|
||||
0x13, 0x5f, 0x53, 0x4d, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x47, 0x75, 0x69, 0x6c, 0x64, 0x4e, 0x6f,
|
||||
0x74, 0x69, 0x66, 0x79, 0x10, 0xf6, 0x07, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x63, 0x73,
|
||||
}
|
||||
|
||||
var (
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -136,20 +136,20 @@ func (gm *GuildMgr) CreateGuild(avatar int32, name *string, leaderId string,
|
||||
}
|
||||
|
||||
// ApplyToGuild 申请加入公会
|
||||
func (gm *GuildMgr) ApplyToGuild(guildId int64, applicantAccountId string, cb func(errCode int32, errMsg string)) {
|
||||
func (gm *GuildMgr) ApplyToGuild(guildId int64, applicantAccountId string, cb func(errCode int32, errMsg string, guild *Guild)) {
|
||||
guild := gm.GetGuild(guildId)
|
||||
if guild == nil {
|
||||
cb(ERR_CODE_GUILD_NO_EXISTS, "ApplyToGuild guild no exists")
|
||||
cb(ERR_CODE_GUILD_NO_EXISTS, "ApplyToGuild guild no exists", nil)
|
||||
return
|
||||
}
|
||||
// 是否加入其他公会
|
||||
if gm.CheckJoinGuild(applicantAccountId) {
|
||||
cb(ERR_CODE_JOINED_GUILD, "ApplyToGuild joined guild")
|
||||
cb(ERR_CODE_JOINED_GUILD, "ApplyToGuild joined guild", nil)
|
||||
return
|
||||
}
|
||||
|
||||
if guild.IsFull() {
|
||||
cb(ERR_CODE_GUILD_MEMBER_FULL, "ApplyToGuild guild member full")
|
||||
cb(ERR_CODE_GUILD_MEMBER_FULL, "ApplyToGuild guild member full", nil)
|
||||
return
|
||||
}
|
||||
// 可直接加入
|
||||
@ -161,11 +161,11 @@ func (gm *GuildMgr) ApplyToGuild(guildId int64, applicantAccountId string, cb fu
|
||||
if guild.JoinCond == JoinCondStar {
|
||||
profile := cacheMgr.GetPlayerProfile(applicantAccountId)
|
||||
if profile == nil {
|
||||
cb(ERR_CODE_GUILD_MEMBER_NO_EXISTS, "applicantAccountId no exists")
|
||||
cb(ERR_CODE_GUILD_MEMBER_NO_EXISTS, "applicantAccountId no exists", nil)
|
||||
return
|
||||
}
|
||||
if profile.Star < guild.JoinCondValue {
|
||||
cb(ERR_CODE_APPLY_GUILD_FAIL, "ApplyToGuild Fail, user star error")
|
||||
cb(ERR_CODE_APPLY_GUILD_FAIL, "ApplyToGuild Fail, user star error", nil)
|
||||
return
|
||||
}
|
||||
gm.JoinGuild(guild, applicantAccountId, cb)
|
||||
@ -193,7 +193,7 @@ func (gm *GuildMgr) ApplyToGuild(guildId int64, applicantAccountId string, cb fu
|
||||
insertKv,
|
||||
func(err error, lastInsertId int64, rowsAffected int64) {
|
||||
if err != nil || rowsAffected <= 0 {
|
||||
cb(ERR_CODE_UPDATE_GUILD_PENDING_REQUEST_DB_FAIL, "ApplyToGuild guild pending request db error")
|
||||
cb(ERR_CODE_UPDATE_GUILD_PENDING_REQUEST_DB_FAIL, "ApplyToGuild guild pending request db error", nil)
|
||||
return
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ func (gm *GuildMgr) ApplyToGuild(guildId int64, applicantAccountId string, cb fu
|
||||
EVENT_APPLY,
|
||||
prop,
|
||||
)
|
||||
cb(ERR_CODE_OK, "ApplyToGuild ok")
|
||||
cb(ERR_CODE_OK, "ApplyToGuild ok", guild)
|
||||
})
|
||||
}
|
||||
|
||||
@ -350,19 +350,19 @@ func (gm *GuildMgr) Reject(operatorAccountId, accountId string, cb func(errCode
|
||||
}
|
||||
|
||||
// JoinGuild 直接加入公会
|
||||
func (gm *GuildMgr) JoinGuild(guild *Guild, accountId string, cb func(errCode int32, errMsg string)) {
|
||||
func (gm *GuildMgr) JoinGuild(guild *Guild, accountId string, cb func(errCode int32, errMsg string, guild *Guild)) {
|
||||
newMember := GuildMember{AccountId: accountId, Level: GuildMemberLevelDefault}
|
||||
guildId := guild.GuildId
|
||||
gm.upsertGuildMember(guildId, &newMember,
|
||||
func(err error) {
|
||||
if err != nil {
|
||||
cb(ERR_CODE_UPDATE_GUILD_MEMBER_DB_FAIL, "JoinGuild Fail, upsertGuildMember")
|
||||
cb(ERR_CODE_UPDATE_GUILD_MEMBER_DB_FAIL, "JoinGuild Fail, upsertGuildMember", nil)
|
||||
return
|
||||
}
|
||||
guild.AddMember(&newMember)
|
||||
gm.AddUserGuild(accountId, guildId)
|
||||
|
||||
cb(ERR_CODE_OK, "ApplyToGuild OK")
|
||||
cb(ERR_CODE_OK, "ApplyToGuild OK", guild)
|
||||
|
||||
user := friendMgr.GetUser(accountId)
|
||||
cacheMgr.LoadPlayerProfile(user, func(playerProfile *PlayerProfile) {})
|
||||
@ -382,15 +382,15 @@ func (gm *GuildMgr) JoinGuild(guild *Guild, accountId string, cb func(errCode in
|
||||
}
|
||||
|
||||
// LeaveGuild 离开公会
|
||||
func (gm *GuildMgr) LeaveGuild(accountId string, cb func(errCode int32, errMsg string)) {
|
||||
func (gm *GuildMgr) LeaveGuild(accountId string, cb func(errCode int32, errMsg string, guild *Guild)) {
|
||||
guild := gm.GetGuildByAccountId(accountId)
|
||||
if guild == nil {
|
||||
cb(ERR_CODE_GUILD_NO_EXISTS, "no join guild]")
|
||||
cb(ERR_CODE_GUILD_NO_EXISTS, "no join guild]", nil)
|
||||
return
|
||||
}
|
||||
member := guild.GetMember(accountId)
|
||||
if member == nil {
|
||||
cb(ERR_CODE_GUILD_MEMBER_NO_EXISTS, "LeaveGuild member no exists")
|
||||
cb(ERR_CODE_GUILD_MEMBER_NO_EXISTS, "LeaveGuild member no exists", nil)
|
||||
return
|
||||
}
|
||||
membersCount := guild.GetMembersCount()
|
||||
@ -404,7 +404,7 @@ func (gm *GuildMgr) LeaveGuild(accountId string, cb func(errCode int32, errMsg s
|
||||
if accountId == guild.LeaderId {
|
||||
newLeader := guild.NewLeader(accountId)
|
||||
if newLeader == nil {
|
||||
cb(ERR_CODE_UPDATE_GUILD_DB_FAIL, "error")
|
||||
cb(ERR_CODE_UPDATE_GUILD_DB_FAIL, "error", nil)
|
||||
return
|
||||
}
|
||||
f5.GetSysLog().Info("LeaveGuild guildId:%d, newLeader:%s", guild.GuildId, newLeader.AccountId)
|
||||
@ -414,7 +414,7 @@ func (gm *GuildMgr) LeaveGuild(accountId string, cb func(errCode int32, errMsg s
|
||||
}
|
||||
gm.updateGuild(guild, updateFields, func(err error) {
|
||||
if err != nil {
|
||||
cb(ERR_CODE_UPDATE_GUILD_DB_FAIL, err.Error())
|
||||
cb(ERR_CODE_UPDATE_GUILD_DB_FAIL, err.Error(), nil)
|
||||
return
|
||||
}
|
||||
guild.LeaderId = newLeader.AccountId
|
||||
@ -424,7 +424,7 @@ func (gm *GuildMgr) LeaveGuild(accountId string, cb func(errCode int32, errMsg s
|
||||
gm.updateGuildMember(guild, newLeader.AccountId, newMemberFields,
|
||||
func(err error) {
|
||||
if err != nil {
|
||||
cb(ERR_CODE_UPDATE_GUILD_MEMBER_DB_FAIL, err.Error())
|
||||
cb(ERR_CODE_UPDATE_GUILD_MEMBER_DB_FAIL, err.Error(), nil)
|
||||
return
|
||||
}
|
||||
})
|
||||
@ -435,7 +435,7 @@ func (gm *GuildMgr) LeaveGuild(accountId string, cb func(errCode int32, errMsg s
|
||||
gm.updateGuildMember(guild, member.AccountId, fields,
|
||||
func(err error) {
|
||||
if err != nil {
|
||||
cb(ERR_CODE_UPDATE_GUILD_MEMBER_DB_FAIL, err.Error())
|
||||
cb(ERR_CODE_UPDATE_GUILD_MEMBER_DB_FAIL, err.Error(), nil)
|
||||
return
|
||||
}
|
||||
|
||||
@ -457,7 +457,7 @@ func (gm *GuildMgr) LeaveGuild(accountId string, cb func(errCode int32, errMsg s
|
||||
EVENT_LEAVE,
|
||||
prop,
|
||||
)
|
||||
cb(ERR_CODE_OK, "LeaveGuild OK")
|
||||
cb(ERR_CODE_OK, "LeaveGuild OK", guild)
|
||||
})
|
||||
}
|
||||
|
||||
@ -671,16 +671,16 @@ func (gm *GuildMgr) SetMemberLevel(operatorAccountId, accountId string, newLevel
|
||||
}
|
||||
|
||||
// Disband 解散公会
|
||||
func (gm *GuildMgr) Disband(operatorAccountId string, cb func(errCode int32, errMsg string)) {
|
||||
func (gm *GuildMgr) Disband(operatorAccountId string, cb func(errCode int32, errMsg string, guild *Guild)) {
|
||||
guild := gm.GetGuildByAccountId(operatorAccountId)
|
||||
if guild == nil {
|
||||
cb(ERR_CODE_GUILD_NO_EXISTS, "Disband guild no exists")
|
||||
cb(ERR_CODE_GUILD_NO_EXISTS, "Disband guild no exists", nil)
|
||||
return
|
||||
}
|
||||
|
||||
// 仅会长可操作
|
||||
if operatorAccountId != guild.LeaderId {
|
||||
cb(ERR_CODE_GUILD_NO_LEADER_PERM, "Disband only leader perm")
|
||||
cb(ERR_CODE_GUILD_NO_LEADER_PERM, "Disband only leader perm", nil)
|
||||
return
|
||||
}
|
||||
guildId := guild.GuildId
|
||||
@ -692,18 +692,18 @@ func (gm *GuildMgr) Disband(operatorAccountId string, cb func(errCode int32, err
|
||||
}
|
||||
gm.updateGuild(guild, updateFields, func(err error) {
|
||||
if err != nil {
|
||||
cb(ERR_CODE_UPDATE_GUILD_DB_FAIL, err.Error())
|
||||
cb(ERR_CODE_UPDATE_GUILD_DB_FAIL, err.Error(), nil)
|
||||
return
|
||||
}
|
||||
fields := [][]string{{"is_leave_guild", q5.ToString(1)}}
|
||||
gm.updateGuildMembers(guildId, fields, func(err error) {
|
||||
if err != nil {
|
||||
cb(ERR_CODE_UPDATE_GUILD_MEMBER_DB_FAIL, err.Error())
|
||||
cb(ERR_CODE_UPDATE_GUILD_MEMBER_DB_FAIL, err.Error(), nil)
|
||||
return
|
||||
}
|
||||
gm.updateAllPendingReqs(guildId, PendingReqIsJoinGuildStatusDisband, func(err error) {
|
||||
if err != nil {
|
||||
cb(ERR_CODE_UPDATE_GUILD_PENDING_REQUEST_DB_FAIL, err.Error())
|
||||
cb(ERR_CODE_UPDATE_GUILD_PENDING_REQUEST_DB_FAIL, err.Error(), nil)
|
||||
return
|
||||
}
|
||||
logContent := fmt.Sprintf("GuildDisbanded[%d-%s]", guildId, guildName)
|
||||
@ -729,7 +729,7 @@ func (gm *GuildMgr) Disband(operatorAccountId string, cb func(errCode int32, err
|
||||
prop,
|
||||
)
|
||||
|
||||
cb(ERR_CODE_OK, "Disband ok")
|
||||
cb(ERR_CODE_OK, "Disband ok", guild)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -320,13 +320,33 @@ func (p *Player) CMCreateGuild(hdr *f5.MsgHdr, msg *cs.CMCreateGuild) {
|
||||
func (p *Player) CMApplyToGuild(hdr *f5.MsgHdr, msg *cs.CMApplyToGuild) {
|
||||
guildMgr.ApplyToGuild(
|
||||
msg.GetGuildId(), p.accountId,
|
||||
func(errCode int32, errMsg string) {
|
||||
func(errCode int32, errMsg string, guild *Guild) {
|
||||
rspMsg := new(cs.SMApplyToGuild)
|
||||
if errCode != 0 {
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
}
|
||||
p.SendMsg(rspMsg)
|
||||
if guild != nil {
|
||||
// 成员通知消息
|
||||
rspNotify := new(cs.SMApplyToGuildNotify)
|
||||
rspNotify.GuildId = &guild.GuildId
|
||||
rspNotify.Name = &guild.Name
|
||||
|
||||
rspNotify.AccountId = &p.accountId
|
||||
playerProfile := cacheMgr.GetPlayerProfile(p.accountId)
|
||||
if playerProfile != nil {
|
||||
rspNotify.Username = &playerProfile.Username
|
||||
}
|
||||
|
||||
for targetAccountId := range guild.Members {
|
||||
target := playerMgr.GetPlayerByAccountId(targetAccountId)
|
||||
if target == nil {
|
||||
continue
|
||||
}
|
||||
target.SendMsg(rspNotify)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
@ -366,11 +386,22 @@ func (p *Player) CMApprove(hdr *f5.MsgHdr, msg *cs.CMApprove) {
|
||||
}
|
||||
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
|
||||
// 成员通知消息
|
||||
rspNotify := new(cs.SMApproveJoinGuildNotify)
|
||||
rspNotify.GuildId = &guild.GuildId
|
||||
rspNotify.Name = &guild.Name
|
||||
|
||||
rspNotify.AccountId = msg.ApplicantAccountId
|
||||
playerProfile := cacheMgr.GetPlayerProfile(msg.GetApplicantAccountId())
|
||||
if playerProfile != nil {
|
||||
rspNotify.Username = &playerProfile.Username
|
||||
}
|
||||
|
||||
for targetAccountId := range guild.Members {
|
||||
target := playerMgr.GetPlayerByAccountId(targetAccountId)
|
||||
if target == nil {
|
||||
continue
|
||||
}
|
||||
target.SendMsg(rspNotify)
|
||||
}
|
||||
}
|
||||
@ -397,13 +428,33 @@ func (p *Player) CMReject(hdr *f5.MsgHdr, msg *cs.CMReject) {
|
||||
func (p *Player) CMLeaveGuild(hdr *f5.MsgHdr, msg *cs.CMLeaveGuild) {
|
||||
guildMgr.LeaveGuild(
|
||||
p.accountId,
|
||||
func(errCode int32, errMsg string) {
|
||||
func(errCode int32, errMsg string, guild *Guild) {
|
||||
rspMsg := new(cs.SMLeaveGuild)
|
||||
if errCode != 0 {
|
||||
rspMsg.Errcode = &errCode
|
||||
rspMsg.Errmsg = &errMsg
|
||||
}
|
||||
p.SendMsg(rspMsg)
|
||||
if guild != nil {
|
||||
// 成员通知消息
|
||||
rspNotify := new(cs.SMLeaveGuildNotify)
|
||||
rspNotify.GuildId = &guild.GuildId
|
||||
rspNotify.Name = &guild.Name
|
||||
|
||||
rspNotify.AccountId = &p.accountId
|
||||
playerProfile := cacheMgr.GetPlayerProfile(p.accountId)
|
||||
if playerProfile != nil {
|
||||
rspNotify.Username = &playerProfile.Username
|
||||
}
|
||||
|
||||
for targetAccountId := range guild.Members {
|
||||
target := playerMgr.GetPlayerByAccountId(targetAccountId)
|
||||
if target == nil {
|
||||
continue
|
||||
}
|
||||
target.SendMsg(rspNotify)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
@ -421,13 +472,28 @@ func (p *Player) CMDismissMember(hdr *f5.MsgHdr, msg *cs.CMDismissMember) {
|
||||
}
|
||||
p.SendMsg(rspMsg)
|
||||
if guild != nil {
|
||||
target := playerMgr.GetPlayerByAccountId(msg.GetDismissAccountId())
|
||||
if target != nil {
|
||||
rspNotify := new(cs.SMDismissMemberNotify)
|
||||
rspNotify.GuildId = &guild.GuildId
|
||||
rspNotify.Name = &guild.Name
|
||||
// 成员通知消息
|
||||
rspNotify := new(cs.SMDismissMemberNotify)
|
||||
rspNotify.GuildId = &guild.GuildId
|
||||
rspNotify.Name = &guild.Name
|
||||
rspNotify.AccountId = msg.DismissAccountId
|
||||
playerProfile := cacheMgr.GetPlayerProfile(msg.GetDismissAccountId())
|
||||
if playerProfile != nil {
|
||||
rspNotify.Username = &playerProfile.Username
|
||||
}
|
||||
|
||||
for targetAccountId := range guild.Members {
|
||||
target := playerMgr.GetPlayerByAccountId(targetAccountId)
|
||||
if target == nil {
|
||||
continue
|
||||
}
|
||||
target.SendMsg(rspNotify)
|
||||
}
|
||||
|
||||
dismissAccount := playerMgr.GetPlayerByAccountId(msg.GetDismissAccountId())
|
||||
if dismissAccount != nil {
|
||||
dismissAccount.SendMsg(rspNotify)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
@ -447,12 +513,22 @@ func (p *Player) CMSetMemberLevel(hdr *f5.MsgHdr, msg *cs.CMSetMemberLevel) {
|
||||
}
|
||||
p.SendMsg(rspMsg)
|
||||
if guild != nil {
|
||||
target := playerMgr.GetPlayerByAccountId(msg.GetMemberAccountId())
|
||||
if target != nil {
|
||||
for range guild.Members {
|
||||
target := playerMgr.GetPlayerByAccountId(msg.GetMemberAccountId())
|
||||
if target == nil {
|
||||
continue
|
||||
}
|
||||
// 通知消息
|
||||
rspNotify := new(cs.SMSetMemberLevelNotify)
|
||||
rspNotify.GuildId = &guild.GuildId
|
||||
rspNotify.Name = &guild.Name
|
||||
rspNotify.MemberLevel = msg.MemberLevel
|
||||
rspNotify.AccountId = msg.MemberAccountId
|
||||
|
||||
playerProfile := cacheMgr.GetPlayerProfile(msg.GetMemberAccountId())
|
||||
if playerProfile != nil {
|
||||
rspNotify.Username = &playerProfile.Username
|
||||
}
|
||||
target.SendMsg(rspNotify)
|
||||
}
|
||||
}
|
||||
@ -463,7 +539,7 @@ func (p *Player) CMSetMemberLevel(hdr *f5.MsgHdr, msg *cs.CMSetMemberLevel) {
|
||||
func (p *Player) CMDisband(hdr *f5.MsgHdr, msg *cs.CMDisband) {
|
||||
guildMgr.Disband(
|
||||
p.accountId,
|
||||
func(errCode int32, errMsg string) {
|
||||
func(errCode int32, errMsg string, guild *Guild) {
|
||||
rspMsg := new(cs.SMDisband)
|
||||
if errCode != 0 {
|
||||
rspMsg.Errcode = &errCode
|
||||
|
@ -100,4 +100,6 @@ enum SMMessageId_e
|
||||
_SMApproveJoinGuildNotify = 1010;
|
||||
_SMDismissMemberNotify = 1011;
|
||||
_SMSetMemberLevelNotify = 1012;
|
||||
_SMApplyToGuildNotify = 1013;
|
||||
_SMLeaveGuildNotify = 1014;
|
||||
}
|
||||
|
@ -414,6 +414,15 @@ message SMApplyToGuild
|
||||
optional string errmsg = 2;
|
||||
}
|
||||
|
||||
// 收到申请加入公会
|
||||
message SMApplyToGuildNotify
|
||||
{
|
||||
optional int64 guild_id = 1;
|
||||
optional string name = 2;
|
||||
optional string accountId = 3;
|
||||
optional string username = 4;
|
||||
}
|
||||
|
||||
// 请求申请者列表
|
||||
message CMApplyList{}
|
||||
|
||||
@ -443,6 +452,8 @@ message SMApproveJoinGuildNotify
|
||||
{
|
||||
optional int64 guild_id = 1;
|
||||
optional string name = 2;
|
||||
optional string accountId = 3;
|
||||
optional string username = 4;
|
||||
}
|
||||
|
||||
// 请求拒绝加入公会
|
||||
@ -468,6 +479,15 @@ message SMLeaveGuild
|
||||
optional string errmsg = 2;
|
||||
}
|
||||
|
||||
// 收到离开公会
|
||||
message SMLeaveGuildNotify
|
||||
{
|
||||
optional int64 guild_id = 1;
|
||||
optional string name = 2;
|
||||
optional string accountId = 3;
|
||||
optional string username = 4;
|
||||
}
|
||||
|
||||
// 请求开除成员
|
||||
message CMDismissMember
|
||||
{
|
||||
@ -486,6 +506,8 @@ message SMDismissMemberNotify
|
||||
{
|
||||
optional int64 guild_id = 1;
|
||||
optional string name = 2;
|
||||
optional string accountId = 3;
|
||||
optional string username = 4;
|
||||
}
|
||||
|
||||
// 请求设置公会成员等级
|
||||
@ -508,6 +530,8 @@ message SMSetMemberLevelNotify
|
||||
optional int64 guild_id = 1;
|
||||
optional string name = 2;
|
||||
optional int32 memberLevel = 3;
|
||||
optional string accountId = 4;
|
||||
optional string username = 5;
|
||||
}
|
||||
|
||||
// 请求公会成员列表
|
||||
|
Loading…
x
Reference in New Issue
Block a user