diff --git a/modules/arena/api_taskreceive.go b/modules/arena/api_taskreceive.go index 2c57bddb5..ce8f7266b 100644 --- a/modules/arena/api_taskreceive.go +++ b/modules/arena/api_taskreceive.go @@ -22,9 +22,8 @@ func (this *apiComp) TaskReceiveCheck(session comm.IUserSession, req *pb.ArenaTa // /获取自己的排行榜信息 func (this *apiComp) TaskReceive(session comm.IUserSession, req *pb.ArenaTaskReceiveReq) (errdata *pb.ErrorData) { var ( - // global *cfg.GameGlobalData + conf *cfg.GameActiveTaskData info *pb.DBArenaUser - need []*cfg.Gameatn err error atno []*pb.UserAtno ) @@ -50,11 +49,22 @@ func (this *apiComp) TaskReceive(session comm.IUserSession, req *pb.ArenaTaskRec } info.Tasks[req.Tid] = 1 - session.SendMsg(string(this.module.GetType()), "buy", &pb.MoonfantasyBuyResp{Issucc: true, BattleNum: info.Buynum}) - - go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { - this.module.WriteUserLog(session.GetUserId(), req, comm.GMResAddType, "MoonfantasyBuyReq", atno) - this.module.WriteUserLog(session.GetUserId(), req, comm.GMResDelType, "MoonfantasyBuyReq", need) // 消耗资源 - }) + if conf, err = this.module.configure.getGameActiveTaskData(req.Tid); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + if errdata, atno = this.module.DispenseAtno(session, conf.Reward, true); errdata != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + session.SendMsg(string(this.module.GetType()), "taskreceive", &pb.ArenaTaskReceiveResp{Tid: req.Tid, Award: atno}) return } diff --git a/modules/arena/configure.go b/modules/arena/configure.go index e8c18c312..9f1e1383d 100644 --- a/modules/arena/configure.go +++ b/modules/arena/configure.go @@ -20,6 +20,7 @@ const ( game_monsterformat = "game_monsterformat.json" //整容表 game_monster = "game_monster.json" //怪物表 game_activeking = "game_activeking.json" //王者之上奖励 + game_achievetask = "game_achievetask.json" //奖励 ) ///竞技场配置管理组件 @@ -218,3 +219,21 @@ func (this *configureComp) getGameActiveKing() (confs []*cfg.GameActiveKingData, } return } + +//查询剧情npc系统 +func (this *configureComp) getGameActiveTaskData(id int32) (result *cfg.GameActiveTaskData, err error) { + var ( + v interface{} + ok bool + ) + if v, err = this.GetConfigure(game_achievetask); err != nil { + this.module.Errorln(err) + } else { + if result, ok = v.(*cfg.GameActiveTask).GetDataMap()[id]; !ok { + // err = fmt.Errorf("on found getChallengenpc:%d", id) + err = comm.NewNotFoundConfErr(moduleName, game_achievetask, id) + this.module.Errorln(err) + } + } + return +} diff --git a/pb/arena_msg.pb.go b/pb/arena_msg.pb.go index 62380172e..a6e8f226f 100644 --- a/pb/arena_msg.pb.go +++ b/pb/arena_msg.pb.go @@ -1362,8 +1362,8 @@ type ArenaTaskReceiveResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Tid int32 `protobuf:"varint,1,opt,name=tid,proto3" json:"tid"` - Award []*UserAssets `protobuf:"bytes,2,rep,name=award,proto3" json:"award"` //奖励 + Tid int32 `protobuf:"varint,1,opt,name=tid,proto3" json:"tid"` + Award []*UserAtno `protobuf:"bytes,2,rep,name=award,proto3" json:"award"` //奖励 } func (x *ArenaTaskReceiveResp) Reset() { @@ -1405,7 +1405,7 @@ func (x *ArenaTaskReceiveResp) GetTid() int32 { return 0 } -func (x *ArenaTaskReceiveResp) GetAward() []*UserAssets { +func (x *ArenaTaskReceiveResp) GetAward() []*UserAtno { if x != nil { return x.Award } @@ -1588,18 +1588,18 @@ var file_arena_arena_msg_proto_rawDesc = []byte{ 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x27, 0x0a, 0x13, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x03, 0x74, 0x69, 0x64, 0x22, 0x4b, 0x0a, 0x14, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x61, 0x73, + 0x03, 0x74, 0x69, 0x64, 0x22, 0x49, 0x0a, 0x14, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, - 0x74, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x74, 0x69, 0x64, 0x12, 0x21, - 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, - 0x55, 0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x05, 0x61, 0x77, 0x61, 0x72, - 0x64, 0x22, 0x52, 0x0a, 0x19, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x53, 0x65, 0x74, 0x74, 0x6c, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x50, 0x75, 0x73, 0x68, 0x12, 0x14, - 0x0a, 0x05, 0x73, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, - 0x74, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, 0x05, - 0x61, 0x77, 0x61, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x74, 0x69, 0x64, 0x12, 0x1f, + 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, + 0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x22, + 0x52, 0x0a, 0x19, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x53, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x50, 0x75, 0x73, 0x68, 0x12, 0x14, 0x0a, 0x05, + 0x73, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x79, + 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, 0x05, 0x61, 0x77, + 0x61, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -1650,9 +1650,8 @@ var file_arena_arena_msg_proto_goTypes = []interface{}{ (ErrorCode)(0), // 31: ErrorCode (*BattleInfo)(nil), // 32: BattleInfo (*BattleReport)(nil), // 33: BattleReport - (*UserAssets)(nil), // 34: UserAssets - (*UserAtno)(nil), // 35: UserAtno - (*DBNpc)(nil), // 36: DBNpc + (*UserAtno)(nil), // 34: UserAtno + (*DBNpc)(nil), // 35: DBNpc } var file_arena_arena_msg_proto_depIdxs = []int32{ 28, // 0: ArenaInfoResp.info:type_name -> DBArenaUser @@ -1669,9 +1668,9 @@ var file_arena_arena_msg_proto_depIdxs = []int32{ 32, // 11: ArenaPlotResp.info:type_name -> BattleInfo 33, // 12: ArenaPlotRewardReq.report:type_name -> BattleReport 27, // 13: ArenaPlotRewardResp.npc:type_name -> ArenaPlotRewardResp.NpcEntry - 34, // 14: ArenaTaskReceiveResp.award:type_name -> UserAssets - 35, // 15: ArenaSettlementRewardPush.award:type_name -> UserAtno - 36, // 16: ArenaPlotRewardResp.NpcEntry.value:type_name -> DBNpc + 34, // 14: ArenaTaskReceiveResp.award:type_name -> UserAtno + 34, // 15: ArenaSettlementRewardPush.award:type_name -> UserAtno + 35, // 16: ArenaPlotRewardResp.NpcEntry.value:type_name -> DBNpc 17, // [17:17] is the sub-list for method output_type 17, // [17:17] is the sub-list for method input_type 17, // [17:17] is the sub-list for extension type_name