From 3f464ddd9416a1fe056824d233bd8f23113b9f86 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 23 Feb 2023 19:07:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A6=E9=A6=86=E5=9B=BE=E9=89=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_vikingboss.json | 252 +++++++++++++++++++++-------- comm/const.go | 2 + modules/atlas/api.go | 26 +++ modules/atlas/api_atlasactivate.go | 23 +++ modules/atlas/api_atlasaward.go | 21 +++ modules/atlas/api_getatlas.go | 26 +++ modules/atlas/comp_configure.go | 43 +++++ modules/atlas/model_atlas.go | 62 +++++++ modules/atlas/module.go | 45 ++++++ modules/smithy/api_rise.go | 2 +- 10 files changed, 438 insertions(+), 64 deletions(-) create mode 100644 modules/atlas/api.go create mode 100644 modules/atlas/api_atlasactivate.go create mode 100644 modules/atlas/api_atlasaward.go create mode 100644 modules/atlas/api_getatlas.go create mode 100644 modules/atlas/comp_configure.go create mode 100644 modules/atlas/model_atlas.go create mode 100644 modules/atlas/module.go diff --git a/bin/json/game_vikingboss.json b/bin/json/game_vikingboss.json index 419601971..684d66594 100644 --- a/bin/json/game_vikingboss.json +++ b/bin/json/game_vikingboss.json @@ -60,7 +60,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301011 + 301011, + 301012, + 301013 ], "ps_consume": [ { @@ -138,7 +140,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301014 + 301014, + 301015, + 301016 ], "ps_consume": [ { @@ -216,7 +220,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301017 + 301017, + 301018, + 301019 ], "ps_consume": [ { @@ -294,7 +300,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301020 + 301020, + 301021, + 301022 ], "ps_consume": [ { @@ -372,7 +380,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301023 + 301023, + 301024, + 301025 ], "ps_consume": [ { @@ -450,7 +460,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301026 + 301026, + 301027, + 301028 ], "ps_consume": [ { @@ -528,7 +540,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301029 + 301029, + 301030, + 301031 ], "ps_consume": [ { @@ -606,7 +620,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301032 + 301032, + 301033, + 301034 ], "ps_consume": [ { @@ -684,7 +700,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301035 + 301035, + 301036, + 301037 ], "ps_consume": [ { @@ -762,7 +780,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301038 + 301038, + 301039, + 301040 ], "ps_consume": [ { @@ -840,7 +860,9 @@ "bossmodel": 11003, "boss_skill": 51004, "boss": [ - 302011 + 302011, + 302012, + 302013 ], "ps_consume": [ { @@ -918,7 +940,9 @@ "bossmodel": 11003, "boss_skill": 51004, "boss": [ - 302014 + 302014, + 302015, + 302016 ], "ps_consume": [ { @@ -996,7 +1020,9 @@ "bossmodel": 11003, "boss_skill": 51004, "boss": [ - 302017 + 302017, + 302018, + 302019 ], "ps_consume": [ { @@ -1074,7 +1100,9 @@ "bossmodel": 11003, "boss_skill": 51004, "boss": [ - 302020 + 302020, + 302021, + 302022 ], "ps_consume": [ { @@ -1152,7 +1180,9 @@ "bossmodel": 11003, "boss_skill": 51004, "boss": [ - 302023 + 302023, + 302024, + 302025 ], "ps_consume": [ { @@ -1230,7 +1260,9 @@ "bossmodel": 11003, "boss_skill": 51004, "boss": [ - 302026 + 302026, + 302027, + 302028 ], "ps_consume": [ { @@ -1308,7 +1340,9 @@ "bossmodel": 11003, "boss_skill": 51004, "boss": [ - 302029 + 302029, + 302030, + 302031 ], "ps_consume": [ { @@ -1386,7 +1420,9 @@ "bossmodel": 11003, "boss_skill": 51004, "boss": [ - 302032 + 302032, + 302033, + 302034 ], "ps_consume": [ { @@ -1464,7 +1500,9 @@ "bossmodel": 11003, "boss_skill": 51004, "boss": [ - 302035 + 302035, + 302036, + 302037 ], "ps_consume": [ { @@ -1542,7 +1580,9 @@ "bossmodel": 11003, "boss_skill": 51004, "boss": [ - 302038 + 302038, + 302039, + 302040 ], "ps_consume": [ { @@ -1620,7 +1660,9 @@ "bossmodel": 11018, "boss_skill": 51004, "boss": [ - 303011 + 303011, + 303012, + 303013 ], "ps_consume": [ { @@ -1698,7 +1740,9 @@ "bossmodel": 11018, "boss_skill": 51004, "boss": [ - 303014 + 303014, + 303015, + 303016 ], "ps_consume": [ { @@ -1776,7 +1820,9 @@ "bossmodel": 11018, "boss_skill": 51004, "boss": [ - 303017 + 303017, + 303018, + 303019 ], "ps_consume": [ { @@ -1854,7 +1900,9 @@ "bossmodel": 11018, "boss_skill": 51004, "boss": [ - 303020 + 303020, + 303021, + 303022 ], "ps_consume": [ { @@ -1932,7 +1980,9 @@ "bossmodel": 11018, "boss_skill": 51004, "boss": [ - 303023 + 303023, + 303024, + 303025 ], "ps_consume": [ { @@ -2010,7 +2060,9 @@ "bossmodel": 11018, "boss_skill": 51004, "boss": [ - 303026 + 303026, + 303027, + 303028 ], "ps_consume": [ { @@ -2088,7 +2140,9 @@ "bossmodel": 11018, "boss_skill": 51004, "boss": [ - 303029 + 303029, + 303030, + 303031 ], "ps_consume": [ { @@ -2166,7 +2220,9 @@ "bossmodel": 11018, "boss_skill": 51004, "boss": [ - 303032 + 303032, + 303033, + 303034 ], "ps_consume": [ { @@ -2244,7 +2300,9 @@ "bossmodel": 11018, "boss_skill": 51004, "boss": [ - 303035 + 303035, + 303036, + 303037 ], "ps_consume": [ { @@ -2322,7 +2380,9 @@ "bossmodel": 11018, "boss_skill": 51004, "boss": [ - 303038 + 303038, + 303039, + 303040 ], "ps_consume": [ { @@ -2390,7 +2450,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301011 + 301011, + 301012, + 301013 ], "ps_consume": [ { @@ -2458,7 +2520,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301014 + 301014, + 301015, + 301016 ], "ps_consume": [ { @@ -2526,7 +2590,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301017 + 301017, + 301018, + 301019 ], "ps_consume": [ { @@ -2594,7 +2660,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301020 + 301020, + 301021, + 301022 ], "ps_consume": [ { @@ -2662,7 +2730,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301023 + 301023, + 301024, + 301025 ], "ps_consume": [ { @@ -2730,7 +2800,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301026 + 301026, + 301027, + 301028 ], "ps_consume": [ { @@ -2798,7 +2870,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301029 + 301029, + 301030, + 301031 ], "ps_consume": [ { @@ -2866,7 +2940,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301032 + 301032, + 301033, + 301034 ], "ps_consume": [ { @@ -2934,7 +3010,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301035 + 301035, + 301036, + 301037 ], "ps_consume": [ { @@ -3002,7 +3080,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301038 + 301038, + 301039, + 301040 ], "ps_consume": [ { @@ -3070,7 +3150,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301011 + 301011, + 301012, + 301013 ], "ps_consume": [ { @@ -3138,7 +3220,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301014 + 301014, + 301015, + 301016 ], "ps_consume": [ { @@ -3206,7 +3290,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301017 + 301017, + 301018, + 301019 ], "ps_consume": [ { @@ -3274,7 +3360,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301020 + 301020, + 301021, + 301022 ], "ps_consume": [ { @@ -3342,7 +3430,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301023 + 301023, + 301024, + 301025 ], "ps_consume": [ { @@ -3410,7 +3500,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301026 + 301026, + 301027, + 301028 ], "ps_consume": [ { @@ -3478,7 +3570,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301029 + 301029, + 301030, + 301031 ], "ps_consume": [ { @@ -3546,7 +3640,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301032 + 301032, + 301033, + 301034 ], "ps_consume": [ { @@ -3614,7 +3710,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301035 + 301035, + 301036, + 301037 ], "ps_consume": [ { @@ -3682,7 +3780,9 @@ "bossmodel": 11009, "boss_skill": 51004, "boss": [ - 301038 + 301038, + 301039, + 301040 ], "ps_consume": [ { @@ -3755,7 +3855,9 @@ "bossmodel": 1001, "boss_skill": 51004, "boss": [ - 11009 + 301038, + 301039, + 301040 ], "ps_consume": [ { @@ -3828,7 +3930,9 @@ "bossmodel": 1002, "boss_skill": 51004, "boss": [ - 11009 + 301038, + 301039, + 301040 ], "ps_consume": [ { @@ -3901,7 +4005,9 @@ "bossmodel": 1003, "boss_skill": 51004, "boss": [ - 11009 + 301038, + 301039, + 301040 ], "ps_consume": [ { @@ -3974,7 +4080,9 @@ "bossmodel": 1004, "boss_skill": 51004, "boss": [ - 11009 + 301038, + 301039, + 301040 ], "ps_consume": [ { @@ -4047,7 +4155,9 @@ "bossmodel": 1011, "boss_skill": 51004, "boss": [ - 11003 + 301038, + 301039, + 301040 ], "ps_consume": [ { @@ -4120,7 +4230,9 @@ "bossmodel": 1012, "boss_skill": 51004, "boss": [ - 11003 + 301038, + 301039, + 301040 ], "ps_consume": [ { @@ -4193,7 +4305,9 @@ "bossmodel": 1013, "boss_skill": 51004, "boss": [ - 11003 + 301038, + 301039, + 301040 ], "ps_consume": [ { @@ -4266,7 +4380,9 @@ "bossmodel": 1014, "boss_skill": 51004, "boss": [ - 11003 + 301038, + 301039, + 301040 ], "ps_consume": [ { @@ -4339,7 +4455,9 @@ "bossmodel": 1021, "boss_skill": 51004, "boss": [ - 11018 + 301038, + 301039, + 301040 ], "ps_consume": [ { @@ -4412,7 +4530,9 @@ "bossmodel": 1022, "boss_skill": 51004, "boss": [ - 11018 + 301038, + 301039, + 301040 ], "ps_consume": [ { @@ -4485,7 +4605,9 @@ "bossmodel": 1023, "boss_skill": 51004, "boss": [ - 11018 + 301038, + 301039, + 301040 ], "ps_consume": [ { @@ -4558,7 +4680,9 @@ "bossmodel": 1024, "boss_skill": 51004, "boss": [ - 11018 + 301038, + 301039, + 301040 ], "ps_consume": [ { @@ -4631,7 +4755,9 @@ "bossmodel": 1001, "boss_skill": 51004, "boss": [ - 11009 + 301038, + 301039, + 301040 ], "ps_consume": [ { diff --git a/comm/const.go b/comm/const.go index 4bc6d8de0..2cc8776bc 100644 --- a/comm/const.go +++ b/comm/const.go @@ -237,6 +237,8 @@ const ( TablePandata = "pandata" // 熊猫武馆派遣 TableDispatch = "dispatch" + + TablePandaAtlas = "pandaatlas" ) // RPC服务接口定义处 diff --git a/modules/atlas/api.go b/modules/atlas/api.go new file mode 100644 index 000000000..32bd8321e --- /dev/null +++ b/modules/atlas/api.go @@ -0,0 +1,26 @@ +package atlas + +import ( + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" +) + +type apiComp struct { + modules.MCompGate + service core.IService + module *PandaAtlas +} + +//组件初始化接口 +func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + err = this.MCompGate.Init(service, module, comp, options) + this.module = module.(*PandaAtlas) + this.service = service + return +} + +func (this *apiComp) Start() (err error) { + err = this.MCompGate.Start() + + return +} diff --git a/modules/atlas/api_atlasactivate.go b/modules/atlas/api_atlasactivate.go new file mode 100644 index 000000000..49e6c943c --- /dev/null +++ b/modules/atlas/api_atlasactivate.go @@ -0,0 +1,23 @@ +package atlas + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" +) + +//参数校验 +func (this *apiComp) ActivateCheck(session comm.IUserSession, req *pb.AtlasActivateReq) (code pb.ErrorCode) { + if req.Id == "" { + code = pb.ErrorCode_ReqParameterError + } + return +} + +// 激活图鉴信息 +func (this *apiComp) Activate(session comm.IUserSession, req *pb.AtlasActivateReq) (code pb.ErrorCode, data proto.Message) { + + session.SendMsg(string(this.module.GetType()), "activate", &pb.AtlasActivateResp{}) + return +} diff --git a/modules/atlas/api_atlasaward.go b/modules/atlas/api_atlasaward.go new file mode 100644 index 000000000..bbc588a24 --- /dev/null +++ b/modules/atlas/api_atlasaward.go @@ -0,0 +1,21 @@ +package atlas + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" +) + +//参数校验 +func (this *apiComp) AwardCheck(session comm.IUserSession, req *pb.AtlasAwardReq) (code pb.ErrorCode) { + + return +} + +// 获取铁匠铺图鉴信息 +func (this *apiComp) Award(session comm.IUserSession, req *pb.AtlasAwardReq) (code pb.ErrorCode, data proto.Message) { + + session.SendMsg(string(this.module.GetType()), "award", &pb.AtlasAwardResp{}) + return +} diff --git a/modules/atlas/api_getatlas.go b/modules/atlas/api_getatlas.go new file mode 100644 index 000000000..aa27b6856 --- /dev/null +++ b/modules/atlas/api_getatlas.go @@ -0,0 +1,26 @@ +package atlas + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" +) + +//参数校验 +func (this *apiComp) AtlasListCheck(session comm.IUserSession, req *pb.SmithyAtlasListReq) (code pb.ErrorCode) { + + return +} + +// 获取铁匠铺图鉴信息 +func (this *apiComp) AtlasList(session comm.IUserSession, req *pb.SmithyAtlasListReq) (code pb.ErrorCode, data proto.Message) { + + code = this.AtlasListCheck(session, req) + if code != pb.ErrorCode_Success { + return // 参数校验失败直接返回 + } + + session.SendMsg(string(this.module.GetType()), "atlaslist", &pb.SmithyAtlasListResp{}) + return +} diff --git a/modules/atlas/comp_configure.go b/modules/atlas/comp_configure.go new file mode 100644 index 000000000..2814420ea --- /dev/null +++ b/modules/atlas/comp_configure.go @@ -0,0 +1,43 @@ +package atlas + +import ( + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/log" + "go_dreamfactory/modules" + "go_dreamfactory/sys/configure" + "sync" +) + +const () + +// /配置管理基础组件 +type configureComp struct { + modules.MCompConfigure + module *PandaAtlas + hlock sync.RWMutex +} + +// 组件初始化接口 +func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + err = this.MCompConfigure.Init(service, module, comp, options) + this.module = module.(*PandaAtlas) + + return +} + +// 加载多个配置文件 +func (this *configureComp) LoadMultiConfigure(confs map[string]interface{}) (err error) { + for k, v := range confs { + err = configure.RegisterConfigure(k, v, nil) + if err != nil { + log.Errorf("配置文件:%s解析失败!", k) + break + } + } + return +} + +// 读取配置数据 +func (this *configureComp) GetConfigure(name string) (v interface{}, err error) { + return configure.GetConfigure(name) +} diff --git a/modules/atlas/model_atlas.go b/modules/atlas/model_atlas.go new file mode 100644 index 000000000..3464c0d75 --- /dev/null +++ b/modules/atlas/model_atlas.go @@ -0,0 +1,62 @@ +package atlas + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" + "go_dreamfactory/pb" + + "go.mongodb.org/mongo-driver/bson/primitive" + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/x/bsonx" +) + +type modelPandaAtlas struct { + modules.MCompModel + module *PandaAtlas +} + +func (this *modelPandaAtlas) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + this.TableName = string(comm.TablePandaAtlas) + err = this.MCompModel.Init(service, module, comp, options) + this.module = module.(*PandaAtlas) + // uid 创建索引 + this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ + Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, + }) + return +} + +func (this *modelPandaAtlas) getPandaAtlasList(uid string) (result *pb.DBPandaAtlas, err error) { + result = &pb.DBPandaAtlas{ + Collect: map[string]*pb.Collect{}, + } + if err = this.Get(uid, result); err != nil { + if mongo.ErrNoDocuments == err { + result.Id = primitive.NewObjectID().Hex() + result.Uid = uid + + result.Collect = make(map[string]*pb.Collect, 0) + result.Award = 1 // 初始1级 + this.Add(uid, result) + err = nil + } + return + } + return +} + +func (this *modelPandaAtlas) modifyPandaAtlasList(uid string, data map[string]interface{}) error { + return this.Change(uid, data) +} + +// 检查是否激活图鉴 +func (this *modelPandaAtlas) CheckActivateAtlas(uid string, id string, lv int32, quality int32, forgeCount int32) bool { + + return true +} + +// 检查是否激活收藏品 +func (this *modelPandaAtlas) CheckActivatePandaAtlas(uid string, id string) { + +} diff --git a/modules/atlas/module.go b/modules/atlas/module.go new file mode 100644 index 000000000..6c850c228 --- /dev/null +++ b/modules/atlas/module.go @@ -0,0 +1,45 @@ +/* +模块名:atlas +描述:武馆图鉴模块 +开发:梅雄风 +*/ +package atlas + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" + "go_dreamfactory/pb" +) + +type PandaAtlas struct { + modules.ModuleBase + api *apiComp + modelPandaAtlas *modelPandaAtlas +} + +func NewModule() core.IModule { + return &PandaAtlas{} +} + +func (this *PandaAtlas) GetType() core.M_Modules { + return comm.ModuleSmithy +} + +func (this *PandaAtlas) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { + err = this.ModuleBase.Init(service, module, options) + + return +} + +func (this *PandaAtlas) OnInstallComp() { + this.ModuleBase.OnInstallComp() + this.api = this.RegisterComp(new(apiComp)).(*apiComp) + + this.modelPandaAtlas = this.RegisterComp(new(modelPandaAtlas)).(*modelPandaAtlas) +} + +func (this *PandaAtlas) CheckActivateAtlasCollect(uid string, id string) (code pb.ErrorCode) { + + return +} diff --git a/modules/smithy/api_rise.go b/modules/smithy/api_rise.go index 29f354afe..7e2c7f7d1 100644 --- a/modules/smithy/api_rise.go +++ b/modules/smithy/api_rise.go @@ -10,7 +10,7 @@ import ( //参数校验 func (this *apiComp) RiseCheck(session comm.IUserSession, req *pb.SmithyRiseReq) (code pb.ErrorCode) { - if req.ItemId != "" && req.Count == 0 { + if req.ItemId != "" && req.Count > 0 { code = pb.ErrorCode_ReqParameterError } return