同步 好感动计算调整
This commit is contained in:
parent
5f64bd6050
commit
d4e8ee08b6
@ -9,7 +9,7 @@ import (
|
||||
"math"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
// 参数校验
|
||||
func (this *apiComp) UseGiftCheck(session comm.IUserSession, req *pb.LibraryUseGiftReq) (errdata *pb.ErrorData) {
|
||||
if req.Heroid == "" || req.Items == "" || req.Counts == 0 {
|
||||
errdata = &pb.ErrorData{
|
||||
@ -84,6 +84,17 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
|
||||
|
||||
addExp += attenuation[i]
|
||||
}
|
||||
itemConf, err1 := this.module.ModuleTools.GetGrormetLlame(req.Items)
|
||||
if err1 != nil {
|
||||
this.module.Errorf("赠送菜品配置没找到:%s", req.Items)
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err1.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
addExp *= itemConf
|
||||
_heroObj.Givecount += req.Counts
|
||||
// 校验是否是自己喜欢的食物
|
||||
_c, err := this.module.configure.GetFavorability(_heroObj.Heroid, _heroObj.Favorlv)
|
||||
@ -98,7 +109,7 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
|
||||
for _, v := range _c.LikesFood { // 喜欢的食物
|
||||
if v == req.Items {
|
||||
likeStates = 1
|
||||
addExp = int32(math.Floor(float64(addExp*this.module.ModuleTools.GetGlobalConf().FavorabilityLikes*req.Counts) / 1000))
|
||||
addExp = int32(math.Floor(float64(addExp/1000) * float64(this.module.ModuleTools.GetGlobalConf().FavorabilityLikes) / 1000))
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -106,7 +117,7 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
|
||||
for _, v := range _c.DislikingFood { //不喜欢
|
||||
if v == req.Items {
|
||||
likeStates = 2
|
||||
addExp = int32(math.Floor(float64(addExp*this.module.ModuleTools.GetGlobalConf().FavorabilityDislikes*req.Counts) / 1000))
|
||||
addExp = int32(math.Floor(float64(addExp/1000) * float64(this.module.ModuleTools.GetGlobalConf().FavorabilityDislikes) / 1000))
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -121,20 +132,8 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
|
||||
if errdata = this.module.CheckRes(session, res); errdata != nil { // 道具不够直接返回
|
||||
return
|
||||
}
|
||||
itemConf, err1 := this.module.ModuleTools.GetGrormetLlame(req.Items)
|
||||
//itemConf, err1 := this.module.configure.GetItemConfigureData(req.Items) // 获取食物的
|
||||
if err1 != nil {
|
||||
this.module.Errorf("赠送菜品配置没找到:%s", req.Items)
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err1.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
addExp *= itemConf
|
||||
_heroObj.Favorexp += addExp / 1000
|
||||
_heroObj.Favorexp += addExp
|
||||
|
||||
// 折算出等级
|
||||
for {
|
||||
|
Loading…
Reference in New Issue
Block a user