上传代码
This commit is contained in:
parent
6f61a5102a
commit
e2a480b1c4
@ -14,8 +14,8 @@ func (this *apiComp) StrengthenUplvCheck(session comm.IUserSession, req *pb.Hero
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
for k, v := range req.ExpCards {
|
||||
if v <= 0 || k == "" {
|
||||
for _, v := range req.ExpCards {
|
||||
if v.Value <= 0 || v.Key == "" {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
@ -51,8 +51,8 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
|
||||
code = pb.ErrorCode_HeroTypeErr
|
||||
return
|
||||
}
|
||||
for k, v := range req.ExpCards {
|
||||
_expHero, code = this.module.GetHero(session.GetUserId(), k) // 校验需要消耗经验卡牌的对象是否存在
|
||||
for _, v := range req.ExpCards {
|
||||
_expHero, code = this.module.GetHero(session.GetUserId(), v.Key) // 校验需要消耗经验卡牌的对象是否存在
|
||||
if code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
@ -61,17 +61,17 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
|
||||
return
|
||||
}
|
||||
|
||||
if v > _expHero.SameCount { // 校验数量
|
||||
if v.Value > _expHero.SameCount { // 校验数量
|
||||
code = pb.ErrorCode_HeroNoEnough
|
||||
return
|
||||
}
|
||||
// 查询 本次消耗会获得多少经验
|
||||
expConf := this.module.configure.GetHeroExp(_expHero.HeroID)
|
||||
if expConf != nil {
|
||||
addExp += expConf.Heroexp * v
|
||||
addExp += expConf.Heroexp * v.Value
|
||||
}
|
||||
costGold = expConf.Needgold * v // 需要消耗的金币
|
||||
if _expHero.SameCount < v { // 消耗经验卡片数量不足
|
||||
costGold = expConf.Needgold * v.Value // 需要消耗的金币
|
||||
if _expHero.SameCount < v.Value { // 消耗经验卡片数量不足
|
||||
code = pb.ErrorCode_HeroNoEnough
|
||||
return
|
||||
}
|
||||
@ -162,8 +162,8 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
|
||||
}
|
||||
|
||||
// 删除经验卡
|
||||
for k, v := range req.ExpCards {
|
||||
costHero, err1 := this.module.modelHero.consumeHeroCard(session.GetUserId(), k, v)
|
||||
for _, v := range req.ExpCards {
|
||||
costHero, err1 := this.module.modelHero.consumeHeroCard(session.GetUserId(), v.Key, v.Value)
|
||||
if err1 != nil {
|
||||
code = pb.ErrorCode_HeroNoEnough
|
||||
this.module.Errorf("delete err failed err:%T!", err1)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -22,10 +22,15 @@ message ItemData {
|
||||
int32 amount = 3; //数量
|
||||
}
|
||||
|
||||
message MapStringInt32 {
|
||||
string Key = 1;
|
||||
int32 Value = 2;
|
||||
}
|
||||
|
||||
// 卡牌升级
|
||||
message HeroStrengthenUplvReq {
|
||||
string heroObjID = 1; // 英雄对象ID
|
||||
map<string, int32> expCards = 2;
|
||||
repeated MapStringInt32 expCards = 2;
|
||||
}
|
||||
|
||||
// 卡牌升级返回
|
||||
|
Loading…
Reference in New Issue
Block a user