This commit is contained in:
meixiongfeng 2022-11-24 21:31:20 +08:00
commit d36a98e6f8
5 changed files with 66 additions and 34 deletions

View File

@ -280,9 +280,9 @@
], ],
"run_horsetime1": 3, "run_horsetime1": 3,
"run_horsetime2": 10, "run_horsetime2": 10,
"boy_headPortrait": "action_44006", "boy_headPortrait": "ytx_js_45003",
"girl_headPortrait": "action_11011", "girl_headPortrait": "action_44005",
"namecolor": "#000080", "namecolor": "#FFFF00",
"skillGetLocation": [ "skillGetLocation": [
114 114
], ],
@ -295,6 +295,16 @@
10 10
], ],
"DrawCard_ContinuousRestriction_Star5": 20, "DrawCard_ContinuousRestriction_Star5": 20,
"DrawCard_ContinuousRestriction_Camp": 2 "DrawCard_ContinuousRestriction_Camp": 2,
"EquipmentConsumption": [
1000,
2000,
3000,
4000,
5000,
6000
],
"DrawCard_supplement1": 1000001,
"DrawCard_supplement10": 1000002
} }
] ]

View File

@ -33,5 +33,6 @@ func (this *ModuleSys) GetType() core.M_Modules {
} }
func (this *ModuleSys) IsAccess(funcName string, userId string) (code pb.ErrorCode) { func (this *ModuleSys) IsAccess(funcName string, userId string) (code pb.ErrorCode) {
return this.modelSys.IsAccess(funcName, userId) // return this.modelSys.IsAccess(funcName, userId)
return pb.ErrorCode_Success
} }

View File

@ -25,6 +25,11 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
uid := session.GetUserId() uid := session.GetUserId()
rsp := &pb.WorldtaskFinishResp{
GroupId: req.GroupId,
TaskId: req.TaskId,
}
// 获取用户信息 // 获取用户信息
user := this.module.ModuleUser.GetUser(uid) user := this.module.ModuleUser.GetUser(uid)
if user == nil { if user == nil {
@ -69,18 +74,27 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
} }
} }
//判断任务是否已完成 var nextTaskId int32
for _, t := range userTask.TaskList { nextTaskId = curTaskConf.IdAfter
if t.TaskId == req.TaskId { finishRsp := func() {
code = pb.ErrorCode_WorldtaskFinihed if err := session.SendMsg(string(this.module.GetType()), WorldtaskSubtypeFinish, rsp); err != nil {
code = pb.ErrorCode_SystemError
return return
} }
// 世界任务类型
if curTaskConf.Des == 2 {
// 任务完成推送
if err := session.SendMsg(string(this.module.GetType()), WorldtaskNexttaskPush, &pb.WorldtaskNexttaskPush{
NextTaskId: nextTaskId,
}); err != nil {
code = pb.ErrorCode_SystemError
return
}
}
} }
var nextTaskId int32
finishCall := func() { finishCall := func() {
nextTaskId = curTaskConf.IdAfter
defer func() { defer func() {
this.module.Debug("世界任务完成", log.Fields{"uid": uid, "params": req, "nextTaskId": nextTaskId}) this.module.Debug("世界任务完成", log.Fields{"uid": uid, "params": req, "nextTaskId": nextTaskId})
}() }()
@ -97,6 +111,15 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
} }
} }
//判断任务是否已完成
for _, t := range userTask.TaskList {
if t.TaskId == req.TaskId {
this.module.Debug("任务已完成,返回下一个", log.Fields{"uid": uid, "taskId": req.TaskId})
finishRsp()
return
}
}
if curTaskConf.Completetask != 0 { if curTaskConf.Completetask != 0 {
if c := this.module.ModuleRtask.CheckCondi(uid, curTaskConf.Completetask); c == pb.ErrorCode_Success { if c := this.module.ModuleRtask.CheckCondi(uid, curTaskConf.Completetask); c == pb.ErrorCode_Success {
finishCall() finishCall()
@ -108,24 +131,7 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
finishCall() finishCall()
} }
rsp := &pb.WorldtaskFinishResp{ finishRsp()
GroupId: req.GroupId,
TaskId: req.TaskId,
}
if err := session.SendMsg(string(this.module.GetType()), WorldtaskSubtypeFinish, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
// 世界任务类型
if curTaskConf.Des == 2 {
// 任务完成推送
if err := session.SendMsg(string(this.module.GetType()), WorldtaskNexttaskPush, &pb.WorldtaskNexttaskPush{
NextTaskId: nextTaskId,
}); err != nil {
code = pb.ErrorCode_SystemError
}
}
return return
} }

View File

@ -26,8 +26,6 @@ type GameWorldTaskData struct {
AutoAccept int32 AutoAccept int32
Overtips int32 Overtips int32
Reword []*Gameatn Reword []*Gameatn
Day string
Weather int32
} }
const TypeId_GameWorldTaskData = -1059668091 const TypeId_GameWorldTaskData = -1059668091
@ -91,8 +89,6 @@ func (_v *GameWorldTaskData)Deserialize(_buf map[string]interface{}) (err error)
} }
} }
{ var _ok_ bool; if _v.Day, _ok_ = _buf["day"].(string); !_ok_ { err = errors.New("day error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["weather"].(float64); !_ok_ { err = errors.New("weather error"); return }; _v.Weather = int32(_tempNum_) }
return return
} }

View File

@ -138,6 +138,9 @@ type GameGlobalData struct {
DrawCardRegressionReward []int32 DrawCardRegressionReward []int32
DrawCardContinuousRestrictionStar5 int32 DrawCardContinuousRestrictionStar5 int32
DrawCardContinuousRestrictionCamp int32 DrawCardContinuousRestrictionCamp int32
EquipmentConsumption []int32
DrawCardSupplement1 int32
DrawCardSupplement10 int32
} }
const TypeId_GameGlobalData = 477542761 const TypeId_GameGlobalData = 477542761
@ -560,6 +563,22 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["DrawCard_ContinuousRestriction_Star5"].(float64); !_ok_ { err = errors.New("DrawCard_ContinuousRestriction_Star5 error"); return }; _v.DrawCardContinuousRestrictionStar5 = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["DrawCard_ContinuousRestriction_Star5"].(float64); !_ok_ { err = errors.New("DrawCard_ContinuousRestriction_Star5 error"); return }; _v.DrawCardContinuousRestrictionStar5 = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["DrawCard_ContinuousRestriction_Camp"].(float64); !_ok_ { err = errors.New("DrawCard_ContinuousRestriction_Camp error"); return }; _v.DrawCardContinuousRestrictionCamp = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["DrawCard_ContinuousRestriction_Camp"].(float64); !_ok_ { err = errors.New("DrawCard_ContinuousRestriction_Camp error"); return }; _v.DrawCardContinuousRestrictionCamp = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["EquipmentConsumption"].([]interface{}); !_ok_ { err = errors.New("EquipmentConsumption error"); return }
_v.EquipmentConsumption = make([]int32, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ int32
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
_v.EquipmentConsumption = append(_v.EquipmentConsumption, _list_v_)
}
}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["DrawCard_supplement1"].(float64); !_ok_ { err = errors.New("DrawCard_supplement1 error"); return }; _v.DrawCardSupplement1 = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["DrawCard_supplement10"].(float64); !_ok_ { err = errors.New("DrawCard_supplement10 error"); return }; _v.DrawCardSupplement10 = int32(_tempNum_) }
return return
} }