From a11dfcbababc5afcfb3f56778d65cae8a605addd Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 4 May 2023 14:37:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A5=BD=E6=84=9F=E5=BA=A6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/library/api_usegift.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/modules/library/api_usegift.go b/modules/library/api_usegift.go index fdf9557d2..470d2c854 100644 --- a/modules/library/api_usegift.go +++ b/modules/library/api_usegift.go @@ -56,13 +56,13 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe code = pb.ErrorCode_LibraryGiveMaxCount return } - last := 1 - for iPos, v := range c { - for ; last <= iPos; last++ { + var last int32 = 1 + for _, v := range c { + for ; last <= v.K; last++ { attenuation[int32(last)] = v.V // 3,1000|6,500|9,250 } } - for i := _heroObj.Givecount; i <= _heroObj.Givecount+req.Counts; i++ { + for i := _heroObj.Givecount + 1; i <= _heroObj.Givecount+req.Counts; i++ { addExp += attenuation[i] } @@ -106,9 +106,8 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe code = pb.ErrorCode_ConfigNoFound return } - // 100*1 + 100*0.5 + 100*0.25 - addExp *= itemConf.SpecialType / 1000 - _heroObj.Favorexp += addExp + addExp *= itemConf.SpecialType + _heroObj.Favorexp += addExp / 1000 // 折算出等级 for { @@ -116,8 +115,8 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe _heroObj.Favorexp = 0 break } - if _exp[_heroObj.Favorlv] <= _heroObj.Favorexp { - _heroObj.Favorexp -= _exp[_heroObj.Favorlv] + if _exp[_heroObj.Favorlv-1] <= _heroObj.Favorexp { + _heroObj.Favorexp -= _exp[_heroObj.Favorlv-1] _heroObj.Favorlv += 1 upLv++ } else {