diff --git a/bin/json/game_buzkashimount.json b/bin/json/game_buzkashimount.json
index c6791052e..c3fe38a85 100644
--- a/bin/json/game_buzkashimount.json
+++ b/bin/json/game_buzkashimount.json
@@ -15,7 +15,7 @@
"access": [
166
],
- "model": "20030001_3",
+ "model": "54101_3",
"point": "",
"stime": 20,
"etime": 0,
@@ -46,7 +46,7 @@
"access": [
166
],
- "model": "20030001_3",
+ "model": "54101_3",
"point": "",
"stime": 20,
"etime": 0,
@@ -77,7 +77,7 @@
"access": [
166
],
- "model": "20030001_3",
+ "model": "54101_3",
"point": "",
"stime": 20,
"etime": 40,
@@ -108,7 +108,7 @@
"access": [
166
],
- "model": "20030001_3",
+ "model": "54101_3",
"point": "",
"stime": 20,
"etime": 0,
@@ -139,7 +139,7 @@
"access": [
166
],
- "model": "20030001_3",
+ "model": "54101_3",
"point": "",
"stime": 20,
"etime": 0,
@@ -170,7 +170,7 @@
"access": [
166
],
- "model": "20030001_3",
+ "model": "54101_3",
"point": "",
"stime": 20,
"etime": 0,
@@ -201,7 +201,7 @@
"access": [
166
],
- "model": "20030001_3",
+ "model": "54101_3",
"point": "",
"stime": 20,
"etime": 0,
@@ -232,7 +232,7 @@
"access": [
166
],
- "model": "20030001_3",
+ "model": "54101_3",
"point": "",
"stime": 20,
"etime": 0,
@@ -263,7 +263,7 @@
"access": [
166
],
- "model": "20030001_3",
+ "model": "54101_3",
"point": "",
"stime": 20,
"etime": 0,
diff --git a/bin/json/game_qualifying.json b/bin/json/game_qualifying.json
new file mode 100644
index 000000000..2ba560fe8
--- /dev/null
+++ b/bin/json/game_qualifying.json
@@ -0,0 +1,146 @@
+[
+ {
+ "lv_id": 1,
+ "score_low": 0,
+ "score_up": 799,
+ "name": {
+ "key": "arena_active_reward_name_1",
+ "text": "黑铁"
+ },
+ "win_reward": [
+ {
+ "a": "attr",
+ "t": "arenacoin",
+ "n": 10
+ }
+ ],
+ "png": "smithy_atk_1",
+ "k_value": 30
+ },
+ {
+ "lv_id": 2,
+ "score_low": 800,
+ "score_up": 1299,
+ "name": {
+ "key": "arena_active_reward_name_2",
+ "text": "青铜"
+ },
+ "win_reward": [
+ {
+ "a": "attr",
+ "t": "arenacoin",
+ "n": 12
+ }
+ ],
+ "png": "smithy_def_4",
+ "k_value": 30
+ },
+ {
+ "lv_id": 3,
+ "score_low": 1300,
+ "score_up": 1599,
+ "name": {
+ "key": "arena_active_reward_name_3",
+ "text": "白银"
+ },
+ "win_reward": [
+ {
+ "a": "attr",
+ "t": "arenacoin",
+ "n": 14
+ }
+ ],
+ "png": "smithy_def_1",
+ "k_value": 30
+ },
+ {
+ "lv_id": 4,
+ "score_low": 1600,
+ "score_up": 2199,
+ "name": {
+ "key": "arena_active_reward_name_4",
+ "text": "黄金"
+ },
+ "win_reward": [
+ {
+ "a": "attr",
+ "t": "arenacoin",
+ "n": 16
+ }
+ ],
+ "png": "smithy_atk_3",
+ "k_value": 30
+ },
+ {
+ "lv_id": 5,
+ "score_low": 2200,
+ "score_up": 2799,
+ "name": {
+ "key": "arena_active_reward_name_5",
+ "text": "铂金"
+ },
+ "win_reward": [
+ {
+ "a": "attr",
+ "t": "arenacoin",
+ "n": 18
+ }
+ ],
+ "png": "smithy_def_2",
+ "k_value": 30
+ },
+ {
+ "lv_id": 6,
+ "score_low": 2800,
+ "score_up": 3699,
+ "name": {
+ "key": "arena_active_reward_name_6",
+ "text": "钻石"
+ },
+ "win_reward": [
+ {
+ "a": "attr",
+ "t": "arenacoin",
+ "n": 20
+ }
+ ],
+ "png": "smithy_sup_4",
+ "k_value": 30
+ },
+ {
+ "lv_id": 7,
+ "score_low": 3700,
+ "score_up": 4599,
+ "name": {
+ "key": "arena_active_reward_name_7",
+ "text": "大师"
+ },
+ "win_reward": [
+ {
+ "a": "attr",
+ "t": "arenacoin",
+ "n": 22
+ }
+ ],
+ "png": "smithy_atk_4",
+ "k_value": 30
+ },
+ {
+ "lv_id": 8,
+ "score_low": 4600,
+ "score_up": 999999,
+ "name": {
+ "key": "arena_active_reward_name_8",
+ "text": "王者"
+ },
+ "win_reward": [
+ {
+ "a": "attr",
+ "t": "arenacoin",
+ "n": 22
+ }
+ ],
+ "png": "smithy_atk_5",
+ "k_value": 30
+ }
+]
\ No newline at end of file
diff --git a/bin/json/game_worldrd.json b/bin/json/game_worldrd.json
index 3f07a9bf5..d2d112980 100644
--- a/bin/json/game_worldrd.json
+++ b/bin/json/game_worldrd.json
@@ -145,5 +145,88 @@
"n": 44004
}
]
+ },
+ {
+ "id": 10,
+ "group": 1003,
+ "eventname": {
+ "key": "eventname_12",
+ "text": "无事发生"
+ },
+ "eventweight": 40000,
+ "eventtype": 0,
+ "battleready": 0,
+ "battleid": 0,
+ "getitem": []
+ },
+ {
+ "id": 11,
+ "group": 1003,
+ "eventname": {
+ "key": "eventname_13",
+ "text": "打怪"
+ },
+ "eventweight": 30000,
+ "eventtype": 1,
+ "battleready": 126,
+ "battleid": 101011,
+ "getitem": []
+ },
+ {
+ "id": 12,
+ "group": 1003,
+ "eventname": {
+ "key": "eventname_14",
+ "text": "获取金币"
+ },
+ "eventweight": 10000,
+ "eventtype": 2,
+ "battleready": 0,
+ "battleid": 0,
+ "getitem": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 10000
+ }
+ ]
+ },
+ {
+ "id": 13,
+ "group": 1003,
+ "eventname": {
+ "key": "eventname_15",
+ "text": "获取金币"
+ },
+ "eventweight": 10000,
+ "eventtype": 0,
+ "battleready": 0,
+ "battleid": 0,
+ "getitem": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 38000
+ }
+ ]
+ },
+ {
+ "id": 14,
+ "group": 1003,
+ "eventname": {
+ "key": "eventname_16",
+ "text": "获取金币"
+ },
+ "eventweight": 10000,
+ "eventtype": 0,
+ "battleready": 0,
+ "battleid": 0,
+ "getitem": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 50000
+ }
+ ]
}
]
\ No newline at end of file
diff --git a/comm/const.go b/comm/const.go
index ad01d51dc..72094ed55 100644
--- a/comm/const.go
+++ b/comm/const.go
@@ -107,6 +107,7 @@ const (
ModuleRobot core.M_Modules = "robot" //压测机器人
ModuleBattleRecord core.M_Modules = "battlerecord" //战斗记录
ModuleDragon core.M_Modules = "dragon" //坐骑
+ ModuleCaptureSheep core.M_Modules = "capturesheep" //捕羊大赛
)
// 数据表名定义处
@@ -366,6 +367,10 @@ const (
///坐骑数据表
TableDragon = "dragon"
+ //捕羊大赛排名
+ TableCapturesheep = "capturesheep"
+ //捕羊大赛排名
+ TableCapturesheepRank = "capturesheeprank" //排名
)
// RPC服务接口定义处
diff --git a/modules/capturesheep/api_matche.go b/modules/capturesheep/api_matche.go
index a9e66faea..2239a3ddd 100644
--- a/modules/capturesheep/api_matche.go
+++ b/modules/capturesheep/api_matche.go
@@ -4,6 +4,8 @@ import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/sys/mgo"
"go_dreamfactory/pb"
+
+ "go.mongodb.org/mongo-driver/bson/primitive"
)
//参数校验
@@ -16,6 +18,7 @@ func (this *apiComp) MatcheCheck(session comm.IUserSession, req *pb.Capturesheep
func (this *apiComp) Matche(session comm.IUserSession, req *pb.CapturesheepMatcheReq) (errdata *pb.ErrorData) {
var (
info *pb.DBCaptureSheep
+ dragon *pb.DBDragon
players []*pb.CaptureSheepRaceMember
ais []*pb.CaptureSheepRaceMember
err error
@@ -31,8 +34,15 @@ func (this *apiComp) Matche(session comm.IUserSession, req *pb.CapturesheepMatch
}
return
}
-
- if players, err = this.module.modelCaptureSheep.matchePlayer(info.Uid, info.Dan, 6); err != nil && err != mgo.MongodbNil {
+ if info.Defmts == "" {
+ errdata = &pb.ErrorData{
+ Code: pb.ErrorCode_ReqParameterError,
+ Title: pb.ErrorCode_ReqParameterError.ToString(),
+ Message: "no dragon!",
+ }
+ return
+ }
+ if dragon, err = this.module.dragon.QueryDragonById(info.Uid, info.Defmts); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
@@ -40,6 +50,25 @@ func (this *apiComp) Matche(session comm.IUserSession, req *pb.CapturesheepMatch
}
return
}
+
+ players = append(players, &pb.CaptureSheepRaceMember{
+ Uid: info.Uid,
+ Name: info.Name,
+ Sex: info.Sex,
+ Skin: info.Skin,
+ Mount: dragon.Dragonid,
+ Maxhp: dragon.Property[comm.Dhp],
+ Currhp: dragon.Property[comm.Dhp],
+ Isai: false,
+ })
+ // if players, err = this.module.modelCaptureSheep.matchePlayer(info.Uid, info.Dan, 6); err != nil && err != mgo.MongodbNil {
+ // errdata = &pb.ErrorData{
+ // Code: pb.ErrorCode_DBError,
+ // Title: pb.ErrorCode_DBError.ToString(),
+ // Message: err.Error(),
+ // }
+ // return
+ // }
if len(players) < 6 {
num := 6 - len(players)
if ais, err = this.module.modelCaptureSheep.matcheAI(info.Dan, int32(num)); err != nil && err != mgo.MongodbNil {
@@ -52,6 +81,14 @@ func (this *apiComp) Matche(session comm.IUserSession, req *pb.CapturesheepMatch
}
players = append(players, ais...)
}
- session.SendMsg(string(this.module.GetType()), "matche", &pb.CapturesheepMatcheResp{})
+ session.SendMsg(string(this.module.GetType()), "matche", &pb.CapturesheepMatcheResp{
+ Race: &pb.DBCaptureSheepRace{
+ Id: primitive.NewObjectID().Hex(),
+ Rtype: req.Rtype,
+ Trackid: req.Trackid,
+ Redmember: players[0:3],
+ Bulemember: players[3:],
+ },
+ })
return
}
diff --git a/modules/capturesheep/api_over.go b/modules/capturesheep/api_over.go
new file mode 100644
index 000000000..e169f38e7
--- /dev/null
+++ b/modules/capturesheep/api_over.go
@@ -0,0 +1,76 @@
+package capturesheep
+
+import (
+ "go_dreamfactory/comm"
+ "go_dreamfactory/lego/sys/mgo"
+ "go_dreamfactory/pb"
+)
+
+// 参数校验
+func (this *apiComp) OverCheck(session comm.IUserSession, req *pb.CapturesheepOverReq) (errdata *pb.ErrorData) {
+
+ return
+}
+
+// /获取自己的排行榜信息
+func (this *apiComp) Over(session comm.IUserSession, req *pb.CapturesheepOverReq) (errdata *pb.ErrorData) {
+ var (
+ redScores, blueScores int32
+ info *pb.DBCaptureSheep
+ selfMenber *pb.CaptureSheepRaceMember
+ otherMenber *pb.CaptureSheepRaceMember
+ err error
+ )
+
+ if errdata = this.OverCheck(session, req); errdata != nil {
+ return
+ }
+ if info, err = this.module.modelCaptureSheep.queryInfo(session.GetUserId()); err != nil && err != mgo.MongodbNil {
+ errdata = &pb.ErrorData{
+ Code: pb.ErrorCode_DBError,
+ Title: pb.ErrorCode_DBError.ToString(),
+ Message: err.Error(),
+ }
+ return
+ }
+ for _, v := range req.Race.Redmember {
+ redScores += v.Scores
+ if v.Uid == session.GetUserId() {
+ selfMenber = v
+ }
+ }
+ for _, v := range req.Race.Bulemember {
+ blueScores += v.Scores
+ if v.Uid == session.GetUserId() {
+ selfMenber = v
+ }
+ }
+
+ if redScores > blueScores { //红方胜利
+ this.module.modelCaptureSheep.integralCompute(selfMenber, otherMenber, true)
+ } else {
+ this.module.modelCaptureSheep.integralCompute(selfMenber, otherMenber, false)
+ }
+ info.Integral = selfMenber.Integral
+ if info.Dan, err = this.module.modelCaptureSheep.computedan(info.Integral); err != nil {
+ errdata = &pb.ErrorData{
+ Code: pb.ErrorCode_ConfigNoFound,
+ Title: pb.ErrorCode_ConfigNoFound.ToString(),
+ Message: err.Error(),
+ }
+ return
+ }
+ if err = this.module.modelCaptureSheep.Change(session.GetUserId(), map[string]interface{}{
+ "integral": info.Integral,
+ "dan": info.Dan,
+ }); err != nil {
+ errdata = &pb.ErrorData{
+ Code: pb.ErrorCode_DBError,
+ Title: pb.ErrorCode_DBError.ToString(),
+ Message: err.Error(),
+ }
+ return
+ }
+ session.SendMsg(string(this.module.GetType()), "info", &pb.CapturesheepOverResp{})
+ return
+}
diff --git a/modules/capturesheep/configure.go b/modules/capturesheep/configure.go
index 47e6d6164..bcdce854f 100644
--- a/modules/capturesheep/configure.go
+++ b/modules/capturesheep/configure.go
@@ -1,13 +1,17 @@
package capturesheep
import (
+ "fmt"
+ "go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
)
const (
- game_arenarobot = "game_arenarobot.json" //ai配置表
+ game_arenarobot = "game_arenarobot.json" //ai配置表
+ game_qualifying = "game_qualifying.json" //段位
+ game_arenarankreward = "game_arenarankreward.json" //比赛奖励配置
)
type configureComp struct {
@@ -23,3 +27,52 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
})
return
}
+
+//查询积分段位信息
+func (this *configureComp) getActiveReward(integral int32) (result *cfg.GameQualifyingData, err error) {
+ var (
+ v interface{}
+ )
+ if v, err = this.GetConfigure(game_qualifying); err != nil {
+ this.module.Errorln(err)
+ } else {
+ for _, v := range v.(*cfg.GameQualifying).GetDataMap() {
+ if integral >= v.ScoreLow && integral <= v.ScoreUp {
+ result = v
+ return
+ }
+ }
+ }
+ err = fmt.Errorf("未找到 匹配积分:%d段位配置", integral)
+ return
+}
+
+//查询积分段位信息
+func (this *configureComp) getActiveRewardById(lv int32) (result *cfg.GameArenaActiveRewardData, err error) {
+ var (
+ v interface{}
+ ok bool
+ )
+ if v, err = this.GetConfigure(game_qualifying); err != nil {
+ this.module.Errorln(err)
+ } else {
+ if result, ok = v.(*cfg.GameArenaActiveReward).GetDataMap()[lv]; !ok {
+ err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_qualifying, lv)
+ this.module.Errorln(err)
+ }
+ }
+ return
+}
+
+//查询比赛奖励
+func (this *configureComp) getRankReward() (result *cfg.GameArenaRankReward, err error) {
+ var (
+ v interface{}
+ )
+ if v, err = this.GetConfigure(game_arenarankreward); err != nil {
+ this.module.Errorln(err)
+ } else {
+ result = v.(*cfg.GameArenaRankReward)
+ }
+ return
+}
diff --git a/modules/capturesheep/modelCaptureSheep.go b/modules/capturesheep/modelCaptureSheep.go
index 8923d0463..aea11a687 100644
--- a/modules/capturesheep/modelCaptureSheep.go
+++ b/modules/capturesheep/modelCaptureSheep.go
@@ -25,7 +25,7 @@ type ModelCaptureSheep struct {
func (this *ModelCaptureSheep) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.MCompModel.Init(service, module, comp, options)
- this.TableName = comm.TableWeeltask
+ this.TableName = comm.TableCapturesheep
this.module = module.(*CaptureSheep)
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
@@ -91,18 +91,89 @@ func (this *ModelCaptureSheep) matchePlayer(uid string, dan, num int32) (results
func (this *ModelCaptureSheep) matcheAI(dan, num int32) (results []*pb.CaptureSheepRaceMember, err error) {
var (
robots []*cfg.GameRobotData
+ dragon *pb.DBDragon
)
results = make([]*pb.CaptureSheepRaceMember, num)
if robots, err = this.module.ModuleTools.RandRobotConfig(num); err != nil {
return
}
for i, v := range robots {
+ if dragon, err = this.module.dragon.CreateRobotDragon(v.Mtsid.T, v.Mtsid.N); err != nil {
+ this.module.Errorln(err)
+ return
+ }
results[i] = &pb.CaptureSheepRaceMember{
- Uid: fmt.Sprintf("ai_%s", id.NewXId()),
- Name: v.Name,
- Sex: v.Sex,
- Skin: v.Showid,
+ Uid: fmt.Sprintf("ai_%s", id.NewXId()),
+ Name: v.Name,
+ Sex: v.Sex,
+ Skin: v.Showid,
+ Mount: dragon.Dragonid,
+ Maxhp: dragon.Property[comm.Dhp],
+ Currhp: dragon.Property[comm.Dhp],
+ Isai: true,
}
}
return
}
+
+func (this *ModelCaptureSheep) modifyIntegral(uid string, integral int32) (err error) {
+ var (
+ dan int32
+ player *pb.ArenaPlayer
+ )
+ if dan, err = this.computedan(integral); err != nil {
+ return
+ }
+ player = &pb.ArenaPlayer{Uid: uid, Integral: integral}
+ if err = this.module.modelRank.updateArenaRank(player); err != nil {
+ this.module.Errorln(err)
+ return
+ }
+ this.Change(uid, map[string]interface{}{
+ "integral": integral,
+ "dan": dan,
+ "rank": player.Rank,
+ })
+ return
+}
+
+func (this *ModelCaptureSheep) computedan(integral int32) (dan int32, err error) {
+ var (
+ active *cfg.GameQualifyingData
+ )
+
+ if active, err = this.module.configure.getActiveReward(integral); err != nil {
+ this.module.Errorln(err)
+ return
+ }
+ dan = active.LvId
+ return
+}
+
+// 积分计算
+func (this *ModelCaptureSheep) integralCompute(red, bule *pb.CaptureSheepRaceMember, iswin bool) {
+ var (
+ redactive *cfg.GameArenaActiveRewardData
+ buleactive *cfg.GameArenaActiveRewardData
+ err error
+ )
+ if redactive, err = this.module.configure.getActiveRewardById(red.Dan); err != nil {
+ this.module.Errorln(err)
+ return
+ }
+ if buleactive, err = this.module.configure.getActiveRewardById(bule.Dan); err != nil {
+ this.module.Errorln(err)
+ return
+ }
+ if iswin {
+ red.Changeintegral = int32(redactive.KValue * float32(1-1/float32(1+10^(bule.Integral-red.Integral)/400)))
+ red.Integral = red.Integral + red.Changeintegral
+ bule.Changeintegral = int32(buleactive.KValue * float32(0-1/float32(1+10^(red.Integral-bule.Integral)/400)))
+ bule.Integral = bule.Integral + bule.Changeintegral
+ } else {
+ red.Changeintegral = int32(redactive.KValue * float32(0-1/float32(1+10^(bule.Integral-red.Integral)/400)))
+ red.Integral = red.Integral + red.Changeintegral
+ bule.Changeintegral = int32(redactive.KValue * float32(1-1/float32(1+10^(red.Integral-bule.Integral)/400)))
+ bule.Integral = bule.Integral + bule.Changeintegral
+ }
+}
diff --git a/modules/capturesheep/modelrank.go b/modules/capturesheep/modelrank.go
new file mode 100644
index 000000000..3dc858498
--- /dev/null
+++ b/modules/capturesheep/modelrank.go
@@ -0,0 +1,125 @@
+package capturesheep
+
+import (
+ "context"
+ "fmt"
+ "go_dreamfactory/comm"
+ "go_dreamfactory/lego/core"
+ "go_dreamfactory/lego/sys/redis/pipe"
+ "go_dreamfactory/modules"
+ "go_dreamfactory/pb"
+ "go_dreamfactory/sys/configure"
+ cfg "go_dreamfactory/sys/configure/structs"
+
+ "github.com/go-redis/redis/v8"
+)
+
+// /竞技场 数据组件
+type modelRank struct {
+ modules.MCompModel
+ module *CaptureSheep
+}
+
+// 组件初始化接口
+func (this *modelRank) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) {
+ this.TableName = comm.TableCapturesheepRank
+ this.MCompModel.Init(service, module, comp, opt)
+ this.module = module.(*CaptureSheep)
+
+ return
+}
+
+// 更新排名
+func (this *modelRank) updateArenaRank(users ...*pb.ArenaPlayer) (err error) {
+ var (
+ pipe *pipe.RedisPipe = this.DBModel.Redis.RedisPipe(context.TODO())
+ menbers []*redis.Z
+ cmd *redis.IntCmd
+ menbersCmd []*redis.IntCmd = make([]*redis.IntCmd, len(users))
+ rank int64
+ )
+ menbers = make([]*redis.Z, len(users))
+ for i, v := range users {
+ menbers[i] = &redis.Z{Score: float64(v.Integral), Member: v.Uid}
+ }
+ if cmd = pipe.ZAdd(this.TableName, menbers...); err != nil {
+ this.module.Errorln(err)
+ }
+ for i, v := range users {
+ menbersCmd[i] = pipe.ZRevRank(this.TableName, v.Uid)
+ }
+ if _, err = pipe.Exec(); err != nil {
+ this.module.Errorln(err)
+ return
+ }
+ if _, err = cmd.Result(); err != nil {
+ this.module.Errorln(err)
+ return
+ }
+ for i, v := range menbersCmd {
+ if rank, err = v.Result(); err != nil {
+ this.module.Errorln(err)
+ return
+ }
+ users[i].Rank = int32(rank + 1)
+ }
+ 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 += 1 {
+ ranks = append(ranks, result[i])
+ }
+ return
+}
+
+// 比赛结算
+func (this *modelRank) raceSettlement() {
+ var (
+ reward *cfg.GameArenaRankReward
+ result []string
+ uids []string
+ Items []*pb.UserAssets
+ err error
+ )
+ if reward, err = this.module.configure.getRankReward(); err != nil {
+ this.module.Errorln(err)
+ return
+ }
+ for _, v := range reward.GetDataList() {
+ if result, err = this.DBModel.Redis.ZRevRange(this.TableName, int64(v.RankLow-1), int64(v.RankUp)).Result(); err != nil {
+ this.module.Errorln(err)
+ return
+ }
+ this.module.Debugf("uid:%v", uids)
+
+ Items = make([]*pb.UserAssets, len(v.RankReward))
+ for i, v := range v.RankReward {
+ Items[i] = &pb.UserAssets{
+ A: v.A,
+ T: v.T,
+ N: v.N,
+ }
+ }
+ for i := 0; i < len(result); i += 2 {
+ // uids = append(uids, result[i])
+ //发邮件
+ this.module.mail.SendNewMail(&pb.DBMailData{
+ Cid: "ArenaRankingReward",
+ Param: []string{fmt.Sprintf("%d", v.RankLow+int32(i))},
+ CreateTime: uint64(configure.Now().Unix()),
+ Items: Items,
+ }, result[i])
+ }
+ }
+
+}
diff --git a/modules/capturesheep/module.go b/modules/capturesheep/module.go
index afd9e958d..d3b14793b 100644
--- a/modules/capturesheep/module.go
+++ b/modules/capturesheep/module.go
@@ -16,9 +16,11 @@ type CaptureSheep struct {
modules.ModuleBase
service core.IService
dragon comm.IDragon
+ mail comm.Imail
api *apiComp
configure *configureComp
modelCaptureSheep *ModelCaptureSheep
+ modelRank *modelRank
}
func NewModule() core.IModule {
@@ -26,7 +28,7 @@ func NewModule() core.IModule {
}
func (this *CaptureSheep) GetType() core.M_Modules {
- return comm.ModuleWeektask
+ return comm.ModuleCaptureSheep
}
func (this *CaptureSheep) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
@@ -42,6 +44,10 @@ func (this *CaptureSheep) Start() (err error) {
return
}
this.dragon = module.(comm.IDragon)
+ if module, err = this.service.GetModule(comm.ModuleMail); err != nil {
+ return
+ }
+ this.mail = module.(comm.Imail)
return
}
@@ -49,6 +55,7 @@ func (this *CaptureSheep) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelCaptureSheep = this.RegisterComp(new(ModelCaptureSheep)).(*ModelCaptureSheep)
+ this.modelRank = this.RegisterComp(new(modelRank)).(*modelRank)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
}
diff --git a/pb/capturesheep_db.pb.go b/pb/capturesheep_db.pb.go
index a35c03f7d..5207dfc68 100644
--- a/pb/capturesheep_db.pb.go
+++ b/pb/capturesheep_db.pb.go
@@ -191,14 +191,18 @@ type CaptureSheepRaceMember struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
- Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` //用户id
- Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"` //用户名称
- Skin string `protobuf:"bytes,3,opt,name=skin,proto3" json:"skin"` //皮肤
- Sex int32 `protobuf:"varint,4,opt,name=sex,proto3" json:"sex"` //性别
- Isai bool `protobuf:"varint,5,opt,name=isai,proto3" json:"isai"` //是否是ai数据
- Mount string `protobuf:"bytes,6,opt,name=mount,proto3" json:"mount"` //上阵坐骑 配置id
- Maxhp int32 `protobuf:"varint,7,opt,name=maxhp,proto3" json:"maxhp"` //初始血量
- Currhp int32 `protobuf:"varint,8,opt,name=currhp,proto3" json:"currhp"` //当前血量
+ Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` //用户id
+ Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"` //用户名称
+ Skin string `protobuf:"bytes,3,opt,name=skin,proto3" json:"skin"` //皮肤
+ Sex int32 `protobuf:"varint,4,opt,name=sex,proto3" json:"sex"` //性别
+ Dan int32 `protobuf:"varint,5,opt,name=dan,proto3" json:"dan"` //段位
+ Integral int32 `protobuf:"varint,6,opt,name=integral,proto3" json:"integral"` //当前积分
+ Changeintegral int32 `protobuf:"varint,7,opt,name=changeintegral,proto3" json:"changeintegral"` //变化积分
+ Isai bool `protobuf:"varint,8,opt,name=isai,proto3" json:"isai"` //是否是ai数据
+ Mount string `protobuf:"bytes,9,opt,name=mount,proto3" json:"mount"` //上阵坐骑 配置id
+ Maxhp int32 `protobuf:"varint,10,opt,name=maxhp,proto3" json:"maxhp"` //初始血量
+ Currhp int32 `protobuf:"varint,11,opt,name=currhp,proto3" json:"currhp"` //当前血量
+ Scores int32 `protobuf:"varint,12,opt,name=scores,proto3" json:"scores"` //当前分数
}
func (x *CaptureSheepRaceMember) Reset() {
@@ -261,6 +265,27 @@ func (x *CaptureSheepRaceMember) GetSex() int32 {
return 0
}
+func (x *CaptureSheepRaceMember) GetDan() int32 {
+ if x != nil {
+ return x.Dan
+ }
+ return 0
+}
+
+func (x *CaptureSheepRaceMember) GetIntegral() int32 {
+ if x != nil {
+ return x.Integral
+ }
+ return 0
+}
+
+func (x *CaptureSheepRaceMember) GetChangeintegral() int32 {
+ if x != nil {
+ return x.Changeintegral
+ }
+ return 0
+}
+
func (x *CaptureSheepRaceMember) GetIsai() bool {
if x != nil {
return x.Isai
@@ -289,6 +314,13 @@ func (x *CaptureSheepRaceMember) GetCurrhp() int32 {
return 0
}
+func (x *CaptureSheepRaceMember) GetScores() int32 {
+ if x != nil {
+ return x.Scores
+ }
+ return 0
+}
+
//捕养比赛
type DBCaptureSheepRace struct {
state protoimpl.MessageState
@@ -388,36 +420,43 @@ var file_capturesheep_capturesheep_db_proto_rawDesc = []byte{
0x04, 0x72, 0x61, 0x6e, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x66, 0x6d, 0x74, 0x73, 0x18,
0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x66, 0x6d, 0x74, 0x73, 0x12, 0x10, 0x0a,
0x03, 0x6c, 0x6f, 0x63, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x01, 0x52, 0x03, 0x6c, 0x6f, 0x63, 0x22,
- 0xbc, 0x01, 0x0a, 0x16, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x53, 0x68, 0x65, 0x65, 0x70,
+ 0xaa, 0x02, 0x0a, 0x16, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x53, 0x68, 0x65, 0x65, 0x70,
0x52, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x62, 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, 0x12, 0x0a, 0x04, 0x73, 0x6b, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x73, 0x6b, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28,
- 0x05, 0x52, 0x03, 0x73, 0x65, 0x78, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x61, 0x69, 0x18, 0x05,
- 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x61, 0x69, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f,
- 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x6f, 0x75, 0x6e, 0x74,
- 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x78, 0x68, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52,
- 0x05, 0x6d, 0x61, 0x78, 0x68, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x75, 0x72, 0x72, 0x68, 0x70,
- 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x75, 0x72, 0x72, 0x68, 0x70, 0x22, 0xdb,
- 0x01, 0x0a, 0x12, 0x44, 0x42, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x53, 0x68, 0x65, 0x65,
- 0x70, 0x52, 0x61, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
- 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2b, 0x0a, 0x05, 0x72, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03,
- 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x53, 0x68,
- 0x65, 0x65, 0x70, 0x52, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x72, 0x74, 0x79,
- 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x69, 0x64, 0x18, 0x04, 0x20,
- 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x69, 0x64, 0x12, 0x35, 0x0a, 0x09,
- 0x72, 0x65, 0x64, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32,
- 0x17, 0x2e, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x53, 0x68, 0x65, 0x65, 0x70, 0x52, 0x61,
- 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x09, 0x72, 0x65, 0x64, 0x6d, 0x65, 0x6d,
- 0x62, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x0a, 0x62, 0x75, 0x6c, 0x65, 0x6d, 0x65, 0x6d, 0x62, 0x65,
- 0x72, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72,
- 0x65, 0x53, 0x68, 0x65, 0x65, 0x70, 0x52, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72,
- 0x52, 0x0a, 0x62, 0x75, 0x6c, 0x65, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x2a, 0x2d, 0x0a, 0x14,
+ 0x05, 0x52, 0x03, 0x73, 0x65, 0x78, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x6e, 0x18, 0x05, 0x20,
+ 0x01, 0x28, 0x05, 0x52, 0x03, 0x64, 0x61, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65,
+ 0x67, 0x72, 0x61, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65,
+ 0x67, 0x72, 0x61, 0x6c, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x69, 0x6e,
+ 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x63, 0x68,
+ 0x61, 0x6e, 0x67, 0x65, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x12, 0x12, 0x0a, 0x04,
+ 0x69, 0x73, 0x61, 0x69, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x61, 0x69,
+ 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x05, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x78, 0x68, 0x70, 0x18,
+ 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x78, 0x68, 0x70, 0x12, 0x16, 0x0a, 0x06,
+ 0x63, 0x75, 0x72, 0x72, 0x68, 0x70, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x75,
+ 0x72, 0x72, 0x68, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x18, 0x0c,
+ 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x22, 0xdb, 0x01, 0x0a,
+ 0x12, 0x44, 0x42, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x53, 0x68, 0x65, 0x65, 0x70, 0x52,
+ 0x61, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x02, 0x69, 0x64, 0x12, 0x2b, 0x0a, 0x05, 0x72, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01,
+ 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x53, 0x68, 0x65, 0x65,
+ 0x70, 0x52, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x72, 0x74, 0x79, 0x70, 0x65,
+ 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28,
+ 0x05, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x69, 0x64, 0x12, 0x35, 0x0a, 0x09, 0x72, 0x65,
+ 0x64, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e,
0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x53, 0x68, 0x65, 0x65, 0x70, 0x52, 0x61, 0x63, 0x65,
- 0x54, 0x79, 0x70, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x10, 0x00, 0x12,
- 0x0a, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x6b, 0x65, 0x64, 0x10, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e,
- 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x09, 0x72, 0x65, 0x64, 0x6d, 0x65, 0x6d, 0x62, 0x65,
+ 0x72, 0x12, 0x37, 0x0a, 0x0a, 0x62, 0x75, 0x6c, 0x65, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18,
+ 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x53,
+ 0x68, 0x65, 0x65, 0x70, 0x52, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x0a,
+ 0x62, 0x75, 0x6c, 0x65, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x2a, 0x2d, 0x0a, 0x14, 0x43, 0x61,
+ 0x70, 0x74, 0x75, 0x72, 0x65, 0x53, 0x68, 0x65, 0x65, 0x70, 0x52, 0x61, 0x63, 0x65, 0x54, 0x79,
+ 0x70, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x10, 0x00, 0x12, 0x0a, 0x0a,
+ 0x06, 0x72, 0x61, 0x6e, 0x6b, 0x65, 0x64, 0x10, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
+ 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
diff --git a/pb/capturesheep_msg.pb.go b/pb/capturesheep_msg.pb.go
index 1b757c4bc..8f3cf3a4c 100644
--- a/pb/capturesheep_msg.pb.go
+++ b/pb/capturesheep_msg.pb.go
@@ -314,6 +314,180 @@ func (x *CapturesheepMatcheResp) GetRace() *DBCaptureSheepRace {
return nil
}
+//捕养大赛使用道具
+type CapturesheepUseItemReq struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id"`
+}
+
+func (x *CapturesheepUseItemReq) Reset() {
+ *x = CapturesheepUseItemReq{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_capturesheep_capturesheep_msg_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CapturesheepUseItemReq) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CapturesheepUseItemReq) ProtoMessage() {}
+
+func (x *CapturesheepUseItemReq) ProtoReflect() protoreflect.Message {
+ mi := &file_capturesheep_capturesheep_msg_proto_msgTypes[6]
+ 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 CapturesheepUseItemReq.ProtoReflect.Descriptor instead.
+func (*CapturesheepUseItemReq) Descriptor() ([]byte, []int) {
+ return file_capturesheep_capturesheep_msg_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *CapturesheepUseItemReq) GetId() int32 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+//捕养大赛使用道具
+type CapturesheepUseItemResp struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+}
+
+func (x *CapturesheepUseItemResp) Reset() {
+ *x = CapturesheepUseItemResp{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_capturesheep_capturesheep_msg_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CapturesheepUseItemResp) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CapturesheepUseItemResp) ProtoMessage() {}
+
+func (x *CapturesheepUseItemResp) ProtoReflect() protoreflect.Message {
+ mi := &file_capturesheep_capturesheep_msg_proto_msgTypes[7]
+ 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 CapturesheepUseItemResp.ProtoReflect.Descriptor instead.
+func (*CapturesheepUseItemResp) Descriptor() ([]byte, []int) {
+ return file_capturesheep_capturesheep_msg_proto_rawDescGZIP(), []int{7}
+}
+
+//捕养大赛使用道具
+type CapturesheepOverReq struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Race *DBCaptureSheepRace `protobuf:"bytes,1,opt,name=race,proto3" json:"race"` //比赛数据
+}
+
+func (x *CapturesheepOverReq) Reset() {
+ *x = CapturesheepOverReq{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_capturesheep_capturesheep_msg_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CapturesheepOverReq) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CapturesheepOverReq) ProtoMessage() {}
+
+func (x *CapturesheepOverReq) ProtoReflect() protoreflect.Message {
+ mi := &file_capturesheep_capturesheep_msg_proto_msgTypes[8]
+ 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 CapturesheepOverReq.ProtoReflect.Descriptor instead.
+func (*CapturesheepOverReq) Descriptor() ([]byte, []int) {
+ return file_capturesheep_capturesheep_msg_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *CapturesheepOverReq) GetRace() *DBCaptureSheepRace {
+ if x != nil {
+ return x.Race
+ }
+ return nil
+}
+
+//捕养大赛使用道具
+type CapturesheepOverResp struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+}
+
+func (x *CapturesheepOverResp) Reset() {
+ *x = CapturesheepOverResp{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_capturesheep_capturesheep_msg_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CapturesheepOverResp) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CapturesheepOverResp) ProtoMessage() {}
+
+func (x *CapturesheepOverResp) ProtoReflect() protoreflect.Message {
+ mi := &file_capturesheep_capturesheep_msg_proto_msgTypes[9]
+ 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 CapturesheepOverResp.ProtoReflect.Descriptor instead.
+func (*CapturesheepOverResp) Descriptor() ([]byte, []int) {
+ return file_capturesheep_capturesheep_msg_proto_rawDescGZIP(), []int{9}
+}
+
var File_capturesheep_capturesheep_msg_proto protoreflect.FileDescriptor
var file_capturesheep_capturesheep_msg_proto_rawDesc = []byte{
@@ -344,8 +518,18 @@ var file_capturesheep_capturesheep_msg_proto_rawDesc = []byte{
0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x65,
0x74, 0x69, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x04, 0x72, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x13, 0x2e, 0x44, 0x42, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x53, 0x68,
- 0x65, 0x65, 0x70, 0x52, 0x61, 0x63, 0x65, 0x52, 0x04, 0x72, 0x61, 0x63, 0x65, 0x42, 0x06, 0x5a,
- 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x65, 0x65, 0x70, 0x52, 0x61, 0x63, 0x65, 0x52, 0x04, 0x72, 0x61, 0x63, 0x65, 0x22, 0x28, 0x0a,
+ 0x16, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x73, 0x68, 0x65, 0x65, 0x70, 0x55, 0x73, 0x65,
+ 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x19, 0x0a, 0x17, 0x43, 0x61, 0x70, 0x74, 0x75,
+ 0x72, 0x65, 0x73, 0x68, 0x65, 0x65, 0x70, 0x55, 0x73, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65,
+ 0x73, 0x70, 0x22, 0x3e, 0x0a, 0x13, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x73, 0x68, 0x65,
+ 0x65, 0x70, 0x4f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x27, 0x0a, 0x04, 0x72, 0x61, 0x63,
+ 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x44, 0x42, 0x43, 0x61, 0x70, 0x74,
+ 0x75, 0x72, 0x65, 0x53, 0x68, 0x65, 0x65, 0x70, 0x52, 0x61, 0x63, 0x65, 0x52, 0x04, 0x72, 0x61,
+ 0x63, 0x65, 0x22, 0x16, 0x0a, 0x14, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x73, 0x68, 0x65,
+ 0x65, 0x70, 0x4f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
+ 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -360,7 +544,7 @@ func file_capturesheep_capturesheep_msg_proto_rawDescGZIP() []byte {
return file_capturesheep_capturesheep_msg_proto_rawDescData
}
-var file_capturesheep_capturesheep_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
+var file_capturesheep_capturesheep_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_capturesheep_capturesheep_msg_proto_goTypes = []interface{}{
(*CapturesheepInfoReq)(nil), // 0: CapturesheepInfoReq
(*CapturesheepInfoResp)(nil), // 1: CapturesheepInfoResp
@@ -368,19 +552,24 @@ var file_capturesheep_capturesheep_msg_proto_goTypes = []interface{}{
(*CapturesheepChangeMtsResp)(nil), // 3: CapturesheepChangeMtsResp
(*CapturesheepMatcheReq)(nil), // 4: CapturesheepMatcheReq
(*CapturesheepMatcheResp)(nil), // 5: CapturesheepMatcheResp
- (*DBCaptureSheep)(nil), // 6: DBCaptureSheep
- (CaptureSheepRaceType)(0), // 7: CaptureSheepRaceType
- (*DBCaptureSheepRace)(nil), // 8: DBCaptureSheepRace
+ (*CapturesheepUseItemReq)(nil), // 6: CapturesheepUseItemReq
+ (*CapturesheepUseItemResp)(nil), // 7: CapturesheepUseItemResp
+ (*CapturesheepOverReq)(nil), // 8: CapturesheepOverReq
+ (*CapturesheepOverResp)(nil), // 9: CapturesheepOverResp
+ (*DBCaptureSheep)(nil), // 10: DBCaptureSheep
+ (CaptureSheepRaceType)(0), // 11: CaptureSheepRaceType
+ (*DBCaptureSheepRace)(nil), // 12: DBCaptureSheepRace
}
var file_capturesheep_capturesheep_msg_proto_depIdxs = []int32{
- 6, // 0: CapturesheepInfoResp.info:type_name -> DBCaptureSheep
- 7, // 1: CapturesheepMatcheReq.rtype:type_name -> CaptureSheepRaceType
- 8, // 2: CapturesheepMatcheResp.race:type_name -> DBCaptureSheepRace
- 3, // [3:3] is the sub-list for method output_type
- 3, // [3:3] is the sub-list for method input_type
- 3, // [3:3] is the sub-list for extension type_name
- 3, // [3:3] is the sub-list for extension extendee
- 0, // [0:3] is the sub-list for field type_name
+ 10, // 0: CapturesheepInfoResp.info:type_name -> DBCaptureSheep
+ 11, // 1: CapturesheepMatcheReq.rtype:type_name -> CaptureSheepRaceType
+ 12, // 2: CapturesheepMatcheResp.race:type_name -> DBCaptureSheepRace
+ 12, // 3: CapturesheepOverReq.race:type_name -> DBCaptureSheepRace
+ 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
+ 4, // [4:4] is the sub-list for extension extendee
+ 0, // [0:4] is the sub-list for field type_name
}
func init() { file_capturesheep_capturesheep_msg_proto_init() }
@@ -462,6 +651,54 @@ func file_capturesheep_capturesheep_msg_proto_init() {
return nil
}
}
+ file_capturesheep_capturesheep_msg_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CapturesheepUseItemReq); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_capturesheep_capturesheep_msg_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CapturesheepUseItemResp); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_capturesheep_capturesheep_msg_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CapturesheepOverReq); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_capturesheep_capturesheep_msg_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CapturesheepOverResp); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
}
type x struct{}
out := protoimpl.TypeBuilder{
@@ -469,7 +706,7 @@ func file_capturesheep_capturesheep_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_capturesheep_capturesheep_msg_proto_rawDesc,
NumEnums: 0,
- NumMessages: 6,
+ NumMessages: 10,
NumExtensions: 0,
NumServices: 0,
},
diff --git a/services/worker/main.go b/services/worker/main.go
index d162ea12d..e4e3d92b0 100644
--- a/services/worker/main.go
+++ b/services/worker/main.go
@@ -11,6 +11,7 @@ import (
"go_dreamfactory/modules/battle"
"go_dreamfactory/modules/battlerecord"
"go_dreamfactory/modules/buried"
+ "go_dreamfactory/modules/capturesheep"
"go_dreamfactory/modules/caravan"
"go_dreamfactory/modules/chat"
"go_dreamfactory/modules/combat"
@@ -158,6 +159,7 @@ func main() {
battlerecord.NewModule(),
weektask.NewModule(),
dragon.NewModule(),
+ capturesheep.NewModule(),
)
}
diff --git a/sys/configure/structs/Game.Qualifying.go b/sys/configure/structs/Game.Qualifying.go
new file mode 100644
index 000000000..725796289
--- /dev/null
+++ b/sys/configure/structs/Game.Qualifying.go
@@ -0,0 +1,42 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+package cfg
+
+type GameQualifying struct {
+ _dataMap map[int32]*GameQualifyingData
+ _dataList []*GameQualifyingData
+}
+
+func NewGameQualifying(_buf []map[string]interface{}) (*GameQualifying, error) {
+ _dataList := make([]*GameQualifyingData, 0, len(_buf))
+ dataMap := make(map[int32]*GameQualifyingData)
+ for _, _ele_ := range _buf {
+ if _v, err2 := DeserializeGameQualifyingData(_ele_); err2 != nil {
+ return nil, err2
+ } else {
+ _dataList = append(_dataList, _v)
+ dataMap[_v.LvId] = _v
+ }
+ }
+ return &GameQualifying{_dataList:_dataList, _dataMap:dataMap}, nil
+}
+
+func (table *GameQualifying) GetDataMap() map[int32]*GameQualifyingData {
+ return table._dataMap
+}
+
+func (table *GameQualifying) GetDataList() []*GameQualifyingData {
+ return table._dataList
+}
+
+func (table *GameQualifying) Get(key int32) *GameQualifyingData {
+ return table._dataMap[key]
+}
+
+
diff --git a/sys/configure/structs/Game.QualifyingData.go b/sys/configure/structs/Game.QualifyingData.go
new file mode 100644
index 000000000..7796cd39c
--- /dev/null
+++ b/sys/configure/structs/Game.QualifyingData.go
@@ -0,0 +1,60 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+package cfg
+
+import "errors"
+
+type GameQualifyingData struct {
+ LvId int32
+ ScoreLow int32
+ ScoreUp int32
+ Name string
+ WinReward []*Gameatn
+ Png string
+ KValue float32
+}
+
+const TypeId_GameQualifyingData = 141547579
+
+func (*GameQualifyingData) GetTypeId() int32 {
+ return 141547579
+}
+
+func (_v *GameQualifyingData)Deserialize(_buf map[string]interface{}) (err error) {
+ { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lv_id"].(float64); !_ok_ { err = errors.New("lv_id error"); return }; _v.LvId = int32(_tempNum_) }
+ { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["score_low"].(float64); !_ok_ { err = errors.New("score_low error"); return }; _v.ScoreLow = int32(_tempNum_) }
+ { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["score_up"].(float64); !_ok_ { err = errors.New("score_up error"); return }; _v.ScoreUp = int32(_tempNum_) }
+ {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["name"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Name error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Name, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
+ {
+ var _arr_ []interface{}
+ var _ok_ bool
+ if _arr_, _ok_ = _buf["win_reward"].([]interface{}); !_ok_ { err = errors.New("win_reward error"); return }
+
+ _v.WinReward = make([]*Gameatn, 0, len(_arr_))
+
+ for _, _e_ := range _arr_ {
+ var _list_v_ *Gameatn
+ { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
+ _v.WinReward = append(_v.WinReward, _list_v_)
+ }
+ }
+
+ { var _ok_ bool; if _v.Png, _ok_ = _buf["png"].(string); !_ok_ { err = errors.New("png error"); return } }
+ { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["k_value"].(float64); !_ok_ { err = errors.New("k_value error"); return }; _v.KValue = float32(_tempNum_) }
+ return
+}
+
+func DeserializeGameQualifyingData(_buf map[string]interface{}) (*GameQualifyingData, error) {
+ v := &GameQualifyingData{}
+ if err := v.Deserialize(_buf); err == nil {
+ return v, nil
+ } else {
+ return nil, err
+ }
+}
diff --git a/sys/configure/structs/Tables.go b/sys/configure/structs/Tables.go
index 1fc361824..f0afb2ae8 100644
--- a/sys/configure/structs/Tables.go
+++ b/sys/configure/structs/Tables.go
@@ -255,6 +255,7 @@ type Tables struct {
MainAchievement *GameMainAchievement
MainBoss *GameMainBoss
Trainlv *GameTrainlv
+ Qualifying *GameQualifying
DragonPlay *GameDragonPlay
DragonPlot *GameDragonPlot
}
@@ -1728,6 +1729,12 @@ func NewTables(loader JsonLoader) (*Tables, error) {
if tables.Trainlv, err = NewGameTrainlv(buf) ; err != nil {
return nil, err
}
+ if buf, err = loader("game_qualifying") ; err != nil {
+ return nil, err
+ }
+ if tables.Qualifying, err = NewGameQualifying(buf) ; err != nil {
+ return nil, err
+ }
if buf, err = loader("game_dragonplay") ; err != nil {
return nil, err
}