diff --git a/modules/viking/api_challengeover.go b/modules/viking/api_challengeover.go index 08183a2cb..48517bb89 100644 --- a/modules/viking/api_challengeover.go +++ b/modules/viking/api_challengeover.go @@ -25,6 +25,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal atno []*pb.UserAtno // atno 类型 del []string // 自动出售的装备 changExp map[string]int32 + res []*cfg.Gameatn // 最后获得的资源 ) changExp = make(map[string]int32, 0) mapData = make(map[string]interface{}, 0) @@ -102,24 +103,36 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal mapData["bossTime"] = viking.BossTime // 更新时间 reward = this.module.configure.GetDropReward(vikingCfg.Drop) // 获取掉落奖励 - if code, atno = this.module.DispenseAtno(session, reward, true); code != pb.ErrorCode_Success { - 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) + // 星级校验 + 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 v1.A == "item" { //补充 自动出售道具 - } } + // 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 len(del) > 0 { // 自动出售 - this.equip.SellEquipments(session, del) + + if code, atno = this.module.DispenseAtno(session, res, true); code != pb.ErrorCode_Success { + return } code = this.module.ModifyVikingData(session.GetUserId(), mapData)