联盟学院

This commit is contained in:
liwei1dao 2022-11-07 12:05:18 +08:00
parent 62b2f74a84
commit 2281db681e
14 changed files with 876 additions and 208 deletions

396
bin/json/game_teaching.json Normal file
View File

@ -0,0 +1,396 @@
[
{
"id": 10001,
"suittype": 1,
"desc": {
"key": "mainline_desc_10001",
"text": "在实战中学习能够影响攻击力和防御力的技能作用"
},
"tips": {
"key": "mainline_desc_10001",
"text": "在实战中学习能够影响攻击力和防御力的技能作用"
},
"task": [
1,
2,
11
],
"us_FormatList": [
101091
],
"FormatList": [
101091
],
"award": [
{
"a": "attr",
"t": "gold",
"n": 1650
}
]
},
{
"id": 10002,
"suittype": 1,
"desc": {
"key": "",
"text": ""
},
"tips": {
"key": "",
"text": ""
},
"task": [],
"us_FormatList": [
101091
],
"FormatList": [
101091
],
"award": [
{
"a": "attr",
"t": "gold",
"n": 1650
}
]
},
{
"id": 10003,
"suittype": 1,
"desc": {
"key": "",
"text": ""
},
"tips": {
"key": "",
"text": ""
},
"task": [],
"us_FormatList": [
101091
],
"FormatList": [
101091
],
"award": [
{
"a": "attr",
"t": "gold",
"n": 1650
}
]
},
{
"id": 20001,
"suittype": 2,
"desc": {
"key": "mainline_desc_10001",
"text": "在实战中学习能够影响攻击力和防御力的技能作用"
},
"tips": {
"key": "",
"text": ""
},
"task": [],
"us_FormatList": [
101091
],
"FormatList": [
101091
],
"award": [
{
"a": "attr",
"t": "gold",
"n": 1650
}
]
},
{
"id": 20002,
"suittype": 2,
"desc": {
"key": "",
"text": ""
},
"tips": {
"key": "",
"text": ""
},
"task": [],
"us_FormatList": [
101091
],
"FormatList": [
101091
],
"award": [
{
"a": "attr",
"t": "gold",
"n": 1650
}
]
},
{
"id": 20003,
"suittype": 2,
"desc": {
"key": "",
"text": ""
},
"tips": {
"key": "",
"text": ""
},
"task": [],
"us_FormatList": [
101091
],
"FormatList": [
101091
],
"award": [
{
"a": "attr",
"t": "gold",
"n": 1650
}
]
},
{
"id": 30001,
"suittype": 3,
"desc": {
"key": "mainline_desc_10001",
"text": "在实战中学习能够影响攻击力和防御力的技能作用"
},
"tips": {
"key": "",
"text": ""
},
"task": [],
"us_FormatList": [
101091
],
"FormatList": [
101091
],
"award": [
{
"a": "attr",
"t": "gold",
"n": 1650
}
]
},
{
"id": 30002,
"suittype": 3,
"desc": {
"key": "",
"text": ""
},
"tips": {
"key": "",
"text": ""
},
"task": [],
"us_FormatList": [
101091
],
"FormatList": [
101091
],
"award": [
{
"a": "attr",
"t": "gold",
"n": 1650
}
]
},
{
"id": 30003,
"suittype": 3,
"desc": {
"key": "",
"text": ""
},
"tips": {
"key": "",
"text": ""
},
"task": [],
"us_FormatList": [
101091
],
"FormatList": [
101091
],
"award": [
{
"a": "attr",
"t": "gold",
"n": 1650
}
]
},
{
"id": 40001,
"suittype": 4,
"desc": {
"key": "mainline_desc_10001",
"text": "在实战中学习能够影响攻击力和防御力的技能作用"
},
"tips": {
"key": "",
"text": ""
},
"task": [],
"us_FormatList": [
101091
],
"FormatList": [
101091
],
"award": [
{
"a": "attr",
"t": "gold",
"n": 1650
}
]
},
{
"id": 40002,
"suittype": 4,
"desc": {
"key": "",
"text": ""
},
"tips": {
"key": "",
"text": ""
},
"task": [],
"us_FormatList": [
101091
],
"FormatList": [
101091
],
"award": [
{
"a": "attr",
"t": "gold",
"n": 1650
}
]
},
{
"id": 40003,
"suittype": 4,
"desc": {
"key": "",
"text": ""
},
"tips": {
"key": "",
"text": ""
},
"task": [],
"us_FormatList": [
101091
],
"FormatList": [
101091
],
"award": [
{
"a": "attr",
"t": "gold",
"n": 1650
}
]
},
{
"id": 50001,
"suittype": 5,
"desc": {
"key": "mainline_desc_10001",
"text": "在实战中学习能够影响攻击力和防御力的技能作用"
},
"tips": {
"key": "",
"text": ""
},
"task": [],
"us_FormatList": [
101091
],
"FormatList": [
101091
],
"award": [
{
"a": "attr",
"t": "gold",
"n": 1650
}
]
},
{
"id": 50002,
"suittype": 5,
"desc": {
"key": "",
"text": ""
},
"tips": {
"key": "",
"text": ""
},
"task": [],
"us_FormatList": [
101091
],
"FormatList": [
101091
],
"award": [
{
"a": "attr",
"t": "gold",
"n": 1650
}
]
},
{
"id": 50003,
"suittype": 5,
"desc": {
"key": "",
"text": ""
},
"tips": {
"key": "",
"text": ""
},
"task": [],
"us_FormatList": [
101091
],
"FormatList": [
101091
],
"award": [
{
"a": "attr",
"t": "gold",
"n": 1650
}
]
}
]

View File

@ -185,6 +185,8 @@ const (
TablePayDaily = "paydaily"
// 巨怪列车收益记录
TableTrollRecord = "trollrecord"
//联盟学院
TableAcademy = "academy"
)
//RPC服务接口定义处

View File

@ -3,6 +3,7 @@ package academy
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"google.golang.org/protobuf/proto"
)
@ -16,7 +17,9 @@ func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.AcademyCh
///挑战
func (this *apiComp) Challenge(session comm.IUserSession, req *pb.AcademyChallengeReq) (code pb.ErrorCode, data proto.Message) {
var (
level *cfg.GameTeachingData
record *pb.DBBattleRecord
err error
cd pb.ErrorCode
)
defer func() {
@ -39,5 +42,14 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.AcademyChallen
return
}
if level, err = this.module.configure.getGameTeaching(req.Level); err != nil {
cd = pb.ErrorCode_DBError
return
}
cd, record = this.module.battle.CreateEveBattle(session, &pb.BattleEVEReq{
Ptype: pb.PlayType_academy,
Redformat: level.UsFormatList,
Buleformat: level.FormatList,
})
return
}

View File

@ -15,11 +15,17 @@ func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.AcademyInfoReq
///获取自己的排行榜信息
func (this *apiComp) Info(session comm.IUserSession, req *pb.AcademyInfoReq) (code pb.ErrorCode, data proto.Message) {
var ()
var (
info *pb.DBAcademy
err error
)
if code = this.InfoCheck(session, req); code != pb.ErrorCode_Success {
return
}
session.SendMsg(string(this.module.GetType()), "info", &pb.AcademyInfoResp{})
if info, err = this.module.modelAcademy.queryInfo(session.GetUserId()); err != nil {
code = pb.ErrorCode_DBError
return
}
session.SendMsg(string(this.module.GetType()), "info", &pb.AcademyInfoResp{Info: info})
return
}

View File

@ -0,0 +1,61 @@
package academy
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) RewardCheck(session comm.IUserSession, req *pb.AcademyReceiveReq) (code pb.ErrorCode) {
return
}
///奖励领取
func (this *apiComp) Reward(session comm.IUserSession, req *pb.AcademyReceiveReq) (code pb.ErrorCode, data proto.Message) {
var (
iswin bool
level *cfg.GameTeachingData
info *pb.DBAcademy
// group []*cfg.GameTeachingData
err error
)
if code = this.RewardCheck(session, req); code != pb.ErrorCode_Success {
return
}
if code, iswin = this.module.battle.CheckBattleReport(session, req.Report); code != pb.ErrorCode_Success {
return
}
if iswin {
if info, err = this.module.modelAcademy.queryInfo(session.GetUserId()); err != nil {
code = pb.ErrorCode_DBError
return
}
if !info.Level[req.Level] {
info.Level[req.Level] = true
}
if err = this.module.modelAcademy.updateInfo(info); err != nil {
code = pb.ErrorCode_DBError
return
}
if level, err = this.module.configure.getGameTeaching(req.Level); err != nil {
code = pb.ErrorCode_DBError
return
}
// if group, err = this.module.configure.getGameTeachingByGroup(req.Group); err != nil {
// code = pb.ErrorCode_ConfigNoFound
// return
// }
// for _, v := range group {
// if !info.Level[v.Id] {
// return
// }
// }
this.module.DispenseRes(session, level.Award, true)
}
return
}

View File

@ -1,23 +1,59 @@
package academy
import (
"go_dreamfactory/modules"
"fmt"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
)
const (
game_equipment = "game_equipment.json"
game_teaching = "game_teaching.json"
)
///背包配置管理组件
type configureComp struct {
modules.MCompConfigure
module *Academy
}
//组件初始化接口
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.MCompConfigure.Init(service, module, comp, options)
this.module = module.(*Academy)
this.LoadConfigure(game_teaching, cfg.NewGameTeaching)
return
}
//查询管卡表
func (this *configureComp) getGameTeaching(id int32) (result *cfg.GameTeachingData, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(game_teaching); err != nil {
this.module.Errorln(err)
} else {
if result, ok = v.(*cfg.GameTeaching).GetDataMap()[id]; !ok {
err = fmt.Errorf("on found GameMonster:%s", id)
this.module.Errorln(err)
}
}
return
}
//查询管卡表
func (this *configureComp) getGameTeachingByGroup(group int32) (result []*cfg.GameTeachingData, err error) {
var (
v interface{}
)
if v, err = this.GetConfigure(game_teaching); err != nil {
this.module.Errorln(err)
} else {
result = make([]*cfg.GameTeachingData, 0)
for _, v := range v.(*cfg.GameTeaching).GetDataMap() {
result = append(result, v)
}
}
return
}

View File

@ -0,0 +1,55 @@
package academy
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/mgo"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
)
///论坛 数据组件
type modelAcademyComp struct {
modules.MCompModel
module *Academy
}
//组件初始化接口
func (this *modelAcademyComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) {
this.TableName = comm.TableAcademy
this.MCompModel.Init(service, module, comp, opt)
this.module = module.(*Academy)
//创建uid索引
// this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
// Keys: bsonx.Doc{{Key: "heroid", Value: bsonx.Int32(1)}},
// })
return
}
//查询用户装备数据
func (this *modelAcademyComp) queryInfo(uId string) (result *pb.DBAcademy, err error) {
result = &pb.DBAcademy{
Uid: uId,
Level: make(map[int32]bool),
}
if err = this.Get(uId, result); err != nil && err != mgo.MongodbNil {
this.module.Errorln(err)
return
}
if err == mgo.MongodbNil {
err = nil
}
return
}
///保存用户竞技场信息
func (this *modelAcademyComp) updateInfo(info *pb.DBAcademy) (err error) {
if err = this.Change(info.Uid, map[string]interface{}{
"level": info.Level,
}); err != nil {
this.module.Errorln(err)
return
}
return
}

View File

@ -1,157 +0,0 @@
package academy
import (
"context"
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/redis"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go_dreamfactory/sys/db"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
)
///论坛 数据组件
type modelForumComp struct {
modules.MCompModel
module *Academy
}
//组件初始化接口
func (this *modelForumComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) {
this.TableName = comm.TableForum
this.MCompModel.Init(service, module, comp, opt)
this.module = module.(*Academy)
//创建uid索引
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "heroid", Value: bsonx.Int32(1)}},
})
return
}
//查询用户未读消息
func (this *modelForumComp) getComment(herocId string) (result []*pb.DBComment, err error) {
var (
key string
c *mongo.Cursor
n int
max_chat int32
)
result = make([]*pb.DBComment, 0)
key = fmt.Sprintf("%s:%s", this.TableName, herocId)
err = this.GetQueues(key, 10, &result)
if err == redis.RedisNil {
//query from mgo
if c, err = this.DB.Find(core.SqlTable(this.TableName), bson.M{"heroid": herocId}); err != nil {
return
} else {
result = make([]*pb.DBComment, c.RemainingBatchLength())
for c.Next(context.Background()) {
chat := &pb.DBComment{}
if err = c.Decode(chat); err != nil {
this.module.Errorf("err:%v", err)
}
result[n] = chat
n++
}
if len(result) > 0 {
this.addCommentChache(key, int64(max_chat), result...)
}
}
}
return
}
///发布评论
func (this *modelForumComp) releaseComment(comment *pb.DBComment) (err error) {
key := fmt.Sprintf("%s:%s", this.TableName, comment.Heroid)
if err = this.addCommentChache(key, 99, comment); err != nil {
this.module.Errorln(err)
return
}
if _, err = this.DB.InsertOne(core.SqlTable(this.TableName), comment); err != nil {
this.module.Errorln(err)
return
}
return
}
//添加评论到缓存中
func (this *modelForumComp) addCommentChache(key string, count int64, msgs ...*pb.DBComment) (err error) {
var (
data map[string]*pb.DBComment = make(map[string]*pb.DBComment, len(msgs))
)
for _, v := range msgs {
data[fmt.Sprintf("%s-%s", key, v.Id)] = v
}
if _, err = this.AddQueues(key, count, data); err != nil {
this.module.Errorln(err)
return
}
return
}
//点赞
func (this *modelForumComp) like(heroid, id string, islike bool) (comment *pb.DBComment, err error) {
comment = &pb.DBComment{}
key := fmt.Sprintf("%s:%s-%s", this.TableName, heroid, id)
if err = this.Redis.HGetAll(key, comment); err != nil && err != redis.RedisNil {
this.module.Errorln(err)
return
}
if err == redis.RedisNil {
if err = this.DB.FindOne(comm.TableHero, bson.M{"_id": id}).Decode(comment); err != nil {
return
}
}
if islike {
comment.Starlist++
} else {
comment.Starlist--
}
if err = this.Redis.HMSet(key, map[string]interface{}{
"starlist": comment.Starlist,
}); err != nil {
return
}
this.DB.UpdateOne(comm.TableHero, bson.M{"_id": id}, bson.M{"starlist": comment.Starlist})
return
}
//查看
func (this *modelForumComp) watchHero(stage string, uid string, herocid string) (hero *pb.DBHero, err error) {
var (
tcoon *db.DBConn
c *mongo.Cursor
)
if tcoon, err = db.ServerDBConn(stage); err != nil {
this.module.Errorf("stage:%s err:%v", stage, err)
return
}
if c, err = tcoon.Mgo.Find(comm.TableHero, bson.M{"uid": uid, "heroID": herocid}); err != nil {
return
} else {
n := 0
result := make([]*pb.DBHero, c.RemainingBatchLength())
for c.Next(context.Background()) {
hero := &pb.DBHero{}
if err = c.Decode(hero); err != nil {
this.module.Errorf("err:%v", err)
}
result[n] = hero
n++
}
for _, v := range result {
if hero == nil || hero.Lv < v.Lv {
hero = v
}
}
}
return
}

View File

@ -2,6 +2,7 @@ package academy
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
@ -18,9 +19,11 @@ func NewModule() core.IModule {
type Academy struct {
modules.ModuleBase
api_comp *apiComp
configure *configureComp
modelForum *modelForumComp
service base.IRPCXService
battle comm.IBattle
api_comp *apiComp
configure *configureComp
modelAcademy *modelAcademyComp
}
//模块名
@ -31,6 +34,18 @@ func (this *Academy) GetType() core.M_Modules {
//模块初始化接口 注册用户创建角色事件
func (this *Academy) 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 *Academy) 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
}
@ -38,6 +53,6 @@ func (this *Academy) Init(service core.IService, module core.IModule, options co
func (this *Academy) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelForum = this.RegisterComp(new(modelForumComp)).(*modelForumComp)
this.modelAcademy = this.RegisterComp(new(modelAcademyComp)).(*modelAcademyComp)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
}

View File

@ -25,6 +25,9 @@ type DBAcademy struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"`
Level map[int32]bool `protobuf:"bytes,2,rep,name=level,proto3" json:"level" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
}
func (x *DBAcademy) Reset() {
@ -59,13 +62,35 @@ func (*DBAcademy) Descriptor() ([]byte, []int) {
return file_academy_academy_db_proto_rawDescGZIP(), []int{0}
}
func (x *DBAcademy) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
func (x *DBAcademy) GetLevel() map[int32]bool {
if x != nil {
return x.Level
}
return nil
}
var File_academy_academy_db_proto protoreflect.FileDescriptor
var file_academy_academy_db_proto_rawDesc = []byte{
0x0a, 0x18, 0x61, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x2f, 0x61, 0x63, 0x61, 0x64, 0x65, 0x6d,
0x79, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0b, 0x0a, 0x09, 0x44, 0x42,
0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x79, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x84, 0x01, 0x0a, 0x09, 0x44,
0x42, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x2b, 0x0a, 0x05, 0x6c, 0x65,
0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x44, 0x42, 0x41, 0x63,
0x61, 0x64, 0x65, 0x6d, 0x79, 0x2e, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x1a, 0x38, 0x0a, 0x0a, 0x4c, 0x65, 0x76, 0x65, 0x6c,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38,
0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (
@ -80,16 +105,18 @@ func file_academy_academy_db_proto_rawDescGZIP() []byte {
return file_academy_academy_db_proto_rawDescData
}
var file_academy_academy_db_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_academy_academy_db_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_academy_academy_db_proto_goTypes = []interface{}{
(*DBAcademy)(nil), // 0: DBAcademy
nil, // 1: DBAcademy.LevelEntry
}
var file_academy_academy_db_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
1, // 0: DBAcademy.level:type_name -> DBAcademy.LevelEntry
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_academy_academy_db_proto_init() }
@ -117,7 +144,7 @@ func file_academy_academy_db_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_academy_academy_db_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -63,6 +63,8 @@ type AcademyInfoResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Info *DBAcademy `protobuf:"bytes,1,opt,name=info,proto3" json:"info"`
}
func (x *AcademyInfoResp) Reset() {
@ -97,11 +99,20 @@ func (*AcademyInfoResp) Descriptor() ([]byte, []int) {
return file_academy_academy_msg_proto_rawDescGZIP(), []int{1}
}
func (x *AcademyInfoResp) GetInfo() *DBAcademy {
if x != nil {
return x.Info
}
return nil
}
//挑战
type AcademyChallengeReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Level int32 `protobuf:"varint,1,opt,name=level,proto3" json:"level"`
}
func (x *AcademyChallengeReq) Reset() {
@ -136,6 +147,13 @@ func (*AcademyChallengeReq) Descriptor() ([]byte, []int) {
return file_academy_academy_msg_proto_rawDescGZIP(), []int{2}
}
func (x *AcademyChallengeReq) GetLevel() int32 {
if x != nil {
return x.Level
}
return 0
}
type AcademyChallengeResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -196,6 +214,10 @@ type AcademyReceiveReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Level int32 `protobuf:"varint,1,opt,name=level,proto3" json:"level"`
Group int32 `protobuf:"varint,2,opt,name=group,proto3" json:"group"`
Report *BattleReport `protobuf:"bytes,3,opt,name=report,proto3" json:"report"` //战报
}
func (x *AcademyReceiveReq) Reset() {
@ -230,10 +252,33 @@ func (*AcademyReceiveReq) Descriptor() ([]byte, []int) {
return file_academy_academy_msg_proto_rawDescGZIP(), []int{4}
}
func (x *AcademyReceiveReq) GetLevel() int32 {
if x != nil {
return x.Level
}
return 0
}
func (x *AcademyReceiveReq) GetGroup() int32 {
if x != nil {
return x.Group
}
return 0
}
func (x *AcademyReceiveReq) GetReport() *BattleReport {
if x != nil {
return x.Report
}
return nil
}
type AcademyReceiveResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Issucc bool `protobuf:"varint,1,opt,name=issucc,proto3" json:"issucc"`
}
func (x *AcademyReceiveResp) Reset() {
@ -268,27 +313,45 @@ func (*AcademyReceiveResp) Descriptor() ([]byte, []int) {
return file_academy_academy_msg_proto_rawDescGZIP(), []int{5}
}
func (x *AcademyReceiveResp) GetIssucc() bool {
if x != nil {
return x.Issucc
}
return false
}
var File_academy_academy_msg_proto protoreflect.FileDescriptor
var file_academy_academy_msg_proto_rawDesc = []byte{
0x0a, 0x19, 0x61, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x2f, 0x61, 0x63, 0x61, 0x64, 0x65, 0x6d,
0x79, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x62, 0x61, 0x74,
0x74, 0x6c, 0x65, 0x2f, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x10, 0x0a, 0x0e, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79,
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x22, 0x11, 0x0a, 0x0f, 0x41, 0x63, 0x61, 0x64, 0x65,
0x6d, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x22, 0x15, 0x0a, 0x13, 0x41, 0x63,
0x61, 0x64, 0x65, 0x6d, 0x79, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65,
0x71, 0x22, 0x57, 0x0a, 0x14, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x43, 0x68, 0x61, 0x6c,
0x79, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x63, 0x61,
0x64, 0x65, 0x6d, 0x79, 0x2f, 0x61, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x5f, 0x64, 0x62, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x2f, 0x62, 0x61,
0x74, 0x74, 0x6c, 0x65, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f,
0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
0x10, 0x0a, 0x0e, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65,
0x71, 0x22, 0x31, 0x0a, 0x0f, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x49, 0x6e, 0x66, 0x6f,
0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x52, 0x04,
0x69, 0x6e, 0x66, 0x6f, 0x22, 0x2b, 0x0a, 0x13, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x43,
0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x6c,
0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65,
0x6c, 0x22, 0x57, 0x0a, 0x14, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x43, 0x68, 0x61, 0x6c,
0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x63, 0x6f, 0x64,
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, 0x13, 0x0a, 0x11, 0x41, 0x63,
0x61, 0x64, 0x65, 0x6d, 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x22,
0x14, 0x0a, 0x12, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76,
0x65, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x66, 0x0a, 0x11, 0x41, 0x63,
0x61, 0x64, 0x65, 0x6d, 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12,
0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x25, 0x0a, 0x06, 0x72,
0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 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, 0x2c, 0x0a, 0x12, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x52, 0x65, 0x63,
0x65, 0x69, 0x76, 0x65, 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,
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -311,17 +374,21 @@ var file_academy_academy_msg_proto_goTypes = []interface{}{
(*AcademyChallengeResp)(nil), // 3: AcademyChallengeResp
(*AcademyReceiveReq)(nil), // 4: AcademyReceiveReq
(*AcademyReceiveResp)(nil), // 5: AcademyReceiveResp
(ErrorCode)(0), // 6: ErrorCode
(*BattleInfo)(nil), // 7: BattleInfo
(*DBAcademy)(nil), // 6: DBAcademy
(ErrorCode)(0), // 7: ErrorCode
(*BattleInfo)(nil), // 8: BattleInfo
(*BattleReport)(nil), // 9: BattleReport
}
var file_academy_academy_msg_proto_depIdxs = []int32{
6, // 0: AcademyChallengeResp.code:type_name -> ErrorCode
7, // 1: AcademyChallengeResp.info:type_name -> BattleInfo
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
6, // 0: AcademyInfoResp.info:type_name -> DBAcademy
7, // 1: AcademyChallengeResp.code:type_name -> ErrorCode
8, // 2: AcademyChallengeResp.info:type_name -> BattleInfo
9, // 3: AcademyReceiveReq.report:type_name -> BattleReport
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_academy_academy_msg_proto_init() }
@ -329,6 +396,7 @@ func file_academy_academy_msg_proto_init() {
if File_academy_academy_msg_proto != nil {
return
}
file_academy_academy_db_proto_init()
file_battle_battle_msg_proto_init()
file_errorcode_proto_init()
if !protoimpl.UnsafeEnabled {

View File

@ -87,6 +87,7 @@ const (
PlayType_viking PlayType = 5 //维京远征
PlayType_moonfantasy PlayType = 6 //月之秘境
PlayType_arena PlayType = 7 //竞技场
PlayType_academy PlayType = 8 //联盟学院
)
// Enum value maps for PlayType.
@ -100,6 +101,7 @@ var (
5: "viking",
6: "moonfantasy",
7: "arena",
8: "academy",
}
PlayType_value = map[string]int32{
"null": 0,
@ -110,6 +112,7 @@ var (
"viking": 5,
"moonfantasy": 6,
"arena": 7,
"academy": 8,
}
)
@ -641,20 +644,21 @@ var file_battle_battle_db_proto_rawDesc = []byte{
0x39, 0x0a, 0x0a, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a,
0x03, 0x6e, 0x69, 0x6c, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x70, 0x76, 0x65, 0x10, 0x01, 0x12,
0x07, 0x0a, 0x03, 0x70, 0x76, 0x70, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x70, 0x76, 0x62, 0x10,
0x03, 0x12, 0x07, 0x0a, 0x03, 0x65, 0x76, 0x65, 0x10, 0x04, 0x2a, 0x6e, 0x0a, 0x08, 0x50, 0x6c,
0x03, 0x12, 0x07, 0x0a, 0x03, 0x65, 0x76, 0x65, 0x10, 0x04, 0x2a, 0x7b, 0x0a, 0x08, 0x50, 0x6c,
0x61, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x6e, 0x75, 0x6c, 0x6c, 0x10, 0x00,
0x12, 0x0c, 0x0a, 0x08, 0x6d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x10, 0x01, 0x12, 0x0a,
0x0a, 0x06, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x72, 0x74,
0x61, 0x73, 0x6b, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x68, 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67,
0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x69, 0x6b, 0x69, 0x6e, 0x67, 0x10, 0x05, 0x12, 0x0f,
0x0a, 0x0b, 0x6d, 0x6f, 0x6f, 0x6e, 0x66, 0x61, 0x6e, 0x74, 0x61, 0x73, 0x79, 0x10, 0x06, 0x12,
0x09, 0x0a, 0x05, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x10, 0x07, 0x2a, 0x1f, 0x0a, 0x0c, 0x42, 0x42,
0x61, 0x74, 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x69, 0x6e,
0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x10, 0x02, 0x2a, 0x2b, 0x0a, 0x0c, 0x44,
0x42, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x12, 0x08, 0x0a, 0x04, 0x64,
0x72, 0x61, 0x77, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x10, 0x01, 0x12, 0x08,
0x0a, 0x04, 0x62, 0x75, 0x6c, 0x65, 0x10, 0x02, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x09, 0x0a, 0x05, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x10, 0x07, 0x12, 0x0b, 0x0a, 0x07, 0x61, 0x63,
0x61, 0x64, 0x65, 0x6d, 0x79, 0x10, 0x08, 0x2a, 0x1f, 0x0a, 0x0c, 0x42, 0x42, 0x61, 0x74, 0x74,
0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x69, 0x6e, 0x10, 0x00, 0x12,
0x07, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x10, 0x02, 0x2a, 0x2b, 0x0a, 0x0c, 0x44, 0x42, 0x42, 0x61,
0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x12, 0x08, 0x0a, 0x04, 0x64, 0x72, 0x61, 0x77,
0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x62,
0x75, 0x6c, 0x65, 0x10, 0x02, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
type GameTeaching struct {
_dataMap map[int32]*GameTeachingData
_dataList []*GameTeachingData
}
func NewGameTeaching(_buf []map[string]interface{}) (*GameTeaching, error) {
_dataList := make([]*GameTeachingData, 0, len(_buf))
dataMap := make(map[int32]*GameTeachingData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameTeachingData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameTeaching{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameTeaching) GetDataMap() map[int32]*GameTeachingData {
return table._dataMap
}
func (table *GameTeaching) GetDataList() []*GameTeachingData {
return table._dataList
}
func (table *GameTeaching) Get(key int32) *GameTeachingData {
return table._dataMap[key]
}

View File

@ -0,0 +1,101 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
import "errors"
type GameTeachingData struct {
Id int32
Suittype int32
Desc string
Tips string
Task []int32
UsFormatList []int32
FormatList []int32
Award []*Gameatn
}
const TypeId_GameTeachingData = -468541165
func (*GameTeachingData) GetTypeId() int32 {
return -468541165
}
func (_v *GameTeachingData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["suittype"].(float64); !_ok_ { err = errors.New("suittype error"); return }; _v.Suittype = int32(_tempNum_) }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["desc"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Desc error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Desc, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["tips"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Tips error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Tips, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["task"].([]interface{}); !_ok_ { err = errors.New("task error"); return }
_v.Task = make([]int32, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ int32
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
_v.Task = append(_v.Task, _list_v_)
}
}
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["us_FormatList"].([]interface{}); !_ok_ { err = errors.New("us_FormatList error"); return }
_v.UsFormatList = make([]int32, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ int32
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
_v.UsFormatList = append(_v.UsFormatList, _list_v_)
}
}
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["FormatList"].([]interface{}); !_ok_ { err = errors.New("FormatList error"); return }
_v.FormatList = make([]int32, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ int32
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
_v.FormatList = append(_v.FormatList, _list_v_)
}
}
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["award"].([]interface{}); !_ok_ { err = errors.New("award error"); return }
_v.Award = 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.Award = append(_v.Award, _list_v_)
}
}
return
}
func DeserializeGameTeachingData(_buf map[string]interface{}) (*GameTeachingData, error) {
v := &GameTeachingData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}