赠送礼物优化

This commit is contained in:
meixiongfeng 2023-05-04 16:30:56 +08:00
parent a11dfcbaba
commit f6d0dbb7dd
4 changed files with 56 additions and 22 deletions

View File

@ -51,7 +51,7 @@
"id": 103,
"PlayType": "Pagoda",
"HeroCount": 5,
"readyScene": "scenesfight_role_interface_02",
"readyScene": "scenesfight_role_interface_03",
"battleScenes": [
"scenesfight_06"
],
@ -243,7 +243,7 @@
"id": 115,
"PlayType": "test",
"HeroCount": 5,
"readyScene": "scenesfight_role_interface_02",
"readyScene": "scenesfight_role_interface_03",
"battleScenes": [
"scenesfight_06"
],
@ -275,7 +275,7 @@
"id": 117,
"PlayType": "test",
"HeroCount": 5,
"readyScene": "scenesfight_role_interface_02",
"readyScene": "scenesfight_role_interface_03",
"battleScenes": [
"scenesfight_06"
],

View File

@ -9908,5 +9908,36 @@
],
"synthetize_deplete": [],
"decompose_deplete": []
},
{
"id": "15010101",
"name": {
"key": "weektask_dj_15010101",
"text": "活跃度"
},
"usetype": 15,
"color": 3,
"bagtype": 0,
"index": 1,
"special_type": 0,
"time": 0,
"reddottype": 0,
"effects": "",
"modelName": "",
"box_id": 0,
"synthetize_num": 0,
"access": [
902
],
"use_skip": 902,
"upper_limit": -1,
"img": "dj_my_tj03",
"intr": {
"key": "weektask15010101",
"text": "秘境神水"
},
"sale": [],
"synthetize_deplete": [],
"decompose_deplete": []
}
]

View File

@ -15,8 +15,8 @@
"reword": [
{
"a": "item",
"t": "151001",
"n": 1
"t": "14030414",
"n": 40
}
]
},
@ -36,8 +36,8 @@
"reword": [
{
"a": "item",
"t": "151001",
"n": 1
"t": "14030414",
"n": 40
}
]
},
@ -57,8 +57,8 @@
"reword": [
{
"a": "item",
"t": "151001",
"n": 1
"t": "14030414",
"n": 40
}
]
},
@ -78,8 +78,8 @@
"reword": [
{
"a": "item",
"t": "151001",
"n": 1
"t": "14030414",
"n": 40
}
]
},
@ -99,8 +99,8 @@
"reword": [
{
"a": "item",
"t": "151001",
"n": 1
"t": "14030414",
"n": 40
}
]
},
@ -120,8 +120,8 @@
"reword": [
{
"a": "item",
"t": "151001",
"n": 1
"t": "14030414",
"n": 40
}
]
},
@ -141,8 +141,8 @@
"reword": [
{
"a": "item",
"t": "151001",
"n": 1
"t": "14030414",
"n": 40
}
]
},
@ -162,8 +162,8 @@
"reword": [
{
"a": "item",
"t": "151001",
"n": 1
"t": "14030414",
"n": 40
}
]
}

View File

@ -24,6 +24,7 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
attenuation map[int32]int32
likeStates int32 // 0 普通食物 1 喜欢 2 不喜欢
addExp int32 // 获得的经验
sCount int32 // 赠送开始次数
)
attenuation = make(map[int32]int32, 0)
code = this.UseGiftCheck(session, req)
@ -48,11 +49,11 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
code = pb.ErrorCode_LibraryMaxLv
return
}
sCount = _heroObj.Givecount
// 获取当天最大的次数
c := this.module.ModuleTools.GetGlobalConf().FavorabilityAttenuation
maxCoun := c[len(c)-1].K + 1
if _heroObj.Givecount+req.Counts > maxCoun { // 当天赠送次数
if sCount+req.Counts > maxCoun { // 当天赠送次数
code = pb.ErrorCode_LibraryGiveMaxCount
return
}
@ -62,7 +63,8 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
attenuation[int32(last)] = v.V // 3,1000|6,500|9,250
}
}
for i := _heroObj.Givecount + 1; i <= _heroObj.Givecount+req.Counts; i++ {
for i := sCount + 1; i <= sCount+req.Counts; i++ {
_heroObj.Givecount += 1
addExp += attenuation[i]
}
@ -130,6 +132,7 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
mapData := make(map[string]interface{})
mapData["favorexp"] = _heroObj.Favorexp
mapData["favorlv"] = _heroObj.Favorlv
mapData["givecount"] = _heroObj.Givecount
this.module.modelFetter.modifyHeroFetterDataByObjId(session.GetUserId(), _heroObj.Id, mapData)
rsp.Data = _heroObj
session.SendMsg(string(this.module.GetType()), LibraryUseGiftResp, rsp)