diff --git a/modules/integral/api_challenge.go b/modules/integral/api_challenge.go index 7ec7d9d9d..7c06c1b95 100644 --- a/modules/integral/api_challenge.go +++ b/modules/integral/api_challenge.go @@ -52,8 +52,23 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.IntegralChalle } return } - for k := range list.Buff { - dibuff = append(dibuff, k) + if list.Itype == 2 { // 事件模式 + var condiIds []int32 + if confList := this.configure.GetIntegralCondition(); len(confList) > 0 { + for _, v := range confList { + condiIds = append(condiIds, v.Id) + } + } + + if _, progress, err := this.module.ModuleBuried.CheckCondition(session, condiIds...); err == nil { + condiIds = []int32{} + for _, v := range progress { // 没有完成的 + if v.State == pb.BuriedItemFinishState_buried_finish { + condiIds = append(condiIds, v.Conid) + } + } + } + dibuff = this.module.configure.GetIntegralConditionByKeys(condiIds) } errdata, record := this.module.battle.CreateDebuffBattle(session, &pb.BattlePVEReq{ Rulesid: cfgData.BattleReadyID, diff --git a/modules/integral/comp_configure.go b/modules/integral/comp_configure.go index 124f67a2a..9d39d02ee 100644 --- a/modules/integral/comp_configure.go +++ b/modules/integral/comp_configure.go @@ -161,6 +161,17 @@ func (this *configureComp) GetIntegralConditionByKey(id int32) (result *cfg.Game return } +func (this *configureComp) GetIntegralConditionByKeys(ids []int32) (result []int32) { + if v, err := this.GetConfigure(game_integralcondition); err == nil { + if configure, ok := v.(*cfg.GameIntegralCondition); ok { + for _, id := range ids { + result = append(result, configure.Get(id).Skillid) + } + } + } + return +} + func (this *configureComp) LoadIntegralCondition() { if v, err := this.GetConfigure(game_integralcondition); err == nil { diff --git a/modules/integral/module.go b/modules/integral/module.go index 4f4b062f6..fd975d34d 100644 --- a/modules/integral/module.go +++ b/modules/integral/module.go @@ -4,7 +4,6 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/lego/base" "go_dreamfactory/lego/core" - "go_dreamfactory/lego/sys/log" "go_dreamfactory/modules" "go_dreamfactory/pb" ) @@ -60,52 +59,53 @@ func (this *Integral) OnInstallComp() { // 任务条件达成通知 func (this *Integral) BuriedsNotify(session comm.IUserSession, conds []*pb.ConIProgress) { - var bChange bool - this.Debug("积分boss条件达成通知", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "conds", Value: conds}) - dt, err := this.modelIntegral.getIntegralList(session) + return + // var bChange bool + // this.Debug("积分boss条件达成通知", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "conds", Value: conds}) + // dt, err := this.modelIntegral.getIntegralList(session) - if dt.Itype != 2 { // 只有事件模式才有debuff - return - } - confList := this.configure.GetIntegralCondition() - if err != nil { - this.Error(err.Error()) - return - } - condMap := make(map[int32]*pb.ConIProgress) - for _, conf := range confList { - for _, cond := range conds { - if cond.Conid == conf.TaskId { - condMap[conf.TaskId] = cond - } - } - } - update := make(map[string]interface{}) + // if dt.Itype != 2 { // 只有事件模式才有debuff + // return + // } + // confList := this.configure.GetIntegralCondition() + // if err != nil { + // this.Error(err.Error()) + // return + // } + // condMap := make(map[int32]*pb.ConIProgress) + // for _, conf := range confList { + // for _, cond := range conds { + // if cond.Conid == conf.TaskId { + // condMap[conf.TaskId] = cond + // } + // } + // } + // update := make(map[string]interface{}) - if dt.Buff == nil { - dt.Buff = make(map[int32]int32) - for _, v := range condMap { - if v.State == pb.BuriedItemFinishState_buried_finish { - if c, err := this.configure.GetIntegralConditionByTask(v.Conid); err == nil { - dt.Buff[c.Id] = 1 - bChange = true - } - } - } - } + // if dt.Buff == nil { + // dt.Buff = make(map[int32]int32) + // for _, v := range condMap { + // if v.State == pb.BuriedItemFinishState_buried_finish { + // if c, err := this.configure.GetIntegralConditionByTask(v.Conid); err == nil { + // dt.Buff[c.Id] = 1 + // bChange = true + // } + // } + // } + // } - for k, v := range condMap { - if dt.Buff[k] != 1 && v.State == pb.BuriedItemFinishState_buried_finish { - dt.Buff[k] = 1 - bChange = true - } - } - if bChange { - update["buff"] = dt.Buff - if err := this.modelIntegral.modifyIntegralData(session.GetUserId(), update); err != nil { - this.Error(err.Error()) - return - } - } + // for k, v := range condMap { + // if dt.Buff[k] != 1 && v.State == pb.BuriedItemFinishState_buried_finish { + // dt.Buff[k] = 1 + // bChange = true + // } + // } + // if bChange { + // update["buff"] = dt.Buff + // if err := this.modelIntegral.modifyIntegralData(session.GetUserId(), update); err != nil { + // this.Error(err.Error()) + // return + // } + // } return }