装备自动出售不入背包
This commit is contained in:
parent
81419dc31b
commit
bd859c2653
@ -25,6 +25,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
|||||||
atno []*pb.UserAtno // atno 类型
|
atno []*pb.UserAtno // atno 类型
|
||||||
del []string // 自动出售的装备
|
del []string // 自动出售的装备
|
||||||
changExp map[string]int32
|
changExp map[string]int32
|
||||||
|
res []*cfg.Gameatn // 最后获得的资源
|
||||||
)
|
)
|
||||||
changExp = make(map[string]int32, 0)
|
changExp = make(map[string]int32, 0)
|
||||||
mapData = make(map[string]interface{}, 0)
|
mapData = make(map[string]interface{}, 0)
|
||||||
@ -102,26 +103,38 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
|||||||
mapData["bossTime"] = viking.BossTime // 更新时间
|
mapData["bossTime"] = viking.BossTime // 更新时间
|
||||||
|
|
||||||
reward = this.module.configure.GetDropReward(vikingCfg.Drop) // 获取掉落奖励
|
reward = this.module.configure.GetDropReward(vikingCfg.Drop) // 获取掉落奖励
|
||||||
if code, atno = this.module.DispenseAtno(session, reward, true); code != pb.ErrorCode_Success {
|
// 星级校验
|
||||||
|
for _, v := range reward {
|
||||||
|
bFound := false
|
||||||
|
if v.A == "equp" {
|
||||||
|
for _, star := range req.Star {
|
||||||
|
cfg := this.configure.GetEquipmentConfigureById(v.T)
|
||||||
|
if cfg != nil && star == cfg.Star { // 自动出售 转换成其他道具
|
||||||
|
if len(cfg.Sale) != 0 {
|
||||||
|
bFound = true
|
||||||
|
res = append(res, cfg.Sale...)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// else if v.A == "item" { //道具出售 以后补充
|
||||||
|
// if cfg, err := this.configure.GetItemConfigureData(v.T); err != nil { // 自动出售 转换成其他道具
|
||||||
|
// if len(cfg.Sale) != 0 {
|
||||||
|
// bFound = true
|
||||||
|
// res = append(res, cfg.Sale...)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
if !bFound {
|
||||||
|
res = append(res, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if code, atno = this.module.DispenseAtno(session, res, true); code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range req.Star {
|
|
||||||
for _, v1 := range atno {
|
|
||||||
if v1.A == "equp" {
|
|
||||||
cfg := this.configure.GetEquipmentConfigureById(v1.T)
|
|
||||||
if cfg != nil && cfg.Star == v {
|
|
||||||
del = append(del, v1.O)
|
|
||||||
}
|
|
||||||
} else if v1.A == "item" { //补充 自动出售道具
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(del) > 0 { // 自动出售
|
|
||||||
this.equip.SellEquipments(session, del)
|
|
||||||
}
|
|
||||||
|
|
||||||
code = this.module.ModifyVikingData(session.GetUserId(), mapData)
|
code = this.module.ModifyVikingData(session.GetUserId(), mapData)
|
||||||
|
|
||||||
if session.GetUserId() != "" { // 恢复时间
|
if session.GetUserId() != "" { // 恢复时间
|
||||||
|
Loading…
Reference in New Issue
Block a user