记录英雄赠送食物的开始时间

This commit is contained in:
meixiongfeng 2023-05-09 16:23:31 +08:00
parent 72b1d99a19
commit d0fed35a83
2 changed files with 16 additions and 12 deletions

View File

@ -37,26 +37,25 @@ func (this *apiComp) FetterLvUp(session comm.IUserSession, req *pb.LibraryFetter
totalFetterLv += _d.Favorlv totalFetterLv += _d.Favorlv
} }
} }
totalFetterLv = 0 fetter.Fidlv += 1
conf := this.module.configure.GetFriendData(fetter.Fid, fetter.Fidlv+1) conf := this.module.configure.GetFriendData(fetter.Fid, fetter.Fidlv)
if len(conf) == 0 { if len(conf) == 0 {
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
return return
} else {
fetter.Fidlv += 1
if conf[0].FavorabilityLv > totalFetterLv {
code = pb.ErrorCode_LibraryLvReward
return
}
} }
if _, ok := fetter.Prize[fetter.Fidlv]; ok {
if conf[0].FavorabilityLv > totalFetterLv {
code = pb.ErrorCode_LibraryLvReward
return
}
if _, ok := fetter.Prize[fetter.Fidlv]; !ok {
code = pb.ErrorCode_LibraryReward code = pb.ErrorCode_LibraryReward
return return
} }
fetter.Prize[fetter.Fidlv] = 1 fetter.Prize[fetter.Fidlv] = 1
// 发奖 // 发奖
hProperty := make(map[string][]*cfg.Gameatr, 0) hProperty := make(map[string][]*cfg.Gameatr, 0)
for _, v := range conf { for _, v := range conf {
var sz []*cfg.Gameatr var sz []*cfg.Gameatr

View File

@ -3,6 +3,7 @@ package library
import ( import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
"go_dreamfactory/utils" "go_dreamfactory/utils"
) )
@ -64,10 +65,10 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
} }
} }
for i := sCount + 1; i <= sCount+req.Counts; i++ { for i := sCount + 1; i <= sCount+req.Counts; i++ {
_heroObj.Givecount += 1
addExp += attenuation[i] addExp += attenuation[i]
} }
_heroObj.Givecount += req.Counts
// 校验是否是自己喜欢的食物 // 校验是否是自己喜欢的食物
_c := this.module.configure.GetFavorability(_heroObj.Heroid, _heroObj.Favorlv) _c := this.module.configure.GetFavorability(_heroObj.Heroid, _heroObj.Favorlv)
if _c == nil { if _c == nil {
@ -133,6 +134,10 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
mapData["favorexp"] = _heroObj.Favorexp mapData["favorexp"] = _heroObj.Favorexp
mapData["favorlv"] = _heroObj.Favorlv mapData["favorlv"] = _heroObj.Favorlv
mapData["givecount"] = _heroObj.Givecount mapData["givecount"] = _heroObj.Givecount
if _heroObj.Ctime == 0 { // 记录刷新的时间
_heroObj.Ctime = configure.Now().Unix()
mapData["ctime"] = _heroObj.Ctime
}
this.module.modelFetter.modifyHeroFetterDataByObjId(session.GetUserId(), _heroObj.Id, mapData) this.module.modelFetter.modifyHeroFetterDataByObjId(session.GetUserId(), _heroObj.Id, mapData)
rsp.Data = _heroObj rsp.Data = _heroObj
session.SendMsg(string(this.module.GetType()), LibraryUseGiftResp, rsp) session.SendMsg(string(this.module.GetType()), LibraryUseGiftResp, rsp)