From e3066d4b19f40d3a6460f7d724cc6c8420cebd7c Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 18 Oct 2022 16:42:06 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=BE=81=E7=BB=8A=E9=A2=86=E5=A5=96?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/library/api.go | 1 + modules/library/api_getstoryreward.go | 8 +++- modules/library/api_usegift.go | 8 ++-- pb/library_msg.pb.go | 68 +++++++++++++-------------- 4 files changed, 46 insertions(+), 39 deletions(-) diff --git a/modules/library/api.go b/modules/library/api.go index ec1c63be3..7b178de88 100644 --- a/modules/library/api.go +++ b/modules/library/api.go @@ -16,6 +16,7 @@ const ( LibraryRankListResp = "ranklist" LibraryActivationFetterResp = "activationfetter" LibraryChangePush = "change" + LibraryGetStoryRewardResp = "getstoryreward" ) type apiComp struct { diff --git a/modules/library/api_getstoryreward.go b/modules/library/api_getstoryreward.go index 1663bbac1..e26f6145d 100644 --- a/modules/library/api_getstoryreward.go +++ b/modules/library/api_getstoryreward.go @@ -23,6 +23,7 @@ func (this *apiComp) GetStoryRewardCheck(session comm.IUserSession, req *pb.Libr func (this *apiComp) GetStoryReward(session comm.IUserSession, req *pb.LibraryGetStoryRewardReq) (code pb.ErrorCode, data proto.Message) { + resp := &pb.LibraryGetStoryRewardResp{} code = this.GetStoryRewardCheck(session, req) if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 @@ -33,7 +34,7 @@ func (this *apiComp) GetStoryReward(session comm.IUserSession, req *pb.LibraryGe return } - conf := this.module.configure.GetLibraryHero(req.Hid) + conf := this.module.configure.GetLibraryHero(_heroFetter.Heroid) if req.History != 0 { for index, v := range conf.History { if utils.ToInt32(v) == req.History && conf.Favorlv[index] >= _heroFetter.Favorlv { @@ -53,6 +54,8 @@ func (this *apiComp) GetStoryReward(session comm.IUserSession, req *pb.LibraryGe mapData := make(map[string]interface{}, 0) mapData["history"] = _heroFetter.History this.module.modelFetter.modifyHeroFetterDataByObjId(session.GetUserId(), _heroFetter.Id, mapData) + resp.Data = _heroFetter + break } } else if req.Rightend != 0 { // 剧情奖励 if req.Rightend == conf.Rightend && _heroFetter.Stroyprize != conf.Rightend { @@ -65,8 +68,9 @@ func (this *apiComp) GetStoryReward(session comm.IUserSession, req *pb.LibraryGe mapData := make(map[string]interface{}, 0) mapData["stroyprize"] = _heroFetter.Stroyprize this.module.modelFetter.modifyHeroFetterDataByObjId(session.GetUserId(), _heroFetter.Id, mapData) + resp.Data = _heroFetter } } - + session.SendMsg(string(this.module.GetType()), LibraryGetStoryRewardResp, resp) return } diff --git a/modules/library/api_usegift.go b/modules/library/api_usegift.go index 37f6e6bbd..33b8dd2db 100644 --- a/modules/library/api_usegift.go +++ b/modules/library/api_usegift.go @@ -34,7 +34,8 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe return } // 查询该英雄原始的星级 - curStar = this.configure.GetHeroConfigStar(_heroObj.Heroid) + + curStar = this.module.configure.GetHeroConfigStar(_heroObj.Heroid) if curStar == 0 { code = pb.ErrorCode_ConfigNoFound return @@ -70,8 +71,8 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe code = pb.ErrorCode_LibraryMaxLv break } - if favorConf[_heroObj.Favorlv] <= _heroObj.Favorexp { - _heroObj.Favorexp -= favorConf[_heroObj.Favorlv] + if favorConf[_heroObj.Favorlv+1] <= _heroObj.Favorexp { + _heroObj.Favorexp -= favorConf[_heroObj.Favorlv+1] _heroObj.Favorlv += 1 } else { break @@ -85,6 +86,7 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe mapData["favorexp"] = _heroObj.Favorexp mapData["favorlv"] = _heroObj.Favorlv this.module.modelFetter.modifyHeroFetterDataByObjId(session.GetUserId(), _heroObj.Id, mapData) + rsp.Data = _heroObj session.SendMsg(string(this.module.GetType()), LibraryUseGiftResp, rsp) return diff --git a/pb/library_msg.pb.go b/pb/library_msg.pb.go index d13d53f65..aa5d4dcbd 100644 --- a/pb/library_msg.pb.go +++ b/pb/library_msg.pb.go @@ -364,7 +364,7 @@ type LibraryGetStoryRewardResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Data *DBLibrary `protobuf:"bytes,1,opt,name=data,proto3" json:"data"` + Data *DBHeroFetter `protobuf:"bytes,1,opt,name=data,proto3" json:"data"` } func (x *LibraryGetStoryRewardResp) Reset() { @@ -399,7 +399,7 @@ func (*LibraryGetStoryRewardResp) Descriptor() ([]byte, []int) { return file_library_library_msg_proto_rawDescGZIP(), []int{7} } -func (x *LibraryGetStoryRewardResp) GetData() *DBLibrary { +func (x *LibraryGetStoryRewardResp) GetData() *DBHeroFetter { if x != nil { return x.Data } @@ -691,37 +691,37 @@ var file_library_library_msg_proto_rawDesc = []byte{ 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x69, 0x67, 0x68, 0x74, 0x65, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x69, 0x67, 0x68, 0x74, 0x65, 0x6e, 0x64, 0x22, - 0x3b, 0x0a, 0x19, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f, - 0x72, 0x79, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x4c, - 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x9a, 0x01, 0x0a, - 0x11, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x55, 0x73, 0x65, 0x47, 0x69, 0x66, 0x74, 0x52, - 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x12, 0x33, 0x0a, 0x05, 0x69, 0x74, - 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x4c, 0x69, 0x62, 0x72, - 0x61, 0x72, 0x79, 0x55, 0x73, 0x65, 0x47, 0x69, 0x66, 0x74, 0x52, 0x65, 0x71, 0x2e, 0x49, 0x74, - 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, - 0x38, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x37, 0x0a, 0x12, 0x4c, 0x69, 0x62, - 0x72, 0x61, 0x72, 0x79, 0x55, 0x73, 0x65, 0x47, 0x69, 0x66, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, - 0x21, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, - 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, 0x52, 0x04, 0x64, 0x61, - 0x74, 0x61, 0x22, 0x2e, 0x0a, 0x1a, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x41, 0x63, 0x74, - 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, - 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, - 0x69, 0x64, 0x22, 0x3d, 0x0a, 0x1b, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x41, 0x63, 0x74, - 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, - 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0a, 0x2e, 0x44, 0x42, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x22, 0x5a, 0x0a, 0x11, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x43, 0x68, 0x61, 0x6e, - 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, - 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x25, 0x0a, 0x06, 0x66, 0x65, 0x74, 0x74, 0x65, 0x72, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x46, - 0x65, 0x74, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, 0x65, 0x74, 0x74, 0x65, 0x72, 0x42, 0x06, 0x5a, - 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x3e, 0x0a, 0x19, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f, + 0x72, 0x79, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x48, + 0x65, 0x72, 0x6f, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, + 0x9a, 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x55, 0x73, 0x65, 0x47, 0x69, + 0x66, 0x74, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x12, 0x33, 0x0a, + 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x4c, + 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x55, 0x73, 0x65, 0x47, 0x69, 0x66, 0x74, 0x52, 0x65, 0x71, + 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, 0x65, + 0x6d, 0x73, 0x1a, 0x38, 0x0a, 0x0a, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x37, 0x0a, 0x12, + 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x55, 0x73, 0x65, 0x47, 0x69, 0x66, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x12, 0x21, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x2e, 0x0a, 0x1a, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, + 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6f, 0x69, 0x64, 0x22, 0x3d, 0x0a, 0x1b, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, + 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x22, 0x5a, 0x0a, 0x11, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x43, + 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x4c, 0x69, 0x62, 0x72, + 0x61, 0x72, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x25, 0x0a, 0x06, 0x66, 0x65, 0x74, + 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x48, 0x65, + 0x72, 0x6f, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, 0x65, 0x74, 0x74, 0x65, 0x72, + 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -759,7 +759,7 @@ var file_library_library_msg_proto_depIdxs = []int32{ 14, // 0: LibraryGetListResp.data:type_name -> DBLibrary 15, // 1: LibraryGetFetterListResp.data:type_name -> DBHeroFetter 14, // 2: LibraryGetRewardResp.data:type_name -> DBLibrary - 14, // 3: LibraryGetStoryRewardResp.data:type_name -> DBLibrary + 15, // 3: LibraryGetStoryRewardResp.data:type_name -> DBHeroFetter 13, // 4: LibraryUseGiftReq.items:type_name -> LibraryUseGiftReq.ItemsEntry 15, // 5: LibraryUseGiftResp.data:type_name -> DBHeroFetter 14, // 6: LibraryActivationFetterResp.data:type_name -> DBLibrary From 85409bd46a93ab42f89cc558d0b9a19372397e42 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 18 Oct 2022 18:01:55 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=8F=98=E6=9B=B4=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=9A=E4=B8=AA=E9=9A=8F=E6=9C=BA=E5=89=A7?= =?UTF-8?q?=E6=83=85=E5=A5=96=E5=8A=B1=E3=80=82=E6=96=B0=E5=A2=9E=E5=A5=BD?= =?UTF-8?q?=E6=84=9F=E5=BA=A6=E5=A5=96=E5=8A=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_libraryfavor.json | 81 ++- bin/json/game_libraryhero.json | 32 + bin/json/game_msgdistrib.json | 2 +- bin/json/game_pagoda.json | 551 ------------------ modules/library/api.go | 1 + modules/library/api_getstoryreward.go | 28 +- modules/library/api_lvreward.go | 64 ++ modules/library/comp_configure.go | 21 +- modules/library/module.go | 3 +- pb/library_db.pb.go | 36 +- pb/library_msg.pb.go | 178 +++++- sys/configure/structs/Game.LibraryFavor.go | 14 +- .../structs/Game.LibraryFavorData.go | 15 + sys/configure/structs/Game.LibraryHeroData.go | 17 + 14 files changed, 432 insertions(+), 611 deletions(-) create mode 100644 modules/library/api_lvreward.go diff --git a/bin/json/game_libraryfavor.json b/bin/json/game_libraryfavor.json index 21626fb61..26c598dea 100644 --- a/bin/json/game_libraryfavor.json +++ b/bin/json/game_libraryfavor.json @@ -3,54 +3,117 @@ "id": 1, "star": 3, "favorlv": 1, - "expneed": 0 + "expneed": 0, + "prize": [ + { + "a": "attr", + "t": "gold", + "n": 1000 + } + ] }, { "id": 2, "star": 3, "favorlv": 2, - "expneed": 100 + "expneed": 100, + "prize": [ + { + "a": "attr", + "t": "gold", + "n": 1200 + } + ] }, { "id": 3, "star": 3, "favorlv": 3, - "expneed": 200 + "expneed": 200, + "prize": [ + { + "a": "attr", + "t": "gold", + "n": 1500 + } + ] }, { "id": 4, "star": 4, "favorlv": 1, - "expneed": 0 + "expneed": 0, + "prize": [ + { + "a": "attr", + "t": "gold", + "n": 1200 + } + ] }, { "id": 5, "star": 4, "favorlv": 2, - "expneed": 200 + "expneed": 200, + "prize": [ + { + "a": "attr", + "t": "gold", + "n": 1500 + } + ] }, { "id": 6, "star": 4, "favorlv": 3, - "expneed": 400 + "expneed": 400, + "prize": [ + { + "a": "attr", + "t": "gold", + "n": 1800 + } + ] }, { "id": 7, "star": 5, "favorlv": 1, - "expneed": 0 + "expneed": 0, + "prize": [ + { + "a": "attr", + "t": "gold", + "n": 1500 + } + ] }, { "id": 8, "star": 5, "favorlv": 2, - "expneed": 250 + "expneed": 250, + "prize": [ + { + "a": "attr", + "t": "gold", + "n": 1800 + } + ] }, { "id": 9, "star": 5, "favorlv": 3, - "expneed": 400 + "expneed": 400, + "prize": [ + { + "a": "attr", + "t": "gold", + "n": 2100 + } + ] } ] \ No newline at end of file diff --git a/bin/json/game_libraryhero.json b/bin/json/game_libraryhero.json index 275245cef..f86a79a7d 100644 --- a/bin/json/game_libraryhero.json +++ b/bin/json/game_libraryhero.json @@ -25,8 +25,16 @@ "n": 1000 } ], + "special_stroyprize": [ + { + "a": "attr", + "t": "gold", + "n": 2000 + } + ], "endid1": 10009, "endid2": 10010, + "endid3": 10011, "fid": [ 102 ] @@ -57,8 +65,16 @@ "n": 1000 } ], + "special_stroyprize": [ + { + "a": "attr", + "t": "gold", + "n": 2000 + } + ], "endid1": 10009, "endid2": 10010, + "endid3": 10011, "fid": [ 101 ] @@ -89,8 +105,16 @@ "n": 1000 } ], + "special_stroyprize": [ + { + "a": "attr", + "t": "gold", + "n": 2000 + } + ], "endid1": 10009, "endid2": 10010, + "endid3": 10011, "fid": [ 101 ] @@ -121,8 +145,16 @@ "n": 1000 } ], + "special_stroyprize": [ + { + "a": "attr", + "t": "gold", + "n": 2000 + } + ], "endid1": 10009, "endid2": 10010, + "endid3": 10011, "fid": [ 102 ] diff --git a/bin/json/game_msgdistrib.json b/bin/json/game_msgdistrib.json index 6ee5e9cd6..ca356330d 100644 --- a/bin/json/game_msgdistrib.json +++ b/bin/json/game_msgdistrib.json @@ -37,7 +37,7 @@ }, { "msgid": "moonfantasy", - "open": false, + "open": true, "routrules": "~/worker", "describe": "月之秘境" }, diff --git a/bin/json/game_pagoda.json b/bin/json/game_pagoda.json index 64c36e22c..c8a4fe2ad 100644 --- a/bin/json/game_pagoda.json +++ b/bin/json/game_pagoda.json @@ -28,557 +28,6 @@ }, "model_display": 250015 }, - { - "key": 2, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 2, - "monster_id": [ - 501004, - 501005 - ], - "reward": [ - { - "a": "attr", - "t": "diamond", - "n": 50 - }, - { - "a": "attr", - "t": "gold", - "n": 660 - } - ], - "exp": 840, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer2", - "text": "第2层" - }, - "model_display": 340065 - }, - { - "key": 3, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 3, - "monster_id": [ - 501007, - 501008 - ], - "reward": [ - { - "a": "attr", - "t": "diamond", - "n": 50 - }, - { - "a": "attr", - "t": "gold", - "n": 897 - } - ], - "exp": 760, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer3", - "text": "第3层" - }, - "model_display": 250015 - }, - { - "key": 4, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 4, - "monster_id": [ - 501010, - 501011 - ], - "reward": [ - { - "a": "item", - "t": "30001", - "n": 2 - }, - { - "a": "attr", - "t": "gold", - "n": 3446 - } - ], - "exp": 2315, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer4", - "text": "第4层" - }, - "model_display": 340065 - }, - { - "key": 5, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 5, - "monster_id": [ - 501013, - 501014 - ], - "reward": [ - { - "a": "attr", - "t": "diamond", - "n": 50 - }, - { - "a": "attr", - "t": "gold", - "n": 4535 - } - ], - "exp": 3375, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer5", - "text": "第5层" - }, - "model_display": 250015 - }, - { - "key": 6, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 6, - "monster_id": [ - 501016, - 501017 - ], - "reward": [ - { - "a": "attr", - "t": "diamond", - "n": 50 - }, - { - "a": "attr", - "t": "gold", - "n": 5624 - } - ], - "exp": 4050, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer6", - "text": "第6层" - }, - "model_display": 340065 - }, - { - "key": 7, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 7, - "monster_id": [ - 501019, - 501020 - ], - "reward": [ - { - "a": "attr", - "t": "diamond", - "n": 50 - }, - { - "a": "attr", - "t": "gold", - "n": 7502 - } - ], - "exp": 5860, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer7", - "text": "第7层" - }, - "model_display": 250015 - }, - { - "key": 8, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 8, - "monster_id": [ - 501022, - 501023 - ], - "reward": [ - { - "a": "item", - "t": "60002", - "n": 1 - }, - { - "a": "attr", - "t": "gold", - "n": 10453 - } - ], - "exp": 7580, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer8", - "text": "第8层" - }, - "model_display": 340065 - }, - { - "key": 9, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 9, - "monster_id": [ - 501025, - 501026 - ], - "reward": [ - { - "a": "attr", - "t": "diamond", - "n": 50 - }, - { - "a": "attr", - "t": "gold", - "n": 13306 - } - ], - "exp": 9060, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer9", - "text": "第9层" - }, - "model_display": 250015 - }, - { - "key": 10, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 10, - "monster_id": [ - 501028, - 501029 - ], - "reward": [ - { - "a": "attr", - "t": "diamond", - "n": 50 - }, - { - "a": "attr", - "t": "gold", - "n": 18206 - } - ], - "exp": 12700, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer10", - "text": "第10层" - }, - "model_display": 340065 - }, - { - "key": 11, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 11, - "monster_id": [ - 501031, - 501032 - ], - "reward": [ - { - "a": "attr", - "t": "diamond", - "n": 50 - }, - { - "a": "attr", - "t": "gold", - "n": 22254 - } - ], - "exp": 18990, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer11", - "text": "第11层" - }, - "model_display": 250015 - }, - { - "key": 12, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 12, - "monster_id": [ - 501034, - 501035 - ], - "reward": [ - { - "a": "item", - "t": "30001", - "n": 2 - }, - { - "a": "attr", - "t": "gold", - "n": 25593 - } - ], - "exp": 22170, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer12", - "text": "第12层" - }, - "model_display": 340065 - }, - { - "key": 13, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 13, - "monster_id": [ - 501037, - 501038 - ], - "reward": [ - { - "a": "attr", - "t": "diamond", - "n": 50 - }, - { - "a": "attr", - "t": "gold", - "n": 30601 - } - ], - "exp": 25740, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer13", - "text": "第13层" - }, - "model_display": 250015 - }, - { - "key": 14, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 14, - "monster_id": [ - 501040, - 501041 - ], - "reward": [ - { - "a": "attr", - "t": "diamond", - "n": 50 - }, - { - "a": "attr", - "t": "gold", - "n": 39286 - } - ], - "exp": 30600, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer14", - "text": "第14层" - }, - "model_display": 340065 - }, - { - "key": 15, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 15, - "monster_id": [ - 501043, - 501044 - ], - "reward": [ - { - "a": "attr", - "t": "diamond", - "n": 50 - }, - { - "a": "attr", - "t": "gold", - "n": 43349 - } - ], - "exp": 36300, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer15", - "text": "第15层" - }, - "model_display": 250015 - }, - { - "key": 16, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 16, - "monster_id": [ - 501046, - 501047 - ], - "reward": [ - { - "a": "item", - "t": "60002", - "n": 1 - }, - { - "a": "attr", - "t": "gold", - "n": 47415 - } - ], - "exp": 44100, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer16", - "text": "第16层" - }, - "model_display": 340065 - }, - { - "key": 17, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 17, - "monster_id": [ - 501049, - 501050 - ], - "reward": [ - { - "a": "attr", - "t": "diamond", - "n": 50 - }, - { - "a": "attr", - "t": "gold", - "n": 63694 - } - ], - "exp": 65300, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer17", - "text": "第17层" - }, - "model_display": 250015 - }, - { - "key": 18, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 18, - "monster_id": [ - 501052, - 501053 - ], - "reward": [ - { - "a": "attr", - "t": "diamond", - "n": 50 - }, - { - "a": "attr", - "t": "gold", - "n": 74187 - } - ], - "exp": 85200, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer18", - "text": "第18层" - }, - "model_display": 340065 - }, - { - "key": 19, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 19, - "monster_id": [ - 501055, - 501056 - ], - "reward": [ - { - "a": "attr", - "t": "diamond", - "n": 50 - }, - { - "a": "attr", - "t": "gold", - "n": 85026 - } - ], - "exp": 102000, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer19", - "text": "第19层" - }, - "model_display": 250015 - }, - { - "key": 20, - "pagoda_type": 101, - "Level_type": 1, - "layer_num": 20, - "monster_id": [ - 501058, - 501059 - ], - "reward": [ - { - "a": "item", - "t": "30001", - "n": 2 - }, - { - "a": "attr", - "t": "gold", - "n": 102031 - } - ], - "exp": 122400, - "fight_scene": "", - "name_display": { - "key": "pagoda_layer20", - "text": "第20层" - }, - "model_display": 340065 - }, { "key": 101, "pagoda_type": 201, diff --git a/modules/library/api.go b/modules/library/api.go index 7b178de88..16732567f 100644 --- a/modules/library/api.go +++ b/modules/library/api.go @@ -17,6 +17,7 @@ const ( LibraryActivationFetterResp = "activationfetter" LibraryChangePush = "change" LibraryGetStoryRewardResp = "getstoryreward" + LibraryLvRewardResp = "lvreward" ) type apiComp struct { diff --git a/modules/library/api_getstoryreward.go b/modules/library/api_getstoryreward.go index e26f6145d..649c8b4f2 100644 --- a/modules/library/api_getstoryreward.go +++ b/modules/library/api_getstoryreward.go @@ -7,6 +7,7 @@ package library import ( "go_dreamfactory/comm" "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" "go_dreamfactory/utils" "strconv" @@ -58,12 +59,31 @@ func (this *apiComp) GetStoryReward(session comm.IUserSession, req *pb.LibraryGe break } } else if req.Rightend != 0 { // 剧情奖励 - if req.Rightend == conf.Rightend && _heroFetter.Stroyprize != conf.Rightend { - _heroFetter.Stroyprize = conf.Rightend + bRepeadGetReawrd := false + if req.Rightend == conf.Rightend || req.Rightend == conf.Endid1 || + req.Rightend == conf.Endid2 || req.Rightend == conf.Endid3 { + for _, v := range _heroFetter.Stroyprize { + if v == req.Rightend { + bRepeadGetReawrd = true + break + } + } + if bRepeadGetReawrd { // 重复领奖 + code = pb.ErrorCode_LibraryReward + return + } + var res []*cfg.Gameatn // + if req.Rightend == conf.Rightend { + res = conf.Stroyprize + } else { + res = conf.SpecialStroyprize + } + + _heroFetter.Stroyprize = append(_heroFetter.Stroyprize, req.Rightend) // 发奖 - code = this.module.DispenseRes(session, conf.Stroyprize, true) + code = this.module.DispenseRes(session, res, true) if code != pb.ErrorCode_Success { - this.module.Errorf("GetStoryReward err:add item : %v", conf.Stroyprize) + this.module.Errorf("GetStoryReward err:add item : %v", res) } mapData := make(map[string]interface{}, 0) mapData["stroyprize"] = _heroFetter.Stroyprize diff --git a/modules/library/api_lvreward.go b/modules/library/api_lvreward.go new file mode 100644 index 000000000..5cb611307 --- /dev/null +++ b/modules/library/api_lvreward.go @@ -0,0 +1,64 @@ +package library + +/* +* 单个英雄剧情id 奖励 + */ + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" +) + +//参数校验 +func (this *apiComp) LvRewardCheck(session comm.IUserSession, req *pb.LibraryLvRewardReq) (code pb.ErrorCode) { + if req.Oid == "" || req.Lv <= 0 { + code = pb.ErrorCode_ReqParameterError + } + return +} + +func (this *apiComp) LvReward(session comm.IUserSession, req *pb.LibraryLvRewardReq) (code pb.ErrorCode, data proto.Message) { + + resp := &pb.LibraryLvRewardResp{} + code = this.LvRewardCheck(session, req) + if code != pb.ErrorCode_Success { + return // 参数校验失败直接返回 + } + _heroFetter := this.module.modelFetter.getOneHeroFetter(session.GetUserId(), req.Oid) + if _heroFetter == nil { + code = pb.ErrorCode_ReqParameterError + return + } + curStar := this.module.configure.GetHeroConfigStar(_heroFetter.Heroid) // 查询原始星级 + if curStar == 0 { + code = pb.ErrorCode_ConfigNoFound + return + } + confData := this.module.configure.GetLibraryFavorData(curStar, req.Lv) + if len(confData.Prize) == 0 { + code = pb.ErrorCode_ReqParameterError + return + } + + for _, v := range _heroFetter.Lvprize { + if v == req.Lv { + code = pb.ErrorCode_LibraryReward // 重复领奖 + break + } + } + _heroFetter.Lvprize = append(_heroFetter.Lvprize, req.Lv) + // 发奖 + code = this.module.DispenseRes(session, confData.Prize, true) + if code != pb.ErrorCode_Success { + this.module.Errorf("GetStoryReward err:add item : %v", confData.Prize) + } + mapData := make(map[string]interface{}, 0) + mapData["lvprize"] = _heroFetter.Lvprize + this.module.modelFetter.modifyHeroFetterDataByObjId(session.GetUserId(), _heroFetter.Id, mapData) + resp.Data = _heroFetter + + session.SendMsg(string(this.module.GetType()), LibraryLvRewardResp, resp) + return +} diff --git a/modules/library/comp_configure.go b/modules/library/comp_configure.go index 1f906440a..8ffd527e5 100644 --- a/modules/library/comp_configure.go +++ b/modules/library/comp_configure.go @@ -22,6 +22,7 @@ const ( type configureComp struct { modules.MCompConfigure fetter map[int64]*cfg.GameLibraryFetterData + favor map[int64]*cfg.GameLibraryFavorData } //组件初始化接口 @@ -37,10 +38,27 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp this.fetter = make(map[int64]*cfg.GameLibraryFetterData, 0) configure.RegisterConfigure(game_libraryfetter, cfg.NewGameLibraryFetter, this.SetLibraryFetter) - + this.favor = make(map[int64]*cfg.GameLibraryFavorData, 0) + configure.RegisterConfigure(game_libraryfetter, cfg.NewGameLibraryFetter, this.SetLibraryFavor) return } +func (this *configureComp) SetLibraryFavor() { + if v, err := this.GetConfigure(game_favornum); err == nil { + if _configure, ok := v.(*cfg.GameLibraryFavor); ok { + for _, v1 := range _configure.GetDataList() { + this.favor[int64(v1.Star<<8)+int64(v1.Favorlv)] = v1 + } + return + } + } else { + err = fmt.Errorf("%T no is *cfg.GameLibraryFavor", v) + } +} +func (this *configureComp) GetLibraryFavorData(star, favorlv int32) (data *cfg.GameLibraryFavorData) { + return this.favor[int64(star<<8)+int64(favorlv)] +} + func (this *configureComp) SetLibraryFetter() { if v, err := this.GetConfigure(game_libraryfetter); err == nil { if _configure, ok := v.(*cfg.GameLibraryFetter); ok { @@ -53,6 +71,7 @@ func (this *configureComp) SetLibraryFetter() { err = fmt.Errorf("%T no is *cfg.GameLibraryFetter", v) } } + func (this *configureComp) GetLibraryFetter(fid, favorlv int32) (data *cfg.GameLibraryFetterData) { return this.fetter[int64(fid<<8)+int64(favorlv)] } diff --git a/modules/library/module.go b/modules/library/module.go index 0d61d6442..139833661 100644 --- a/modules/library/module.go +++ b/modules/library/module.go @@ -111,7 +111,8 @@ func (this *Library) createHeroFetter(uid string, heroConfId string) (obj *pb.DB Heroid: heroConfId, History: make([]int32, 0), Favorlv: 1, - Stroyprize: 0, + Stroyprize: make([]int32, 0), + Lvprize: make([]int32, 0), } if err := this.modelFetter.createHeroFetter(uid, obj); err != nil { code = pb.ErrorCode_DBError diff --git a/pb/library_db.pb.go b/pb/library_db.pb.go index b582eebb4..608484de3 100644 --- a/pb/library_db.pb.go +++ b/pb/library_db.pb.go @@ -129,13 +129,14 @@ type DBHeroFetter struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID - Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID - Heroid string `protobuf:"bytes,3,opt,name=heroid,proto3" json:"heroid"` // 英雄配置表id - History []int32 `protobuf:"varint,4,rep,packed,name=history,proto3" json:"history"` // 传记往事ID - Favorlv int32 `protobuf:"varint,5,opt,name=favorlv,proto3" json:"favorlv"` // 好感度等级 - Favorexp int32 `protobuf:"varint,6,opt,name=favorexp,proto3" json:"favorexp"` // 好感度经验 - Stroyprize int32 `protobuf:"varint,7,opt,name=stroyprize,proto3" json:"stroyprize"` // 剧情奖励 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID + Heroid string `protobuf:"bytes,3,opt,name=heroid,proto3" json:"heroid"` // 英雄配置表id + History []int32 `protobuf:"varint,4,rep,packed,name=history,proto3" json:"history"` // 传记往事ID + Favorlv int32 `protobuf:"varint,5,opt,name=favorlv,proto3" json:"favorlv"` // 好感度等级 + Favorexp int32 `protobuf:"varint,6,opt,name=favorexp,proto3" json:"favorexp"` // 好感度经验 + Stroyprize []int32 `protobuf:"varint,7,rep,packed,name=stroyprize,proto3" json:"stroyprize"` // 剧情奖励 + Lvprize []int32 `protobuf:"varint,8,rep,packed,name=lvprize,proto3" json:"lvprize"` // 等级奖励 } func (x *DBHeroFetter) Reset() { @@ -212,11 +213,18 @@ func (x *DBHeroFetter) GetFavorexp() int32 { return 0 } -func (x *DBHeroFetter) GetStroyprize() int32 { +func (x *DBHeroFetter) GetStroyprize() []int32 { if x != nil { return x.Stroyprize } - return 0 + return nil +} + +func (x *DBHeroFetter) GetLvprize() []int32 { + if x != nil { + return x.Lvprize + } + return nil } var File_library_library_db_proto protoreflect.FileDescriptor @@ -245,7 +253,7 @@ var file_library_library_db_proto_rawDesc = []byte{ 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x7a, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb8, 0x01, 0x0a, + 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xd2, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, @@ -256,9 +264,11 @@ var file_library_library_db_proto_rawDesc = []byte{ 0x28, 0x05, 0x52, 0x07, 0x66, 0x61, 0x76, 0x6f, 0x72, 0x6c, 0x76, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x61, 0x76, 0x6f, 0x72, 0x65, 0x78, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x66, 0x61, 0x76, 0x6f, 0x72, 0x65, 0x78, 0x70, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x6f, 0x79, - 0x70, 0x72, 0x69, 0x7a, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74, 0x72, - 0x6f, 0x79, 0x70, 0x72, 0x69, 0x7a, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x72, 0x69, 0x7a, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74, 0x72, + 0x6f, 0x79, 0x70, 0x72, 0x69, 0x7a, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x76, 0x70, 0x72, 0x69, + 0x7a, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x76, 0x70, 0x72, 0x69, 0x7a, + 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/pb/library_msg.pb.go b/pb/library_msg.pb.go index aa5d4dcbd..309745e42 100644 --- a/pb/library_msg.pb.go +++ b/pb/library_msg.pb.go @@ -660,6 +660,109 @@ func (x *LibraryChangePush) GetFetter() []*DBHeroFetter { return nil } +// 领取等级奖励 +type LibraryLvRewardReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Oid string `protobuf:"bytes,1,opt,name=oid,proto3" json:"oid"` // 对象唯一id + Lv int32 `protobuf:"varint,2,opt,name=lv,proto3" json:"lv"` // 好感度等级 +} + +func (x *LibraryLvRewardReq) Reset() { + *x = LibraryLvRewardReq{} + if protoimpl.UnsafeEnabled { + mi := &file_library_library_msg_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LibraryLvRewardReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LibraryLvRewardReq) ProtoMessage() {} + +func (x *LibraryLvRewardReq) ProtoReflect() protoreflect.Message { + mi := &file_library_library_msg_proto_msgTypes[13] + 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 LibraryLvRewardReq.ProtoReflect.Descriptor instead. +func (*LibraryLvRewardReq) Descriptor() ([]byte, []int) { + return file_library_library_msg_proto_rawDescGZIP(), []int{13} +} + +func (x *LibraryLvRewardReq) GetOid() string { + if x != nil { + return x.Oid + } + return "" +} + +func (x *LibraryLvRewardReq) GetLv() int32 { + if x != nil { + return x.Lv + } + return 0 +} + +type LibraryLvRewardResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data *DBHeroFetter `protobuf:"bytes,1,opt,name=data,proto3" json:"data"` +} + +func (x *LibraryLvRewardResp) Reset() { + *x = LibraryLvRewardResp{} + if protoimpl.UnsafeEnabled { + mi := &file_library_library_msg_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LibraryLvRewardResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LibraryLvRewardResp) ProtoMessage() {} + +func (x *LibraryLvRewardResp) ProtoReflect() protoreflect.Message { + mi := &file_library_library_msg_proto_msgTypes[14] + 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 LibraryLvRewardResp.ProtoReflect.Descriptor instead. +func (*LibraryLvRewardResp) Descriptor() ([]byte, []int) { + return file_library_library_msg_proto_rawDescGZIP(), []int{14} +} + +func (x *LibraryLvRewardResp) GetData() *DBHeroFetter { + if x != nil { + return x.Data + } + return nil +} + var File_library_library_msg_proto protoreflect.FileDescriptor var file_library_library_msg_proto_rawDesc = []byte{ @@ -721,7 +824,15 @@ var file_library_library_msg_proto_rawDesc = []byte{ 0x61, 0x72, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x25, 0x0a, 0x06, 0x66, 0x65, 0x74, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, 0x52, 0x06, 0x66, 0x65, 0x74, 0x74, 0x65, 0x72, - 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x22, 0x36, 0x0a, 0x12, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x4c, 0x76, 0x52, 0x65, 0x77, + 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x22, 0x38, 0x0a, 0x13, 0x4c, 0x69, 0x62, 0x72, + 0x61, 0x72, 0x79, 0x4c, 0x76, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x21, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, + 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, 0x52, 0x04, 0x64, 0x61, + 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -736,7 +847,7 @@ func file_library_library_msg_proto_rawDescGZIP() []byte { return file_library_library_msg_proto_rawDescData } -var file_library_library_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_library_library_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_library_library_msg_proto_goTypes = []interface{}{ (*LibraryGetListReq)(nil), // 0: LibraryGetListReq (*LibraryGetListResp)(nil), // 1: LibraryGetListResp @@ -751,25 +862,28 @@ var file_library_library_msg_proto_goTypes = []interface{}{ (*LibraryActivationFetterReq)(nil), // 10: LibraryActivationFetterReq (*LibraryActivationFetterResp)(nil), // 11: LibraryActivationFetterResp (*LibraryChangePush)(nil), // 12: LibraryChangePush - nil, // 13: LibraryUseGiftReq.ItemsEntry - (*DBLibrary)(nil), // 14: DBLibrary - (*DBHeroFetter)(nil), // 15: DBHeroFetter + (*LibraryLvRewardReq)(nil), // 13: LibraryLvRewardReq + (*LibraryLvRewardResp)(nil), // 14: LibraryLvRewardResp + nil, // 15: LibraryUseGiftReq.ItemsEntry + (*DBLibrary)(nil), // 16: DBLibrary + (*DBHeroFetter)(nil), // 17: DBHeroFetter } var file_library_library_msg_proto_depIdxs = []int32{ - 14, // 0: LibraryGetListResp.data:type_name -> DBLibrary - 15, // 1: LibraryGetFetterListResp.data:type_name -> DBHeroFetter - 14, // 2: LibraryGetRewardResp.data:type_name -> DBLibrary - 15, // 3: LibraryGetStoryRewardResp.data:type_name -> DBHeroFetter - 13, // 4: LibraryUseGiftReq.items:type_name -> LibraryUseGiftReq.ItemsEntry - 15, // 5: LibraryUseGiftResp.data:type_name -> DBHeroFetter - 14, // 6: LibraryActivationFetterResp.data:type_name -> DBLibrary - 14, // 7: LibraryChangePush.data:type_name -> DBLibrary - 15, // 8: LibraryChangePush.fetter:type_name -> DBHeroFetter - 9, // [9:9] is the sub-list for method output_type - 9, // [9:9] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 16, // 0: LibraryGetListResp.data:type_name -> DBLibrary + 17, // 1: LibraryGetFetterListResp.data:type_name -> DBHeroFetter + 16, // 2: LibraryGetRewardResp.data:type_name -> DBLibrary + 17, // 3: LibraryGetStoryRewardResp.data:type_name -> DBHeroFetter + 15, // 4: LibraryUseGiftReq.items:type_name -> LibraryUseGiftReq.ItemsEntry + 17, // 5: LibraryUseGiftResp.data:type_name -> DBHeroFetter + 16, // 6: LibraryActivationFetterResp.data:type_name -> DBLibrary + 16, // 7: LibraryChangePush.data:type_name -> DBLibrary + 17, // 8: LibraryChangePush.fetter:type_name -> DBHeroFetter + 17, // 9: LibraryLvRewardResp.data:type_name -> DBHeroFetter + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name } func init() { file_library_library_msg_proto_init() } @@ -935,6 +1049,30 @@ func file_library_library_msg_proto_init() { return nil } } + file_library_library_msg_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LibraryLvRewardReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_library_library_msg_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LibraryLvRewardResp); 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{ @@ -942,7 +1080,7 @@ func file_library_library_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_library_library_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 14, + NumMessages: 16, NumExtensions: 0, NumServices: 0, }, diff --git a/sys/configure/structs/Game.LibraryFavor.go b/sys/configure/structs/Game.LibraryFavor.go index 722621d04..f220a9c47 100644 --- a/sys/configure/structs/Game.LibraryFavor.go +++ b/sys/configure/structs/Game.LibraryFavor.go @@ -9,34 +9,26 @@ package cfg type GameLibraryFavor struct { - _dataMap map[int32]*GameLibraryFavorData _dataList []*GameLibraryFavorData } func NewGameLibraryFavor(_buf []map[string]interface{}) (*GameLibraryFavor, error) { _dataList := make([]*GameLibraryFavorData, 0, len(_buf)) - dataMap := make(map[int32]*GameLibraryFavorData) for _, _ele_ := range _buf { if _v, err2 := DeserializeGameLibraryFavorData(_ele_); err2 != nil { return nil, err2 } else { _dataList = append(_dataList, _v) - dataMap[_v.Id] = _v } } - return &GameLibraryFavor{_dataList:_dataList, _dataMap:dataMap}, nil -} - -func (table *GameLibraryFavor) GetDataMap() map[int32]*GameLibraryFavorData { - return table._dataMap + return &GameLibraryFavor{_dataList:_dataList}, nil } func (table *GameLibraryFavor) GetDataList() []*GameLibraryFavorData { return table._dataList } -func (table *GameLibraryFavor) Get(key int32) *GameLibraryFavorData { - return table._dataMap[key] +func (table *GameLibraryFavor) Get(index int) *GameLibraryFavorData { + return table._dataList[index] } - diff --git a/sys/configure/structs/Game.LibraryFavorData.go b/sys/configure/structs/Game.LibraryFavorData.go index f2d3edf3b..5e76749ac 100644 --- a/sys/configure/structs/Game.LibraryFavorData.go +++ b/sys/configure/structs/Game.LibraryFavorData.go @@ -15,6 +15,7 @@ type GameLibraryFavorData struct { Star int32 Favorlv int32 Expneed int32 + Prize []*Gameatn } const TypeId_GameLibraryFavorData = 465616649 @@ -28,6 +29,20 @@ func (_v *GameLibraryFavorData)Deserialize(_buf map[string]interface{}) (err err { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star"].(float64); !_ok_ { err = errors.New("star error"); return }; _v.Star = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["favorlv"].(float64); !_ok_ { err = errors.New("favorlv error"); return }; _v.Favorlv = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["expneed"].(float64); !_ok_ { err = errors.New("expneed error"); return }; _v.Expneed = int32(_tempNum_) } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["prize"].([]interface{}); !_ok_ { err = errors.New("prize error"); return } + + _v.Prize = make([]*Gameatn, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ *Gameatn + { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } } + _v.Prize = append(_v.Prize, _list_v_) + } + } + return } diff --git a/sys/configure/structs/Game.LibraryHeroData.go b/sys/configure/structs/Game.LibraryHeroData.go index 9424b99b0..746a820db 100644 --- a/sys/configure/structs/Game.LibraryHeroData.go +++ b/sys/configure/structs/Game.LibraryHeroData.go @@ -19,8 +19,10 @@ type GameLibraryHeroData struct { Startid int32 Rightend int32 Stroyprize []*Gameatn + SpecialStroyprize []*Gameatn Endid1 int32 Endid2 int32 + Endid3 int32 Fid []int32 } @@ -78,8 +80,23 @@ func (_v *GameLibraryHeroData)Deserialize(_buf map[string]interface{}) (err erro } } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["special_stroyprize"].([]interface{}); !_ok_ { err = errors.New("special_stroyprize error"); return } + + _v.SpecialStroyprize = make([]*Gameatn, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ *Gameatn + { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } } + _v.SpecialStroyprize = append(_v.SpecialStroyprize, _list_v_) + } + } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["endid1"].(float64); !_ok_ { err = errors.New("endid1 error"); return }; _v.Endid1 = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["endid2"].(float64); !_ok_ { err = errors.New("endid2 error"); return }; _v.Endid2 = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["endid3"].(float64); !_ok_ { err = errors.New("endid3 error"); return }; _v.Endid3 = int32(_tempNum_) } { var _arr_ []interface{} var _ok_ bool From 1a3030da01987991efe4e32b388975e6907de61a Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Wed, 19 Oct 2022 10:08:51 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E8=81=8A=E5=A4=A9?= =?UTF-8?q?=E7=A7=81=E8=81=8A=E9=A2=91=E9=81=93=E4=B8=BA=E8=B7=A8=E6=9C=8D?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/chat/api_send.go | 39 +++++++++++++++++------------------ modules/chat/api_sendcross.go | 8 +++++++ 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/modules/chat/api_send.go b/modules/chat/api_send.go index ca64ecd0f..e9e1e1815 100644 --- a/modules/chat/api_send.go +++ b/modules/chat/api_send.go @@ -87,26 +87,25 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code return } break - case pb.ChatChannel_Private: - msg.Ruid = req.TargetId - if err = this.module.PushUser(msg); err != nil { - code = pb.ErrorCode_DBError - return - } - session.SendMsg(string(this.module.GetType()), "message", &pb.ChatMessagePush{Chat: msg}) - break - // case pb.ChatChannel_CrossServer: - // if userexpand, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil { - // code = pb.ErrorCode_DBError - // return - // } - // msg.ChannelId = userexpand.Chatchannel //指定频道 - // if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s-%d", crosschatkey, userexpand.Chatchannel), int64(max_chat), msg); err != nil { - // code = pb.ErrorCode_DBError - // return - // } - // this.module.PushToUsers(userexpand.Chatchannel, msg) - break + // case pb.ChatChannel_Private: + // msg.Ruid = req.TargetId + // if err = this.module.PushUser(msg); err != nil { + // code = pb.ErrorCode_DBError + // return + // } + // session.SendMsg(string(this.module.GetType()), "message", &pb.ChatMessagePush{Chat: msg}) + // break + // case pb.ChatChannel_CrossServer: + // if userexpand, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil { + // code = pb.ErrorCode_DBError + // return + // } + // msg.ChannelId = userexpand.Chatchannel //指定频道 + // if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s-%d", crosschatkey, userexpand.Chatchannel), int64(max_chat), msg); err != nil { + // code = pb.ErrorCode_DBError + // return + // } + // this.module.PushToUsers(userexpand.Chatchannel, msg) default: code = pb.ErrorCode_ReqParameterError this.module.Errorf("getlist no support channel:%d ", req.Channel) diff --git a/modules/chat/api_sendcross.go b/modules/chat/api_sendcross.go index 0c4140df3..82cc955ce 100644 --- a/modules/chat/api_sendcross.go +++ b/modules/chat/api_sendcross.go @@ -87,6 +87,14 @@ func (this *apiComp) SendCross(session comm.IUserSession, req *pb.ChatSendCrossR // } // session.SendMsg(string(this.module.GetType()), "message", &pb.ChatMessagePush{Chat: msg}) // break + case pb.ChatChannel_Private: + msg.Ruid = req.TargetId + if err = this.module.PushUser(msg); err != nil { + code = pb.ErrorCode_DBError + return + } + session.SendMsg(string(this.module.GetType()), "message", &pb.ChatMessagePush{Chat: msg}) + break case pb.ChatChannel_CrossServer: if userexpand, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil { code = pb.ErrorCode_DBError From 6ef841ed723c5ea79070458dfd11808995af4454 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 19 Oct 2022 11:54:53 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A5=BD=E6=84=9F?= =?UTF-8?q?=E5=BA=A6=E5=89=A7=E6=83=85=E8=A7=A3=E9=94=81=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_libraryhero.json | 112 +++++++++++------- comm/const.go | 2 + modules/hero/api_strengthenUpStar.go | 5 +- modules/library/api_getstoryreward.go | 68 +++++++---- pb/errorcode.pb.go | 10 +- sys/configure/structs/Game.LibraryHeroData.go | 48 ++++++-- 6 files changed, 163 insertions(+), 82 deletions(-) diff --git a/bin/json/game_libraryhero.json b/bin/json/game_libraryhero.json index f86a79a7d..5510feb43 100644 --- a/bin/json/game_libraryhero.json +++ b/bin/json/game_libraryhero.json @@ -18,13 +18,6 @@ ], "startid": 10001, "rightend": 10008, - "stroyprize": [ - { - "a": "attr", - "t": "gold", - "n": 1000 - } - ], "special_stroyprize": [ { "a": "attr", @@ -32,9 +25,24 @@ "n": 2000 } ], - "endid1": 10009, - "endid2": 10010, - "endid3": 10011, + "endid": [ + 10009, + 10010, + 10011 + ], + "stroyprize": [ + { + "a": "attr", + "t": "gold", + "n": 1000 + } + ], + "plot_unlock": [ + 1, + 2, + 3, + 4 + ], "fid": [ 102 ] @@ -58,13 +66,6 @@ ], "startid": 10001, "rightend": 10008, - "stroyprize": [ - { - "a": "attr", - "t": "gold", - "n": 1000 - } - ], "special_stroyprize": [ { "a": "attr", @@ -72,9 +73,24 @@ "n": 2000 } ], - "endid1": 10009, - "endid2": 10010, - "endid3": 10011, + "endid": [ + 10009, + 10010, + 10011 + ], + "stroyprize": [ + { + "a": "attr", + "t": "gold", + "n": 1000 + } + ], + "plot_unlock": [ + 1, + 2, + 3, + 4 + ], "fid": [ 101 ] @@ -98,13 +114,6 @@ ], "startid": 10001, "rightend": 10008, - "stroyprize": [ - { - "a": "attr", - "t": "gold", - "n": 1000 - } - ], "special_stroyprize": [ { "a": "attr", @@ -112,9 +121,24 @@ "n": 2000 } ], - "endid1": 10009, - "endid2": 10010, - "endid3": 10011, + "endid": [ + 10009, + 10010, + 10011 + ], + "stroyprize": [ + { + "a": "attr", + "t": "gold", + "n": 1000 + } + ], + "plot_unlock": [ + 1, + 2, + 3, + 4 + ], "fid": [ 101 ] @@ -138,13 +162,6 @@ ], "startid": 10001, "rightend": 10008, - "stroyprize": [ - { - "a": "attr", - "t": "gold", - "n": 1000 - } - ], "special_stroyprize": [ { "a": "attr", @@ -152,9 +169,24 @@ "n": 2000 } ], - "endid1": 10009, - "endid2": 10010, - "endid3": 10011, + "endid": [ + 10009, + 10010, + 10011 + ], + "stroyprize": [ + { + "a": "attr", + "t": "gold", + "n": 1000 + } + ], + "plot_unlock": [ + 1, + 2, + 3, + 4 + ], "fid": [ 102 ] diff --git a/comm/const.go b/comm/const.go index 177ec6bef..047b0f7b7 100644 --- a/comm/const.go +++ b/comm/const.go @@ -120,6 +120,8 @@ const ( TablePagodaRecord = "pagodarecord" ///有序的爬塔排行 (真正的排行榜 最多只有50条) TablePagodaRankList = "pagodaranklist" + + TableSeasonRankList = "seasonranklist" // 赛季塔列表 /// 美食馆 TableSmithy = "smithy" /// 赛季塔数据表 diff --git a/modules/hero/api_strengthenUpStar.go b/modules/hero/api_strengthenUpStar.go index 3b2e99834..d437604cd 100644 --- a/modules/hero/api_strengthenUpStar.go +++ b/modules/hero/api_strengthenUpStar.go @@ -142,7 +142,10 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr "sameCount": 1, "isOverlying": false, } - + heroConf := this.module.configure.GetHeroConfig(_hero.HeroID) + if heroConf != nil && heroConf.Type == comm.CardTypeStar { + _heroMap["heroID"] = _hero.HeroID + } // 保存数据 err := this.module.modelHero.ChangeList(session.GetUserId(), _hero.Id, _heroMap) if err != nil { diff --git a/modules/library/api_getstoryreward.go b/modules/library/api_getstoryreward.go index 649c8b4f2..0ab119814 100644 --- a/modules/library/api_getstoryreward.go +++ b/modules/library/api_getstoryreward.go @@ -60,36 +60,52 @@ func (this *apiComp) GetStoryReward(session comm.IUserSession, req *pb.LibraryGe } } else if req.Rightend != 0 { // 剧情奖励 bRepeadGetReawrd := false - if req.Rightend == conf.Rightend || req.Rightend == conf.Endid1 || - req.Rightend == conf.Endid2 || req.Rightend == conf.Endid3 { - for _, v := range _heroFetter.Stroyprize { - if v == req.Rightend { - bRepeadGetReawrd = true - break + sz := conf.Endid + for _, id := range sz { + if req.Rightend == conf.Rightend || req.Rightend == id { + if len(conf.PlotUnlock) >= len(_heroFetter.Stroyprize)+1 { + // 校验等级 + lv := conf.PlotUnlock[len(_heroFetter.Stroyprize)] + if _heroFetter.Favorlv < lv { + code = pb.ErrorCode_LibraryLvReward + return + } + } else { + code = pb.ErrorCode_LibraryLvReward + return } - } - if bRepeadGetReawrd { // 重复领奖 - code = pb.ErrorCode_LibraryReward - return - } - var res []*cfg.Gameatn // - if req.Rightend == conf.Rightend { - res = conf.Stroyprize - } else { - res = conf.SpecialStroyprize + for _, v := range _heroFetter.Stroyprize { + if v == req.Rightend { + bRepeadGetReawrd = true + break + } + } + if bRepeadGetReawrd { // 重复领奖 + code = pb.ErrorCode_LibraryReward + return + } + var res []*cfg.Gameatn // + if req.Rightend == conf.Rightend { + res = conf.Stroyprize + } else { + res = conf.SpecialStroyprize + } + + _heroFetter.Stroyprize = append(_heroFetter.Stroyprize, req.Rightend) + // 发奖 + code = this.module.DispenseRes(session, res, true) + if code != pb.ErrorCode_Success { + this.module.Errorf("GetStoryReward err:add item : %v", res) + } + mapData := make(map[string]interface{}, 0) + mapData["stroyprize"] = _heroFetter.Stroyprize + this.module.modelFetter.modifyHeroFetterDataByObjId(session.GetUserId(), _heroFetter.Id, mapData) + resp.Data = _heroFetter + break } - _heroFetter.Stroyprize = append(_heroFetter.Stroyprize, req.Rightend) - // 发奖 - code = this.module.DispenseRes(session, res, true) - if code != pb.ErrorCode_Success { - this.module.Errorf("GetStoryReward err:add item : %v", res) - } - mapData := make(map[string]interface{}, 0) - mapData["stroyprize"] = _heroFetter.Stroyprize - this.module.modelFetter.modifyHeroFetterDataByObjId(session.GetUserId(), _heroFetter.Id, mapData) - resp.Data = _heroFetter } + } session.SendMsg(string(this.module.GetType()), LibraryGetStoryRewardResp, resp) return diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index f150b08a6..970dbe4f5 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -194,6 +194,7 @@ const ( ErrorCode_LibraryNoData ErrorCode = 2802 // 没找到羁绊数据 ErrorCode_LibraryActivation ErrorCode = 2803 // 已经是激活状态 ErrorCode_LibraryReward ErrorCode = 2804 // 已经领取奖励 + ErrorCode_LibraryLvReward ErrorCode = 2805 // 领奖等级没达到 ) // Enum value maps for ErrorCode. @@ -353,6 +354,7 @@ var ( 2802: "LibraryNoData", 2803: "LibraryActivation", 2804: "LibraryReward", + 2805: "LibraryLvReward", } ErrorCode_value = map[string]int32{ "Success": 0, @@ -509,6 +511,7 @@ var ( "LibraryNoData": 2802, "LibraryActivation": 2803, "LibraryReward": 2804, + "LibraryLvReward": 2805, } ) @@ -543,7 +546,7 @@ var File_errorcode_proto protoreflect.FileDescriptor var file_errorcode_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2a, 0xe3, 0x1a, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0xf9, 0x1a, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12, 0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, @@ -757,8 +760,9 @@ var file_errorcode_proto_rawDesc = []byte{ 0x72, 0x79, 0x4e, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x10, 0xf2, 0x15, 0x12, 0x16, 0x0a, 0x11, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0xf3, 0x15, 0x12, 0x12, 0x0a, 0x0d, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, - 0x77, 0x61, 0x72, 0x64, 0x10, 0xf4, 0x15, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x77, 0x61, 0x72, 0x64, 0x10, 0xf4, 0x15, 0x12, 0x14, 0x0a, 0x0f, 0x4c, 0x69, 0x62, 0x72, 0x61, + 0x72, 0x79, 0x4c, 0x76, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x10, 0xf5, 0x15, 0x42, 0x06, 0x5a, + 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/sys/configure/structs/Game.LibraryHeroData.go b/sys/configure/structs/Game.LibraryHeroData.go index 746a820db..39808dc48 100644 --- a/sys/configure/structs/Game.LibraryHeroData.go +++ b/sys/configure/structs/Game.LibraryHeroData.go @@ -18,11 +18,10 @@ type GameLibraryHeroData struct { Favorlv []int32 Startid int32 Rightend int32 - Stroyprize []*Gameatn SpecialStroyprize []*Gameatn - Endid1 int32 - Endid2 int32 - Endid3 int32 + Endid []int32 + Stroyprize []*Gameatn + PlotUnlock []int32 Fid []int32 } @@ -66,6 +65,34 @@ func (_v *GameLibraryHeroData)Deserialize(_buf map[string]interface{}) (err erro { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["startid"].(float64); !_ok_ { err = errors.New("startid error"); return }; _v.Startid = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["rightend"].(float64); !_ok_ { err = errors.New("rightend error"); return }; _v.Rightend = int32(_tempNum_) } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["special_stroyprize"].([]interface{}); !_ok_ { err = errors.New("special_stroyprize error"); return } + + _v.SpecialStroyprize = make([]*Gameatn, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ *Gameatn + { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } } + _v.SpecialStroyprize = append(_v.SpecialStroyprize, _list_v_) + } + } + + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["endid"].([]interface{}); !_ok_ { err = errors.New("endid error"); return } + + _v.Endid = make([]int32, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ int32 + { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) } + _v.Endid = append(_v.Endid, _list_v_) + } + } + { var _arr_ []interface{} var _ok_ bool @@ -83,20 +110,17 @@ func (_v *GameLibraryHeroData)Deserialize(_buf map[string]interface{}) (err erro { var _arr_ []interface{} var _ok_ bool - if _arr_, _ok_ = _buf["special_stroyprize"].([]interface{}); !_ok_ { err = errors.New("special_stroyprize error"); return } + if _arr_, _ok_ = _buf["plot_unlock"].([]interface{}); !_ok_ { err = errors.New("plot_unlock error"); return } - _v.SpecialStroyprize = make([]*Gameatn, 0, len(_arr_)) + _v.PlotUnlock = make([]int32, 0, len(_arr_)) for _, _e_ := range _arr_ { - var _list_v_ *Gameatn - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } } - _v.SpecialStroyprize = append(_v.SpecialStroyprize, _list_v_) + var _list_v_ int32 + { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) } + _v.PlotUnlock = append(_v.PlotUnlock, _list_v_) } } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["endid1"].(float64); !_ok_ { err = errors.New("endid1 error"); return }; _v.Endid1 = int32(_tempNum_) } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["endid2"].(float64); !_ok_ { err = errors.New("endid2 error"); return }; _v.Endid2 = int32(_tempNum_) } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["endid3"].(float64); !_ok_ { err = errors.New("endid3 error"); return }; _v.Endid3 = int32(_tempNum_) } { var _arr_ []interface{} var _ok_ bool