世界任务

This commit is contained in:
wh_zcy 2022-11-10 14:40:47 +08:00
parent 2d46852079
commit efecdb298e
6 changed files with 61 additions and 34 deletions

View File

@ -47,13 +47,14 @@ func (this *WorldtaskMineView) CreateView(t *model.TestCase) fyne.CanvasObject {
this.mineReq()
})
// 接取任务
this.juqingBtn = widget.NewButton("接取任务", func() {
// 完成任务
this.juqingBtn = widget.NewButton("完成任务", func() {
groupId := widget.NewEntry()
groupId.PlaceHolder = "分组ID"
taskIdEntry := widget.NewEntry()
taskIdEntry.PlaceHolder = "任务ID"
form := widget.NewForm(
widget.NewFormItem("组ID", groupId),
widget.NewFormItem("任务ID", taskIdEntry),
)

View File

@ -135,17 +135,23 @@ func (this *ModuleRtask) initRtaskVerifyHandle() {
case comm.Rtype8:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalFirstParam,
verify: this.modelRtask.verfiyRtype8,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype9:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalFirstParam,
verify: this.modelRtask.verfiyRtype9,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype10:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalFirstParam,
verify: this.modelRtask.verfiyRtype10,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype11:
this.registerVerifyHandle(v.Id, &rtaskCondi{
@ -159,7 +165,7 @@ func (this *ModuleRtask) initRtaskVerifyHandle() {
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.Rtype62, comm.Rtype64, comm.Rtype69, comm.Rtype72:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.lessEqualFirstParam,
@ -169,7 +175,9 @@ func (this *ModuleRtask) initRtaskVerifyHandle() {
case comm.Rtype20:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalFirstParam,
verify: this.modelRtask.verifyRtype20,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype22:
this.registerVerifyHandle(v.Id, &rtaskCondi{

View File

@ -179,6 +179,7 @@ func (this *ModelUser) ChangeLevel(event interface{}, next func(event interface{
ul.session.SendMsg(string(this.module.GetType()), UserSubTypeLvChangedPush,
&pb.UserLvChangedPush{Uid: ul.session.GetUserId(), Exp: ul.exp, Lv: ul.lv})
this.module.DispenseRes(ul.session, rewards, true)
this.module.ModuleRtask.SendToRtask(ul.session, comm.Rtype71, 1)
}
}

View File

@ -54,6 +54,22 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
userTask.Uid = uid
}
//判断任务是否已完成
for _, t := range userTask.TaskList {
// TODO 上个任务是否完成
if t.TaskId == req.TaskId && t.Status == 1 {
code = pb.ErrorCode_WorldtaskFinihed
return
}
}
if curTaskConf.Completetask != 0 {
if code = this.module.ModuleRtask.CheckCondi(uid, curTaskConf.Completetask); code != pb.ErrorCode_Success {
code = pb.ErrorCode_WorldtaskNoComplete
return
}
}
// 完成任务
if err := this.module.modelWorldtask.finishTask(req.GroupId, req.TaskId, userTask); err != nil {
code = pb.ErrorCode_WorldtaskFinish

View File

@ -50,22 +50,14 @@ func (this *ModelWorldtask) finishTask(groupId, taskId int32, task *pb.DBWorldta
if task.LastTaskIds == nil {
task.LastTaskIds = make(map[int32]int32)
}
if len(task.TaskList) == 0 {
update["uid"] = task.Uid
task.TaskList = append(task.TaskList, &pb.Worldtask{
TaskId: taskId,
Status: 1, //完成
})
task.LastTaskIds[groupId] = taskId
} else {
for _, v := range task.TaskList {
if v.TaskId == taskId {
v.Status = 1 //完成
task.LastTaskIds[groupId] = taskId
break
}
}
}
update["taskList"] = task.TaskList
update["lastTaskIds"] = task.LastTaskIds
return this.Change(task.Uid, update)

View File

@ -259,11 +259,13 @@ const (
ErrorCode_GrowtaskAdvReceive ErrorCode = 3602 //进阶奖励领取失败
// pay
ErrorCode_PayBuyNumNotEnough ErrorCode = 3701 //支付次数不足
ErrorCode_PayRenewTimeErr ErrorCode = 3702 // 续费时间没达到要求
// worldtask
ErrorCode_WorldtaskFinish ErrorCode = 3801 //任务完成失败
ErrorCode_WorldtaskLvNotEnough ErrorCode = 3802 //等级不满足
ErrorCode_WorldtaskNoAccept ErrorCode = 3803 //不能接取
ErrorCode_WorldtaskNoComplete ErrorCode = 3804 //任务条件未完成
ErrorCode_WorldtaskFinihed ErrorCode = 3805 //任务已完成
ErrorCode_WorldtaskLastUnFinished ErrorCode = 3806 //上个任务未完成
)
// Enum value maps for ErrorCode.
@ -479,10 +481,12 @@ var (
3601: "GrowtaskReceive",
3602: "GrowtaskAdvReceive",
3701: "PayBuyNumNotEnough",
3702: "PayRenewTimeErr",
3801: "WorldtaskFinish",
3802: "WorldtaskLvNotEnough",
3803: "WorldtaskNoAccept",
3804: "WorldtaskNoComplete",
3805: "WorldtaskFinihed",
3806: "WorldtaskLastUnFinished",
}
ErrorCode_value = map[string]int32{
"Success": 0,
@ -695,10 +699,12 @@ var (
"GrowtaskReceive": 3601,
"GrowtaskAdvReceive": 3602,
"PayBuyNumNotEnough": 3701,
"PayRenewTimeErr": 3702,
"WorldtaskFinish": 3801,
"WorldtaskLvNotEnough": 3802,
"WorldtaskNoAccept": 3803,
"WorldtaskNoComplete": 3804,
"WorldtaskFinihed": 3805,
"WorldtaskLastUnFinished": 3806,
}
)
@ -733,7 +739,7 @@ var File_errorcode_proto protoreflect.FileDescriptor
var file_errorcode_proto_rawDesc = []byte{
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2a, 0x82, 0x26, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
0x6f, 0x2a, 0xbb, 0x26, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12,
0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
@ -1031,14 +1037,17 @@ var file_errorcode_proto_rawDesc = []byte{
0x76, 0x65, 0x10, 0x91, 0x1c, 0x12, 0x17, 0x0a, 0x12, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73,
0x6b, 0x41, 0x64, 0x76, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0x92, 0x1c, 0x12, 0x17,
0x0a, 0x12, 0x50, 0x61, 0x79, 0x42, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x4e, 0x6f, 0x74, 0x45, 0x6e,
0x6f, 0x75, 0x67, 0x68, 0x10, 0xf5, 0x1c, 0x12, 0x14, 0x0a, 0x0f, 0x50, 0x61, 0x79, 0x52, 0x65,
0x6e, 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65, 0x45, 0x72, 0x72, 0x10, 0xf6, 0x1c, 0x12, 0x14, 0x0a,
0x0f, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68,
0x10, 0xd9, 0x1d, 0x12, 0x19, 0x0a, 0x14, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b,
0x4c, 0x76, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xda, 0x1d, 0x12, 0x16,
0x0a, 0x11, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x41, 0x63, 0x63,
0x65, 0x70, 0x74, 0x10, 0xdb, 0x1d, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6f, 0x75, 0x67, 0x68, 0x10, 0xf5, 0x1c, 0x12, 0x14, 0x0a, 0x0f, 0x57, 0x6f, 0x72, 0x6c, 0x64,
0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x10, 0xd9, 0x1d, 0x12, 0x19, 0x0a,
0x14, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x76, 0x4e, 0x6f, 0x74, 0x45,
0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xda, 0x1d, 0x12, 0x16, 0x0a, 0x11, 0x57, 0x6f, 0x72, 0x6c,
0x64, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x10, 0xdb, 0x1d,
0x12, 0x18, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x43,
0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x10, 0xdc, 0x1d, 0x12, 0x15, 0x0a, 0x10, 0x57, 0x6f,
0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x68, 0x65, 0x64, 0x10, 0xdd,
0x1d, 0x12, 0x1c, 0x0a, 0x17, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x61,
0x73, 0x74, 0x55, 0x6e, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xde, 0x1d, 0x42,
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (