From d0881162ca03debfa51bef71082770f27d895c2c Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 21 Aug 2023 18:02:39 +0800 Subject: [PATCH] =?UTF-8?q?GM=20=E6=BB=A1=E9=93=81=E5=8C=A0=E9=93=BA?= =?UTF-8?q?=E6=89=93=E9=80=A0=20=E6=BB=A1=E5=9B=BE=E9=89=B4=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 2 + modules/friend/api_cross_agree.go | 1 + modules/friend/api_cross_apply.go | 16 +++++ modules/gm/api_cmd.go | 2 + modules/gm/module.go | 30 ++++++++ modules/smithy/comp_configure.go | 28 ++++++++ modules/smithy/module.go | 56 +++++++++++++++ pb/friend_msg.pb.go | 116 ++++++++++++++++++++++++++---- 8 files changed, 236 insertions(+), 15 deletions(-) diff --git a/comm/imodule.go b/comm/imodule.go index 24f048331..932483c62 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -478,6 +478,8 @@ type ( CheckActivateAtlasCollect(uid string, id string) IBuriedUpdateNotify IGetReddot // 铁匠铺红点 + GmProficiency(uid string) + GmSmithyAtlas(session IUserSession) } IPandaAtlas interface { diff --git a/modules/friend/api_cross_agree.go b/modules/friend/api_cross_agree.go index 5d316223e..151949d67 100644 --- a/modules/friend/api_cross_agree.go +++ b/modules/friend/api_cross_agree.go @@ -60,6 +60,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (e //把设置的助战英雄推送给好友 push := &pb.FriendAddAgreePush{ TargetUid: friendId, + Info: self, } this.module.Debug("推送加好友成功", diff --git a/modules/friend/api_cross_apply.go b/modules/friend/api_cross_apply.go index 83bf32f02..03bb6045a 100644 --- a/modules/friend/api_cross_apply.go +++ b/modules/friend/api_cross_apply.go @@ -138,6 +138,22 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (e return } + // 申请推送 + push := &pb.FriendAddApplyPush{ + TargetUid: self.Uid, + Info: self, + } + + this.module.Debug("推送加好友成功", + log.Field{Key: "uid", Value: uid}, + log.Field{Key: "friendId", Value: target.Uid}, + ) + if err := this.module.SendMsgToUsers(string(this.module.GetType()), "addapply", push, target.Uid); err != nil { + this.module.Error("推送加好友成功", + log.Field{Key: "uid", Value: uid}, + log.Field{Key: "err", Value: err.Error()}, + ) + } resp := &pb.FriendApplyResp{ UserId: session.GetUserId(), FriendId: req.FriendId, diff --git a/modules/gm/api_cmd.go b/modules/gm/api_cmd.go index a56b79160..e2ddfbd83 100644 --- a/modules/gm/api_cmd.go +++ b/modules/gm/api_cmd.go @@ -41,6 +41,8 @@ import ( 31、bingo:jx // 获得所有教习资源 32、bingo:godlike // 一键超神 33、bingo:race,1,10 +34、bingo:smithypro +35、bingo:smithyatlas */ //参数校验 func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (errdata *pb.ErrorData) { diff --git a/modules/gm/module.go b/modules/gm/module.go index bf0994f6a..1ef96213b 100644 --- a/modules/gm/module.go +++ b/modules/gm/module.go @@ -603,6 +603,36 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er module1.(comm.IStonehenge).GmAddStoneEvent(session.GetUserId(), int32(num1)) + this.Debug("使用bingo命令:uid = %s ", + log.Field{Key: "uid", Value: session.GetUserId()}, + log.Field{Key: "0", Value: datas[0]}, + ) + } else if len(datas) == 1 && (datas[0] == "smithyatlas") { // gm + var ( + err error + ) + module1, err := this.service.GetModule(comm.ModuleSmithy) + if err != nil { + return + } + + module1.(comm.ISmithy).GmSmithyAtlas(session) + + this.Debug("使用bingo命令:uid = %s ", + log.Field{Key: "uid", Value: session.GetUserId()}, + log.Field{Key: "0", Value: datas[0]}, + ) + } else if len(datas) == 1 && (datas[0] == "smithypro") { // gm + var ( + err error + ) + module1, err := this.service.GetModule(comm.ModuleSmithy) + if err != nil { + return + } + + module1.(comm.ISmithy).GmProficiency(session.GetUserId()) + this.Debug("使用bingo命令:uid = %s ", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "0", Value: datas[0]}, diff --git a/modules/smithy/comp_configure.go b/modules/smithy/comp_configure.go index f64a5f66c..35b730928 100644 --- a/modules/smithy/comp_configure.go +++ b/modules/smithy/comp_configure.go @@ -62,6 +62,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp err = this.LoadConfigure(game_smithytask, cfg.NewGameSmithyTask) err = this.LoadConfigure(game_smithymake, cfg.NewGameSmithyMake) + this.GmGetAllAtlasConf() return } @@ -332,3 +333,30 @@ func (this *configureComp) GetSmithyMake(cid int32) (data *cfg.GameSmithyMakeDat err = comm.NewNotFoundConfErr(moduleName, game_smithymake, cid) return } + +// gm 查询 不管性能 +func (this *configureComp) GmGetProficileData() (conf map[int32]int32) { + conf = make(map[int32]int32, 0) + if v, err := this.GetConfigure(game_smproficiency); err == nil { + if configure, ok := v.(*cfg.GameSmithyProficiency); ok { + for _, v := range configure.GetDataList() { + if _, ok := conf[v.ReelId]; !ok { + conf[v.ReelId] = v.ProficiencyLv + } + conf[v.ReelId] = v.ProficiencyLv + } + return + } + } + return +} + +func (this *configureComp) GmGetAllAtlasConf() (data []*cfg.GameSmithyAtlasData) { + if v, err := this.GetConfigure(game_smithyatlas); err == nil { + if configure, ok := v.(*cfg.GameSmithyAtlas); ok { + data = configure.GetDataList() + } + } + + return +} diff --git a/modules/smithy/module.go b/modules/smithy/module.go index 6fe21b854..d777cad16 100644 --- a/modules/smithy/module.go +++ b/modules/smithy/module.go @@ -13,6 +13,7 @@ import ( "go_dreamfactory/modules" "go_dreamfactory/pb" "go_dreamfactory/sys/configure" + cfg "go_dreamfactory/sys/configure/structs" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" @@ -258,3 +259,58 @@ func (this *Smithy) BuriedsNotify(session comm.IUserSession, conds []*pb.ConIPro } } } + +// gm 不管性能 +func (this *Smithy) GmProficiency(uid string) { + stove, err := this.modelStove.getSmithyStoveList(uid) + if err != nil { + + return + } + conf := this.configure.GmGetProficileData() + for k, v := range conf { + if c := this.configure.GetSmithyProficileData(k, v); c != nil { + stove.Data[k] = &pb.Mastery{ + Lv: v, + Value: c.Proficiency, + } + } + } + + update := make(map[string]interface{}) + update["data"] = stove.Data + this.modelStove.updateSmithyStove(uid, update) +} + +// gm 新增图鉴信息 +func (this *Smithy) GmSmithyAtlas(session comm.IUserSession) { + var ( + res []*cfg.Gameatn + ) + + conf := this.configure.GmGetAllAtlasConf() + for _, v := range conf { + + for _, v1 := range this.configure.GetAllEquipmentConfigure() { + if v1.AtlasId == v.Id { + res = append(res, &cfg.Gameatn{ + A: "equi", + T: v1.Id, + N: 1, + }) + break + } + } + } + + if errdata, atno := this.DispenseAtno(session, res, true); errdata == nil { + ids := make([]string, 0) + for _, v := range atno { + ids = append(ids, v.O) + } + if equip, errdata := this.ModuleEquipment.QueryEquipment(session.GetUserId(), ids...); errdata == nil { + this.modelAtlas.CheckActivateEquipAtlas(session.GetUserId(), equip, 1) + } + } + +} diff --git a/pb/friend_msg.pb.go b/pb/friend_msg.pb.go index fbd1c2f93..e978664f2 100644 --- a/pb/friend_msg.pb.go +++ b/pb/friend_msg.pb.go @@ -2125,7 +2125,8 @@ type FriendAddAgreePush struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - TargetUid string `protobuf:"bytes,1,opt,name=targetUid,proto3" json:"targetUid"` // 好友id + TargetUid string `protobuf:"bytes,1,opt,name=targetUid,proto3" json:"targetUid"` // 好友id + Info *DBFriend `protobuf:"bytes,2,opt,name=info,proto3" json:"info"` } func (x *FriendAddAgreePush) Reset() { @@ -2167,6 +2168,68 @@ func (x *FriendAddAgreePush) GetTargetUid() string { return "" } +func (x *FriendAddAgreePush) GetInfo() *DBFriend { + if x != nil { + return x.Info + } + return nil +} + +type FriendAddApplyPush struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TargetUid string `protobuf:"bytes,1,opt,name=targetUid,proto3" json:"targetUid"` // 好友id + Info *DBFriend `protobuf:"bytes,2,opt,name=info,proto3" json:"info"` +} + +func (x *FriendAddApplyPush) Reset() { + *x = FriendAddApplyPush{} + if protoimpl.UnsafeEnabled { + mi := &file_friend_friend_msg_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FriendAddApplyPush) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FriendAddApplyPush) ProtoMessage() {} + +func (x *FriendAddApplyPush) ProtoReflect() protoreflect.Message { + mi := &file_friend_friend_msg_proto_msgTypes[43] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FriendAddApplyPush.ProtoReflect.Descriptor instead. +func (*FriendAddApplyPush) Descriptor() ([]byte, []int) { + return file_friend_friend_msg_proto_rawDescGZIP(), []int{43} +} + +func (x *FriendAddApplyPush) GetTargetUid() string { + if x != nil { + return x.TargetUid + } + return "" +} + +func (x *FriendAddApplyPush) GetInfo() *DBFriend { + if x != nil { + return x.Info + } + return nil +} + var File_friend_friend_msg_proto protoreflect.FileDescriptor var file_friend_friend_msg_proto_rawDesc = []byte{ @@ -2328,11 +2391,19 @@ var file_friend_friend_msg_proto_rawDesc = []byte{ 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x55, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x55, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x32, 0x0a, 0x12, 0x46, + 0x01, 0x28, 0x08, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x51, 0x0a, 0x12, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x41, 0x67, 0x72, 0x65, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x55, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x55, 0x69, 0x64, 0x42, - 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x55, 0x69, 0x64, 0x12, + 0x1d, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, + 0x44, 0x42, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x51, + 0x0a, 0x12, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x41, 0x70, 0x70, 0x6c, 0x79, + 0x50, 0x75, 0x73, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x55, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x55, + 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x09, 0x2e, 0x44, 0x42, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x52, 0x04, 0x69, 0x6e, 0x66, + 0x6f, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -2347,7 +2418,7 @@ func file_friend_friend_msg_proto_rawDescGZIP() []byte { return file_friend_friend_msg_proto_rawDescData } -var file_friend_friend_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 43) +var file_friend_friend_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 44) var file_friend_friend_msg_proto_goTypes = []interface{}{ (*FriendBase)(nil), // 0: FriendBase (*FriendListReq)(nil), // 1: FriendListReq @@ -2392,26 +2463,29 @@ var file_friend_friend_msg_proto_goTypes = []interface{}{ (*FriendGetRelationReq)(nil), // 40: FriendGetRelationReq (*FriendGetRelationResp)(nil), // 41: FriendGetRelationResp (*FriendAddAgreePush)(nil), // 42: FriendAddAgreePush - (*DBFriend)(nil), // 43: DBFriend - (*AssistRecord)(nil), // 44: AssistRecord + (*FriendAddApplyPush)(nil), // 43: FriendAddApplyPush + (*DBFriend)(nil), // 44: DBFriend + (*AssistRecord)(nil), // 45: AssistRecord } var file_friend_friend_msg_proto_depIdxs = []int32{ 0, // 0: FriendListResp.list:type_name -> FriendBase - 43, // 1: FriendListResp.friend:type_name -> DBFriend + 44, // 1: FriendListResp.friend:type_name -> DBFriend 0, // 2: FriendRandlistResp.list:type_name -> FriendBase 0, // 3: FriendApplyListResp.list:type_name -> FriendBase 0, // 4: FriendSearchResp.friends:type_name -> FriendBase 0, // 5: FriendBlackListResp.friends:type_name -> FriendBase 0, // 6: FriendZanlistResp.list:type_name -> FriendBase 0, // 7: FriendAssistlistResp.list:type_name -> FriendBase - 44, // 8: FriendAssistlistResp.record:type_name -> AssistRecord + 45, // 8: FriendAssistlistResp.record:type_name -> AssistRecord 0, // 9: FriendAssistHeroUpdatePush.friend:type_name -> FriendBase 0, // 10: FriendAssistHeroListResp.friends:type_name -> FriendBase - 11, // [11:11] is the sub-list for method output_type - 11, // [11:11] is the sub-list for method input_type - 11, // [11:11] is the sub-list for extension type_name - 11, // [11:11] is the sub-list for extension extendee - 0, // [0:11] is the sub-list for field type_name + 44, // 11: FriendAddAgreePush.info:type_name -> DBFriend + 44, // 12: FriendAddApplyPush.info:type_name -> DBFriend + 13, // [13:13] is the sub-list for method output_type + 13, // [13:13] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name } func init() { file_friend_friend_msg_proto_init() } @@ -2937,6 +3011,18 @@ func file_friend_friend_msg_proto_init() { return nil } } + file_friend_friend_msg_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FriendAddApplyPush); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -2944,7 +3030,7 @@ func file_friend_friend_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_friend_friend_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 43, + NumMessages: 44, NumExtensions: 0, NumServices: 0, },