世界任务区分任务类型
This commit is contained in:
parent
77258d5004
commit
865d82ae9d
@ -71,7 +71,7 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
|
|||||||
|
|
||||||
//判断任务是否已完成
|
//判断任务是否已完成
|
||||||
for _, t := range userTask.TaskList {
|
for _, t := range userTask.TaskList {
|
||||||
if t.TaskId == req.TaskId && t.Status == 1 {
|
if t.TaskId == req.TaskId {
|
||||||
code = pb.ErrorCode_WorldtaskFinihed
|
code = pb.ErrorCode_WorldtaskFinihed
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,21 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.WorldtaskMineReq) (
|
|||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
var list []*pb.Worldtask
|
||||||
|
for _, v := range myWorldtask.TaskList {
|
||||||
|
if v.TaskType == 2 { //世界任务
|
||||||
|
list = append(list, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var wtMp = make(map[int32]*pb.Worldtask)
|
||||||
|
for k, v := range myWorldtask.LastTaskIds {
|
||||||
|
if v.TaskType == 2 {
|
||||||
|
wtMp[k] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
myWorldtask.LastTaskIds = wtMp
|
||||||
|
myWorldtask.TaskList = list
|
||||||
rsp := &pb.WorldtaskMineResp{
|
rsp := &pb.WorldtaskMineResp{
|
||||||
Task: myWorldtask,
|
Task: myWorldtask,
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ func (this *ModelWorldtask) IsPreFinished(userTask *pb.DBWorldtask, curTaskConf
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, t := range userTask.TaskList {
|
for _, t := range userTask.TaskList {
|
||||||
if lastTaskId == t.TaskId && t.Status == 1 {
|
if lastTaskId == t.TaskId{
|
||||||
preTaskFinished = true
|
preTaskFinished = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,15 +77,21 @@ func (this *ModelWorldtask) finishTask(groupId, taskId int32, task *pb.DBWorldta
|
|||||||
}
|
}
|
||||||
update := map[string]interface{}{}
|
update := map[string]interface{}{}
|
||||||
if task.LastTaskIds == nil {
|
if task.LastTaskIds == nil {
|
||||||
task.LastTaskIds = make(map[int32]int32)
|
task.LastTaskIds = make(map[int32]*pb.Worldtask)
|
||||||
|
}
|
||||||
|
|
||||||
|
taskConf := this.moduleWorldtask.worldtaskConf.GetDataMap()[taskId]
|
||||||
|
if taskConf == nil {
|
||||||
|
return comm.NewCustomError(pb.ErrorCode_ConfigNoFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
update["uid"] = task.Uid
|
update["uid"] = task.Uid
|
||||||
task.TaskList = append(task.TaskList, &pb.Worldtask{
|
wt := &pb.Worldtask{
|
||||||
TaskId: taskId,
|
TaskId: taskId,
|
||||||
Status: 1, //完成
|
TaskType: taskConf.Des,
|
||||||
})
|
}
|
||||||
task.LastTaskIds[groupId] = taskId
|
task.TaskList = append(task.TaskList,wt)
|
||||||
|
task.LastTaskIds[groupId] = wt
|
||||||
|
|
||||||
update["taskList"] = task.TaskList
|
update["taskList"] = task.TaskList
|
||||||
update["lastTaskIds"] = task.LastTaskIds
|
update["lastTaskIds"] = task.LastTaskIds
|
||||||
|
@ -172,7 +172,7 @@ func (this *Worldtask) BingoJumpTask(session comm.IUserSession, groupId, taskId
|
|||||||
}
|
}
|
||||||
|
|
||||||
if mytask.LastTaskIds == nil {
|
if mytask.LastTaskIds == nil {
|
||||||
mytask.LastTaskIds = make(map[int32]int32)
|
mytask.LastTaskIds = make(map[int32]*pb.Worldtask)
|
||||||
}
|
}
|
||||||
//重置taskList
|
//重置taskList
|
||||||
mytask.TaskList = []*pb.Worldtask{}
|
mytask.TaskList = []*pb.Worldtask{}
|
||||||
@ -181,20 +181,23 @@ func (this *Worldtask) BingoJumpTask(session comm.IUserSession, groupId, taskId
|
|||||||
if taskConf.Ontxe != 0 && taskConf.IdAfter != 0 {
|
if taskConf.Ontxe != 0 && taskConf.IdAfter != 0 {
|
||||||
for _, v := range this.worldtaskConf.GetDataList() {
|
for _, v := range this.worldtaskConf.GetDataList() {
|
||||||
if v.Group == groupId && v.Key <= taskId {
|
if v.Group == groupId && v.Key <= taskId {
|
||||||
mytask.LastTaskIds[groupId] = v.Key
|
mytask.LastTaskIds[groupId] = &pb.Worldtask{
|
||||||
|
TaskId: v.Key,
|
||||||
|
TaskType: v.Des,
|
||||||
|
}
|
||||||
mytask.TaskList = append(mytask.TaskList, &pb.Worldtask{
|
mytask.TaskList = append(mytask.TaskList, &pb.Worldtask{
|
||||||
TaskId: v.Key,
|
TaskId: v.Key,
|
||||||
Status: 1,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mytask.LastTaskIds[groupId] = taskId
|
wt := &pb.Worldtask{
|
||||||
mytask.TaskList = append(mytask.TaskList, &pb.Worldtask{
|
TaskId: taskId,
|
||||||
TaskId: taskId,
|
TaskType: taskConf.Des,
|
||||||
Status: 1,
|
}
|
||||||
})
|
mytask.LastTaskIds[groupId] = wt
|
||||||
|
mytask.TaskList = append(mytask.TaskList, wt)
|
||||||
}
|
}
|
||||||
update = map[string]interface{}{
|
update = map[string]interface{}{
|
||||||
"lastTaskIds": mytask.LastTaskIds,
|
"lastTaskIds": mytask.LastTaskIds,
|
||||||
|
@ -25,9 +25,9 @@ type DBWorldtask struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` //玩家ID
|
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` //玩家ID
|
||||||
LastTaskIds map[int32]int32 `protobuf:"bytes,2,rep,name=lastTaskIds,proto3" json:"lastTaskIds" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"lastTaskId"` //上一次完成的任务 key:groupId val:任务ID
|
LastTaskIds map[int32]*Worldtask `protobuf:"bytes,2,rep,name=lastTaskIds,proto3" json:"lastTaskIds" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" bson:"lastTaskId"` //上一次完成的任务 key:groupId val:任务ID
|
||||||
TaskList []*Worldtask `protobuf:"bytes,3,rep,name=taskList,proto3" json:"taskList" bson:"taskList"` // 任务列表
|
TaskList []*Worldtask `protobuf:"bytes,3,rep,name=taskList,proto3" json:"taskList" bson:"taskList"` // 任务列表
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBWorldtask) Reset() {
|
func (x *DBWorldtask) Reset() {
|
||||||
@ -69,7 +69,7 @@ func (x *DBWorldtask) GetUid() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBWorldtask) GetLastTaskIds() map[int32]int32 {
|
func (x *DBWorldtask) GetLastTaskIds() map[int32]*Worldtask {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.LastTaskIds
|
return x.LastTaskIds
|
||||||
}
|
}
|
||||||
@ -88,8 +88,8 @@ type Worldtask struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId" bson:"taskIds"` //任务ID
|
TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId" bson:"taskIds"` //任务ID
|
||||||
Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status" bson:"status"` //任务状态 0 未完成 1已完成
|
TaskType int32 `protobuf:"varint,3,opt,name=taskType,proto3" json:"taskType" bson:"taskType"` //任务类型 1 日/周常 2随机任务 3支线剧情
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Worldtask) Reset() {
|
func (x *Worldtask) Reset() {
|
||||||
@ -131,9 +131,9 @@ func (x *Worldtask) GetTaskId() int32 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Worldtask) GetStatus() int32 {
|
func (x *Worldtask) GetTaskType() int32 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Status
|
return x.TaskType
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -142,7 +142,7 @@ var File_worldtask_worldtask_db_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
var file_worldtask_worldtask_db_proto_rawDesc = []byte{
|
var file_worldtask_worldtask_db_proto_rawDesc = []byte{
|
||||||
0x0a, 0x1c, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x2f, 0x77, 0x6f, 0x72, 0x6c,
|
0x0a, 0x1c, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x2f, 0x77, 0x6f, 0x72, 0x6c,
|
||||||
0x64, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc8,
|
0x64, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd4,
|
||||||
0x01, 0x0a, 0x0b, 0x44, 0x42, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x12, 0x10,
|
0x01, 0x0a, 0x0b, 0x44, 0x42, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x12, 0x10,
|
||||||
0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64,
|
0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64,
|
||||||
0x12, 0x3f, 0x0a, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x18,
|
0x12, 0x3f, 0x0a, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x18,
|
||||||
@ -151,15 +151,16 @@ var file_worldtask_worldtask_db_proto_rawDesc = []byte{
|
|||||||
0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x64,
|
0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x64,
|
||||||
0x73, 0x12, 0x26, 0x0a, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20,
|
0x73, 0x12, 0x26, 0x0a, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20,
|
||||||
0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x52,
|
0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x52,
|
||||||
0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x1a, 0x3e, 0x0a, 0x10, 0x4c, 0x61, 0x73,
|
0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x1a, 0x4a, 0x0a, 0x10, 0x4c, 0x61, 0x73,
|
||||||
0x74, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
|
0x74, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
|
||||||
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
|
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
|
||||||
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
|
0x20, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a,
|
||||||
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x3b, 0x0a, 0x09, 0x57, 0x6f, 0x72,
|
0x2e, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
|
||||||
0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64,
|
0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x3f, 0x0a, 0x09, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x16,
|
0x73, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||||
0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06,
|
0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61,
|
||||||
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
|
0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x74, 0x61,
|
||||||
|
0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,11 +185,12 @@ var file_worldtask_worldtask_db_proto_goTypes = []interface{}{
|
|||||||
var file_worldtask_worldtask_db_proto_depIdxs = []int32{
|
var file_worldtask_worldtask_db_proto_depIdxs = []int32{
|
||||||
2, // 0: DBWorldtask.lastTaskIds:type_name -> DBWorldtask.LastTaskIdsEntry
|
2, // 0: DBWorldtask.lastTaskIds:type_name -> DBWorldtask.LastTaskIdsEntry
|
||||||
1, // 1: DBWorldtask.taskList:type_name -> Worldtask
|
1, // 1: DBWorldtask.taskList:type_name -> Worldtask
|
||||||
2, // [2:2] is the sub-list for method output_type
|
1, // 2: DBWorldtask.LastTaskIdsEntry.value:type_name -> Worldtask
|
||||||
2, // [2:2] is the sub-list for method input_type
|
3, // [3:3] is the sub-list for method output_type
|
||||||
2, // [2:2] is the sub-list for extension type_name
|
3, // [3:3] is the sub-list for method input_type
|
||||||
2, // [2:2] is the sub-list for extension extendee
|
3, // [3:3] is the sub-list for extension type_name
|
||||||
0, // [0:2] is the sub-list for field type_name
|
3, // [3:3] is the sub-list for extension extendee
|
||||||
|
0, // [0:3] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_worldtask_worldtask_db_proto_init() }
|
func init() { file_worldtask_worldtask_db_proto_init() }
|
||||||
|
Loading…
Reference in New Issue
Block a user