Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
c832d16998
File diff suppressed because it is too large
Load Diff
@ -8,12 +8,12 @@
|
||||
"des": 2,
|
||||
"icon": "",
|
||||
"task_Tname": {
|
||||
"key": "story_80",
|
||||
"key": "Mainline_Tasks",
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "Mainline_Tasks_1",
|
||||
"text": "初来乍到"
|
||||
"text": "主线任务1"
|
||||
},
|
||||
"task_display": {
|
||||
"key": "story_80",
|
||||
@ -45,12 +45,12 @@
|
||||
"des": 2,
|
||||
"icon": "",
|
||||
"task_Tname": {
|
||||
"key": "story_80",
|
||||
"key": "Mainline_Tasks",
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "Mainline_Tasks_2",
|
||||
"text": "不测风云"
|
||||
"text": "主线任务2"
|
||||
},
|
||||
"task_display": {
|
||||
"key": "story_80",
|
||||
@ -82,12 +82,12 @@
|
||||
"des": 2,
|
||||
"icon": "",
|
||||
"task_Tname": {
|
||||
"key": "story_80",
|
||||
"key": "Mainline_Tasks",
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "Mainline_Tasks_3",
|
||||
"text": "雨过天晴"
|
||||
"text": "主线任务3"
|
||||
},
|
||||
"task_display": {
|
||||
"key": "story_80",
|
||||
@ -117,12 +117,12 @@
|
||||
"des": 2,
|
||||
"icon": "",
|
||||
"task_Tname": {
|
||||
"key": "story_80",
|
||||
"key": "Mainline_Tasks",
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "story_80",
|
||||
"text": "1"
|
||||
"key": "Mainline_Tasks_4",
|
||||
"text": "主线任务4"
|
||||
},
|
||||
"task_display": {
|
||||
"key": "story_80",
|
||||
@ -152,12 +152,12 @@
|
||||
"des": 2,
|
||||
"icon": "",
|
||||
"task_Tname": {
|
||||
"key": "story_80",
|
||||
"key": "Mainline_Tasks",
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "story_80",
|
||||
"text": "1"
|
||||
"key": "Mainline_Tasks_5",
|
||||
"text": "主线任务5"
|
||||
},
|
||||
"task_display": {
|
||||
"key": "story_80",
|
||||
@ -187,12 +187,12 @@
|
||||
"des": 2,
|
||||
"icon": "",
|
||||
"task_Tname": {
|
||||
"key": "story_80",
|
||||
"key": "Mainline_Tasks",
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "story_80",
|
||||
"text": "1"
|
||||
"key": "Mainline_Tasks_6",
|
||||
"text": "主线任务6"
|
||||
},
|
||||
"task_display": {
|
||||
"key": "story_80",
|
||||
@ -222,12 +222,12 @@
|
||||
"des": 2,
|
||||
"icon": "",
|
||||
"task_Tname": {
|
||||
"key": "story_80",
|
||||
"key": "Mainline_Tasks",
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "story_80",
|
||||
"text": "1"
|
||||
"key": "Mainline_Tasks_7",
|
||||
"text": "主线任务7"
|
||||
},
|
||||
"task_display": {
|
||||
"key": "story_80",
|
||||
@ -257,12 +257,12 @@
|
||||
"des": 2,
|
||||
"icon": "",
|
||||
"task_Tname": {
|
||||
"key": "story_80",
|
||||
"key": "Mainline_Tasks",
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "story_80",
|
||||
"text": "1"
|
||||
"key": "Mainline_Tasks_8",
|
||||
"text": "主线任务8"
|
||||
},
|
||||
"task_display": {
|
||||
"key": "story_80",
|
||||
@ -292,12 +292,12 @@
|
||||
"des": 2,
|
||||
"icon": "",
|
||||
"task_Tname": {
|
||||
"key": "story_80",
|
||||
"key": "Mainline_Tasks",
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "story_80",
|
||||
"text": "1"
|
||||
"key": "Mainline_Tasks_9",
|
||||
"text": "主线任务9"
|
||||
},
|
||||
"task_display": {
|
||||
"key": "story_80",
|
||||
@ -322,17 +322,17 @@
|
||||
"key": 20100,
|
||||
"lock": 1,
|
||||
"ontxe": 20090,
|
||||
"id_after": 30010,
|
||||
"id_after": 0,
|
||||
"group": 2,
|
||||
"des": 2,
|
||||
"icon": "",
|
||||
"task_Tname": {
|
||||
"key": "story_80",
|
||||
"key": "Mainline_Tasks",
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "story_80",
|
||||
"text": "1"
|
||||
"key": "Mainline_Tasks_10",
|
||||
"text": "主线任务10"
|
||||
},
|
||||
"task_display": {
|
||||
"key": "story_80",
|
||||
@ -362,11 +362,11 @@
|
||||
"des": 3,
|
||||
"icon": "",
|
||||
"task_Tname": {
|
||||
"key": "story_80",
|
||||
"key": "Side_Quest",
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "story_80",
|
||||
"key": "WuGuanSceneTask_1",
|
||||
"text": "1"
|
||||
},
|
||||
"task_display": {
|
||||
@ -392,24 +392,26 @@
|
||||
"key": 40010,
|
||||
"lock": 1,
|
||||
"ontxe": 20020,
|
||||
"id_after": 0,
|
||||
"id_after": 40020,
|
||||
"group": 4,
|
||||
"des": 3,
|
||||
"icon": "",
|
||||
"task_Tname": {
|
||||
"key": "story_80",
|
||||
"key": "Side_Quest",
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "story_80",
|
||||
"key": "SmithyScene_1",
|
||||
"text": "1"
|
||||
},
|
||||
"task_display": {
|
||||
"key": "story_80",
|
||||
"text": "1"
|
||||
},
|
||||
"npc": 0,
|
||||
"completetask": [],
|
||||
"npc": 70020,
|
||||
"completetask": [
|
||||
0
|
||||
],
|
||||
"deliver_npc": 0,
|
||||
"auto_accept": 0,
|
||||
"reword": [
|
||||
@ -422,28 +424,30 @@
|
||||
"module": []
|
||||
},
|
||||
{
|
||||
"key": 50010,
|
||||
"key": 40020,
|
||||
"lock": 1,
|
||||
"ontxe": 20030,
|
||||
"ontxe": 40010,
|
||||
"id_after": 0,
|
||||
"group": 5,
|
||||
"group": 4,
|
||||
"des": 3,
|
||||
"icon": "",
|
||||
"task_Tname": {
|
||||
"key": "story_80",
|
||||
"key": "Side_Quest",
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "story_80",
|
||||
"key": "SmithyScene_1_1",
|
||||
"text": "1"
|
||||
},
|
||||
"task_display": {
|
||||
"key": "story_80",
|
||||
"text": "1"
|
||||
},
|
||||
"npc": 0,
|
||||
"completetask": [],
|
||||
"deliver_npc": 0,
|
||||
"npc": 70021,
|
||||
"completetask": [
|
||||
308
|
||||
],
|
||||
"deliver_npc": 70023,
|
||||
"auto_accept": 0,
|
||||
"reword": [
|
||||
{
|
||||
@ -454,6 +458,76 @@
|
||||
],
|
||||
"module": []
|
||||
},
|
||||
{
|
||||
"key": 50010,
|
||||
"lock": 1,
|
||||
"ontxe": 20030,
|
||||
"id_after": 50011,
|
||||
"group": 5,
|
||||
"des": 3,
|
||||
"icon": "",
|
||||
"task_Tname": {
|
||||
"key": "Side_Quest",
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "SmithyScene_2",
|
||||
"text": "1"
|
||||
},
|
||||
"task_display": {
|
||||
"key": "story_80",
|
||||
"text": "1"
|
||||
},
|
||||
"npc": 70030,
|
||||
"completetask": [
|
||||
0
|
||||
],
|
||||
"deliver_npc": 0,
|
||||
"auto_accept": 0,
|
||||
"reword": [
|
||||
{
|
||||
"a": "item",
|
||||
"t": "110001",
|
||||
"n": 113
|
||||
}
|
||||
],
|
||||
"module": []
|
||||
},
|
||||
{
|
||||
"key": 50011,
|
||||
"lock": 1,
|
||||
"ontxe": 50010,
|
||||
"id_after": 0,
|
||||
"group": 5,
|
||||
"des": 3,
|
||||
"icon": "",
|
||||
"task_Tname": {
|
||||
"key": "Side_Quest",
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "SmithyScene_2_1",
|
||||
"text": "1"
|
||||
},
|
||||
"task_display": {
|
||||
"key": "story_80",
|
||||
"text": "1"
|
||||
},
|
||||
"npc": 70031,
|
||||
"completetask": [
|
||||
309
|
||||
],
|
||||
"deliver_npc": 70033,
|
||||
"auto_accept": 0,
|
||||
"reword": [
|
||||
{
|
||||
"a": "item",
|
||||
"t": "110001",
|
||||
"n": 114
|
||||
}
|
||||
],
|
||||
"module": []
|
||||
},
|
||||
{
|
||||
"key": 60010,
|
||||
"lock": 1,
|
||||
@ -463,26 +537,28 @@
|
||||
"des": 3,
|
||||
"icon": "",
|
||||
"task_Tname": {
|
||||
"key": "story_80",
|
||||
"key": "Side_Quest",
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "story_80",
|
||||
"key": "WuGuanSceneTask_2",
|
||||
"text": "1"
|
||||
},
|
||||
"task_display": {
|
||||
"key": "story_80",
|
||||
"text": "1"
|
||||
},
|
||||
"npc": 0,
|
||||
"completetask": [],
|
||||
"npc": 70040,
|
||||
"completetask": [
|
||||
0
|
||||
],
|
||||
"deliver_npc": 0,
|
||||
"auto_accept": 0,
|
||||
"reword": [
|
||||
{
|
||||
"a": "item",
|
||||
"t": "110001",
|
||||
"n": 113
|
||||
"n": 115
|
||||
}
|
||||
],
|
||||
"module": []
|
||||
@ -496,26 +572,28 @@
|
||||
"des": 3,
|
||||
"icon": "",
|
||||
"task_Tname": {
|
||||
"key": "story_80",
|
||||
"key": "Side_Quest",
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "story_80",
|
||||
"key": "WuGuanSceneTask_3",
|
||||
"text": "1"
|
||||
},
|
||||
"task_display": {
|
||||
"key": "story_80",
|
||||
"text": "1"
|
||||
},
|
||||
"npc": 0,
|
||||
"completetask": [],
|
||||
"npc": 70050,
|
||||
"completetask": [
|
||||
0
|
||||
],
|
||||
"deliver_npc": 0,
|
||||
"auto_accept": 0,
|
||||
"reword": [
|
||||
{
|
||||
"a": "item",
|
||||
"t": "110001",
|
||||
"n": 114
|
||||
"n": 116
|
||||
}
|
||||
],
|
||||
"module": []
|
||||
@ -529,26 +607,28 @@
|
||||
"des": 3,
|
||||
"icon": "",
|
||||
"task_Tname": {
|
||||
"key": "story_80",
|
||||
"key": "Side_Quest",
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "story_80",
|
||||
"key": "SmithyScene_3",
|
||||
"text": "1"
|
||||
},
|
||||
"task_display": {
|
||||
"key": "story_80",
|
||||
"text": "1"
|
||||
},
|
||||
"npc": 0,
|
||||
"completetask": [],
|
||||
"npc": 70060,
|
||||
"completetask": [
|
||||
0
|
||||
],
|
||||
"deliver_npc": 0,
|
||||
"auto_accept": 0,
|
||||
"reword": [
|
||||
{
|
||||
"a": "item",
|
||||
"t": "110001",
|
||||
"n": 115
|
||||
"n": 117
|
||||
}
|
||||
],
|
||||
"module": []
|
||||
@ -566,7 +646,7 @@
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "story_80",
|
||||
"key": "Daily_tasks",
|
||||
"text": "1"
|
||||
},
|
||||
"task_display": {
|
||||
@ -601,7 +681,7 @@
|
||||
"text": "1"
|
||||
},
|
||||
"task_name": {
|
||||
"key": "story_80",
|
||||
"key": "Weekly_Tasks",
|
||||
"text": "1"
|
||||
},
|
||||
"task_display": {
|
||||
|
@ -211,8 +211,6 @@ type (
|
||||
RemoveCondi(uid string, condiId int32) error
|
||||
// 更新任务条件数据
|
||||
ChangeCondi(uid string, data map[int32]*pb.RtaskData) error
|
||||
//任务触发
|
||||
SendToRtask(session IUserSession, rtaskType TaskType, params ...int32) (code pb.ErrorCode)
|
||||
//任务批量触发
|
||||
TriggerTask(uid string, taskParams ...*TaskParam)
|
||||
// 获取任务条件记录
|
||||
|
@ -94,8 +94,12 @@ func (this *ModelRtask) checkCondi(uid string, condiId int32) (err error, ok boo
|
||||
var condi *rtaskCondi
|
||||
cond, ok := this.moduleRtask.handleMap.Load(condiId)
|
||||
if !ok {
|
||||
errors.Errorf("condiID: %v handle no found", condiId)
|
||||
return
|
||||
rcs := this.moduleRtask.getHandle(comm.TaskType(conf.Type))
|
||||
for _, v:=range rcs {
|
||||
if v.condId == condiId {
|
||||
cond = v
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if condi, ok = cond.(*rtaskCondi); !ok {
|
||||
|
@ -45,9 +45,7 @@ type ModuleRtask struct {
|
||||
}
|
||||
|
||||
func NewModule() core.IModule {
|
||||
return &ModuleRtask{
|
||||
// handleMap: make(map[int32]*rtaskCondi),
|
||||
}
|
||||
return &ModuleRtask{}
|
||||
}
|
||||
|
||||
func (this *ModuleRtask) GetType() core.M_Modules {
|
||||
@ -57,7 +55,6 @@ func (this *ModuleRtask) GetType() core.M_Modules {
|
||||
func (this *ModuleRtask) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
err = this.ModuleBase.Init(service, module, options)
|
||||
this.service = service.(base.IRPCXService)
|
||||
// this.initRtaskVerifyHandle()
|
||||
return
|
||||
}
|
||||
func (this *ModuleRtask) Start() (err error) {
|
||||
@ -260,145 +257,6 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
return
|
||||
}
|
||||
|
||||
// 条件校验初始
|
||||
// Deprecated
|
||||
func (this *ModuleRtask) initRtaskVerifyHandle() {
|
||||
conf, err := this.configure.getRtaskCondiCfg()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
for _, v := range conf.GetDataList() {
|
||||
if typeCfg, err := this.configure.getRtaskTypeById(v.Id); err == nil {
|
||||
if typeCfg != nil {
|
||||
switch comm.TaskType(typeCfg.Type) {
|
||||
case comm.Rtype1:
|
||||
this.registerVerifyHandle(v.Id, &rtaskCondi{
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verfiyRtype1,
|
||||
update: this.modelRtaskRecord.overrideUpdate,
|
||||
})
|
||||
case comm.Rtype2:
|
||||
this.registerVerifyHandle(v.Id, &rtaskCondi{
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verifyRtype2,
|
||||
update: this.modelRtaskRecord.overrideUpdate,
|
||||
})
|
||||
case comm.Rtype3:
|
||||
this.registerVerifyHandle(v.Id, &rtaskCondi{
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verifyRtype3,
|
||||
update: this.modelRtaskRecord.overrideUpdate,
|
||||
})
|
||||
case comm.Rtype4:
|
||||
this.registerVerifyHandle(v.Id, &rtaskCondi{
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verifyRtype4,
|
||||
update: this.modelRtaskRecord.overrideUpdate,
|
||||
})
|
||||
case comm.Rtype5:
|
||||
this.registerVerifyHandle(v.Id, &rtaskCondi{
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verifyRtype5,
|
||||
update: this.modelRtaskRecord.overrideUpdate,
|
||||
})
|
||||
case comm.Rtype6:
|
||||
this.registerVerifyHandle(v.Id, &rtaskCondi{
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verifyRtype6,
|
||||
update: this.modelRtaskRecord.overrideUpdate,
|
||||
})
|
||||
case comm.Rtype8:
|
||||
this.registerVerifyHandle(v.Id, &rtaskCondi{
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verfiyRtype8,
|
||||
update: this.modelRtaskRecord.overrideUpdate,
|
||||
})
|
||||
case comm.Rtype9:
|
||||
this.registerVerifyHandle(v.Id, &rtaskCondi{
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verfiyRtype9,
|
||||
update: this.modelRtaskRecord.overrideUpdate,
|
||||
})
|
||||
case comm.Rtype10:
|
||||
this.registerVerifyHandle(v.Id, &rtaskCondi{
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verfiyRtype10,
|
||||
update: this.modelRtaskRecord.overrideUpdate,
|
||||
})
|
||||
case comm.Rtype11, comm.Rtype84, comm.Rtype85:
|
||||
this.registerVerifyHandle(v.Id, &rtaskCondi{
|
||||
find: this.modelRtaskRecord.lessEqualFirstParam,
|
||||
verify: this.modelRtaskRecord.verifyFirstGreatEqualParam,
|
||||
update: this.modelRtaskRecord.overrideUpdate,
|
||||
})
|
||||
case comm.Rtype18:
|
||||
this.registerVerifyHandle(v.Id, &rtaskCondi{
|
||||
find: this.modelRtaskRecord.greatEqualFirstParam,
|
||||
verify: this.modelRtaskRecord.verifyFirstGreatEqualParam,
|
||||
update: this.modelRtaskRecord.addUpdate,
|
||||
})
|
||||
case comm.Rtype7, comm.Rtype12, comm.Rtype13, comm.Rtype14, comm.Rtype15,
|
||||
comm.Rtype19, comm.Rtype21, comm.Rtype24,
|
||||
comm.Rtype26, comm.Rtype27, comm.Rtype28, comm.Rtype38,
|
||||
comm.Rtype39, comm.Rtype50, comm.Rtype51, comm.Rtype53,
|
||||
comm.Rtype54, comm.Rtype57, comm.Rtype58, comm.Rtype60,
|
||||
comm.Rtype62, comm.Rtype64, comm.Rtype69, comm.Rtype72, comm.Rtype88, comm.Rtype104,
|
||||
comm.Rtype96, comm.Rtype105, comm.Rtype128, comm.Rtype130, comm.Rtype131,
|
||||
comm.Rtype141, comm.Rtype142, comm.Rtype143, comm.Rtype144, comm.Rtype145, comm.Rtype146,
|
||||
comm.Rtype147, comm.Rtype149, comm.Rtype153, comm.Rtype154, comm.Rtype155, comm.Rtype156:
|
||||
this.registerVerifyHandle(v.Id, &rtaskCondi{
|
||||
find: this.modelRtaskRecord.lessEqualFirstParam,
|
||||
verify: this.modelRtaskRecord.verifyFirstGreatEqualParam,
|
||||
update: this.modelRtaskRecord.addUpdate,
|
||||
})
|
||||
case comm.Rtype20:
|
||||
this.registerVerifyHandle(v.Id, &rtaskCondi{
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verifyRtype20,
|
||||
update: this.modelRtaskRecord.overrideUpdate,
|
||||
})
|
||||
case comm.Rtype22, comm.Rtype109:
|
||||
this.registerVerifyHandle(v.Id, &rtaskCondi{
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtaskRecord.verifyFirstEqualParam,
|
||||
update: this.modelRtaskRecord.overrideUpdate,
|
||||
})
|
||||
case comm.Rtype63:
|
||||
this.registerVerifyHandle(v.Id, &rtaskCondi{
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verifyRtype63,
|
||||
update: this.modelRtaskRecord.addUpdate,
|
||||
})
|
||||
case comm.Rtype16, comm.Rtype17,
|
||||
comm.Rtype35, comm.Rtype44,
|
||||
comm.Rtype59, comm.Rtype61, comm.Rtype70:
|
||||
this.registerVerifyHandle(v.Id, &rtaskCondi{
|
||||
find: this.modelRtaskRecord.equalParams,
|
||||
verify: this.modelRtaskRecord.verifyFromDb,
|
||||
update: this.modelRtaskRecord.overrideUpdate,
|
||||
})
|
||||
case comm.Rtype23, comm.Rtype25, comm.Rtype29, comm.Rtype30, comm.Rtype31,
|
||||
comm.Rtype32, comm.Rtype33, comm.Rtype34, comm.Rtype36,
|
||||
comm.Rtype37, comm.Rtype40, comm.Rtype41,
|
||||
comm.Rtype42, comm.Rtype43, comm.Rtype45,
|
||||
comm.Rtype46, comm.Rtype47, comm.Rtype48, comm.Rtype49,
|
||||
comm.Rtype52, comm.Rtype55, comm.Rtype56,
|
||||
comm.Rtype65, comm.Rtype66, comm.Rtype67, comm.Rtype68, comm.Rtype140:
|
||||
this.registerVerifyHandle(v.Id, &rtaskCondi{
|
||||
find: this.modelRtaskRecord.lessThanParams,
|
||||
verify: this.modelRtaskRecord.verifyFromDb,
|
||||
update: this.modelRtaskRecord.addUpdate,
|
||||
})
|
||||
|
||||
default:
|
||||
log.Warnf("rtaskType[%v] not register", typeCfg.Type)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理触发的任务
|
||||
func (this *ModuleRtask) processOneTask(session comm.IUserSession, rtaskType comm.TaskType, params ...int32) (code pb.ErrorCode) {
|
||||
uid := session.GetUserId()
|
||||
@ -481,80 +339,6 @@ func (this *ModuleRtask) processOneTask(session comm.IUserSession, rtaskType com
|
||||
return
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.TaskType, params ...int32) (code pb.ErrorCode) {
|
||||
uid := session.GetUserId()
|
||||
if this.IsCross() {
|
||||
//随机任务
|
||||
if _, err := this.service.AcrossClusterRpcGo(
|
||||
context.Background(),
|
||||
session.GetServiecTag(),
|
||||
comm.Service_Worker,
|
||||
string(comm.Rpc_ModuleRtaskSendTask),
|
||||
pb.RPCRTaskReq{Uid: uid, TaskType: int32(rtaskType), Param: params},
|
||||
nil); err != nil {
|
||||
this.Errorln(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
this.Debug("任务事件触发",
|
||||
log.Field{Key: "uid", Value: uid},
|
||||
log.Field{Key: "taskType", Value: rtaskType},
|
||||
log.Field{Key: "params", Value: params},
|
||||
)
|
||||
var (
|
||||
condis []*rtaskCondi
|
||||
)
|
||||
|
||||
condis = this.getHandle(rtaskType)
|
||||
|
||||
// for _, codiConf := range this.configure.getRtaskCondis(int32(rtaskType)) {
|
||||
// v, ok := this.handleMap[codiConf.Id]
|
||||
// if !ok {
|
||||
// this.Warn("未注册事件处理器",
|
||||
// log.Field{Key: "uid", Value: uid},
|
||||
// log.Field{Key: "condiId", Value: codiConf.Id},
|
||||
// )
|
||||
// code = pb.ErrorCode_RtaskCondiNoFound
|
||||
// return
|
||||
// }
|
||||
|
||||
// if v.find == nil {
|
||||
// this.Warn("未设置find Handle",
|
||||
// log.Field{Key: "uid", Value: uid},
|
||||
// log.Field{Key: "condiId", Value: codiConf.Id},
|
||||
// )
|
||||
// return
|
||||
// }
|
||||
|
||||
// if condiId, _ := v.find(codiConf, params...); condiId != 0 {
|
||||
// v.condId = codiConf.Id
|
||||
// condis = append(condis, v)
|
||||
// }
|
||||
// }
|
||||
|
||||
// update
|
||||
for _, v := range condis {
|
||||
conf, err := this.configure.getRtaskTypeById(v.condId)
|
||||
if err != nil {
|
||||
log.Errorf("get condId conf err:%v", err)
|
||||
code = pb.ErrorCode_RtaskCondiNoFound
|
||||
return
|
||||
}
|
||||
|
||||
if v.update != nil {
|
||||
if err := v.update(uid, conf, params...); err != nil {
|
||||
log.Errorf("update task:%v", err)
|
||||
code = pb.ErrorCode_DBError
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (this *ModuleRtask) TriggerTask(uid string, taskParams ...*comm.TaskParam) {
|
||||
this.Debug("任务处理",
|
||||
log.Field{Key: "uid", Value: uid},
|
||||
|
@ -17,9 +17,7 @@ func (this *apiComp) SendCheck(session comm.IUserSession, req *pb.TaskSendReq) (
|
||||
func (this *apiComp) Send(session comm.IUserSession, req *pb.TaskSendReq) (code pb.ErrorCode, data proto.Message) {
|
||||
if imodule, err := this.service.GetModule(comm.ModuleRtask); err == nil {
|
||||
if itask, ok := imodule.(comm.IRtask); ok {
|
||||
if code = itask.SendToRtask(session, comm.TaskType(req.TaskType), req.Params...); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
itask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.TaskType(req.TaskType), req.Params...))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
|
||||
return
|
||||
}
|
||||
|
||||
updateCheckCond := func(nextTaskId int32) *pb.DBWorldtask {
|
||||
updateCheckCond := func(userTask *pb.DBWorldtask, nextTaskId int32) *pb.DBWorldtask {
|
||||
//检查下个任务的完成条件
|
||||
nextTaskConf, err := this.module.configure.getWorldtaskById(nextTaskId)
|
||||
if err != nil || curTaskConf == nil {
|
||||
@ -85,13 +85,16 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
|
||||
userTask.CurrentTask = make(map[int32]*pb.Worldtask)
|
||||
}
|
||||
|
||||
if len(nextTaskConf.Completetask) == 1 && nextTaskConf.Completetask[0] == 0 {
|
||||
update := make(map[string]interface{})
|
||||
if (len(nextTaskConf.Completetask) == 1 && nextTaskConf.Completetask[0] == 0) ||
|
||||
len(nextTaskConf.Completetask) == 0 {
|
||||
wt := &pb.Worldtask{
|
||||
TaskId: nextTaskId,
|
||||
TaskType: nextTaskConf.Des,
|
||||
CondiIds: []int32{},
|
||||
}
|
||||
userTask.CurrentTask[nextTaskConf.Group] = wt
|
||||
update["currentTask"] = userTask.CurrentTask
|
||||
} else {
|
||||
for _, condiId := range nextTaskConf.Completetask {
|
||||
if condiId == 0 {
|
||||
@ -105,9 +108,8 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
|
||||
log.Field{Key: "uid", Value: uid},
|
||||
log.Field{Key: "taskId", Value: nextTaskId},
|
||||
log.Field{Key: "condiId", Value: condiId},
|
||||
)
|
||||
rsp.CondiId = condiId
|
||||
rsp.TaskId = nextTaskId
|
||||
)
|
||||
|
||||
} else {
|
||||
nwt, ok := userTask.CurrentTask[nextTaskConf.Group]
|
||||
if ok {
|
||||
@ -121,19 +123,19 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
|
||||
}
|
||||
}
|
||||
userTask.CurrentTask[nextTaskConf.Group] = nwt
|
||||
update["currentTask"] = userTask.CurrentTask
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
update := map[string]interface{}{
|
||||
"currentTask": userTask.CurrentTask,
|
||||
}
|
||||
|
||||
if err := this.module.modelWorldtask.Change(uid, update); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return nil
|
||||
if len(update) > 0 {
|
||||
if err := this.module.modelWorldtask.Change(uid, update); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return userTask
|
||||
@ -145,9 +147,9 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
|
||||
|
||||
nextTask := make(map[int32]*pb.Worldtask)
|
||||
for _, next := range nextTaskIds {
|
||||
userTask = updateCheckCond(next)
|
||||
if userTask != nil {
|
||||
for k, v := range userTask.CurrentTask {
|
||||
ut := updateCheckCond(userTask, next)
|
||||
if ut != nil {
|
||||
for k, v := range ut.CurrentTask {
|
||||
nextTask[k] = &pb.Worldtask{
|
||||
TaskId: v.TaskId,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user