This commit is contained in:
meixiongfeng 2023-07-14 21:20:02 +08:00
commit 733d6f5658
5 changed files with 382 additions and 345 deletions

File diff suppressed because it is too large Load Diff

View File

@ -4911,7 +4911,7 @@
"lock": 1, "lock": 1,
"lockend": 999, "lockend": 999,
"ontxe": 0, "ontxe": 0,
"id_after": 500010, "id_after": 0,
"group": 510, "group": 510,
"des": 5, "des": 5,
"icon": "25001", "icon": "25001",
@ -4934,7 +4934,7 @@
"deliver_npc": 50018, "deliver_npc": 50018,
"taskend_removeitem": [], "taskend_removeitem": [],
"auto_accept": 0, "auto_accept": 0,
"lock_add": 0, "lock_add": 1,
"reword": [ "reword": [
{ {
"a": "attr", "a": "attr",
@ -4952,7 +4952,7 @@
"lock": 1, "lock": 1,
"lockend": 999, "lockend": 999,
"ontxe": 0, "ontxe": 0,
"id_after": 500020, "id_after": 0,
"group": 520, "group": 520,
"des": 5, "des": 5,
"icon": "25001", "icon": "25001",
@ -4975,7 +4975,7 @@
"deliver_npc": 50028, "deliver_npc": 50028,
"taskend_removeitem": [], "taskend_removeitem": [],
"auto_accept": 0, "auto_accept": 0,
"lock_add": 0, "lock_add": 1,
"reword": [ "reword": [
{ {
"a": "attr", "a": "attr",
@ -4993,7 +4993,7 @@
"lock": 1, "lock": 1,
"lockend": 999, "lockend": 999,
"ontxe": 0, "ontxe": 0,
"id_after": 500030, "id_after": 0,
"group": 530, "group": 530,
"des": 5, "des": 5,
"icon": "25001", "icon": "25001",
@ -5016,7 +5016,7 @@
"deliver_npc": 50038, "deliver_npc": 50038,
"taskend_removeitem": [], "taskend_removeitem": [],
"auto_accept": 0, "auto_accept": 0,
"lock_add": 0, "lock_add": 1,
"reword": [ "reword": [
{ {
"a": "attr", "a": "attr",
@ -5034,7 +5034,7 @@
"lock": 1, "lock": 1,
"lockend": 999, "lockend": 999,
"ontxe": 0, "ontxe": 0,
"id_after": 500040, "id_after": 0,
"group": 540, "group": 540,
"des": 5, "des": 5,
"icon": "25001", "icon": "25001",
@ -5057,7 +5057,7 @@
"deliver_npc": 50048, "deliver_npc": 50048,
"taskend_removeitem": [], "taskend_removeitem": [],
"auto_accept": 0, "auto_accept": 0,
"lock_add": 0, "lock_add": 1,
"reword": [ "reword": [
{ {
"a": "attr", "a": "attr",
@ -5075,7 +5075,7 @@
"lock": 1, "lock": 1,
"lockend": 999, "lockend": 999,
"ontxe": 0, "ontxe": 0,
"id_after": 500050, "id_after": 0,
"group": 550, "group": 550,
"des": 5, "des": 5,
"icon": "25001", "icon": "25001",
@ -5098,7 +5098,7 @@
"deliver_npc": 50058, "deliver_npc": 50058,
"taskend_removeitem": [], "taskend_removeitem": [],
"auto_accept": 0, "auto_accept": 0,
"lock_add": 0, "lock_add": 1,
"reword": [ "reword": [
{ {
"a": "attr", "a": "attr",

View File

@ -17,13 +17,14 @@ func (this *apiComp) FinishCheck(session comm.IUserSession, req *pb.WTaskFinishR
// /获取系统公告 // /获取系统公告
func (this *apiComp) Finish(session comm.IUserSession, req *pb.WTaskFinishReq) (errdata *pb.ErrorData) { func (this *apiComp) Finish(session comm.IUserSession, req *pb.WTaskFinishReq) (errdata *pb.ErrorData) {
var ( var (
conf *cfg.GameWorldTaskData conf *cfg.GameWorldTaskData
wtask *pb.DBWTask wtask *pb.DBWTask
condis []*pb.ConIProgress condis []*pb.ConIProgress
award []*pb.UserAssets award []*pb.UserAssets
err error completesMap map[int32]struct{} = make(map[int32]struct{})
isfinsh bool err error
ok bool isfinsh bool
ok bool
) )
if errdata = this.FinishCheck(session, req); errdata != nil { if errdata = this.FinishCheck(session, req); errdata != nil {
return return
@ -110,18 +111,27 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WTaskFinishReq) (
break break
} }
} }
wtask.Completes = append(wtask.Completes, req.Tid) for _, v := range wtask.Completes {
completesMap[v] = struct{}{}
if conf.Des == 5 { //商队任务 完成任务时 移除下一个任务的完成条件 方便顺序获取任务
for i, v := range wtask.Completes {
if conf.IdAfter != 0 && conf.IdAfter == v {
wtask.Completes = append(wtask.Completes[0:i], wtask.Completes[i+1:]...)
}
}
} }
session.SendMsg(string(this.module.GetType()), "finish", &pb.WTaskFinishResp{Tid: req.Tid, Award: award}) if conf.Des == 5 && conf.IdAfter == 0 { //商队任务 一组任务完成后 重置
tasks, _ := this.module.configure.getgroupTask()[conf.Group]
completes := make([]int32, 0, len(wtask.Completes))
for _, task := range tasks {
if _, ok := completesMap[task.Key]; ok {
delete(completesMap, task.Key)
}
}
for k, _ := range completesMap {
completes = append(completes, k)
}
wtask.Completes = completes
} else {
wtask.Completes = append(wtask.Completes, req.Tid)
}
this.module.checkgroupState(session, wtask, conf.Group) this.module.checkgroupState(session, wtask, conf.Group)
session.SendMsg(string(this.module.GetType()), "finish", &pb.WTaskFinishResp{Tid: req.Tid, Award: award, Completes: wtask.Completes, Groups: wtask.Groups})
this.module.fishtask(session, wtask, true) this.module.fishtask(session, wtask, true)
if err = this.module.modelwtask.updateUserWTasks(session.GetUserId(), wtask); err != nil { if err = this.module.modelwtask.updateUserWTasks(session.GetUserId(), wtask); err != nil {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{

View File

@ -443,7 +443,7 @@ func (this *WTask) checkgroupState(session comm.IUserSession, wtask *pb.DBWTask,
} }
for _, v := range groupTask[group] { for _, v := range groupTask[group] {
if _, ok = completeMap[v.Key]; !ok { if _, ok = completeMap[v.Key]; !ok {
break return
} }
des = v.Des des = v.Des
} }

View File

@ -401,8 +401,10 @@ type WTaskFinishResp struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Tid int32 `protobuf:"varint,1,opt,name=tid,proto3" json:"tid"` Tid int32 `protobuf:"varint,1,opt,name=tid,proto3" json:"tid"`
Award []*UserAssets `protobuf:"bytes,2,rep,name=award,proto3" json:"award"` //奖励 Award []*UserAssets `protobuf:"bytes,2,rep,name=award,proto3" json:"award"` //奖励
Completes []int32 `protobuf:"varint,3,rep,packed,name=completes,proto3" json:"completes"` //完成任务列表
Groups map[int32]int32 `protobuf:"bytes,4,rep,name=groups,proto3" json:"groups" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //任务组状态 key表示组id value:0 任务组未完成 1:任务组已完成 2:任务组奖励已领取
} }
func (x *WTaskFinishResp) Reset() { func (x *WTaskFinishResp) Reset() {
@ -451,6 +453,20 @@ func (x *WTaskFinishResp) GetAward() []*UserAssets {
return nil return nil
} }
func (x *WTaskFinishResp) GetCompletes() []int32 {
if x != nil {
return x.Completes
}
return nil
}
func (x *WTaskFinishResp) GetGroups() map[int32]int32 {
if x != nil {
return x.Groups
}
return nil
}
// 章节奖励 请求 // 章节奖励 请求
type WTaskChapterRewardReq struct { type WTaskChapterRewardReq struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -905,11 +921,20 @@ var file_wtask_wtask_msg_proto_rawDesc = []byte{
0x74, 0x65, 0x6d, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x22, 0x22, 0x0a, 0x74, 0x65, 0x6d, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x22, 0x22, 0x0a,
0x0e, 0x57, 0x54, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x57, 0x54, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x71, 0x12,
0x10, 0x0a, 0x03, 0x74, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x74, 0x69, 0x10, 0x0a, 0x03, 0x74, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x74, 0x69,
0x64, 0x22, 0x46, 0x0a, 0x0f, 0x57, 0x54, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x64, 0x22, 0xd5, 0x01, 0x0a, 0x0f, 0x57, 0x54, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73,
0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x05, 0x52, 0x03, 0x74, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x28, 0x05, 0x52, 0x03, 0x74, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64,
0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x73, 0x73,
0x74, 0x73, 0x52, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x22, 0x2d, 0x0a, 0x15, 0x57, 0x54, 0x61, 0x65, 0x74, 0x73, 0x52, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f,
0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x09, 0x63,
0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x73, 0x12, 0x34, 0x0a, 0x06, 0x67, 0x72, 0x6f, 0x75,
0x70, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x57, 0x54, 0x61, 0x73, 0x6b,
0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70,
0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x1a, 0x39,
0x0a, 0x0b, 0x47, 0x72, 0x6f, 0x75, 0x70, 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,
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x2d, 0x0a, 0x15, 0x57, 0x54, 0x61,
0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52,
0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28,
0x05, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x51, 0x0a, 0x16, 0x57, 0x54, 0x61, 0x73, 0x05, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x51, 0x0a, 0x16, 0x57, 0x54, 0x61, 0x73,
@ -963,7 +988,7 @@ func file_wtask_wtask_msg_proto_rawDescGZIP() []byte {
return file_wtask_wtask_msg_proto_rawDescData return file_wtask_wtask_msg_proto_rawDescData
} }
var file_wtask_wtask_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_wtask_wtask_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 17)
var file_wtask_wtask_msg_proto_goTypes = []interface{}{ var file_wtask_wtask_msg_proto_goTypes = []interface{}{
(*WTaskInfoReq)(nil), // 0: WTaskInfoReq (*WTaskInfoReq)(nil), // 0: WTaskInfoReq
(*WTaskInfoResp)(nil), // 1: WTaskInfoResp (*WTaskInfoResp)(nil), // 1: WTaskInfoResp
@ -981,29 +1006,31 @@ var file_wtask_wtask_msg_proto_goTypes = []interface{}{
(*WTaskBattleStartResp)(nil), // 13: WTaskBattleStartResp (*WTaskBattleStartResp)(nil), // 13: WTaskBattleStartResp
(*WTaskBattleFinishReq)(nil), // 14: WTaskBattleFinishReq (*WTaskBattleFinishReq)(nil), // 14: WTaskBattleFinishReq
(*WTaskBattleFinishResp)(nil), // 15: WTaskBattleFinishResp (*WTaskBattleFinishResp)(nil), // 15: WTaskBattleFinishResp
(*DBWTask)(nil), // 16: DBWTask nil, // 16: WTaskFinishResp.GroupsEntry
(*DBWTaskItem)(nil), // 17: DBWTaskItem (*DBWTask)(nil), // 17: DBWTask
(*UserAssets)(nil), // 18: UserAssets (*DBWTaskItem)(nil), // 18: DBWTaskItem
(*BattleFormation)(nil), // 19: BattleFormation (*UserAssets)(nil), // 19: UserAssets
(*BattleInfo)(nil), // 20: BattleInfo (*BattleFormation)(nil), // 20: BattleFormation
(*BattleReport)(nil), // 21: BattleReport (*BattleInfo)(nil), // 21: BattleInfo
(*BattleReport)(nil), // 22: BattleReport
} }
var file_wtask_wtask_msg_proto_depIdxs = []int32{ var file_wtask_wtask_msg_proto_depIdxs = []int32{
16, // 0: WTaskInfoResp.info:type_name -> DBWTask 17, // 0: WTaskInfoResp.info:type_name -> DBWTask
17, // 1: WTaskInfoResp.accepts:type_name -> DBWTaskItem 18, // 1: WTaskInfoResp.accepts:type_name -> DBWTaskItem
17, // 2: WTaskAcceptResp.accepts:type_name -> DBWTaskItem 18, // 2: WTaskAcceptResp.accepts:type_name -> DBWTaskItem
17, // 3: WTaskCompleteCondiResp.progress:type_name -> DBWTaskItem 18, // 3: WTaskCompleteCondiResp.progress:type_name -> DBWTaskItem
18, // 4: WTaskFinishResp.award:type_name -> UserAssets 19, // 4: WTaskFinishResp.award:type_name -> UserAssets
18, // 5: WTaskChapterRewardResp.award:type_name -> UserAssets 16, // 5: WTaskFinishResp.groups:type_name -> WTaskFinishResp.GroupsEntry
17, // 6: WTaskAcceptChangePush.accepts:type_name -> DBWTaskItem 19, // 6: WTaskChapterRewardResp.award:type_name -> UserAssets
19, // 7: WTaskBattleStartReq.battle:type_name -> BattleFormation 18, // 7: WTaskAcceptChangePush.accepts:type_name -> DBWTaskItem
20, // 8: WTaskBattleStartResp.info:type_name -> BattleInfo 20, // 8: WTaskBattleStartReq.battle:type_name -> BattleFormation
21, // 9: WTaskBattleFinishReq.report:type_name -> BattleReport 21, // 9: WTaskBattleStartResp.info:type_name -> BattleInfo
10, // [10:10] is the sub-list for method output_type 22, // 10: WTaskBattleFinishReq.report:type_name -> BattleReport
10, // [10:10] is the sub-list for method input_type 11, // [11:11] is the sub-list for method output_type
10, // [10:10] is the sub-list for extension type_name 11, // [11:11] is the sub-list for method input_type
10, // [10:10] is the sub-list for extension extendee 11, // [11:11] is the sub-list for extension type_name
0, // [0:10] is the sub-list for field 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_wtask_wtask_msg_proto_init() } func init() { file_wtask_wtask_msg_proto_init() }
@ -1214,7 +1241,7 @@ func file_wtask_wtask_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_wtask_wtask_msg_proto_rawDesc, RawDescriptor: file_wtask_wtask_msg_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 16, NumMessages: 17,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },