diff --git a/lego/sys/redis/cluster/zset.go b/lego/sys/redis/cluster/zset.go index 4d576b0c5..b5eafedd0 100644 --- a/lego/sys/redis/cluster/zset.go +++ b/lego/sys/redis/cluster/zset.go @@ -55,13 +55,8 @@ func (this *Redis) ZLexCount(key string, min string, max string) (result int64, /* Redis ZRange 通过索引区间返回有序集合指定区间内的成员 */ -func (this *Redis) ZRange(key string, start int64, stop int64, v interface{}) (err error) { - var _result []string - cmd := this.client.ZRange(this.client.Context(), key, start, stop) - if _result, err = cmd.Result(); err == nil { - err = this.codec.UnmarshalSlice(_result, v) - } - return +func (this *Redis) ZRange(key string, start int64, stop int64) *redis.StringSliceCmd { + return this.client.ZRange(this.client.Context(), key, start, stop) } /* @@ -131,13 +126,8 @@ func (this *Redis) ZRemRangeByScore(key string, min string, max string) (result /* Redis ZRevRange 返回有序集中指定区间内的成员,通过索引,分数从高到低 ZREVRANGE */ -func (this *Redis) ZRevRange(key string, start int64, stop int64, v interface{}) (err error) { - var _result []string - cmd := this.client.ZRevRange(this.client.Context(), key, start, stop) - if _result, err = cmd.Result(); err == nil { - err = this.codec.UnmarshalSlice(_result, v) - } - return +func (this *Redis) ZRevRange(key string, start int64, stop int64) *redis.StringSliceCmd { + return this.client.ZRevRange(this.client.Context(), key, start, stop) } /* diff --git a/lego/sys/redis/core.go b/lego/sys/redis/core.go index 56afed7d4..3a3b7b55b 100644 --- a/lego/sys/redis/core.go +++ b/lego/sys/redis/core.go @@ -103,7 +103,7 @@ type ( ZIncrBy(key string, increment float64, member string) (result float64, err error) ZInterStore(destination string, store *redis.ZStore) (result int64, err error) ZLexCount(key string, min string, max string) (result int64, err error) - ZRange(key string, start int64, stop int64, v interface{}) (err error) + ZRange(key string, start int64, stop int64) *redis.StringSliceCmd ZRangeByLex(key string, opt *redis.ZRangeBy, v interface{}) (err error) ZRangeByScore(key string, opt *redis.ZRangeBy, v interface{}) (err error) ZRank(key string, member string) (result int64, err error) @@ -111,7 +111,7 @@ type ( ZRemRangeByLex(key string, min string, max string) (result int64, err error) ZRemRangeByRank(key string, start int64, stop int64) (result int64, err error) ZRemRangeByScore(key string, min string, max string) (result int64, err error) - ZRevRange(key string, start int64, stop int64, v interface{}) (err error) + ZRevRange(key string, start int64, stop int64) *redis.StringSliceCmd ZRevRangeByScore(key string, opt *redis.ZRangeBy, v interface{}) (err error) ZRevRank(key string, member string) (result int64, err error) ZScore(key string, member string) (result float64, err error) @@ -435,8 +435,8 @@ func ZInterStore(destination string, store *redis.ZStore) (result int64, err err func ZLexCount(key string, min string, max string) (result int64, err error) { return defsys.ZLexCount(key, min, max) } -func ZRange(key string, start int64, stop int64, v interface{}) (err error) { - return defsys.ZRange(key, start, stop, v) +func ZRange(key string, start int64, stop int64) *redis.StringSliceCmd { + return defsys.ZRange(key, start, stop) } func ZRangeByLex(key string, opt *redis.ZRangeBy, v interface{}) (err error) { return defsys.ZRangeByLex(key, opt, v) @@ -459,8 +459,8 @@ func ZRemRangeByRank(key string, start int64, stop int64) (result int64, err err func ZRemRangeByScore(key string, min string, max string) (result int64, err error) { return defsys.ZRemRangeByScore(key, min, max) } -func ZRevRange(key string, start int64, stop int64, v interface{}) (err error) { - return defsys.ZRevRange(key, start, stop, v) +func ZRevRange(key string, start int64, stop int64) *redis.StringSliceCmd { + return defsys.ZRevRange(key, start, stop) } func ZRevRangeByScore(key string, opt *redis.ZRangeBy, v interface{}) (err error) { return defsys.ZRevRangeByScore(key, opt, v) diff --git a/lego/sys/redis/redis.go b/lego/sys/redis/redis.go index b7dbf9bb2..d95c0b593 100644 --- a/lego/sys/redis/redis.go +++ b/lego/sys/redis/redis.go @@ -322,8 +322,8 @@ func (this *Redis) ZInterStore(destination string, store *redis.ZStore) (result func (this *Redis) ZLexCount(key string, min string, max string) (result int64, err error) { return this.client.ZLexCount(key, min, max) } -func (this *Redis) ZRange(key string, start int64, stop int64, v interface{}) (err error) { - return this.client.ZRange(key, start, stop, v) +func (this *Redis) ZRange(key string, start int64, stop int64) *redis.StringSliceCmd { + return this.client.ZRange(key, start, stop) } func (this *Redis) ZRangeByLex(key string, opt *redis.ZRangeBy, v interface{}) (err error) { return this.client.ZRangeByLex(key, opt, v) @@ -346,8 +346,8 @@ func (this *Redis) ZRemRangeByRank(key string, start int64, stop int64) (result func (this *Redis) ZRemRangeByScore(key string, min string, max string) (result int64, err error) { return this.client.ZRemRangeByScore(key, min, max) } -func (this *Redis) ZRevRange(key string, start int64, stop int64, v interface{}) (err error) { - return this.client.ZRevRange(key, start, stop, v) +func (this *Redis) ZRevRange(key string, start int64, stop int64) *redis.StringSliceCmd { + return this.client.ZRevRange(key, start, stop) } func (this *Redis) ZRevRangeByScore(key string, opt *redis.ZRangeBy, v interface{}) (err error) { return this.client.ZRevRangeByScore(key, opt, v) diff --git a/lego/sys/redis/single/zset.go b/lego/sys/redis/single/zset.go index da603049f..9a2178aa1 100644 --- a/lego/sys/redis/single/zset.go +++ b/lego/sys/redis/single/zset.go @@ -55,13 +55,8 @@ func (this *Redis) ZLexCount(key string, min string, max string) (result int64, /* Redis ZRange 通过索引区间返回有序集合指定区间内的成员 */ -func (this *Redis) ZRange(key string, start int64, stop int64, v interface{}) (err error) { - var _result []string - cmd := this.client.ZRange(this.client.Context(), key, start, stop) - if _result, err = cmd.Result(); err == nil { - err = this.codec.UnmarshalSlice(_result, v) - } - return +func (this *Redis) ZRange(key string, start int64, stop int64) *redis.StringSliceCmd { + return this.client.ZRange(this.client.Context(), key, start, stop) } /* @@ -131,13 +126,8 @@ func (this *Redis) ZRemRangeByScore(key string, min string, max string) (result /* Redis ZRevRange 返回有序集中指定区间内的成员,通过索引,分数从高到低 ZREVRANGE */ -func (this *Redis) ZRevRange(key string, start int64, stop int64, v interface{}) (err error) { - var _result []string - cmd := this.client.ZRevRange(this.client.Context(), key, start, stop) - if _result, err = cmd.Result(); err == nil { - err = this.codec.UnmarshalSlice(_result, v) - } - return +func (this *Redis) ZRevRange(key string, start int64, stop int64) *redis.StringSliceCmd { + return this.client.ZRevRange(this.client.Context(), key, start, stop) } /* diff --git a/modules/arena/api_challenge.go b/modules/arena/api_challenge.go index 5f8661e50..973181ac3 100644 --- a/modules/arena/api_challenge.go +++ b/modules/arena/api_challenge.go @@ -9,7 +9,7 @@ import ( //参数校验 func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.ArenaChallengeReq) (code pb.ErrorCode) { - if req.Playerid == "" || req.Battle.Format == nil || len(req.Battle.Format) != 5 { + if (!req.Isai && req.Playerid == "") || (req.Isai && req.MformatId == 0) || req.Battle.Format == nil || len(req.Battle.Format) != 5 { code = pb.ErrorCode_ReqParameterError } return @@ -27,16 +27,20 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.ArenaChallenge err error ) defer func() { - session.SendMsg(string(this.module.GetType()), "challenge", &pb.ArenaChallengeResp{Code: cd, Info: &pb.BattleInfo{ - Id: record.Id, - Title: record.Title, - Btype: record.Btype, - Ptype: record.Ptype, - RedCompId: record.RedCompId, - Redflist: record.Redflist, - BlueCompId: record.BlueCompId, - Buleflist: record.Buleflist, - }}) + if cd == pb.ErrorCode_Success { + session.SendMsg(string(this.module.GetType()), "challenge", &pb.ArenaChallengeResp{Code: cd, Info: &pb.BattleInfo{ + Id: record.Id, + Title: record.Title, + Btype: record.Btype, + Ptype: record.Ptype, + RedCompId: record.RedCompId, + Redflist: record.Redflist, + BlueCompId: record.BlueCompId, + Buleflist: record.Buleflist, + }}) + } else { + session.SendMsg(string(this.module.GetType()), "challenge", &pb.ArenaChallengeResp{Code: cd, Info: nil}) + } }() if cd = this.ChallengeCheck(session, req); cd != pb.ErrorCode_Success { return @@ -46,10 +50,14 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.ArenaChallenge return } - for i, v := range req.Battle.Format { - if red.Attack.Formt[i].Id != v { - change = true + if red.Attack != nil { + for i, v := range req.Battle.Format { + if red.Attack.Formt[i].Id != v { + change = true + } } + } else { + change = true } if red.Defend == nil || change { diff --git a/modules/arena/api_challengereward.go b/modules/arena/api_challengereward.go index b581af8e0..b688e3370 100644 --- a/modules/arena/api_challengereward.go +++ b/modules/arena/api_challengereward.go @@ -3,6 +3,7 @@ package arena import ( "go_dreamfactory/comm" "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" "time" "google.golang.org/protobuf/proto" @@ -17,16 +18,23 @@ func (this *apiComp) ChallengeRewardCheck(session comm.IUserSession, req *pb.Are ///挑战奖励领取 func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaChallengeRewardReq) (code pb.ErrorCode, data proto.Message) { var ( - info *pb.DBArenaUser - rival *pb.DBArenaUser - red *pb.ArenaPlayer - bule *pb.ArenaPlayer - err error - iswin bool + reward *cfg.GameArenaActiveRewardData + info *pb.DBArenaUser + rival *pb.DBArenaUser + red *pb.ArenaPlayer + redstate pb.BattleRecordState + bule *pb.ArenaPlayer + bulestate pb.BattleRecordState + err error + iswin bool ) if code = this.ChallengeRewardCheck(session, req); code != pb.ErrorCode_Success { return } + if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil { + code = pb.ErrorCode_DBError + return + } if req.Iswin { if code, iswin = this.module.battle.CheckBattleReport(session, req.Report); code != pb.ErrorCode_Success { return @@ -35,11 +43,42 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha code = pb.ErrorCode_BattleValidationFailed return } + if reward, err = this.module.configure.getActiveRewardById(info.Dan); err != nil { + this.module.Errorln(err) + return + } + if code = this.module.DispenseRes(session, reward.WinReward, true); code != pb.ErrorCode_Success { + return + } + if req.Revengeid != "" { + redstate = pb.BattleRecordState_RevengeSucceeded + bulestate = pb.BattleRecordState_RevengeEnd + for _, v := range info.Record { + if v.Bid == req.Revengeid { + v.State = pb.BattleRecordState_RevengeEnd + } + } + } else { + redstate = pb.BattleRecordState_RevengeSucceeded + bulestate = pb.BattleRecordState_WaitingRevenge + } + + session.SendMsg(string(this.module.GetType()), "challengereward", &pb.ArenaChallengeRewardResp{Issucc: true}) + } else { + if req.Revengeid != "" { + redstate = pb.BattleRecordState_RevengeFailed + bulestate = pb.BattleRecordState_RevengeEnd + for _, v := range info.Record { + if v.Bid == req.Revengeid { + v.State = pb.BattleRecordState_RevengeEnd + } + } + } else { + redstate = pb.BattleRecordState_RevengeFailed + bulestate = pb.BattleRecordState_RevengeSucceeded + } } - if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil { - code = pb.ErrorCode_DBError - return - } + red = &pb.ArenaPlayer{ Uid: info.Uid, Name: info.Name, @@ -52,18 +91,6 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha if len(info.Record) > 10 { info.Record = info.Record[1:] } - info.Record = append(info.Record, &pb.DBArenaBattleRecord{ - Bid: req.Report.Info.Id, - Time: time.Now().Unix(), - Iswin: req.Iswin, - Isdefend: false, - Rivalid: bule.Uid, - Rivalname: bule.Name, - }) - if err = this.module.modelArena.Change(red.Uid, map[string]interface{}{"record": info.Record}); err != nil { - code = pb.ErrorCode_DBError - return - } if !req.Isai { if rival, err = this.module.modelArena.queryPlayerInfo(req.Report.Info.BlueCompId); err != nil { @@ -81,18 +108,6 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha if len(rival.Record) > 10 { rival.Record = rival.Record[1:] } - rival.Record = append(rival.Record, &pb.DBArenaBattleRecord{ - Bid: req.Report.Info.Id, - Time: time.Now().Unix(), - Iswin: !req.Iswin, - Isdefend: true, - Rivalid: red.Uid, - Rivalname: red.Name, - }) - if err = this.module.modelArena.Change(rival.Uid, map[string]interface{}{"record": rival.Record}); err != nil { - code = pb.ErrorCode_DBError - return - } } else { bule = &pb.ArenaPlayer{ Dan: info.Dan, @@ -112,6 +127,34 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha if err = this.module.modelArena.updateArenaUserInfo(rival); err != nil { code = pb.ErrorCode_DBError } + info.Record = append(info.Record, &pb.DBArenaBattleRecord{ + Bid: req.Report.Info.Id, + Time: time.Now().Unix(), + Iswin: req.Iswin, + Isdefend: false, + Rivalid: bule.Uid, + Rivalname: bule.Name, + Addintegral: red.Changeintegral, + State: redstate, + }) + if err = this.module.modelArena.Change(red.Uid, map[string]interface{}{"record": info.Record}); err != nil { + code = pb.ErrorCode_DBError + return + } + rival.Record = append(rival.Record, &pb.DBArenaBattleRecord{ + Bid: req.Report.Info.Id, + Time: time.Now().Unix(), + Iswin: !req.Iswin, + Isdefend: true, + Rivalid: red.Uid, + Rivalname: red.Name, + Addintegral: bule.Changeintegral, + State: bulestate, + }) + if err = this.module.modelArena.Change(rival.Uid, map[string]interface{}{"record": rival.Record}); err != nil { + code = pb.ErrorCode_DBError + return + } } else { this.module.modelRank.updateArenaRank(red) info.Integral = red.Integral @@ -119,6 +162,20 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha if err = this.module.modelArena.updateArenaUserInfo(info); err != nil { code = pb.ErrorCode_DBError } + info.Record = append(info.Record, &pb.DBArenaBattleRecord{ + Bid: req.Report.Info.Id, + Time: time.Now().Unix(), + Iswin: req.Iswin, + Isdefend: false, + Rivalid: bule.Uid, + Rivalname: bule.Name, + Addintegral: red.Changeintegral, + }) + if err = this.module.modelArena.Change(red.Uid, map[string]interface{}{"record": info.Record}); err != nil { + code = pb.ErrorCode_DBError + return + } } + return } diff --git a/modules/arena/api_rank.go b/modules/arena/api_rank.go index 76201da16..29141585f 100644 --- a/modules/arena/api_rank.go +++ b/modules/arena/api_rank.go @@ -15,8 +15,35 @@ func (this *apiComp) RankCheck(session comm.IUserSession, req *pb.ArenaRankReq) ///排行榜获取 func (this *apiComp) Rank(session comm.IUserSession, req *pb.ArenaRankReq) (code pb.ErrorCode, data proto.Message) { + var ( + uids []string + ranks []*pb.DBArenaUser + players []*pb.ArenaPlayer + err error + ) + if code = this.RankCheck(session, req); code != pb.ErrorCode_Success { return } + if uids, err = this.module.modelRank.queryRankUser(); err != nil { + code = pb.ErrorCode_DBError + return + } + if ranks, err = this.module.modelArena.queryPlayers(uids); err != nil { + code = pb.ErrorCode_DBError + return + } + players = make([]*pb.ArenaPlayer, len(ranks)) + for i, v := range ranks { + players[i] = &pb.ArenaPlayer{ + Uid: v.Uid, + Name: v.Name, + Dan: v.Dan, + Integral: v.Integral, + Defend: v.Defend, + Isai: false, + } + } + session.SendMsg(string(this.module.GetType()), "rank", &pb.ArenaRankResp{Players: players}) return } diff --git a/modules/arena/modelarena.go b/modules/arena/modelarena.go index 2682a1c77..0708d256f 100644 --- a/modules/arena/modelarena.go +++ b/modules/arena/modelarena.go @@ -6,6 +6,7 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/mgo" + "go_dreamfactory/lego/utils/container/id" "go_dreamfactory/modules" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" @@ -47,6 +48,16 @@ func (this *modelArena) queryPlayerInfo(uId string) (result *pb.DBArenaUser, err return } +//查询用户装备数据 +func (this *modelArena) queryPlayers(uIds []string) (result []*pb.DBArenaUser, err error) { + result = make([]*pb.DBArenaUser, 0) + if err = this.Gets(uIds, &result); err != nil && err != mgo.MongodbNil { + this.module.Errorln(err) + return + } + return +} + //查询用户装备数据 func (this *modelArena) queryArenaPlayer(uId string) (result *pb.ArenaPlayer, err error) { temp := &pb.DBArenaUser{} @@ -174,6 +185,7 @@ func (this *modelArena) matcheAI(dan, num int32) (results []*pb.ArenaPlayer, err return } results[i] = &pb.ArenaPlayer{ + Uid: fmt.Sprintf("ai_%s", id.NewXId()), Name: this.randUserName(), Dan: dan, Integral: int32(rand.Intn(int(active.ScoreUp)-int(active.ScoreLow))) + active.ScoreLow, @@ -307,10 +319,14 @@ func (this *modelArena) integralCompute(red, bule *pb.ArenaPlayer, iswin bool) { return } if iswin { - red.Integral = red.Integral + int32(redactive.KValue*float32(1-1/(1+10^(bule.Integral-red.Integral)/400))) - bule.Integral = bule.Integral * int32(buleactive.KValue*float32(0-1/(1+10^(red.Integral-bule.Integral)/400))) + red.Changeintegral = int32(redactive.KValue * float32(1-1/(1+10^(bule.Integral-red.Integral)/400))) + red.Integral = red.Integral + red.Changeintegral + bule.Changeintegral = int32(buleactive.KValue * float32(0-1/(1+10^(red.Integral-bule.Integral)/400))) + bule.Integral = bule.Integral + bule.Changeintegral } else { - red.Integral = red.Integral + int32(redactive.KValue*float32(0-1/(1+10^(bule.Integral-red.Integral)/400))) - bule.Integral = bule.Integral * int32(redactive.KValue*float32(1-1/(1+10^(red.Integral-bule.Integral)/400))) + red.Changeintegral = int32(redactive.KValue * float32(0-1/(1+10^(bule.Integral-red.Integral)/400))) + red.Integral = red.Integral + red.Changeintegral + bule.Changeintegral = int32(redactive.KValue * float32(1-1/(1+10^(red.Integral-bule.Integral)/400))) + bule.Integral = bule.Integral + bule.Changeintegral } } diff --git a/modules/arena/modelrank.go b/modules/arena/modelrank.go index 1f17fc13a..e2089ec12 100644 --- a/modules/arena/modelrank.go +++ b/modules/arena/modelrank.go @@ -32,7 +32,7 @@ func (this *modelRank) updateArenaRank(users ...*pb.ArenaPlayer) (err error) { pipe *pipe.RedisPipe = this.DBModel.Redis.RedisPipe(context.TODO()) menbers []*redis.Z cmd *redis.IntCmd - menbersCmd []*redis.IntCmd + menbersCmd []*redis.IntCmd = make([]*redis.IntCmd, len(users)) rank int64 ) menbers = make([]*redis.Z, len(users)) @@ -45,7 +45,7 @@ func (this *modelRank) updateArenaRank(users ...*pb.ArenaPlayer) (err error) { for i, v := range users { menbersCmd[i] = pipe.ZRevRank(this.TableName, v.Uid) } - if _, err = pipe.Exec(); err == nil { + if _, err = pipe.Exec(); err != nil { this.module.Errorln(err) return } @@ -62,3 +62,19 @@ func (this *modelRank) updateArenaRank(users ...*pb.ArenaPlayer) (err error) { } return } + +//获取排行榜前50的用户名单 +func (this *modelRank) queryRankUser() (ranks []string, err error) { + var ( + result []string + ) + if result, err = this.DBModel.Redis.ZRevRange(this.TableName, 0, 50).Result(); err != nil { + this.module.Errorln(err) + return + } + ranks = make([]string, 0) + for i := 0; i < len(result); i += 2 { + ranks = append(ranks, result[i]) + } + return +} diff --git a/modules/arena/module.go b/modules/arena/module.go index 273985c99..958c94df5 100644 --- a/modules/arena/module.go +++ b/modules/arena/module.go @@ -2,6 +2,7 @@ package arena import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/base" "go_dreamfactory/lego/core" "go_dreamfactory/modules" ) @@ -18,6 +19,7 @@ func NewModule() core.IModule { type Arena struct { modules.ModuleBase + service base.IRPCXService battle comm.IBattle api *apiComp configure *configureComp @@ -33,7 +35,16 @@ func (this *Arena) GetType() core.M_Modules { //模块初始化接口 注册用户创建角色事件 func (this *Arena) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { err = this.ModuleBase.Init(service, module, options) - + this.service = service.(base.IRPCXService) + return +} +func (this *Arena) Start() (err error) { + err = this.ModuleBase.Start() + var module core.IModule + if module, err = this.service.GetModule(comm.ModuleBattle); err != nil { + return + } + this.battle = module.(comm.IBattle) return } diff --git a/modules/battle/modelBattle.go b/modules/battle/modelBattle.go index 5a153883f..ad130221f 100644 --- a/modules/battle/modelBattle.go +++ b/modules/battle/modelBattle.go @@ -256,7 +256,7 @@ func (this *modelBattleComp) createpvp(session comm.IUserSession, conn *db.DBCon //自己的英雄阵营 for i, v := range req.Buleformat.Format { if v != nil { - tid := 100 + i + tid := 200 + i if record.Buleflist[0].Team[i], code = this.createBattleRole(v, tid, i); code != pb.ErrorCode_Success { return } diff --git a/pb/arena_db.pb.go b/pb/arena_db.pb.go index 56ea059dd..bde234fed 100644 --- a/pb/arena_db.pb.go +++ b/pb/arena_db.pb.go @@ -20,6 +20,64 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type BattleRecordState int32 + +const ( + BattleRecordState_Win BattleRecordState = 0 + BattleRecordState_Lost BattleRecordState = 1 + BattleRecordState_WaitingRevenge BattleRecordState = 2 + BattleRecordState_RevengeFailed BattleRecordState = 3 + BattleRecordState_RevengeSucceeded BattleRecordState = 4 + BattleRecordState_RevengeEnd BattleRecordState = 5 +) + +// Enum value maps for BattleRecordState. +var ( + BattleRecordState_name = map[int32]string{ + 0: "Win", + 1: "Lost", + 2: "WaitingRevenge", + 3: "RevengeFailed", + 4: "RevengeSucceeded", + 5: "RevengeEnd", + } + BattleRecordState_value = map[string]int32{ + "Win": 0, + "Lost": 1, + "WaitingRevenge": 2, + "RevengeFailed": 3, + "RevengeSucceeded": 4, + "RevengeEnd": 5, + } +) + +func (x BattleRecordState) Enum() *BattleRecordState { + p := new(BattleRecordState) + *p = x + return p +} + +func (x BattleRecordState) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BattleRecordState) Descriptor() protoreflect.EnumDescriptor { + return file_arena_arena_db_proto_enumTypes[0].Descriptor() +} + +func (BattleRecordState) Type() protoreflect.EnumType { + return &file_arena_arena_db_proto_enumTypes[0] +} + +func (x BattleRecordState) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use BattleRecordState.Descriptor instead. +func (BattleRecordState) EnumDescriptor() ([]byte, []int) { + return file_arena_arena_db_proto_rawDescGZIP(), []int{0} +} + //玩家战斗阵型 type DBPlayerBattleFormt struct { state protoimpl.MessageState @@ -82,14 +140,15 @@ type ArenaPlayer struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"` - Dan int32 `protobuf:"varint,3,opt,name=dan,proto3" json:"dan"` //段位 - Integral int32 `protobuf:"varint,4,opt,name=Integral,proto3" json:"Integral"` - Rank int32 `protobuf:"varint,5,opt,name=rank,proto3" json:"rank"` //排名 - Defend *DBPlayerBattleFormt `protobuf:"bytes,6,opt,name=defend,proto3" json:"defend"` //防守 - Isai bool `protobuf:"varint,7,opt,name=isai,proto3" json:"isai"` //是否是ai - Mformatid int32 `protobuf:"varint,8,opt,name=mformatid,proto3" json:"mformatid"` // AIId + Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"` + Dan int32 `protobuf:"varint,3,opt,name=dan,proto3" json:"dan"` //段位 + Integral int32 `protobuf:"varint,4,opt,name=integral,proto3" json:"integral"` + Rank int32 `protobuf:"varint,5,opt,name=rank,proto3" json:"rank"` //排名 + Defend *DBPlayerBattleFormt `protobuf:"bytes,6,opt,name=defend,proto3" json:"defend"` //防守 + Isai bool `protobuf:"varint,7,opt,name=isai,proto3" json:"isai"` //是否是ai + Mformatid int32 `protobuf:"varint,8,opt,name=mformatid,proto3" json:"mformatid"` // AIId + Changeintegral int32 `protobuf:"varint,9,opt,name=changeintegral,proto3" json:"changeintegral"` //变化积分 } func (x *ArenaPlayer) Reset() { @@ -180,18 +239,27 @@ func (x *ArenaPlayer) GetMformatid() int32 { return 0 } +func (x *ArenaPlayer) GetChangeintegral() int32 { + if x != nil { + return x.Changeintegral + } + return 0 +} + //战斗记录 type DBArenaBattleRecord struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Bid string `protobuf:"bytes,1,opt,name=bid,proto3" json:"bid"` //战斗id - Time int64 `protobuf:"varint,2,opt,name=time,proto3" json:"time"` //战斗时间 - Iswin bool `protobuf:"varint,3,opt,name=iswin,proto3" json:"iswin"` //是否胜利 - Isdefend bool `protobuf:"varint,4,opt,name=isdefend,proto3" json:"isdefend"` //是否防守 - Rivalid string `protobuf:"bytes,5,opt,name=rivalid,proto3" json:"rivalid"` //对手id - Rivalname string `protobuf:"bytes,6,opt,name=rivalname,proto3" json:"rivalname"` //对手名称 + Bid string `protobuf:"bytes,1,opt,name=bid,proto3" json:"bid"` //战斗id + Time int64 `protobuf:"varint,2,opt,name=time,proto3" json:"time"` //战斗时间 + Iswin bool `protobuf:"varint,3,opt,name=iswin,proto3" json:"iswin"` //是否胜利 + Isdefend bool `protobuf:"varint,4,opt,name=isdefend,proto3" json:"isdefend"` //是否防守 + Rivalid string `protobuf:"bytes,5,opt,name=rivalid,proto3" json:"rivalid"` //对手id + Rivalname string `protobuf:"bytes,6,opt,name=rivalname,proto3" json:"rivalname"` //对手名称 + Addintegral int32 `protobuf:"varint,7,opt,name=addintegral,proto3" json:"addintegral"` //积分变化 + State BattleRecordState `protobuf:"varint,8,opt,name=State,proto3,enum=BattleRecordState" json:"State"` //记录状态 } func (x *DBArenaBattleRecord) Reset() { @@ -268,6 +336,20 @@ func (x *DBArenaBattleRecord) GetRivalname() string { return "" } +func (x *DBArenaBattleRecord) GetAddintegral() int32 { + if x != nil { + return x.Addintegral + } + return 0 +} + +func (x *DBArenaBattleRecord) GetState() BattleRecordState { + if x != nil { + return x.State + } + return BattleRecordState_Win +} + //竞技场用户数据 type DBArenaUser struct { state protoimpl.MessageState @@ -422,13 +504,13 @@ var file_arena_arena_db_proto_rawDesc = []byte{ 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x70, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x70, 0x6f, 0x73, 0x12, 0x1d, 0x0a, 0x05, 0x66, 0x6f, 0x72, 0x6d, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, - 0x65, 0x72, 0x6f, 0x52, 0x05, 0x66, 0x6f, 0x72, 0x6d, 0x74, 0x22, 0xd5, 0x01, 0x0a, 0x0b, 0x41, + 0x65, 0x72, 0x6f, 0x52, 0x05, 0x66, 0x6f, 0x72, 0x6d, 0x74, 0x22, 0xfd, 0x01, 0x0a, 0x0b, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x64, - 0x61, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x12, 0x12, + 0x61, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x12, 0x2c, 0x0a, 0x06, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x42, 0x61, 0x74, @@ -436,43 +518,57 @@ var file_arena_arena_db_proto_rawDesc = []byte{ 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x61, 0x69, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x61, 0x69, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6d, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, - 0x69, 0x64, 0x22, 0xa5, 0x01, 0x0a, 0x13, 0x44, 0x42, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x42, 0x61, - 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x62, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x62, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, - 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, - 0x12, 0x14, 0x0a, 0x05, 0x69, 0x73, 0x77, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x05, 0x69, 0x73, 0x77, 0x69, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x64, 0x65, 0x66, 0x65, - 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x64, 0x65, 0x66, 0x65, - 0x6e, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x69, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x69, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, - 0x72, 0x69, 0x76, 0x61, 0x6c, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x72, 0x69, 0x76, 0x61, 0x6c, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x87, 0x03, 0x0a, 0x0b, 0x44, - 0x42, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x55, 0x73, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x12, 0x16, 0x0a, 0x06, - 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x69, - 0x63, 0x6b, 0x65, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x03, 0x64, 0x61, 0x6e, 0x12, 0x2c, 0x0a, 0x06, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x50, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x74, 0x52, 0x06, 0x61, 0x74, - 0x74, 0x61, 0x63, 0x6b, 0x12, 0x2c, 0x0a, 0x06, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x42, - 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x74, 0x52, 0x06, 0x64, 0x65, 0x66, 0x65, - 0x6e, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6b, 0x18, 0x08, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6b, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x74, - 0x74, 0x61, 0x63, 0x6b, 0x72, 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, - 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x72, 0x61, 0x74, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, - 0x66, 0x65, 0x6e, 0x64, 0x72, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, - 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x72, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x61, - 0x6e, 0x6b, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x12, 0x16, - 0x0a, 0x06, 0x62, 0x75, 0x79, 0x6e, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, - 0x62, 0x75, 0x79, 0x6e, 0x75, 0x6d, 0x12, 0x2c, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, - 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x41, 0x72, 0x65, 0x6e, 0x61, - 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, - 0x63, 0x6f, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x69, 0x6e, 0x74, 0x65, + 0x67, 0x72, 0x61, 0x6c, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x63, 0x68, 0x61, 0x6e, + 0x67, 0x65, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x22, 0xf1, 0x01, 0x0a, 0x13, 0x44, + 0x42, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x62, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x62, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x73, 0x77, 0x69, + 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69, 0x73, 0x77, 0x69, 0x6e, 0x12, 0x1a, + 0x0a, 0x08, 0x69, 0x73, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x08, 0x69, 0x73, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x69, + 0x76, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x69, 0x76, + 0x61, 0x6c, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x69, 0x76, 0x61, 0x6c, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x69, 0x76, 0x61, 0x6c, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x64, 0x64, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, + 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x61, 0x64, 0x64, 0x69, 0x6e, 0x74, 0x65, + 0x67, 0x72, 0x61, 0x6c, 0x12, 0x28, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x87, + 0x03, 0x0a, 0x0b, 0x44, 0x42, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x55, 0x73, 0x65, 0x72, 0x12, 0x10, + 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, + 0x12, 0x16, 0x0a, 0x06, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x06, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x6e, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x64, 0x61, 0x6e, 0x12, 0x2c, 0x0a, 0x06, 0x61, 0x74, + 0x74, 0x61, 0x63, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x50, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x74, + 0x52, 0x06, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x12, 0x2c, 0x0a, 0x06, 0x64, 0x65, 0x66, 0x65, + 0x6e, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x50, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x74, 0x52, 0x06, + 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6b, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6b, 0x12, 0x1e, + 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x72, 0x61, 0x74, 0x65, 0x18, 0x09, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x72, 0x61, 0x74, 0x65, 0x12, 0x1e, + 0x0a, 0x0a, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x72, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x0a, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x72, 0x61, 0x74, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x72, 0x61, + 0x6e, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x79, 0x6e, 0x75, 0x6d, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x06, 0x62, 0x75, 0x79, 0x6e, 0x75, 0x6d, 0x12, 0x2c, 0x0a, 0x06, 0x72, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x41, + 0x72, 0x65, 0x6e, 0x61, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2a, 0x73, 0x0a, 0x11, 0x42, 0x61, 0x74, 0x74, + 0x6c, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x07, 0x0a, + 0x03, 0x57, 0x69, 0x6e, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x6f, 0x73, 0x74, 0x10, 0x01, + 0x12, 0x12, 0x0a, 0x0e, 0x57, 0x61, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x76, 0x65, 0x6e, + 0x67, 0x65, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x65, 0x76, 0x65, 0x6e, 0x67, 0x65, 0x46, + 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x65, 0x76, 0x65, 0x6e, + 0x67, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, 0x65, 0x64, 0x10, 0x04, 0x12, 0x0e, 0x0a, + 0x0a, 0x52, 0x65, 0x76, 0x65, 0x6e, 0x67, 0x65, 0x45, 0x6e, 0x64, 0x10, 0x05, 0x42, 0x06, 0x5a, + 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -487,25 +583,28 @@ func file_arena_arena_db_proto_rawDescGZIP() []byte { return file_arena_arena_db_proto_rawDescData } +var file_arena_arena_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_arena_arena_db_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_arena_arena_db_proto_goTypes = []interface{}{ - (*DBPlayerBattleFormt)(nil), // 0: DBPlayerBattleFormt - (*ArenaPlayer)(nil), // 1: ArenaPlayer - (*DBArenaBattleRecord)(nil), // 2: DBArenaBattleRecord - (*DBArenaUser)(nil), // 3: DBArenaUser - (*DBHero)(nil), // 4: DBHero + (BattleRecordState)(0), // 0: BattleRecordState + (*DBPlayerBattleFormt)(nil), // 1: DBPlayerBattleFormt + (*ArenaPlayer)(nil), // 2: ArenaPlayer + (*DBArenaBattleRecord)(nil), // 3: DBArenaBattleRecord + (*DBArenaUser)(nil), // 4: DBArenaUser + (*DBHero)(nil), // 5: DBHero } var file_arena_arena_db_proto_depIdxs = []int32{ - 4, // 0: DBPlayerBattleFormt.formt:type_name -> DBHero - 0, // 1: ArenaPlayer.defend:type_name -> DBPlayerBattleFormt - 0, // 2: DBArenaUser.attack:type_name -> DBPlayerBattleFormt - 0, // 3: DBArenaUser.defend:type_name -> DBPlayerBattleFormt - 2, // 4: DBArenaUser.record:type_name -> DBArenaBattleRecord - 5, // [5:5] is the sub-list for method output_type - 5, // [5:5] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 5, // 0: DBPlayerBattleFormt.formt:type_name -> DBHero + 1, // 1: ArenaPlayer.defend:type_name -> DBPlayerBattleFormt + 0, // 2: DBArenaBattleRecord.State:type_name -> BattleRecordState + 1, // 3: DBArenaUser.attack:type_name -> DBPlayerBattleFormt + 1, // 4: DBArenaUser.defend:type_name -> DBPlayerBattleFormt + 3, // 5: DBArenaUser.record:type_name -> DBArenaBattleRecord + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_arena_arena_db_proto_init() } @@ -569,13 +668,14 @@ func file_arena_arena_db_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_arena_arena_db_proto_rawDesc, - NumEnums: 0, + NumEnums: 1, NumMessages: 4, NumExtensions: 0, NumServices: 0, }, GoTypes: file_arena_arena_db_proto_goTypes, DependencyIndexes: file_arena_arena_db_proto_depIdxs, + EnumInfos: file_arena_arena_db_proto_enumTypes, MessageInfos: file_arena_arena_db_proto_msgTypes, }.Build() File_arena_arena_db_proto = out.File diff --git a/pb/arena_msg.pb.go b/pb/arena_msg.pb.go index fa290ac05..10cfc0ad7 100644 --- a/pb/arena_msg.pb.go +++ b/pb/arena_msg.pb.go @@ -540,6 +540,7 @@ type ArenaChallengeRewardReq struct { Isai bool `protobuf:"varint,2,opt,name=isai,proto3" json:"isai"` //对手是否是ai Aiintegral int32 `protobuf:"varint,3,opt,name=aiintegral,proto3" json:"aiintegral"` // ai 积分 Report *BattleReport `protobuf:"bytes,4,opt,name=report,proto3" json:"report"` //战报 + Revengeid string `protobuf:"bytes,5,opt,name=revengeid,proto3" json:"revengeid"` //复仇id } func (x *ArenaChallengeRewardReq) Reset() { @@ -602,6 +603,13 @@ func (x *ArenaChallengeRewardReq) GetReport() *BattleReport { return nil } +func (x *ArenaChallengeRewardReq) GetRevengeid() string { + if x != nil { + return x.Revengeid + } + return "" +} + type ArenaChallengeRewardResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -693,6 +701,8 @@ type ArenaRankResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Players []*ArenaPlayer `protobuf:"bytes,1,rep,name=players,proto3" json:"players"` } func (x *ArenaRankResp) Reset() { @@ -727,6 +737,13 @@ func (*ArenaRankResp) Descriptor() ([]byte, []int) { return file_arena_arena_msg_proto_rawDescGZIP(), []int{13} } +func (x *ArenaRankResp) GetPlayers() []*ArenaPlayer { + if x != nil { + return x.Players + } + return nil +} + //购买票据 type ArenaBuyReq struct { state protoimpl.MessageState @@ -876,7 +893,7 @@ var file_arena_arena_msg_proto_rawDesc = []byte{ 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, - 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x8a, 0x01, 0x0a, 0x17, 0x41, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0xa8, 0x01, 0x0a, 0x17, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x73, 0x77, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69, 0x73, 0x77, 0x69, 0x6e, 0x12, 0x12, 0x0a, 0x04, @@ -885,20 +902,24 @@ var file_arena_arena_msg_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x61, 0x69, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, - 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x32, 0x0a, 0x18, 0x41, 0x72, 0x65, 0x6e, 0x61, - 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x22, 0x0e, 0x0a, 0x0c, 0x41, - 0x72, 0x65, 0x6e, 0x61, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x22, 0x0f, 0x0a, 0x0d, 0x41, - 0x72, 0x65, 0x6e, 0x61, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x22, 0x25, 0x0a, 0x0b, - 0x41, 0x72, 0x65, 0x6e, 0x61, 0x42, 0x75, 0x79, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x62, - 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x75, 0x79, - 0x4e, 0x75, 0x6d, 0x22, 0x3e, 0x0a, 0x0c, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x42, 0x75, 0x79, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x12, 0x16, 0x0a, 0x06, 0x74, - 0x69, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x69, 0x63, - 0x6b, 0x65, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x76, 0x65, 0x6e, + 0x67, 0x65, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x76, 0x65, + 0x6e, 0x67, 0x65, 0x69, 0x64, 0x22, 0x32, 0x0a, 0x18, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x43, 0x68, + 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, + 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x22, 0x0e, 0x0a, 0x0c, 0x41, 0x72, 0x65, + 0x6e, 0x61, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x22, 0x37, 0x0a, 0x0d, 0x41, 0x72, 0x65, + 0x6e, 0x61, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x26, 0x0a, 0x07, 0x70, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x41, 0x72, + 0x65, 0x6e, 0x61, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x07, 0x70, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x73, 0x22, 0x25, 0x0a, 0x0b, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x42, 0x75, 0x79, 0x52, 0x65, + 0x71, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x06, 0x62, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x22, 0x3e, 0x0a, 0x0c, 0x41, 0x72, 0x65, + 0x6e, 0x61, 0x42, 0x75, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, + 0x75, 0x63, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, + 0x63, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x06, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -945,11 +966,12 @@ var file_arena_arena_msg_proto_depIdxs = []int32{ 19, // 3: ArenaChallengeResp.code:type_name -> ErrorCode 20, // 4: ArenaChallengeResp.info:type_name -> BattleInfo 21, // 5: ArenaChallengeRewardReq.report:type_name -> BattleReport - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 17, // 6: ArenaRankResp.players:type_name -> ArenaPlayer + 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 extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_arena_arena_msg_proto_init() }