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