战斗任务
This commit is contained in:
parent
01cf37bd2b
commit
9870184e47
@ -178,4 +178,5 @@ func (this *Battle) CheckBattleReport(session comm.IUserSession, report *pb.Batt
|
|||||||
|
|
||||||
this.moonfantasy.Trigger(session, report)
|
this.moonfantasy.Trigger(session, report)
|
||||||
return pb.ErrorCode_Success, true
|
return pb.ErrorCode_Success, true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -141,8 +141,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 初始化随机任务数据
|
// 初始化随机任务数据
|
||||||
// TODO: 判断次功能开启时再初始化
|
this.module.ModuleRtask.InitCondiData(user.Uid)
|
||||||
go this.module.ModuleRtask.InitCondiData(user.Uid)
|
|
||||||
|
|
||||||
// 日常登录任务
|
// 日常登录任务
|
||||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype7, 1)
|
this.module.ModuleRtask.SendToRtask(session, comm.Rtype7, 1)
|
||||||
|
@ -74,7 +74,7 @@ func (this *ModelUser) User_Create(user *pb.DBUser) (err error) {
|
|||||||
func (this *ModelUser) GetUser(uid string) (user *pb.DBUser) {
|
func (this *ModelUser) GetUser(uid string) (user *pb.DBUser) {
|
||||||
user = &pb.DBUser{}
|
user = &pb.DBUser{}
|
||||||
if err := this.Get(uid, user); err != nil {
|
if err := this.Get(uid, user); err != nil {
|
||||||
this.module.Errorln(err)
|
this.module.Errorf("GetUser uid:%v err:%v",uid,err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -40,7 +40,7 @@ func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBa
|
|||||||
// var isWin bool
|
// var isWin bool
|
||||||
if code, _ = ibattle.CheckBattleReport(session, req.Report); code == pb.ErrorCode_Success {
|
if code, _ = ibattle.CheckBattleReport(session, req.Report); code == pb.ErrorCode_Success {
|
||||||
//触发任务
|
//触发任务
|
||||||
go this.module.ModuleRtask.SendToRtask(session, comm.Rtype70, 1, req.BattleConfId)
|
this.module.ModuleRtask.SendToRtask(session, comm.Rtype70, 1, req.BattleConfId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,23 @@ func (this *Worldtask) GetType() core.M_Modules {
|
|||||||
// 任务条件达成通知
|
// 任务条件达成通知
|
||||||
func (this *Worldtask) TaskcondNotify(session comm.IUserSession, condId int32) error {
|
func (this *Worldtask) TaskcondNotify(session comm.IUserSession, condId int32) error {
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
|
|
||||||
|
conf, err := this.configure.getWorldtaskCfg()
|
||||||
|
if err != nil || conf == nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
finishedTaskIds := make(map[int32]int32) //达成的任务条件
|
||||||
|
for _, c := range conf.GetDataList() {
|
||||||
|
if c.Completetask == condId && c.Completetask != 0 {
|
||||||
|
finishedTaskIds[c.Group] = c.Key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(finishedTaskIds) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
//下一个任务ID
|
//下一个任务ID
|
||||||
var nextTaskId int32
|
var nextTaskId int32
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
@ -61,17 +78,6 @@ func (this *Worldtask) TaskcondNotify(session comm.IUserSession, condId int32) e
|
|||||||
if userTask.Uid != "" {
|
if userTask.Uid != "" {
|
||||||
//查找任务ID根据condId 可能会找出不同的任务
|
//查找任务ID根据condId 可能会找出不同的任务
|
||||||
// 遍历配置表
|
// 遍历配置表
|
||||||
conf, err := this.configure.getWorldtaskCfg()
|
|
||||||
if err != nil || conf == nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
finishedTaskIds := make(map[int32]int32) //达成的任务条件
|
|
||||||
for _, c := range conf.GetDataList() {
|
|
||||||
if c.Completetask == condId && c.Completetask != 0 {
|
|
||||||
finishedTaskIds[c.Group] = c.Key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for k, id := range finishedTaskIds {
|
for k, id := range finishedTaskIds {
|
||||||
taskConf, err := this.configure.getWorldtaskById(id)
|
taskConf, err := this.configure.getWorldtaskById(id)
|
||||||
|
Loading…
Reference in New Issue
Block a user