世界任务多任务
This commit is contained in:
parent
b53972e79f
commit
cbb23917c0
@ -446,10 +446,9 @@ func (this *modelDispatch) updateNotice(uid string, dispatch *pb.DBDispatch) err
|
|||||||
count := len(dispatch.Nb.Tasks)
|
count := len(dispatch.Nb.Tasks)
|
||||||
if count < 6 {
|
if count < 6 {
|
||||||
randCount = 6 - count
|
randCount = 6 - count
|
||||||
|
dispatch.Nb.Tasks = append(dispatch.Nb.Tasks, this.addRandomTask(uid, dispatch, randCount)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch.Nb.Tasks = this.addRandomTask(uid, dispatch, randCount)
|
|
||||||
|
|
||||||
//判断是否有下一等级
|
//判断是否有下一等级
|
||||||
nextConf, err := this.module.configure.getDispatchLvConf(dispatch.Nb.Lv + 1)
|
nextConf, err := this.module.configure.getDispatchLvConf(dispatch.Nb.Lv + 1)
|
||||||
if nextConf != nil {
|
if nextConf != nil {
|
||||||
|
21
modules/worldtask/api_chapteraward.go
Normal file
21
modules/worldtask/api_chapteraward.go
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package worldtask
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 章节奖励领取
|
||||||
|
|
||||||
|
func (this *apiComp) ChapterawardCheck(session comm.IUserSession, req *pb.WorldtaskChapterawardReq) (code pb.ErrorCode) {
|
||||||
|
if req.GroupId <= 0 {
|
||||||
|
code = pb.ErrorCode_ReqParameterError
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *apiComp) Chapteraward(session comm.IUserSession, req *pb.WorldtaskChapterawardReq) (code pb.ErrorCode, data proto.Message) {
|
||||||
|
return
|
||||||
|
}
|
@ -90,15 +90,13 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
|
|||||||
userTask.CurrentTask = make(map[int32]*pb.Worldtask)
|
userTask.CurrentTask = make(map[int32]*pb.Worldtask)
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.GroupId != nextTaskId {
|
|
||||||
userTask.CurrentTask[nextTaskConf.Group] = &pb.Worldtask{
|
|
||||||
TaskId: nextTaskId,
|
|
||||||
}
|
|
||||||
return userTask
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(nextTaskConf.Completetask) == 1 && nextTaskConf.Completetask[0] == 0 {
|
if len(nextTaskConf.Completetask) == 1 && nextTaskConf.Completetask[0] == 0 {
|
||||||
userTask.CurrentTask[nextTaskConf.Group].CondiIds = []int32{}
|
wt := &pb.Worldtask{
|
||||||
|
TaskId: nextTaskId,
|
||||||
|
TaskType: nextTaskConf.Des,
|
||||||
|
CondiIds: []int32{},
|
||||||
|
}
|
||||||
|
userTask.CurrentTask[nextTaskConf.Group] = wt
|
||||||
} else {
|
} else {
|
||||||
for _, condiId := range nextTaskConf.Completetask {
|
for _, condiId := range nextTaskConf.Completetask {
|
||||||
if condiId == 0 {
|
if condiId == 0 {
|
||||||
@ -117,6 +115,7 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
|
|||||||
condiIds := []int32{condiId}
|
condiIds := []int32{condiId}
|
||||||
userTask.CurrentTask[nextTaskConf.Group] = &pb.Worldtask{
|
userTask.CurrentTask[nextTaskConf.Group] = &pb.Worldtask{
|
||||||
TaskId: nextTaskId,
|
TaskId: nextTaskId,
|
||||||
|
TaskType: nextTaskConf.Des,
|
||||||
CondiIds: condiIds,
|
CondiIds: condiIds,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,11 +124,6 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//设置当前进行的任务
|
|
||||||
userTask.CurrentTask[curTaskConf.Group] = &pb.Worldtask{
|
|
||||||
TaskId: nextTaskId,
|
|
||||||
TaskType: nextTaskConf.Des,
|
|
||||||
}
|
|
||||||
|
|
||||||
update := map[string]interface{}{
|
update := map[string]interface{}{
|
||||||
"currentTask": userTask.CurrentTask,
|
"currentTask": userTask.CurrentTask,
|
||||||
@ -159,9 +153,6 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
|
|||||||
for k, v := range userTask.CurrentTask {
|
for k, v := range userTask.CurrentTask {
|
||||||
nextTask[k] = &pb.Worldtask{
|
nextTask[k] = &pb.Worldtask{
|
||||||
TaskId: v.TaskId,
|
TaskId: v.TaskId,
|
||||||
// CondiIds: v.CondiIds,
|
|
||||||
// NpcStatus: v.NpcStatus,
|
|
||||||
// DeliverNpc: v.DeliverNpc,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -174,9 +165,15 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe
|
|||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// if _, ok := utils.Findx(userTask.Chapters, req.GroupId); !ok {
|
||||||
|
// userTask.Chapters = append(userTask.Chapters, req.GroupId)
|
||||||
|
// update := map[string]interface{}{
|
||||||
|
// "chapters": userTask.Chapters,
|
||||||
|
// }
|
||||||
|
// this.module.modelWorldtask.Change(uid, update)
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
finishCall := func() {
|
finishCall := func() {
|
||||||
|
@ -837,6 +837,101 @@ func (x *WorldtaskFinishIdsPush) GetTaskList() []*Worldtask {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 章节奖励领取
|
||||||
|
type WorldtaskChapterawardReq struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
GroupId int32 `protobuf:"varint,1,opt,name=groupId,proto3" json:"groupId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *WorldtaskChapterawardReq) Reset() {
|
||||||
|
*x = WorldtaskChapterawardReq{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_worldtask_worldtask_msg_proto_msgTypes[15]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *WorldtaskChapterawardReq) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*WorldtaskChapterawardReq) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *WorldtaskChapterawardReq) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_worldtask_worldtask_msg_proto_msgTypes[15]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use WorldtaskChapterawardReq.ProtoReflect.Descriptor instead.
|
||||||
|
func (*WorldtaskChapterawardReq) Descriptor() ([]byte, []int) {
|
||||||
|
return file_worldtask_worldtask_msg_proto_rawDescGZIP(), []int{15}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *WorldtaskChapterawardReq) GetGroupId() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.GroupId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type WorldtaskChapterawardResp struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
GroupId int32 `protobuf:"varint,1,opt,name=groupId,proto3" json:"groupId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *WorldtaskChapterawardResp) Reset() {
|
||||||
|
*x = WorldtaskChapterawardResp{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_worldtask_worldtask_msg_proto_msgTypes[16]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *WorldtaskChapterawardResp) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*WorldtaskChapterawardResp) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *WorldtaskChapterawardResp) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_worldtask_worldtask_msg_proto_msgTypes[16]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use WorldtaskChapterawardResp.ProtoReflect.Descriptor instead.
|
||||||
|
func (*WorldtaskChapterawardResp) Descriptor() ([]byte, []int) {
|
||||||
|
return file_worldtask_worldtask_msg_proto_rawDescGZIP(), []int{16}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *WorldtaskChapterawardResp) GetGroupId() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.GroupId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
var File_worldtask_worldtask_msg_proto protoreflect.FileDescriptor
|
var File_worldtask_worldtask_msg_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_worldtask_worldtask_msg_proto_rawDesc = []byte{
|
var file_worldtask_worldtask_msg_proto_rawDesc = []byte{
|
||||||
@ -925,8 +1020,15 @@ var file_worldtask_worldtask_msg_proto_rawDesc = []byte{
|
|||||||
0x16, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68,
|
0x16, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68,
|
||||||
0x49, 0x64, 0x73, 0x50, 0x75, 0x73, 0x68, 0x12, 0x26, 0x0a, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c,
|
0x49, 0x64, 0x73, 0x50, 0x75, 0x73, 0x68, 0x12, 0x26, 0x0a, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c,
|
||||||
0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x57, 0x6f, 0x72, 0x6c,
|
0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 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, 0x42,
|
0x64, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x22,
|
||||||
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x34, 0x0a, 0x18, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70,
|
||||||
|
0x74, 0x65, 0x72, 0x61, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x67,
|
||||||
|
0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x67, 0x72,
|
||||||
|
0x6f, 0x75, 0x70, 0x49, 0x64, 0x22, 0x35, 0x0a, 0x19, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61,
|
||||||
|
0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x61, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65,
|
||||||
|
0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20,
|
||||||
|
0x01, 0x28, 0x05, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04,
|
||||||
|
0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -941,7 +1043,7 @@ func file_worldtask_worldtask_msg_proto_rawDescGZIP() []byte {
|
|||||||
return file_worldtask_worldtask_msg_proto_rawDescData
|
return file_worldtask_worldtask_msg_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_worldtask_worldtask_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
|
var file_worldtask_worldtask_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 18)
|
||||||
var file_worldtask_worldtask_msg_proto_goTypes = []interface{}{
|
var file_worldtask_worldtask_msg_proto_goTypes = []interface{}{
|
||||||
(*WorldtaskMineReq)(nil), // 0: WorldtaskMineReq
|
(*WorldtaskMineReq)(nil), // 0: WorldtaskMineReq
|
||||||
(*WorldtaskMineResp)(nil), // 1: WorldtaskMineResp
|
(*WorldtaskMineResp)(nil), // 1: WorldtaskMineResp
|
||||||
@ -958,21 +1060,23 @@ var file_worldtask_worldtask_msg_proto_goTypes = []interface{}{
|
|||||||
(*WorldtaskBattleFinishReq)(nil), // 12: WorldtaskBattleFinishReq
|
(*WorldtaskBattleFinishReq)(nil), // 12: WorldtaskBattleFinishReq
|
||||||
(*WorldtaskBattleFinishResp)(nil), // 13: WorldtaskBattleFinishResp
|
(*WorldtaskBattleFinishResp)(nil), // 13: WorldtaskBattleFinishResp
|
||||||
(*WorldtaskFinishIdsPush)(nil), // 14: WorldtaskFinishIdsPush
|
(*WorldtaskFinishIdsPush)(nil), // 14: WorldtaskFinishIdsPush
|
||||||
nil, // 15: WorldtaskNexttaskPush.NextTaskEntry
|
(*WorldtaskChapterawardReq)(nil), // 15: WorldtaskChapterawardReq
|
||||||
(*DBWorldtask)(nil), // 16: DBWorldtask
|
(*WorldtaskChapterawardResp)(nil), // 16: WorldtaskChapterawardResp
|
||||||
(*BattleFormation)(nil), // 17: BattleFormation
|
nil, // 17: WorldtaskNexttaskPush.NextTaskEntry
|
||||||
(*BattleInfo)(nil), // 18: BattleInfo
|
(*DBWorldtask)(nil), // 18: DBWorldtask
|
||||||
(*BattleReport)(nil), // 19: BattleReport
|
(*BattleFormation)(nil), // 19: BattleFormation
|
||||||
(*Worldtask)(nil), // 20: Worldtask
|
(*BattleInfo)(nil), // 20: BattleInfo
|
||||||
|
(*BattleReport)(nil), // 21: BattleReport
|
||||||
|
(*Worldtask)(nil), // 22: Worldtask
|
||||||
}
|
}
|
||||||
var file_worldtask_worldtask_msg_proto_depIdxs = []int32{
|
var file_worldtask_worldtask_msg_proto_depIdxs = []int32{
|
||||||
16, // 0: WorldtaskMineResp.task:type_name -> DBWorldtask
|
18, // 0: WorldtaskMineResp.task:type_name -> DBWorldtask
|
||||||
15, // 1: WorldtaskNexttaskPush.nextTask:type_name -> WorldtaskNexttaskPush.NextTaskEntry
|
17, // 1: WorldtaskNexttaskPush.nextTask:type_name -> WorldtaskNexttaskPush.NextTaskEntry
|
||||||
17, // 2: WorldtaskBattleStartReq.battle:type_name -> BattleFormation
|
19, // 2: WorldtaskBattleStartReq.battle:type_name -> BattleFormation
|
||||||
18, // 3: WorldtaskBattleStartResp.info:type_name -> BattleInfo
|
20, // 3: WorldtaskBattleStartResp.info:type_name -> BattleInfo
|
||||||
19, // 4: WorldtaskBattleFinishReq.report:type_name -> BattleReport
|
21, // 4: WorldtaskBattleFinishReq.report:type_name -> BattleReport
|
||||||
20, // 5: WorldtaskFinishIdsPush.taskList:type_name -> Worldtask
|
22, // 5: WorldtaskFinishIdsPush.taskList:type_name -> Worldtask
|
||||||
20, // 6: WorldtaskNexttaskPush.NextTaskEntry.value:type_name -> Worldtask
|
22, // 6: WorldtaskNexttaskPush.NextTaskEntry.value:type_name -> Worldtask
|
||||||
7, // [7:7] is the sub-list for method output_type
|
7, // [7:7] is the sub-list for method output_type
|
||||||
7, // [7:7] is the sub-list for method input_type
|
7, // [7:7] is the sub-list for method input_type
|
||||||
7, // [7:7] is the sub-list for extension type_name
|
7, // [7:7] is the sub-list for extension type_name
|
||||||
@ -1168,6 +1272,30 @@ func file_worldtask_worldtask_msg_proto_init() {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
file_worldtask_worldtask_msg_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*WorldtaskChapterawardReq); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_worldtask_worldtask_msg_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*WorldtaskChapterawardResp); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
@ -1175,7 +1303,7 @@ func file_worldtask_worldtask_msg_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_worldtask_worldtask_msg_proto_rawDesc,
|
RawDescriptor: file_worldtask_worldtask_msg_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 16,
|
NumMessages: 18,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user