上传工会boos战代码

This commit is contained in:
liwei 2023-07-19 18:11:40 +08:00
parent fb084e55d9
commit 8f84a12855
7 changed files with 57 additions and 43 deletions

View File

@ -334,13 +334,21 @@ func (this *modelChatComp) sendChatToWorld(chat *pb.DBChat, queuecount int32) (e
} }
// 发送聊天消息到工会频道 // 发送聊天消息到工会频道
func (this *modelChatComp) sendChatToUnion(chat *pb.DBChat, queuecount int32) (err error) { func (this *modelChatComp) sendChatToUnion(chat *pb.DBChat, queuecount int32) (errdata *pb.ErrorData) {
var (
err error
)
if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s-%s", unionchatkey, chat.UnionId), int64(queuecount), chat); err != nil { if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s-%s", unionchatkey, chat.UnionId), int64(queuecount), chat); err != nil {
this.module.Errorln(err) this.module.Errorln(err)
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return return
} }
if err = this.module.pushChatToUnion(chat); err != nil { if errdata = this.module.pushChatToUnion(chat); errdata != nil {
this.module.Errorln(err) this.module.Errorln(errdata)
return return
} }
return return

View File

@ -2,6 +2,7 @@ package chat
import ( import (
"context" "context"
"errors"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/base" "go_dreamfactory/lego/base"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
@ -93,6 +94,7 @@ func (this *Chat) EventUserOffline(uid, sessionid string) {
func (this *Chat) Rpc_ModuleChatPushChat(ctx context.Context, args *pb.DBChat, reply *pb.EmptyResp) (err error) { func (this *Chat) Rpc_ModuleChatPushChat(ctx context.Context, args *pb.DBChat, reply *pb.EmptyResp) (err error) {
var ( var (
max_chat int32 max_chat int32
errdata *pb.ErrorData
) )
if max_chat, err = this.configure.GetChannelRecordMax(); err != nil { if max_chat, err = this.configure.GetChannelRecordMax(); err != nil {
this.Errorln(err) this.Errorln(err)
@ -106,7 +108,8 @@ func (this *Chat) Rpc_ModuleChatPushChat(ctx context.Context, args *pb.DBChat, r
} }
break break
case pb.ChatChannel_Union: case pb.ChatChannel_Union:
if err = this.modelChat.sendChatToUnion(args, max_chat); err != nil { if errdata = this.modelChat.sendChatToUnion(args, max_chat); errdata != nil {
err = errors.New(errdata.Message)
this.Errorln(err) this.Errorln(err)
return return
} }
@ -189,8 +192,8 @@ func (this *Chat) SendUnionChat(msg *pb.DBChat) (errdata *pb.ErrorData) {
return return
} }
if this.IsCross() { if this.IsCross() {
if err = this.modelChat.sendChatToUnion(msg, max_chat); err != nil { if errdata = this.modelChat.sendChatToUnion(msg, max_chat); errdata != nil {
this.Errorln(err) this.Errorln(errdata)
return return
} }
} else { } else {
@ -353,8 +356,11 @@ func (this *Chat) pushChatToWorld(msg *pb.DBChat) (err error) {
} }
// 推送消息到工会 // 推送消息到工会
func (this *Chat) pushChatToUnion(msg *pb.DBChat) (err error) { func (this *Chat) pushChatToUnion(msg *pb.DBChat) (errdata *pb.ErrorData) {
if members := this.sociaty.MembersBySociatyId(msg.UnionId); members != nil { var (
members []*pb.SociatyMemberInfo
)
if members, errdata = this.sociaty.MembersBySociatyId(msg.UnionId); members != nil {
users := make([]string, 0, len(members)) users := make([]string, 0, len(members))
for _, v := range members { for _, v := range members {
if v.OfflineTime == 0 { //离线时间为0 表示在线 if v.OfflineTime == 0 { //离线时间为0 表示在线

View File

@ -10,13 +10,13 @@ import (
) )
// 参数校验 // 参数校验
func (this *apiComp) ChallengeFinishCheck(session comm.IUserSession, req *pb.UniongveChallengeFinishRep) (errdata *pb.ErrorData) { func (this *apiComp) ChallengeFinishCheck(session comm.IUserSession, req *pb.UniongveChallengeFinishReq) (errdata *pb.ErrorData) {
return return
} }
// 获取工会boos战信息 // 获取工会boos战信息
func (this *apiComp) ChallengeFinish(session comm.IUserSession, req *pb.UniongveChallengeFinishRep) (errdata *pb.ErrorData) { func (this *apiComp) ChallengeFinish(session comm.IUserSession, req *pb.UniongveChallengeFinishReq) (errdata *pb.ErrorData) {
var ( var (
conf *cfg.GameGuildBossData conf *cfg.GameGuildBossData
score *cfg.GameGuildBossScoreData score *cfg.GameGuildBossScoreData

View File

@ -98,5 +98,5 @@ func (this *ModelUnionroulette) roulettechangePush(unionid string, uid string, a
this.module.SendMsgToUsers(string(this.module.GetType()), "roulettechange", &pb.UniongveRouletteChangePush{ this.module.SendMsgToUsers(string(this.module.GetType()), "roulettechange", &pb.UniongveRouletteChangePush{
Record: info, Record: info,
}) }, users...)
} }

View File

@ -189,7 +189,7 @@ func (this *ModelUniongve) booshpchangepush(unionid string, info *pb.DBUnionGve)
} }
this.module.SendMsgToUsers(string(this.module.GetType()), "booschange", &pb.UniongveBoosChangePush{ this.module.SendMsgToUsers(string(this.module.GetType()), "booschange", &pb.UniongveBoosChangePush{
Info: info, Info: info,
}) }, users...)
} }
// 击杀boos // 击杀boos
@ -247,7 +247,7 @@ func (this *ModelUniongve) booskill(unionid string, boosid int32, info *pb.DBUni
} }
this.module.SendMsgToUsers(string(this.module.GetType()), "stagechange", &pb.UniongveStageChangePush{ this.module.SendMsgToUsers(string(this.module.GetType()), "stagechange", &pb.UniongveStageChangePush{
Info: info, Info: info,
}) }, users...)
} }
// boos 信息变化推送 // boos 信息变化推送

View File

@ -116,7 +116,7 @@ func (this *modelRank) raceSettlement() {
} }
// boos 血量变化推送 // boos 奖励推送
func (this *modelRank) rankRewardPush(unionid string, reward []*cfg.Gameatn) { func (this *modelRank) rankRewardPush(unionid string, reward []*cfg.Gameatn) {
var ( var (
members []*pb.SociatyMemberInfo members []*pb.SociatyMemberInfo

View File

@ -611,7 +611,7 @@ func (x *UniongveChallengeResp) GetInfo() *BattleInfo {
} }
//战斗 完成请求 //战斗 完成请求
type UniongveChallengeFinishRep struct { type UniongveChallengeFinishReq struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
@ -621,8 +621,8 @@ type UniongveChallengeFinishRep struct {
Report *BattleReport `protobuf:"bytes,3,opt,name=report,proto3" json:"report"` //战报 Report *BattleReport `protobuf:"bytes,3,opt,name=report,proto3" json:"report"` //战报
} }
func (x *UniongveChallengeFinishRep) Reset() { func (x *UniongveChallengeFinishReq) Reset() {
*x = UniongveChallengeFinishRep{} *x = UniongveChallengeFinishReq{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_uniongve_uniongve_msg_proto_msgTypes[11] mi := &file_uniongve_uniongve_msg_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -630,13 +630,13 @@ func (x *UniongveChallengeFinishRep) Reset() {
} }
} }
func (x *UniongveChallengeFinishRep) String() string { func (x *UniongveChallengeFinishReq) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*UniongveChallengeFinishRep) ProtoMessage() {} func (*UniongveChallengeFinishReq) ProtoMessage() {}
func (x *UniongveChallengeFinishRep) ProtoReflect() protoreflect.Message { func (x *UniongveChallengeFinishReq) ProtoReflect() protoreflect.Message {
mi := &file_uniongve_uniongve_msg_proto_msgTypes[11] mi := &file_uniongve_uniongve_msg_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -648,26 +648,26 @@ func (x *UniongveChallengeFinishRep) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use UniongveChallengeFinishRep.ProtoReflect.Descriptor instead. // Deprecated: Use UniongveChallengeFinishReq.ProtoReflect.Descriptor instead.
func (*UniongveChallengeFinishRep) Descriptor() ([]byte, []int) { func (*UniongveChallengeFinishReq) Descriptor() ([]byte, []int) {
return file_uniongve_uniongve_msg_proto_rawDescGZIP(), []int{11} return file_uniongve_uniongve_msg_proto_rawDescGZIP(), []int{11}
} }
func (x *UniongveChallengeFinishRep) GetUnionid() string { func (x *UniongveChallengeFinishReq) GetUnionid() string {
if x != nil { if x != nil {
return x.Unionid return x.Unionid
} }
return "" return ""
} }
func (x *UniongveChallengeFinishRep) GetBoosid() int32 { func (x *UniongveChallengeFinishReq) GetBoosid() int32 {
if x != nil { if x != nil {
return x.Boosid return x.Boosid
} }
return 0 return 0
} }
func (x *UniongveChallengeFinishRep) GetReport() *BattleReport { func (x *UniongveChallengeFinishReq) GetReport() *BattleReport {
if x != nil { if x != nil {
return x.Report return x.Report
} }
@ -996,7 +996,7 @@ var file_uniongve_uniongve_msg_proto_rawDesc = []byte{
0x32, 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x32, 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69,
0x6e, 0x66, 0x6f, 0x22, 0x75, 0x0a, 0x1a, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, 0x43, 0x6e, 0x66, 0x6f, 0x22, 0x75, 0x0a, 0x1a, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x67, 0x76, 0x65, 0x43,
0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65,
0x70, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x28, 0x09, 0x52, 0x07, 0x75, 0x6e, 0x69, 0x6f, 0x6e, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x62,
0x6f, 0x6f, 0x73, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x6f, 0x6f, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x6f, 0x6f,
0x73, 0x69, 0x64, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x73, 0x69, 0x64, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20,
@ -1055,7 +1055,7 @@ var file_uniongve_uniongve_msg_proto_goTypes = []interface{}{
(*UniongveRouletteResp)(nil), // 8: UniongveRouletteResp (*UniongveRouletteResp)(nil), // 8: UniongveRouletteResp
(*UniongveChallengeReq)(nil), // 9: UniongveChallengeReq (*UniongveChallengeReq)(nil), // 9: UniongveChallengeReq
(*UniongveChallengeResp)(nil), // 10: UniongveChallengeResp (*UniongveChallengeResp)(nil), // 10: UniongveChallengeResp
(*UniongveChallengeFinishRep)(nil), // 11: UniongveChallengeFinishRep (*UniongveChallengeFinishReq)(nil), // 11: UniongveChallengeFinishReq
(*UniongveChallengeFinishResp)(nil), // 12: UniongveChallengeFinishResp (*UniongveChallengeFinishResp)(nil), // 12: UniongveChallengeFinishResp
(*UniongveInfoChangePush)(nil), // 13: UniongveInfoChangePush (*UniongveInfoChangePush)(nil), // 13: UniongveInfoChangePush
(*UniongveStageChangePush)(nil), // 14: UniongveStageChangePush (*UniongveStageChangePush)(nil), // 14: UniongveStageChangePush
@ -1074,7 +1074,7 @@ var file_uniongve_uniongve_msg_proto_depIdxs = []int32{
18, // 2: UniongveRouletteResp.award:type_name -> UserAssets 18, // 2: UniongveRouletteResp.award:type_name -> UserAssets
19, // 3: UniongveChallengeReq.battle:type_name -> BattleFormation 19, // 3: UniongveChallengeReq.battle:type_name -> BattleFormation
20, // 4: UniongveChallengeResp.info:type_name -> BattleInfo 20, // 4: UniongveChallengeResp.info:type_name -> BattleInfo
21, // 5: UniongveChallengeFinishRep.report:type_name -> BattleReport 21, // 5: UniongveChallengeFinishReq.report:type_name -> BattleReport
18, // 6: UniongveChallengeFinishResp.award:type_name -> UserAssets 18, // 6: UniongveChallengeFinishResp.award:type_name -> UserAssets
17, // 7: UniongveInfoChangePush.info:type_name -> DBUnionGve 17, // 7: UniongveInfoChangePush.info:type_name -> DBUnionGve
17, // 8: UniongveStageChangePush.info:type_name -> DBUnionGve 17, // 8: UniongveStageChangePush.info:type_name -> DBUnionGve
@ -1229,7 +1229,7 @@ func file_uniongve_uniongve_msg_proto_init() {
} }
} }
file_uniongve_uniongve_msg_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { file_uniongve_uniongve_msg_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UniongveChallengeFinishRep); i { switch v := v.(*UniongveChallengeFinishReq); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1: