积分boss debuff 带入

This commit is contained in:
meixiongfeng 2024-01-10 18:25:23 +08:00
parent dd08881031
commit a9f5ceadb7
3 changed files with 73 additions and 47 deletions

View File

@ -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,

View File

@ -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 {

View File

@ -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
}