上传工会boos战代码
This commit is contained in:
parent
fb084e55d9
commit
8f84a12855
@ -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 {
|
||||
this.module.Errorln(err)
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if err = this.module.pushChatToUnion(chat); err != nil {
|
||||
this.module.Errorln(err)
|
||||
if errdata = this.module.pushChatToUnion(chat); errdata != nil {
|
||||
this.module.Errorln(errdata)
|
||||
return
|
||||
}
|
||||
return
|
||||
|
@ -2,6 +2,7 @@ package chat
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/base"
|
||||
"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) {
|
||||
var (
|
||||
max_chat int32
|
||||
errdata *pb.ErrorData
|
||||
)
|
||||
if max_chat, err = this.configure.GetChannelRecordMax(); err != nil {
|
||||
this.Errorln(err)
|
||||
@ -106,7 +108,8 @@ func (this *Chat) Rpc_ModuleChatPushChat(ctx context.Context, args *pb.DBChat, r
|
||||
}
|
||||
break
|
||||
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)
|
||||
return
|
||||
}
|
||||
@ -189,8 +192,8 @@ func (this *Chat) SendUnionChat(msg *pb.DBChat) (errdata *pb.ErrorData) {
|
||||
return
|
||||
}
|
||||
if this.IsCross() {
|
||||
if err = this.modelChat.sendChatToUnion(msg, max_chat); err != nil {
|
||||
this.Errorln(err)
|
||||
if errdata = this.modelChat.sendChatToUnion(msg, max_chat); errdata != nil {
|
||||
this.Errorln(errdata)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
@ -353,8 +356,11 @@ func (this *Chat) pushChatToWorld(msg *pb.DBChat) (err error) {
|
||||
}
|
||||
|
||||
// 推送消息到工会
|
||||
func (this *Chat) pushChatToUnion(msg *pb.DBChat) (err error) {
|
||||
if members := this.sociaty.MembersBySociatyId(msg.UnionId); members != nil {
|
||||
func (this *Chat) pushChatToUnion(msg *pb.DBChat) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
members []*pb.SociatyMemberInfo
|
||||
)
|
||||
if members, errdata = this.sociaty.MembersBySociatyId(msg.UnionId); members != nil {
|
||||
users := make([]string, 0, len(members))
|
||||
for _, v := range members {
|
||||
if v.OfflineTime == 0 { //离线时间为0 表示在线
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
// 获取工会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 (
|
||||
conf *cfg.GameGuildBossData
|
||||
score *cfg.GameGuildBossScoreData
|
||||
|
@ -98,5 +98,5 @@ func (this *ModelUnionroulette) roulettechangePush(unionid string, uid string, a
|
||||
|
||||
this.module.SendMsgToUsers(string(this.module.GetType()), "roulettechange", &pb.UniongveRouletteChangePush{
|
||||
Record: info,
|
||||
})
|
||||
}, users...)
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ func (this *ModelUniongve) booshpchangepush(unionid string, info *pb.DBUnionGve)
|
||||
}
|
||||
this.module.SendMsgToUsers(string(this.module.GetType()), "booschange", &pb.UniongveBoosChangePush{
|
||||
Info: info,
|
||||
})
|
||||
}, users...)
|
||||
}
|
||||
|
||||
// 击杀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{
|
||||
Info: info,
|
||||
})
|
||||
}, users...)
|
||||
}
|
||||
|
||||
// boos 信息变化推送
|
||||
|
@ -116,7 +116,7 @@ func (this *modelRank) raceSettlement() {
|
||||
|
||||
}
|
||||
|
||||
// boos 血量变化推送
|
||||
// boos 奖励推送
|
||||
func (this *modelRank) rankRewardPush(unionid string, reward []*cfg.Gameatn) {
|
||||
var (
|
||||
members []*pb.SociatyMemberInfo
|
||||
|
@ -611,7 +611,7 @@ func (x *UniongveChallengeResp) GetInfo() *BattleInfo {
|
||||
}
|
||||
|
||||
//战斗 完成请求
|
||||
type UniongveChallengeFinishRep struct {
|
||||
type UniongveChallengeFinishReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
@ -621,8 +621,8 @@ type UniongveChallengeFinishRep struct {
|
||||
Report *BattleReport `protobuf:"bytes,3,opt,name=report,proto3" json:"report"` //战报
|
||||
}
|
||||
|
||||
func (x *UniongveChallengeFinishRep) Reset() {
|
||||
*x = UniongveChallengeFinishRep{}
|
||||
func (x *UniongveChallengeFinishReq) Reset() {
|
||||
*x = UniongveChallengeFinishReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_uniongve_uniongve_msg_proto_msgTypes[11]
|
||||
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)
|
||||
}
|
||||
|
||||
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]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@ -648,26 +648,26 @@ func (x *UniongveChallengeFinishRep) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UniongveChallengeFinishRep.ProtoReflect.Descriptor instead.
|
||||
func (*UniongveChallengeFinishRep) Descriptor() ([]byte, []int) {
|
||||
// Deprecated: Use UniongveChallengeFinishReq.ProtoReflect.Descriptor instead.
|
||||
func (*UniongveChallengeFinishReq) Descriptor() ([]byte, []int) {
|
||||
return file_uniongve_uniongve_msg_proto_rawDescGZIP(), []int{11}
|
||||
}
|
||||
|
||||
func (x *UniongveChallengeFinishRep) GetUnionid() string {
|
||||
func (x *UniongveChallengeFinishReq) GetUnionid() string {
|
||||
if x != nil {
|
||||
return x.Unionid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UniongveChallengeFinishRep) GetBoosid() int32 {
|
||||
func (x *UniongveChallengeFinishReq) GetBoosid() int32 {
|
||||
if x != nil {
|
||||
return x.Boosid
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UniongveChallengeFinishRep) GetReport() *BattleReport {
|
||||
func (x *UniongveChallengeFinishReq) GetReport() *BattleReport {
|
||||
if x != nil {
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
@ -1055,7 +1055,7 @@ var file_uniongve_uniongve_msg_proto_goTypes = []interface{}{
|
||||
(*UniongveRouletteResp)(nil), // 8: UniongveRouletteResp
|
||||
(*UniongveChallengeReq)(nil), // 9: UniongveChallengeReq
|
||||
(*UniongveChallengeResp)(nil), // 10: UniongveChallengeResp
|
||||
(*UniongveChallengeFinishRep)(nil), // 11: UniongveChallengeFinishRep
|
||||
(*UniongveChallengeFinishReq)(nil), // 11: UniongveChallengeFinishReq
|
||||
(*UniongveChallengeFinishResp)(nil), // 12: UniongveChallengeFinishResp
|
||||
(*UniongveInfoChangePush)(nil), // 13: UniongveInfoChangePush
|
||||
(*UniongveStageChangePush)(nil), // 14: UniongveStageChangePush
|
||||
@ -1074,7 +1074,7 @@ var file_uniongve_uniongve_msg_proto_depIdxs = []int32{
|
||||
18, // 2: UniongveRouletteResp.award:type_name -> UserAssets
|
||||
19, // 3: UniongveChallengeReq.battle:type_name -> BattleFormation
|
||||
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
|
||||
17, // 7: UniongveInfoChangePush.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{} {
|
||||
switch v := v.(*UniongveChallengeFinishRep); i {
|
||||
switch v := v.(*UniongveChallengeFinishReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
Loading…
Reference in New Issue
Block a user