任务通知模块
This commit is contained in:
parent
1b613b0dd3
commit
790fea5ca1
@ -23,6 +23,7 @@ type apiComp struct {
|
||||
|
||||
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
_ = this.MCompGate.Init(service, module, comp, options)
|
||||
this.service = service.(base.IRPCXService)
|
||||
this.module = module.(*Worldtask)
|
||||
return
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package worldtask
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
@ -89,7 +90,7 @@ func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBa
|
||||
var isWin bool
|
||||
if code, isWin = ibattle.CheckBattleReport(session, req.Report); code == pb.ErrorCode_Success {
|
||||
//触发任务
|
||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype70, 1, req.BattleConfId)
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype70, 1, req.BattleConfId))
|
||||
if isWin {
|
||||
if battleConf, ok := this.module.worldBattleConf.GetDataMap()[req.BattleConfId]; ok {
|
||||
if code := this.module.DispenseRes(session, []*cfg.Gameatn{battleConf.Playexp}, true); code != pb.ErrorCode_Success {
|
||||
@ -107,6 +108,8 @@ func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBa
|
||||
log.Field{Key: "战斗结果", Value: isWin},
|
||||
)
|
||||
|
||||
//判断是否配置了通知module
|
||||
if len(taskConf.Module) == 0 {
|
||||
// 发奖
|
||||
if code = this.module.DispenseRes(session, taskConf.Reword, true); code != pb.ErrorCode_Success {
|
||||
this.module.Error("资源发放",
|
||||
@ -116,6 +119,18 @@ func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBa
|
||||
log.Field{Key: "code", Value: code},
|
||||
)
|
||||
}
|
||||
} else {
|
||||
for _, m := range taskConf.Module {
|
||||
i, err := this.service.GetModule(core.M_Modules(m))
|
||||
if err != nil {
|
||||
this.module.Errorln(err)
|
||||
continue
|
||||
}
|
||||
if ic, ok := i.(comm.ITaskComplete); ok {
|
||||
ic.TaskComplete(session, req.TaskId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err := session.SendMsg(string(this.module.GetType()), WorldtaskBattleFinish, rsp); err != nil {
|
||||
|
@ -2,6 +2,7 @@ package worldtask
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
@ -135,6 +136,8 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
|
||||
return
|
||||
}
|
||||
|
||||
//判断是否配置了通知module
|
||||
if len(curTaskConf.Module) == 0 {
|
||||
// 发奖
|
||||
if code = this.module.DispenseRes(session, curTaskConf.Reword, true); code != pb.ErrorCode_Success {
|
||||
this.module.Error("资源发放",
|
||||
@ -145,6 +148,18 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
|
||||
log.Field{Key: "code", Value: code},
|
||||
)
|
||||
}
|
||||
} else {
|
||||
for _, m := range curTaskConf.Module {
|
||||
i, err := this.service.GetModule(core.M_Modules(m))
|
||||
if err != nil {
|
||||
this.module.Errorln(err)
|
||||
continue
|
||||
}
|
||||
if ic, ok := i.(comm.ITaskComplete); ok {
|
||||
ic.TaskComplete(session, req.TaskId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user