打造一次升多级情况

This commit is contained in:
meixiongfeng 2023-05-10 10:30:53 +08:00
parent d0fed35a83
commit 72867cea6e

View File

@ -237,29 +237,35 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
stove.Data[req.ReelId].Value += req.Count stove.Data[req.ReelId].Value += req.Count
stove.Forge[req.ReelId] += req.Count stove.Forge[req.ReelId] += req.Count
// 可能存在一次升多级的情况
// 检查是否提升了熟练度等级 // 检查是否提升了熟练度等级
nextProficiency := this.module.configure.GetSmithyProficileData(req.ReelId, stove.Data[req.ReelId].Lv+1) for {
if nextProficiency != nil && nextProficiency.Proficiency <= stove.Data[req.ReelId].Value { // 提升熟练度 nextProficiency := this.module.configure.GetSmithyProficileData(req.ReelId, stove.Data[req.ReelId].Lv+1)
stove.Data[req.ReelId].Lv += 1 if nextProficiency != nil && nextProficiency.Proficiency <= stove.Data[req.ReelId].Value { // 提升熟练度
stove.Data[req.ReelId].Lv += 1
// 校验是否解锁了新的图纸 // 校验是否解锁了新的图纸
if nextProficiency.Type == comm.SmithyReelType3 { if nextProficiency.Type == comm.SmithyReelType3 {
stove.Data[nextProficiency.Value1] = &pb.Mastery{ stove.Data[nextProficiency.Value1] = &pb.Mastery{
Lv: 1, Lv: 1,
Value: 0, Value: 0,
}
} }
} // 是否解锁新套装
// 是否解锁新套装 if nextProficiency.Type == comm.SmithyReelType4 {
if nextProficiency.Type == comm.SmithyReelType4 { if rst, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()); err == nil {
if rst, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()); err == nil { rst.SuiteId = append(rst.SuiteId, nextProficiency.Value1)
rst.SuiteId = append(rst.SuiteId, nextProficiency.Value1)
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{ this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
"suiteId": rst.SuiteId, "suiteId": rst.SuiteId,
}) })
}
} }
} else {
break
} }
} }
update["data"] = stove.Data update["data"] = stove.Data
update["forge"] = stove.Forge // 打造次数 update["forge"] = stove.Forge // 打造次数