Compare commits

...

2 Commits

2 changed files with 23 additions and 8 deletions

View File

@ -20,7 +20,7 @@ const (
type configureComp struct {
modules.MCompConfigure
lock sync.RWMutex
worldtaskConf map[int32]*cfg.GameWorldTaskData
worldtaskConf map[int32]*cfg.GameWorldTaskData //key 条件ID
}
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
@ -31,6 +31,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
gameWorldAll: cfg.NewGameWorldAll,
gameburiedCond: cfg.NewGameBuriedCondi,
})
this.worldtaskConf = make(map[int32]*cfg.GameWorldTaskData)
configure.RegisterConfigure(gameWorldTask, cfg.NewGameBuriedCondi, this.updateconfigure)
return
}

View File

@ -40,7 +40,6 @@ func (this *Worldtask) OnInstallComp() {
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelWorldtask = this.RegisterComp(new(ModelWorldtask)).(*ModelWorldtask)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
// conf,err = this.configure.getWorldtaskBattleCfg()
}
@ -53,6 +52,11 @@ func (this *Worldtask) Start() (err error) {
if err = this.checkWorldtaskConf(); err != nil {
return err
}
conf, err := this.configure.getWorldtaskCfg()
if err != nil {
return err
}
this.configure.worldtaskConf = conf.GetDataMap()
return
}
@ -121,8 +125,6 @@ func (this *Worldtask) TCondFinishNotify(uid string, conds []*pb.ConIProgress) {
return
}
// 检索condId是否是世界任务的完成条件
taskConds := make(map[int32][]*pb.CurrentTask)
finishedCondIds := []*pb.ConIProgress{}
@ -186,11 +188,23 @@ func (this *Worldtask) TCondFinishNotify(uid string, conds []*pb.ConIProgress) {
if err != nil || curTaskConf == nil {
return
}
var flag bool
if curTaskConf.DeliverNpc == 0 {
defer func() {
this.modelWorldtask.taskFinish(session, t.TaskId, userTask, curTaskConf)
this.modelWorldtask.taskFinishPush(session, userTask, curTaskConf)
}()
//判断当前任务下的条件是否全部是完成状态
for _, s := range t.Conds {
if s.State == pb.BuriedItemFinishState_buried_finish {
flag = true
} else {
flag = false
}
}
if flag {
defer func() {
this.modelWorldtask.taskFinish(session, t.TaskId, userTask, curTaskConf)
this.modelWorldtask.taskFinishPush(session, userTask, curTaskConf)
}()
}
}
currentTasks = append(currentTasks, t)
}