上传gm优化

This commit is contained in:
liwei 2023-07-25 15:07:54 +08:00
parent 394c34a7b4
commit 6b917ba72e

View File

@ -430,12 +430,17 @@ func (this *WTask) ClearCaravanTask(session comm.IUserSession, task int32) {
// 跳世界任务 // 跳世界任务
func (this *WTask) BingoJumpTask(session comm.IUserSession, taskId int32) (errdata *pb.ErrorData) { func (this *WTask) BingoJumpTask(session comm.IUserSession, taskId int32) (errdata *pb.ErrorData) {
var ( var (
wtask *pb.DBWTask wtask *pb.DBWTask
update map[string]interface{} = make(map[string]interface{}) accepts []int32 = make([]int32, 0)
ok bool acceptsMap map[int32]struct{} = make(map[int32]struct{})
err error complete []int32 = make([]int32, 0)
completeMap map[int32]struct{} = make(map[int32]struct{})
conf *cfg.GameWorldTaskData
update map[string]interface{} = make(map[string]interface{})
ok bool
err error
) )
if _, err = this.configure.gettaskconfconfigure(taskId); err != nil { if conf, err = this.configure.gettaskconfconfigure(taskId); err != nil {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound, Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(), Title: pb.ErrorCode_ConfigNoFound.ToString(),
@ -452,6 +457,12 @@ func (this *WTask) BingoJumpTask(session comm.IUserSession, taskId int32) (errda
} }
return return
} }
for _, v := range wtask.Accepts {
acceptsMap[v] = struct{}{}
}
for _, v := range wtask.Completes {
completeMap[v] = struct{}{}
}
ok = false ok = false
for _, v := range wtask.Activations { for _, v := range wtask.Activations {
if taskId == v { if taskId == v {
@ -462,8 +473,41 @@ func (this *WTask) BingoJumpTask(session comm.IUserSession, taskId int32) (errda
if ok { if ok {
return return
} }
for {
if conf.Ontxe != 0 {
if _, ok = completeMap[conf.Ontxe]; !ok {
completeMap[conf.Ontxe] = struct{}{}
if _, ok = acceptsMap[conf.Ontxe]; ok {
delete(acceptsMap, conf.Ontxe)
}
if conf, err = this.configure.gettaskconfconfigure(conf.Ontxe); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: err.Error(),
}
return
}
}
} else {
break
}
}
for k, _ := range acceptsMap {
accepts = append(accepts, k)
}
for k, _ := range completeMap {
complete = append(complete, k)
}
wtask.Activations = append(wtask.Activations, taskId) wtask.Activations = append(wtask.Activations, taskId)
wtask.Accepts = accepts
wtask.Completes = complete
update["activations"] = wtask.Activations update["activations"] = wtask.Activations
update["accepts"] = wtask.Accepts
update["completes"] = wtask.Completes
if err = this.modelwtask.Change(session.GetUserId(), update); err != nil { if err = this.modelwtask.Change(session.GetUserId(), update); err != nil {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{