羁绊剧情pb修改

This commit is contained in:
wh_zcy 2022-12-29 14:29:48 +08:00
parent 22da54b265
commit 907c65a656
5 changed files with 127 additions and 53 deletions

View File

@ -26,7 +26,7 @@ func (this *apiComp) FetterstoryTask(session comm.IUserSession, req *pb.LibraryF
// 我的主线任务
list := this.module.modelFetterstory.getMaintasks(uid, req.FetterId)
rsp := &pb.LinestoryMaintaskResp{
rsp := &pb.LibraryFetterstoryTaskResp{
List: list,
}

View File

@ -48,7 +48,7 @@ func (this *modelFetterstory) getFetterstory(uid string) *pb.DBFetterstory {
}
// 获取羁绊节点任务信息
func (this *modelFetterstory) getFetterTasks(uid string, fetterId int32) *pb.FetterTask {
func (this *modelFetterstory) getFetterTasks(uid string, fetterId int32) *pb.FetterTasks {
ls := this.getFetterstory(uid)
return ls.FeeterTask[fetterId]
}
@ -72,7 +72,7 @@ func (this *modelFetterstory) isPreFinished(finishTasks []int32, taskId int32) b
}
// 获取玩家羁绊剧情-主线任务
func (this *modelFetterstory) getMaintasks(uid string, fetterId int32) (list []*pb.TaskMain) {
func (this *modelFetterstory) getMaintasks(uid string, fetterId int32) (list []*pb.FetterTask) {
// 调用世界任务接口groupId & taskId
if module, err := this.service.GetModule(comm.ModuleWorldtask); err == nil {
if iwt, ok := module.(comm.IWorldtask); ok {
@ -88,11 +88,11 @@ func (this *modelFetterstory) getMaintasks(uid string, fetterId int32) (list []*
if mainTasks == nil {
return
}
for _, taskId := range mainTasks.TaskIds {
for _, taskId := range mainTasks.Tasks {
// 遍历已完成的世界任务
for _, task := range wt.TaskList {
if taskId == task.TaskId {
list = append(list, &pb.TaskMain{
list = append(list, &pb.FetterTask{
TaskId: taskId,
Status: 1,
})

View File

@ -296,18 +296,18 @@ func (this *Library) TaskFinishNotify(uid string, taskId, fetterId int32) error
return comm.NewCustomError(pb.ErrorCode_LibraryFetterTaskNoFound)
}
if !this.modelFetterstory.isPreFinished(ft.TaskIds, taskId) {
if !this.modelFetterstory.isPreFinished(ft.Tasks, taskId) {
return comm.NewCustomError(pb.ErrorCode_LibraryPreTaskNoFinished)
}
var isUpdate bool
if _, ok := utils.Findx(ft.TaskIds, taskId); !ok {
ft.TaskIds = append(ft.TaskIds, taskId)
if _, ok := utils.Findx(ft.Tasks, taskId); !ok {
ft.Tasks = append(ft.Tasks, taskId)
isUpdate = true
}
if isUpdate {
update := map[string]interface{}{
"feeterTask": ft.TaskIds,
"feeterTask": ft.Tasks,
}
return this.modelFetterstory.Change(uid, update)
}

View File

@ -233,9 +233,9 @@ type DBFetterstory struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
FeeterTask map[int32]*FetterTask `protobuf:"bytes,3,rep,name=feeterTask,proto3" json:"feeterTask" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" bson:"feeterTask"` //已开启的羁绊任务 key:羁绊ID
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
FeeterTask map[int32]*FetterTasks `protobuf:"bytes,3,rep,name=feeterTask,proto3" json:"feeterTask" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" bson:"feeterTask"` //已开启的羁绊任务 key:羁绊ID
}
func (x *DBFetterstory) Reset() {
@ -284,26 +284,74 @@ func (x *DBFetterstory) GetUid() string {
return ""
}
func (x *DBFetterstory) GetFeeterTask() map[int32]*FetterTask {
func (x *DBFetterstory) GetFeeterTask() map[int32]*FetterTasks {
if x != nil {
return x.FeeterTask
}
return nil
}
type FetterTasks struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Tasks []int32 `protobuf:"varint,1,rep,packed,name=tasks,proto3" json:"tasks"`
}
func (x *FetterTasks) Reset() {
*x = FetterTasks{}
if protoimpl.UnsafeEnabled {
mi := &file_library_library_db_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FetterTasks) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FetterTasks) ProtoMessage() {}
func (x *FetterTasks) ProtoReflect() protoreflect.Message {
mi := &file_library_library_db_proto_msgTypes[3]
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 FetterTasks.ProtoReflect.Descriptor instead.
func (*FetterTasks) Descriptor() ([]byte, []int) {
return file_library_library_db_proto_rawDescGZIP(), []int{3}
}
func (x *FetterTasks) GetTasks() []int32 {
if x != nil {
return x.Tasks
}
return nil
}
// 羁绊任务
type FetterTask struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TaskIds []int32 `protobuf:"varint,1,rep,packed,name=taskIds,proto3" json:"taskIds" bson:"taskIds"` //完成的任务
TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId" bson:"taskId"` //任务Id
Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status" bson:"status"` //状态 0锁定 1已完成
}
func (x *FetterTask) Reset() {
*x = FetterTask{}
if protoimpl.UnsafeEnabled {
mi := &file_library_library_db_proto_msgTypes[3]
mi := &file_library_library_db_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -316,7 +364,7 @@ func (x *FetterTask) String() string {
func (*FetterTask) ProtoMessage() {}
func (x *FetterTask) ProtoReflect() protoreflect.Message {
mi := &file_library_library_db_proto_msgTypes[3]
mi := &file_library_library_db_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -329,14 +377,21 @@ func (x *FetterTask) ProtoReflect() protoreflect.Message {
// Deprecated: Use FetterTask.ProtoReflect.Descriptor instead.
func (*FetterTask) Descriptor() ([]byte, []int) {
return file_library_library_db_proto_rawDescGZIP(), []int{3}
return file_library_library_db_proto_rawDescGZIP(), []int{4}
}
func (x *FetterTask) GetTaskIds() []int32 {
func (x *FetterTask) GetTaskId() int32 {
if x != nil {
return x.TaskIds
return x.TaskId
}
return nil
return 0
}
func (x *FetterTask) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
var File_library_library_db_proto protoreflect.FileDescriptor
@ -379,22 +434,26 @@ var file_library_library_db_proto_rawDesc = []byte{
0x70, 0x72, 0x69, 0x7a, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74, 0x72,
0x6f, 0x79, 0x70, 0x72, 0x69, 0x7a, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x76, 0x70, 0x72, 0x69,
0x7a, 0x65, 0x18, 0x08, 0x20, 0x03, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x76, 0x70, 0x72, 0x69, 0x7a,
0x65, 0x22, 0xbd, 0x01, 0x0a, 0x0d, 0x44, 0x42, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, 0x73, 0x74,
0x65, 0x22, 0xbe, 0x01, 0x0a, 0x0d, 0x44, 0x42, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, 0x73, 0x74,
0x6f, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x3e, 0x0a, 0x0a, 0x66, 0x65, 0x65, 0x74, 0x65, 0x72, 0x54,
0x61, 0x73, 0x6b, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x44, 0x42, 0x46, 0x65,
0x74, 0x74, 0x65, 0x72, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x46, 0x65, 0x65, 0x74, 0x65, 0x72,
0x54, 0x61, 0x73, 0x6b, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x66, 0x65, 0x65, 0x74, 0x65,
0x72, 0x54, 0x61, 0x73, 0x6b, 0x1a, 0x4a, 0x0a, 0x0f, 0x46, 0x65, 0x65, 0x74, 0x65, 0x72, 0x54,
0x72, 0x54, 0x61, 0x73, 0x6b, 0x1a, 0x4b, 0x0a, 0x0f, 0x46, 0x65, 0x65, 0x74, 0x65, 0x72, 0x54,
0x61, 0x73, 0x6b, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x21, 0x0a, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x46, 0x65, 0x74, 0x74,
0x65, 0x72, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38,
0x01, 0x22, 0x26, 0x0a, 0x0a, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, 0x54, 0x61, 0x73, 0x6b, 0x12,
0x18, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05,
0x52, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x22, 0x0a, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x46, 0x65, 0x74, 0x74,
0x65, 0x72, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02,
0x38, 0x01, 0x22, 0x23, 0x0a, 0x0b, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, 0x54, 0x61, 0x73, 0x6b,
0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05,
0x52, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x22, 0x3c, 0x0a, 0x0a, 0x46, 0x65, 0x74, 0x74, 0x65,
0x72, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x16, 0x0a,
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73,
0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -409,21 +468,22 @@ func file_library_library_db_proto_rawDescGZIP() []byte {
return file_library_library_db_proto_rawDescData
}
var file_library_library_db_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_library_library_db_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_library_library_db_proto_goTypes = []interface{}{
(*DBLibrary)(nil), // 0: DBLibrary
(*DBHeroFetter)(nil), // 1: DBHeroFetter
(*DBFetterstory)(nil), // 2: DBFetterstory
(*FetterTask)(nil), // 3: FetterTask
nil, // 4: DBLibrary.HeroEntry
nil, // 5: DBLibrary.PrizeEntry
nil, // 6: DBFetterstory.FeeterTaskEntry
(*FetterTasks)(nil), // 3: FetterTasks
(*FetterTask)(nil), // 4: FetterTask
nil, // 5: DBLibrary.HeroEntry
nil, // 6: DBLibrary.PrizeEntry
nil, // 7: DBFetterstory.FeeterTaskEntry
}
var file_library_library_db_proto_depIdxs = []int32{
4, // 0: DBLibrary.hero:type_name -> DBLibrary.HeroEntry
5, // 1: DBLibrary.prize:type_name -> DBLibrary.PrizeEntry
6, // 2: DBFetterstory.feeterTask:type_name -> DBFetterstory.FeeterTaskEntry
3, // 3: DBFetterstory.FeeterTaskEntry.value:type_name -> FetterTask
5, // 0: DBLibrary.hero:type_name -> DBLibrary.HeroEntry
6, // 1: DBLibrary.prize:type_name -> DBLibrary.PrizeEntry
7, // 2: DBFetterstory.feeterTask:type_name -> DBFetterstory.FeeterTaskEntry
3, // 3: DBFetterstory.FeeterTaskEntry.value:type_name -> FetterTasks
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
@ -474,6 +534,18 @@ func file_library_library_db_proto_init() {
}
}
file_library_library_db_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FetterTasks); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_library_library_db_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FetterTask); i {
case 0:
return &v.state
@ -492,7 +564,7 @@ func file_library_library_db_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_library_library_db_proto_rawDesc,
NumEnums: 0,
NumMessages: 7,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -769,7 +769,7 @@ type LibraryFetterstoryTaskReq struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
FetterId int32 `protobuf:"varint,1,opt,name=fetterId,proto3" json:"fetterId"` //章节ID
FetterId int32 `protobuf:"varint,1,opt,name=fetterId,proto3" json:"fetterId"` //羁绊ID
}
func (x *LibraryFetterstoryTaskReq) Reset() {
@ -816,7 +816,7 @@ type LibraryFetterstoryTaskResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TaskIds []int32 `protobuf:"varint,1,rep,packed,name=taskIds,proto3" json:"taskIds"`
List []*FetterTask `protobuf:"bytes,1,rep,name=list,proto3" json:"list"`
}
func (x *LibraryFetterstoryTaskResp) Reset() {
@ -851,9 +851,9 @@ func (*LibraryFetterstoryTaskResp) Descriptor() ([]byte, []int) {
return file_library_library_msg_proto_rawDescGZIP(), []int{16}
}
func (x *LibraryFetterstoryTaskResp) GetTaskIds() []int32 {
func (x *LibraryFetterstoryTaskResp) GetList() []*FetterTask {
if x != nil {
return x.TaskIds
return x.List
}
return nil
}
@ -929,12 +929,12 @@ var file_library_library_msg_proto_rawDesc = []byte{
0x74, 0x61, 0x22, 0x37, 0x0a, 0x19, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x46, 0x65, 0x74,
0x74, 0x65, 0x72, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x12,
0x1a, 0x0a, 0x08, 0x66, 0x65, 0x74, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x05, 0x52, 0x08, 0x66, 0x65, 0x74, 0x74, 0x65, 0x72, 0x49, 0x64, 0x22, 0x36, 0x0a, 0x1a, 0x4c,
0x05, 0x52, 0x08, 0x66, 0x65, 0x74, 0x74, 0x65, 0x72, 0x49, 0x64, 0x22, 0x3d, 0x0a, 0x1a, 0x4c,
0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, 0x73, 0x74, 0x6f, 0x72,
0x79, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x61, 0x73,
0x6b, 0x49, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x07, 0x74, 0x61, 0x73, 0x6b,
0x49, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x79, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x04, 0x6c, 0x69, 0x73,
0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72,
0x54, 0x61, 0x73, 0x6b, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -971,6 +971,7 @@ var file_library_library_msg_proto_goTypes = []interface{}{
nil, // 17: LibraryUseGiftReq.ItemsEntry
(*DBLibrary)(nil), // 18: DBLibrary
(*DBHeroFetter)(nil), // 19: DBHeroFetter
(*FetterTask)(nil), // 20: FetterTask
}
var file_library_library_msg_proto_depIdxs = []int32{
18, // 0: LibraryGetListResp.data:type_name -> DBLibrary
@ -983,11 +984,12 @@ var file_library_library_msg_proto_depIdxs = []int32{
18, // 7: LibraryChangePush.data:type_name -> DBLibrary
19, // 8: LibraryChangePush.fetter:type_name -> DBHeroFetter
19, // 9: LibraryLvRewardResp.data:type_name -> DBHeroFetter
10, // [10:10] is the sub-list for method output_type
10, // [10:10] is the sub-list for method input_type
10, // [10:10] is the sub-list for extension type_name
10, // [10:10] is the sub-list for extension extendee
0, // [0:10] is the sub-list for field type_name
20, // 10: LibraryFetterstoryTaskResp.list:type_name -> FetterTask
11, // [11:11] is the sub-list for method output_type
11, // [11:11] is the sub-list for method input_type
11, // [11:11] is the sub-list for extension type_name
11, // [11:11] is the sub-list for extension extendee
0, // [0:11] is the sub-list for field type_name
}
func init() { file_library_library_msg_proto_init() }