铁匠铺

This commit is contained in:
meixiongfeng 2022-08-19 18:19:43 +08:00
parent 597d7b1e12
commit 52cebd0430
21 changed files with 4396 additions and 6 deletions

1799
bin/json/game_smithy.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,719 @@
[
{
"id": 1001,
"star": 1,
"starshow": {
"key": "smithy_name_1001",
"text": "木质"
},
"before": -1,
"starupneed": [
{
"a": "item",
"t": "50001",
"n": 5
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "1",
"floors": 1,
"time": 300,
"desk": ""
},
{
"id": 1002,
"star": 2,
"starshow": {
"key": "smithy_name_1002",
"text": "石质"
},
"before": 1,
"starupneed": [
{
"a": "item",
"t": "50001",
"n": 10
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "1",
"floors": 1,
"time": 300,
"desk": ""
},
{
"id": 1003,
"star": 3,
"starshow": {
"key": "smithy_name_1003",
"text": "铁质"
},
"before": 2,
"starupneed": [
{
"a": "item",
"t": "50001",
"n": 15
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "1",
"floors": 1,
"time": 300,
"desk": ""
},
{
"id": 1004,
"star": 4,
"starshow": {
"key": "smithy_name_1004",
"text": "钢质"
},
"before": 3,
"starupneed": [
{
"a": "item",
"t": "50001",
"n": 20
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "0.8",
"floors": 2,
"time": 300,
"desk": ""
},
{
"id": 1005,
"star": 5,
"starshow": {
"key": "smithy_name_1005",
"text": "铂金质"
},
"before": 4,
"starupneed": [
{
"a": "item",
"t": "50001",
"n": 25
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "0.7",
"floors": 3,
"time": 300,
"desk": ""
},
{
"id": 1006,
"star": 6,
"starshow": {
"key": "smithy_name_1006",
"text": "钻石质"
},
"before": 5,
"starupneed": [
{
"a": "item",
"t": "50001",
"n": 30
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "0.6",
"floors": 4,
"time": 300,
"desk": ""
},
{
"id": 1007,
"star": 7,
"starshow": {
"key": "smithy_name_1007",
"text": "星耀石质"
},
"before": 6,
"starupneed": [
{
"a": "item",
"t": "50001",
"n": 35
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "0.5",
"floors": 5,
"time": 300,
"desk": ""
},
{
"id": 1008,
"star": 8,
"starshow": {
"key": "smithy_name_1008",
"text": "星陨石质"
},
"before": 7,
"starupneed": [
{
"a": "item",
"t": "50001",
"n": 40
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "0.4",
"floors": 5,
"time": 300,
"desk": ""
},
{
"id": 1009,
"star": 9,
"starshow": {
"key": "smithy_name_1009",
"text": "星核质"
},
"before": 8,
"starupneed": [
{
"a": "item",
"t": "50001",
"n": 45
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "0.3",
"floors": 5,
"time": 300,
"desk": ""
},
{
"id": 1010,
"star": 10,
"starshow": {
"key": "smithy_name_1010",
"text": "宇宙粒子质"
},
"before": 9,
"starupneed": [],
"sucess": "-1",
"floors": -1,
"time": 300,
"desk": ""
},
{
"id": 1011,
"star": 11,
"starshow": {
"key": "smithy_name_1001",
"text": "木质"
},
"before": 10,
"starupneed": [
{
"a": "item",
"t": "50002",
"n": 5
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "1",
"floors": 1,
"time": 500,
"desk": ""
},
{
"id": 1012,
"star": 12,
"starshow": {
"key": "smithy_name_1002",
"text": "石质"
},
"before": 11,
"starupneed": [
{
"a": "item",
"t": "50002",
"n": 10
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "1",
"floors": 1,
"time": 500,
"desk": ""
},
{
"id": 1013,
"star": 13,
"starshow": {
"key": "smithy_name_1003",
"text": "铁质"
},
"before": 12,
"starupneed": [
{
"a": "item",
"t": "50002",
"n": 15
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "1",
"floors": 1,
"time": 500,
"desk": ""
},
{
"id": 1014,
"star": 14,
"starshow": {
"key": "smithy_name_1004",
"text": "钢质"
},
"before": 13,
"starupneed": [
{
"a": "item",
"t": "50002",
"n": 20
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "0.8",
"floors": 2,
"time": 500,
"desk": ""
},
{
"id": 1015,
"star": 15,
"starshow": {
"key": "smithy_name_1005",
"text": "铂金质"
},
"before": 14,
"starupneed": [
{
"a": "item",
"t": "50002",
"n": 25
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "0.7",
"floors": 3,
"time": 500,
"desk": ""
},
{
"id": 1016,
"star": 16,
"starshow": {
"key": "smithy_name_1006",
"text": "钻石质"
},
"before": 15,
"starupneed": [
{
"a": "item",
"t": "50002",
"n": 30
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "0.6",
"floors": 4,
"time": 500,
"desk": ""
},
{
"id": 1017,
"star": 17,
"starshow": {
"key": "smithy_name_1007",
"text": "星耀石质"
},
"before": 16,
"starupneed": [
{
"a": "item",
"t": "50002",
"n": 35
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "0.5",
"floors": 5,
"time": 500,
"desk": ""
},
{
"id": 1018,
"star": 18,
"starshow": {
"key": "smithy_name_1008",
"text": "星陨石质"
},
"before": 17,
"starupneed": [
{
"a": "item",
"t": "50002",
"n": 40
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "0.4",
"floors": 5,
"time": 500,
"desk": ""
},
{
"id": 1019,
"star": 19,
"starshow": {
"key": "smithy_name_1009",
"text": "星核质"
},
"before": 18,
"starupneed": [
{
"a": "item",
"t": "50002",
"n": 45
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "0.3",
"floors": 5,
"time": 500,
"desk": ""
},
{
"id": 1020,
"star": 20,
"starshow": {
"key": "smithy_name_1010",
"text": "宇宙粒子质"
},
"before": 19,
"starupneed": [],
"sucess": "-1",
"floors": -1,
"time": 500,
"desk": ""
},
{
"id": 1021,
"star": 21,
"starshow": {
"key": "smithy_name_1001",
"text": "木质"
},
"before": 20,
"starupneed": [
{
"a": "item",
"t": "50003",
"n": 5
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "1",
"floors": 1,
"time": 1000,
"desk": ""
},
{
"id": 1022,
"star": 22,
"starshow": {
"key": "smithy_name_1002",
"text": "石质"
},
"before": 21,
"starupneed": [
{
"a": "item",
"t": "50003",
"n": 10
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "1",
"floors": 1,
"time": 1000,
"desk": ""
},
{
"id": 1023,
"star": 23,
"starshow": {
"key": "smithy_name_1003",
"text": "铁质"
},
"before": 22,
"starupneed": [
{
"a": "item",
"t": "50003",
"n": 15
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "1",
"floors": 1,
"time": 1000,
"desk": ""
},
{
"id": 1024,
"star": 24,
"starshow": {
"key": "smithy_name_1004",
"text": "钢质"
},
"before": 23,
"starupneed": [
{
"a": "item",
"t": "50003",
"n": 20
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "0.8",
"floors": 2,
"time": 1000,
"desk": ""
},
{
"id": 1025,
"star": 25,
"starshow": {
"key": "smithy_name_1005",
"text": "铂金质"
},
"before": 24,
"starupneed": [
{
"a": "item",
"t": "50003",
"n": 25
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "0.7",
"floors": 3,
"time": 1000,
"desk": ""
},
{
"id": 1026,
"star": 26,
"starshow": {
"key": "smithy_name_1006",
"text": "钻石质"
},
"before": 25,
"starupneed": [
{
"a": "item",
"t": "50003",
"n": 30
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "0.6",
"floors": 4,
"time": 1000,
"desk": ""
},
{
"id": 1027,
"star": 27,
"starshow": {
"key": "smithy_name_1007",
"text": "星耀石质"
},
"before": 26,
"starupneed": [
{
"a": "item",
"t": "50003",
"n": 35
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "0.5",
"floors": 5,
"time": 1000,
"desk": ""
},
{
"id": 1028,
"star": 28,
"starshow": {
"key": "smithy_name_1008",
"text": "星陨石质"
},
"before": 27,
"starupneed": [
{
"a": "item",
"t": "50003",
"n": 40
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "0.4",
"floors": 5,
"time": 1000,
"desk": ""
},
{
"id": 1029,
"star": 29,
"starshow": {
"key": "smithy_name_1009",
"text": "星核质"
},
"before": 28,
"starupneed": [
{
"a": "item",
"t": "50003",
"n": 45
},
{
"a": "item",
"t": "10013",
"n": 1
}
],
"sucess": "0.3",
"floors": 5,
"time": 1000,
"desk": ""
},
{
"id": 1030,
"star": 30,
"starshow": {
"key": "smithy_name_1010",
"text": "宇宙粒子质"
},
"before": 29,
"starupneed": [],
"sucess": "-1",
"floors": -1,
"time": 1000,
"desk": ""
}
]

View File

@ -53,6 +53,7 @@ const (
ModuleMartialhall core.M_Modules = "martialhall" //武馆模块 ModuleMartialhall core.M_Modules = "martialhall" //武馆模块
ModuleGourmet core.M_Modules = "gourmet" //美食馆 ModuleGourmet core.M_Modules = "gourmet" //美食馆
ModuleRtask core.M_Modules = "rtask" //随机任务 ModuleRtask core.M_Modules = "rtask" //随机任务
ModuleSmithy core.M_Modules = "smithy" //铁匠铺
) )
//数据表名定义处 //数据表名定义处
@ -105,6 +106,8 @@ const (
TableRtask = "rtask" TableRtask = "rtask"
///爬塔排行 ///爬塔排行
TablePagodaRank = "pagodarank" TablePagodaRank = "pagodarank"
/// 美食馆
TableSmithy = "smithy"
) )
//RPC服务接口定义处 //RPC服务接口定义处

View File

@ -9,7 +9,7 @@ const (
GourmetGetListResp = "getlist" GourmetGetListResp = "getlist"
GourmetCreateOrderResp = "createorder" GourmetCreateOrderResp = "createorder"
GourmetSkillLvResp = "skilllv" GourmetSkillLvResp = "skilllv"
PagodaGetRewardResp = "getreward" GourmetGetRewardResp = "getreward"
) )
type apiComp struct { type apiComp struct {

View File

@ -37,6 +37,6 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.GourmetGetRewa
mapData["items"] = nil mapData["items"] = nil
code = this.module.ModifyGourmetData(session.GetUserId(), mapData) code = this.module.ModifyGourmetData(session.GetUserId(), mapData)
} }
session.SendMsg(string(this.module.GetType()), PagodaGetRewardResp, &pb.GourmetGetRewardResp{Data: _gourmet}) session.SendMsg(string(this.module.GetType()), GourmetGetRewardResp, &pb.GourmetGetRewardResp{Data: _gourmet})
return return
} }

34
modules/smithy/api.go Normal file
View File

@ -0,0 +1,34 @@
package smithy
import (
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
const (
SmithyGetListResp = "getlist"
SmithyCreateOrderResp = "createorder"
SmithySkillLvResp = "skilllv"
SmithyGetRewardResp = "getreward"
)
type apiComp struct {
modules.MCompGate
service core.IService
configure *configureComp
module *Smithy
}
//组件初始化接口
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.(*Smithy)
this.service = service
return
}
func (this *apiComp) Start() (err error) {
err = this.MCompGate.Start()
return
}

View File

@ -0,0 +1,120 @@
package smithy
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"go_dreamfactory/utils"
"time"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) CreateOrderCheck(session comm.IUserSession, req *pb.SmithyCreateOrderReq) (code pb.ErrorCode) {
if len(req.Order) == 0 {
code = pb.ErrorCode_ReqParameterError
return
}
return
}
///美食城创建订单
func (this *apiComp) CreateOrder(session comm.IUserSession, req *pb.SmithyCreateOrderReq) (code pb.ErrorCode, data proto.Message) {
var (
res []*cfg.Gameatn
costTime int32
)
code = this.CreateOrderCheck(session, req)
if code != pb.ErrorCode_Success {
return // 参数校验失败直接返回
}
_smithy, err := this.module.modelSmithy.getSmithyList(session.GetUserId())
if err != nil {
code = pb.ErrorCode_DBError
return
}
_skillCfg := this.module.configure.GetSmithyStoveConfigData(_smithy.StoveLv)
needTime := _skillCfg.Time // 订单需要的时间
for _, order := range req.Order {
if order.Count == 0 {
continue
}
costTime += needTime * order.Count
}
if _smithy.Orders == nil { // 队列数据为nil 直接将订单数据给ta
_smithy.Orders = req.Order
} else {
for _, v := range req.Order {
bFound := false
for _, v1 := range _smithy.Orders {
if v.DeskType == v1.DeskType {
v1.Count += v.Count // 加对应的数量
bFound = true
break
}
}
if !bFound {
_smithy.Orders = append(_smithy.Orders, v)
}
}
}
if _smithy.Clang == nil || (_smithy.Clang != nil && _smithy.Clang.ETime == 0) {
if _smithy.Ctime == 0 {
_smithy.Ctime = time.Now().Unix()
}
if !utils.IsToday(_smithy.Ctime) {
_smithy.Ctime = time.Now().Unix()
_smithy.OrderCostTime = 0
}
for _, v := range _smithy.Orders {
if v.Count > 0 {
v.Count--
// 获取生产时间
_smithy.Clang = &pb.Clang{
DeskType: v.DeskType,
ETime: time.Now().Unix() + int64(needTime),
}
break
}
}
}
// 計算耗時
for _, v := range _smithy.Orders {
if v.Count > 0 {
v.NeedTime = needTime * v.Count
}
}
if _smithy.Clang != nil && _smithy.Clang.ETime == 0 {
_smithy.Clang = nil
}
// 获取总的下单时长
cfgCom := this.module.configure.GetGlobalConf()
if cfgCom == nil {
return
}
if cfgCom.SmithyMaxtime < _smithy.OrderCostTime+costTime { // 大于总时长是不允许的
code = pb.ErrorCode_GourmetMoreOrderTime
return
}
if code = this.module.ConsumeRes(session, res, true); code != pb.ErrorCode_Success { // 消耗校验
return
}
if code = this.module.DispenseRes(session, res, true); code != pb.ErrorCode_Success { // 真正消耗
return
}
// 校验通过 写数据
mapData := make(map[string]interface{}, 0)
mapData["orders"] = _smithy.Orders
mapData["orderCostTime"] = _smithy.OrderCostTime
mapData["clang"] = _smithy.Clang // 正在做的
code = this.module.ModifySmithyData(session.GetUserId(), mapData)
session.SendMsg(string(this.module.GetType()), SmithyCreateOrderResp, &pb.SmithyCreateOrderResp{Data: _smithy})
return
}

View File

@ -0,0 +1,62 @@
package smithy
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) SkillLVCheck(session comm.IUserSession, req *pb.SmithySkillLvReq) (code pb.ErrorCode) {
if req.SkillType == 0 {
code = pb.ErrorCode_ReqParameterError
}
return
}
///美食城厨师技能升级
func (this *apiComp) SkillLV(session comm.IUserSession, req *pb.SmithySkillLvReq) (code pb.ErrorCode, dat proto.Message) {
code = this.SkillLVCheck(session, req)
if code != pb.ErrorCode_Success {
return // 参数校验失败直接返回
}
_smithy, err := this.module.modelSmithy.getSmithyList(session.GetUserId())
if err != nil {
code = pb.ErrorCode_DBError
return
}
// skilllv, ok := _smithy.Skill[req.SkillType]
// if !ok { // 校验技能存不存在
// skilllv, ok = _smithy.Skill[req.SkillType]
// if !ok {
// code = pb.ErrorCode_ReqParameterError
// return
// }
// bSpecial = true
// }
// _skillCfg := this.module.configure.GetSmithyStoveConfigData(skilllv) // 获取技能配置
// code = this.module.ConsumeRes(session, _skillCfg.Starupneed, true) // 消耗检测
// if code != pb.ErrorCode_Success {
// return
// }
// // 概率升级
// n, _ := rand.Int(rand.Reader, big.NewInt(1000))
// if n.Int64() < int64(_skillCfg.Star) { // 可以升级
// // 技能升级成功
// if bSpecial { // 通用技能升级
// _smithy.Skill[req.SkillType] += 1
// this.module.modelSmithy.CalculationSpecialSkillLv(session.GetUserId(), _smithy, req.SkillType, _smithy.Skill[req.SkillType])
// } else { // 某一类型技能升级
// _smithy.Skill[req.SkillType] += 1
// this.module.modelSmithy.CalculationSmithybySkiiLv(session.GetUserId(), _smithy, req.SkillType, _smithy.Skill[req.SkillType])
// }
// }
session.SendMsg(string(this.module.GetType()), SmithySkillLvResp, &pb.SmithySkillLvResp{Data: _smithy})
return
}

View File

@ -0,0 +1,42 @@
package smithy
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) GetRewardCheck(session comm.IUserSession, req *pb.SmithyGetRewardReq) (code pb.ErrorCode) {
return
}
///美食城领取奖励
func (this *apiComp) GetReward(session comm.IUserSession, req *pb.SmithyGetRewardReq) (code pb.ErrorCode, data proto.Message) {
code = this.GetRewardCheck(session, req)
_gourmet, err := this.module.modelSmithy.getSmithyList(session.GetUserId())
if err != nil {
code = pb.ErrorCode_DBError
return
}
if len(_gourmet.Items) > 0 {
res := make([]*cfg.Gameatn, 0)
for _, v := range _gourmet.Items {
res = append(res, &cfg.Gameatn{
A: v.A,
T: v.T,
N: v.N,
})
}
code = this.module.DispenseRes(session, res, true)
_gourmet.Items = nil
mapData := make(map[string]interface{}, 0)
mapData["items"] = nil
code = this.module.ModifySmithyData(session.GetUserId(), mapData)
}
session.SendMsg(string(this.module.GetType()), SmithyGetRewardResp, &pb.SmithyGetRewardResp{Data: _gourmet})
return
}

View File

@ -0,0 +1,32 @@
package smithy
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.SmithyGetListReq) (code pb.ErrorCode) {
return
}
///获取美食城基本信息
func (this *apiComp) GetList(session comm.IUserSession, req *pb.SmithyGetListReq) (code pb.ErrorCode, data proto.Message) {
code = this.GetListCheck(session, req)
if code != pb.ErrorCode_Success {
return // 参数校验失败直接返回
}
_gourmet, err := this.module.modelSmithy.getSmithyList(session.GetUserId())
if err != nil {
code = pb.ErrorCode_DBError
return
}
// 计算订单信息
this.module.modelSmithy.CalculationSmithy(session.GetUserId(), _gourmet)
session.SendMsg(string(this.module.GetType()), SmithyGetListResp, &pb.SmithyGetListResp{Data: _gourmet})
return
}

View File

@ -0,0 +1,121 @@
package smithy
import (
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/core/cbase"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
"sync"
)
const (
game_smithy = "game_smithy.json"
game_smithystove = "game_smithystove.json"
game_drop = "game_drop.json"
)
///配置管理基础组件
type configureComp struct {
cbase.ModuleCompBase
hlock sync.RWMutex
modules.MCompConfigure
_smithyMap map[int64]*cfg.GameSmithyData
_dropMap map[int32][]*cfg.GameDropData // 掉落表 key 是DiropId
}
//组件初始化接口
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.ModuleCompBase.Init(service, module, comp, options)
this._smithyMap = make(map[int64]*cfg.GameSmithyData, 0)
configure.RegisterConfigure(game_smithy, cfg.NewGameSmithy, func() {
if v, err := this.GetConfigure(game_smithy); err == nil {
if configure, ok := v.(*cfg.GameSmithy); ok {
this.hlock.Lock()
defer this.hlock.Unlock()
for _, value := range configure.GetDataList() {
this._smithyMap[int64(value.Type<<16)+int64(value.Star)] = value
}
return
}
}
log.Errorf("get game_pagoda conf err:%v", err)
return
})
this._dropMap = make(map[int32][]*cfg.GameDropData, 0)
configure.RegisterConfigure(game_drop, cfg.NewGameDrop, func() {
if v, err := this.GetConfigure(game_drop); err == nil {
if configure, ok := v.(*cfg.GameDrop); ok {
this.hlock.Lock()
defer this.hlock.Unlock()
for _, value := range configure.GetDataList() {
this._dropMap[value.Dropid] = append(this._dropMap[value.Dropid], value)
}
return
}
}
log.Errorf("get game_pagoda conf err:%v", err)
return
})
// _data := this.GetSmithyConfigData(1002, 4) // 测试配置文件读取
// _dataskill := this.GetSmithyStoveConfigData(1001, 4)
// _data := this.GetDropData(1001)
// fmt.Printf("%v", _data)
err = this.LoadConfigure(game_smithystove, cfg.NewGameSmithyStove)
return
}
// 获取美食馆配置数据
func (this *configureComp) GetSmithyConfigData(smithyType int32, level int32) (data *cfg.GameSmithyData) {
return this._smithyMap[int64(smithyType<<16)+int64(level)]
}
func (this *configureComp) GetSmithyTypeConfigData() (mapType map[int32]struct{}) {
if v, err := this.GetConfigure(game_smithy); err == nil {
if configure, ok := v.(*cfg.GameSmithy); ok {
for _, v1 := range configure.GetDataList() {
if _, ok := mapType[v1.Type]; !ok {
mapType[v1.Type] = struct{}{}
}
}
return
}
}
return
}
// 获取炉子配置数据
func (this *configureComp) GetSmithyStoveConfigData(level int32) (data *cfg.GameSmithyStoveData) {
if v, err := this.GetConfigure(game_smithystove); err == nil {
if configure, ok := v.(*cfg.GameSmithyStove); ok {
data = configure.Get(int32(level))
return
}
}
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)
}
func (this *configureComp) GetDropData(dropId int32) (data []*cfg.GameDropData) {
data = this._dropMap[dropId]
return
}

View File

@ -0,0 +1,198 @@
package smithy
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/redis"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"go_dreamfactory/utils"
"time"
"go.mongodb.org/mongo-driver/bson/primitive"
)
type modelSmithy struct {
modules.MCompModel
module *Smithy
}
func (this *modelSmithy) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.TableName = string(comm.TableSmithy)
err = this.MCompModel.Init(service, module, comp, options)
this.module = module.(*Smithy)
return
}
// 获取铁匠铺信息
func (this *modelSmithy) getSmithyList(uid string) (result *pb.DBSmithy, err error) {
result = &pb.DBSmithy{}
if err = this.Get(uid, result); err != nil {
if redis.RedisNil != err { // 没有数据直接创建新的数据
result.Id = primitive.NewObjectID().Hex()
result.Uid = uid
result.Skill = make(map[int32]int32, 0)
result.StoveLv = 1 // storv 等级默认1级
mapType := this.module.configure.GetSmithyTypeConfigData() // 找类型
for key := range mapType {
result.Skill[key] = 1
}
if err = this.Add(uid, result); err != nil {
this.module.Errorf("err:%v", err)
err = nil
return
}
}
return
}
err = nil
return result, err
}
func (this *modelSmithy) modifySmithyDataByObjId(uid string, data map[string]interface{}) error {
return this.Change(uid, data)
}
// todo 调用drop 表 获取掉落信息
func (this *modelSmithy) GetDropReward(count, dropId int32, Items []*pb.UserAssets) {
res := make([]*cfg.Gameatn, 0)
for i := 0; i < int(count); i++ {
data := this.module.configure.GetDropData(dropId)
szW := make([]int32, 0)
for _, value := range data {
szW = append(szW, value.P)
}
index := comm.GetRandW(szW)
res = append(res, data[index].Prize...)
}
for _, v := range res {
bFind := false
for _, v1 := range Items {
if v.A == v1.A && v.T == v1.T {
v1.N += v.N
bFind = true
}
}
if !bFind {
Items = append(Items, &pb.UserAssets{
A: v.A,
T: v.T,
N: v.N,
})
}
}
return
}
// 计算订单信息
func (this *modelSmithy) CalculationSmithy(uid string, Smithy *pb.DBSmithy) {
var (
bCooking bool
costTime int32
curTime int32
)
mapData := make(map[string]interface{}, 0)
if Smithy.Clang != nil && Smithy.Clang.ETime > 0 {
costTime = int32(time.Now().Unix() - Smithy.Clang.ETime) // 当前过去的时间
if costTime < 0 { // 没有完成 不做处理
return
}
}
if Smithy.Clang == nil {
Smithy.Clang = &pb.Clang{}
}
for _, order := range Smithy.Orders {
if order.Count == 0 {
continue
}
foodtype := order.DeskType
// 获取技能等级
skillLv := Smithy.Skill[foodtype]
// 计算出需要的时间
_skillCfg := this.module.configure.GetSmithyStoveConfigData(skillLv) // 技能配置表
_Smithycfg := this.module.configure.GetSmithyConfigData(foodtype, skillLv) // 美食家配置表
for i := 0; i < int(order.Count); i++ {
curTime += _skillCfg.Time
// 判断是不是第二天
if Smithy.Clang.ETime == 0 {
Smithy.Clang.ETime = time.Now().Unix()
}
if !utils.IsToday(Smithy.Clang.ETime + int64(curTime)) { // 判断是不是今天
// 跨天了
Smithy.Clang.ETime = Smithy.Clang.ETime + int64(curTime) // 设置下单的时间
Smithy.Ctime = Smithy.Clang.ETime // 设置创建订单时间
Smithy.OrderCostTime = 0 // 清空当天的订单时长
}
order.Count--
this.GetDropReward(1, _Smithycfg.Drop, Smithy.Items) // 获取掉落奖励
if curTime > costTime {
Smithy.OrderCostTime += int32(curTime - costTime)
// 转时间戳
eTimd := time.Now().Unix() + int64(curTime-costTime)
Smithy.Clang.DeskType = order.DeskType
Smithy.Clang.ETime = eTimd
bCooking = true
// 记录下订单时间
Smithy.Ctime = time.Now().Unix()
mapData["ctime"] = Smithy.Ctime
break
}
Smithy.OrderCostTime += curTime
}
if bCooking { // 分配了正在製作的食物
break
}
}
if !bCooking { // 经过计算没有烹饪食物的时候
Smithy.Clang = nil
}
// 保存信息
mapData["orders"] = Smithy.Orders
mapData["orderCostTime"] = Smithy.OrderCostTime
mapData["clang"] = Smithy.Clang // 正在做的
this.module.ModifySmithyData(uid, mapData)
}
// 技能等级提高了 重新计算订单时间(只对订单中数据有影响)
func (this *modelSmithy) CalculationSmithybySkiiLv(uid string, Smithy *pb.DBSmithy, skillType int32, skilllv int32) {
mapData := make(map[string]interface{}, 0)
for _, v := range Smithy.Orders {
if v.DeskType > 0 && v.DeskType == skillType {
_skillCfg := this.module.configure.GetSmithyStoveConfigData(skilllv)
if _skillCfg != nil {
v.NeedTime = _skillCfg.Time * v.Count
mapData["orders"] = Smithy.Orders
}
break
}
}
mapData["skill"] = Smithy.Skill
this.module.ModifySmithyData(uid, mapData)
}
// 升级高效制作技能重计算时间消耗
func (this *modelSmithy) CalculationSpecialSkillLv(uid string, Smithy *pb.DBSmithy, skillType int32, skilllv int32) {
mapData := make(map[string]interface{}, 0)
for _, v := range Smithy.Orders {
if v.Count > 0 {
_skillCfg := this.module.configure.GetSmithyStoveConfigData(skilllv)
if _skillCfg != nil {
v.NeedTime += _skillCfg.Time * v.Count
if v.NeedTime < 0 { // 担心配置错误 为负数情况 所以这里做下判断
v.NeedTime = 0
}
mapData["orders"] = Smithy.Orders
}
}
}
mapData["stoveLv"] = Smithy.StoveLv
this.module.ModifySmithyData(uid, mapData)
}

50
modules/smithy/module.go Normal file
View File

@ -0,0 +1,50 @@
/*
模块名:Smithy
描述:美食家模块
开发:梅雄风
*/
package smithy
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
)
type Smithy struct {
modules.ModuleBase
modelSmithy *modelSmithy
api *apiComp
configure *configureComp
}
func NewModule() core.IModule {
return &Smithy{}
}
func (this *Smithy) GetType() core.M_Modules {
return comm.ModuleSmithy
}
func (this *Smithy) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
return
}
func (this *Smithy) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelSmithy = this.RegisterComp(new(modelSmithy)).(*modelSmithy)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
}
// 接口信息
func (this *Smithy) ModifySmithyData(uid string, data map[string]interface{}) (code pb.ErrorCode) {
err := this.modelSmithy.modifySmithyDataByObjId(uid, data)
if err != nil {
code = pb.ErrorCode_DBError
}
return
}

View File

@ -147,9 +147,9 @@ type DBGourmet struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
CookingFood *Cooking `protobuf:"bytes,3,opt,name=cookingFood,proto3" json:"cookingFood" bson:"cookingFood"` //正在烹饪的食品 CookingFood *Cooking `protobuf:"bytes,3,opt,name=cookingFood,proto3" json:"cookingFood" bson:"cooking"` //正在烹饪的食品
Foods []*OrderCook `protobuf:"bytes,4,rep,name=foods,proto3" json:"foods"` // 等待烹饪的食品 Foods []*OrderCook `protobuf:"bytes,4,rep,name=foods,proto3" json:"foods" bson:"foods"` //等待烹饪的食品
Items []*UserAssets `protobuf:"bytes,5,rep,name=items,proto3" json:"items"` // 已经做好的食品 Items []*UserAssets `protobuf:"bytes,5,rep,name=items,proto3" json:"items" bson:"items"` //已经做好的食品
Skill map[int32]int32 `protobuf:"bytes,6,rep,name=skill,proto3" json:"skill" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"skill"` //技能ID Skill map[int32]int32 `protobuf:"bytes,6,rep,name=skill,proto3" json:"skill" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"skill"` //技能ID
SpecialSkill map[int32]int32 `protobuf:"bytes,7,rep,name=specialSkill,proto3" json:"specialSkill" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"specialSkill"` //通用技能 SpecialSkill map[int32]int32 `protobuf:"bytes,7,rep,name=specialSkill,proto3" json:"specialSkill" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"specialSkill"` //通用技能
OrderCostTime int32 `protobuf:"varint,8,opt,name=orderCostTime,proto3" json:"orderCostTime" bson:"orderCostTime"` //订单消耗的时常 OrderCostTime int32 `protobuf:"varint,8,opt,name=orderCostTime,proto3" json:"orderCostTime" bson:"orderCostTime"` //订单消耗的时常

View File

@ -151,7 +151,7 @@ type DBHero struct {
IsOverlying bool `protobuf:"varint,23,opt,name=isOverlying,proto3" json:"isOverlying"` // go_tags(`bson:"isOverlying"`) 是否允许叠加 默认true IsOverlying bool `protobuf:"varint,23,opt,name=isOverlying,proto3" json:"isOverlying"` // go_tags(`bson:"isOverlying"`) 是否允许叠加 默认true
EnergyProperty map[string]int32 `protobuf:"bytes,24,rep,name=energyProperty,proto3" json:"energyProperty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"energyProperty"` // EnergyProperty map[string]int32 `protobuf:"bytes,24,rep,name=energyProperty,proto3" json:"energyProperty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"energyProperty"` //
JuexProperty map[string]int32 `protobuf:"bytes,25,rep,name=juexProperty,proto3" json:"juexProperty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"juexProperty"` ////hp JuexProperty map[string]int32 `protobuf:"bytes,25,rep,name=juexProperty,proto3" json:"juexProperty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"juexProperty"` ////hp
Status HeroType `protobuf:"varint,26,opt,name=status,proto3,enum=HeroType" json:"status"` // 状态 (1 练功) Status HeroType `protobuf:"varint,26,opt,name=status,proto3,enum=HeroType" json:"status" bson:"heroType"` //状态 (1 练功)
} }
func (x *DBHero) Reset() { func (x *DBHero) Reset() {

386
pb/smithy_db.pb.go Normal file
View File

@ -0,0 +1,386 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: smithy/smithy_db.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type Clang struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
DeskType int32 `protobuf:"varint,1,opt,name=deskType,proto3" json:"deskType"` // 台子类型
ETime int64 `protobuf:"varint,2,opt,name=eTime,proto3" json:"eTime"`
}
func (x *Clang) Reset() {
*x = Clang{}
if protoimpl.UnsafeEnabled {
mi := &file_smithy_smithy_db_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Clang) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Clang) ProtoMessage() {}
func (x *Clang) ProtoReflect() protoreflect.Message {
mi := &file_smithy_smithy_db_proto_msgTypes[0]
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 Clang.ProtoReflect.Descriptor instead.
func (*Clang) Descriptor() ([]byte, []int) {
return file_smithy_smithy_db_proto_rawDescGZIP(), []int{0}
}
func (x *Clang) GetDeskType() int32 {
if x != nil {
return x.DeskType
}
return 0
}
func (x *Clang) GetETime() int64 {
if x != nil {
return x.ETime
}
return 0
}
// 队列里的烹饪食品
type OrderClang struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
DeskType int32 `protobuf:"varint,1,opt,name=deskType,proto3" json:"deskType"` // 台子类型
Count int32 `protobuf:"varint,2,opt,name=count,proto3" json:"count"` // 料理数量
NeedTime int32 `protobuf:"varint,3,opt,name=needTime,proto3" json:"needTime"` // 需要的时间
}
func (x *OrderClang) Reset() {
*x = OrderClang{}
if protoimpl.UnsafeEnabled {
mi := &file_smithy_smithy_db_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *OrderClang) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*OrderClang) ProtoMessage() {}
func (x *OrderClang) ProtoReflect() protoreflect.Message {
mi := &file_smithy_smithy_db_proto_msgTypes[1]
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 OrderClang.ProtoReflect.Descriptor instead.
func (*OrderClang) Descriptor() ([]byte, []int) {
return file_smithy_smithy_db_proto_rawDescGZIP(), []int{1}
}
func (x *OrderClang) GetDeskType() int32 {
if x != nil {
return x.DeskType
}
return 0
}
func (x *OrderClang) GetCount() int32 {
if x != nil {
return x.Count
}
return 0
}
func (x *OrderClang) GetNeedTime() int32 {
if x != nil {
return x.NeedTime
}
return 0
}
type DBSmithy struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
Clang *Clang `protobuf:"bytes,3,opt,name=clang,proto3" json:"clang"` // 正在制作中的数据
Orders []*OrderClang `protobuf:"bytes,4,rep,name=orders,proto3" json:"orders" bson:"orders"` //订单数据
Items []*UserAssets `protobuf:"bytes,5,rep,name=items,proto3" json:"items" bson:"items"` //已经做好装备
Skill map[int32]int32 `protobuf:"bytes,6,rep,name=skill,proto3" json:"skill" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"skill"` //锻造台等级
StoveLv int32 `protobuf:"varint,7,opt,name=stoveLv,proto3" json:"stoveLv" bson:"stoveLv"` //炉子等级
OrderCostTime int32 `protobuf:"varint,8,opt,name=orderCostTime,proto3" json:"orderCostTime" bson:"orderCostTime"` //订单消耗的时常
Ctime int64 `protobuf:"varint,9,opt,name=ctime,proto3" json:"ctime"` // 订单创建时间
}
func (x *DBSmithy) Reset() {
*x = DBSmithy{}
if protoimpl.UnsafeEnabled {
mi := &file_smithy_smithy_db_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DBSmithy) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DBSmithy) ProtoMessage() {}
func (x *DBSmithy) ProtoReflect() protoreflect.Message {
mi := &file_smithy_smithy_db_proto_msgTypes[2]
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 DBSmithy.ProtoReflect.Descriptor instead.
func (*DBSmithy) Descriptor() ([]byte, []int) {
return file_smithy_smithy_db_proto_rawDescGZIP(), []int{2}
}
func (x *DBSmithy) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *DBSmithy) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
func (x *DBSmithy) GetClang() *Clang {
if x != nil {
return x.Clang
}
return nil
}
func (x *DBSmithy) GetOrders() []*OrderClang {
if x != nil {
return x.Orders
}
return nil
}
func (x *DBSmithy) GetItems() []*UserAssets {
if x != nil {
return x.Items
}
return nil
}
func (x *DBSmithy) GetSkill() map[int32]int32 {
if x != nil {
return x.Skill
}
return nil
}
func (x *DBSmithy) GetStoveLv() int32 {
if x != nil {
return x.StoveLv
}
return 0
}
func (x *DBSmithy) GetOrderCostTime() int32 {
if x != nil {
return x.OrderCostTime
}
return 0
}
func (x *DBSmithy) GetCtime() int64 {
if x != nil {
return x.Ctime
}
return 0
}
var File_smithy_smithy_db_proto protoreflect.FileDescriptor
var file_smithy_smithy_db_proto_rawDesc = []byte{
0x0a, 0x16, 0x73, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x2f, 0x73, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x5f,
0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x22, 0x39, 0x0a, 0x05, 0x43, 0x6c, 0x61, 0x6e, 0x67, 0x12, 0x1a, 0x0a,
0x08, 0x64, 0x65, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x08, 0x64, 0x65, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x54, 0x69,
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22,
0x5a, 0x0a, 0x0a, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x6e, 0x67, 0x12, 0x1a, 0x0a,
0x08, 0x64, 0x65, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x08, 0x64, 0x65, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12,
0x1a, 0x0a, 0x08, 0x6e, 0x65, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
0x05, 0x52, 0x08, 0x6e, 0x65, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xce, 0x02, 0x0a, 0x08,
0x44, 0x42, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x05, 0x63, 0x6c,
0x61, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x43, 0x6c, 0x61, 0x6e,
0x67, 0x52, 0x05, 0x63, 0x6c, 0x61, 0x6e, 0x67, 0x12, 0x23, 0x0a, 0x06, 0x6f, 0x72, 0x64, 0x65,
0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72,
0x43, 0x6c, 0x61, 0x6e, 0x67, 0x52, 0x06, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x12, 0x21, 0x0a,
0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55,
0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73,
0x12, 0x2a, 0x0a, 0x05, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x14, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x2e, 0x53, 0x6b, 0x69, 0x6c, 0x6c,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x12, 0x18, 0x0a, 0x07,
0x73, 0x74, 0x6f, 0x76, 0x65, 0x4c, 0x76, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73,
0x74, 0x6f, 0x76, 0x65, 0x4c, 0x76, 0x12, 0x24, 0x0a, 0x0d, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x43,
0x6f, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6f,
0x72, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05,
0x63, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x74, 0x69,
0x6d, 0x65, 0x1a, 0x38, 0x0a, 0x0a, 0x53, 0x6b, 0x69, 0x6c, 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,
0x05, 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 (
file_smithy_smithy_db_proto_rawDescOnce sync.Once
file_smithy_smithy_db_proto_rawDescData = file_smithy_smithy_db_proto_rawDesc
)
func file_smithy_smithy_db_proto_rawDescGZIP() []byte {
file_smithy_smithy_db_proto_rawDescOnce.Do(func() {
file_smithy_smithy_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_smithy_smithy_db_proto_rawDescData)
})
return file_smithy_smithy_db_proto_rawDescData
}
var file_smithy_smithy_db_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_smithy_smithy_db_proto_goTypes = []interface{}{
(*Clang)(nil), // 0: Clang
(*OrderClang)(nil), // 1: OrderClang
(*DBSmithy)(nil), // 2: DBSmithy
nil, // 3: DBSmithy.SkillEntry
(*UserAssets)(nil), // 4: UserAssets
}
var file_smithy_smithy_db_proto_depIdxs = []int32{
0, // 0: DBSmithy.clang:type_name -> Clang
1, // 1: DBSmithy.orders:type_name -> OrderClang
4, // 2: DBSmithy.items:type_name -> UserAssets
3, // 3: DBSmithy.skill:type_name -> DBSmithy.SkillEntry
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_smithy_smithy_db_proto_init() }
func file_smithy_smithy_db_proto_init() {
if File_smithy_smithy_db_proto != nil {
return
}
file_comm_proto_init()
if !protoimpl.UnsafeEnabled {
file_smithy_smithy_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Clang); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_smithy_smithy_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OrderClang); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_smithy_smithy_db_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DBSmithy); 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{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_smithy_smithy_db_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_smithy_smithy_db_proto_goTypes,
DependencyIndexes: file_smithy_smithy_db_proto_depIdxs,
MessageInfos: file_smithy_smithy_db_proto_msgTypes,
}.Build()
File_smithy_smithy_db_proto = out.File
file_smithy_smithy_db_proto_rawDesc = nil
file_smithy_smithy_db_proto_goTypes = nil
file_smithy_smithy_db_proto_depIdxs = nil
}

578
pb/smithy_msg.pb.go Normal file
View File

@ -0,0 +1,578 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: smithy/smithy_msg.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// 查询塔进度
type SmithyGetListReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *SmithyGetListReq) Reset() {
*x = SmithyGetListReq{}
if protoimpl.UnsafeEnabled {
mi := &file_smithy_smithy_msg_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SmithyGetListReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SmithyGetListReq) ProtoMessage() {}
func (x *SmithyGetListReq) ProtoReflect() protoreflect.Message {
mi := &file_smithy_smithy_msg_proto_msgTypes[0]
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 SmithyGetListReq.ProtoReflect.Descriptor instead.
func (*SmithyGetListReq) Descriptor() ([]byte, []int) {
return file_smithy_smithy_msg_proto_rawDescGZIP(), []int{0}
}
// 返回进度信息
type SmithyGetListResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data *DBSmithy `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
}
func (x *SmithyGetListResp) Reset() {
*x = SmithyGetListResp{}
if protoimpl.UnsafeEnabled {
mi := &file_smithy_smithy_msg_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SmithyGetListResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SmithyGetListResp) ProtoMessage() {}
func (x *SmithyGetListResp) ProtoReflect() protoreflect.Message {
mi := &file_smithy_smithy_msg_proto_msgTypes[1]
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 SmithyGetListResp.ProtoReflect.Descriptor instead.
func (*SmithyGetListResp) Descriptor() ([]byte, []int) {
return file_smithy_smithy_msg_proto_rawDescGZIP(), []int{1}
}
func (x *SmithyGetListResp) GetData() *DBSmithy {
if x != nil {
return x.Data
}
return nil
}
// 创建订单
type SmithyCreateOrderReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Order []*OrderClang `protobuf:"bytes,1,rep,name=order,proto3" json:"order"` // 烹饪时间不用传 后端会重新计算
}
func (x *SmithyCreateOrderReq) Reset() {
*x = SmithyCreateOrderReq{}
if protoimpl.UnsafeEnabled {
mi := &file_smithy_smithy_msg_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SmithyCreateOrderReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SmithyCreateOrderReq) ProtoMessage() {}
func (x *SmithyCreateOrderReq) ProtoReflect() protoreflect.Message {
mi := &file_smithy_smithy_msg_proto_msgTypes[2]
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 SmithyCreateOrderReq.ProtoReflect.Descriptor instead.
func (*SmithyCreateOrderReq) Descriptor() ([]byte, []int) {
return file_smithy_smithy_msg_proto_rawDescGZIP(), []int{2}
}
func (x *SmithyCreateOrderReq) GetOrder() []*OrderClang {
if x != nil {
return x.Order
}
return nil
}
type SmithyCreateOrderResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data *DBSmithy `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
}
func (x *SmithyCreateOrderResp) Reset() {
*x = SmithyCreateOrderResp{}
if protoimpl.UnsafeEnabled {
mi := &file_smithy_smithy_msg_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SmithyCreateOrderResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SmithyCreateOrderResp) ProtoMessage() {}
func (x *SmithyCreateOrderResp) ProtoReflect() protoreflect.Message {
mi := &file_smithy_smithy_msg_proto_msgTypes[3]
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 SmithyCreateOrderResp.ProtoReflect.Descriptor instead.
func (*SmithyCreateOrderResp) Descriptor() ([]byte, []int) {
return file_smithy_smithy_msg_proto_rawDescGZIP(), []int{3}
}
func (x *SmithyCreateOrderResp) GetData() *DBSmithy {
if x != nil {
return x.Data
}
return nil
}
// 领取奖励
type SmithyGetRewardReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *SmithyGetRewardReq) Reset() {
*x = SmithyGetRewardReq{}
if protoimpl.UnsafeEnabled {
mi := &file_smithy_smithy_msg_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SmithyGetRewardReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SmithyGetRewardReq) ProtoMessage() {}
func (x *SmithyGetRewardReq) ProtoReflect() protoreflect.Message {
mi := &file_smithy_smithy_msg_proto_msgTypes[4]
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 SmithyGetRewardReq.ProtoReflect.Descriptor instead.
func (*SmithyGetRewardReq) Descriptor() ([]byte, []int) {
return file_smithy_smithy_msg_proto_rawDescGZIP(), []int{4}
}
type SmithyGetRewardResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data *DBSmithy `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
}
func (x *SmithyGetRewardResp) Reset() {
*x = SmithyGetRewardResp{}
if protoimpl.UnsafeEnabled {
mi := &file_smithy_smithy_msg_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SmithyGetRewardResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SmithyGetRewardResp) ProtoMessage() {}
func (x *SmithyGetRewardResp) ProtoReflect() protoreflect.Message {
mi := &file_smithy_smithy_msg_proto_msgTypes[5]
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 SmithyGetRewardResp.ProtoReflect.Descriptor instead.
func (*SmithyGetRewardResp) Descriptor() ([]byte, []int) {
return file_smithy_smithy_msg_proto_rawDescGZIP(), []int{5}
}
func (x *SmithyGetRewardResp) GetData() *DBSmithy {
if x != nil {
return x.Data
}
return nil
}
// 技能升级
type SmithySkillLvReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SkillType int32 `protobuf:"varint,1,opt,name=skillType,proto3" json:"skillType"` // 技能id
}
func (x *SmithySkillLvReq) Reset() {
*x = SmithySkillLvReq{}
if protoimpl.UnsafeEnabled {
mi := &file_smithy_smithy_msg_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SmithySkillLvReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SmithySkillLvReq) ProtoMessage() {}
func (x *SmithySkillLvReq) ProtoReflect() protoreflect.Message {
mi := &file_smithy_smithy_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 SmithySkillLvReq.ProtoReflect.Descriptor instead.
func (*SmithySkillLvReq) Descriptor() ([]byte, []int) {
return file_smithy_smithy_msg_proto_rawDescGZIP(), []int{6}
}
func (x *SmithySkillLvReq) GetSkillType() int32 {
if x != nil {
return x.SkillType
}
return 0
}
type SmithySkillLvResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data *DBSmithy `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
}
func (x *SmithySkillLvResp) Reset() {
*x = SmithySkillLvResp{}
if protoimpl.UnsafeEnabled {
mi := &file_smithy_smithy_msg_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SmithySkillLvResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SmithySkillLvResp) ProtoMessage() {}
func (x *SmithySkillLvResp) ProtoReflect() protoreflect.Message {
mi := &file_smithy_smithy_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 SmithySkillLvResp.ProtoReflect.Descriptor instead.
func (*SmithySkillLvResp) Descriptor() ([]byte, []int) {
return file_smithy_smithy_msg_proto_rawDescGZIP(), []int{7}
}
func (x *SmithySkillLvResp) GetData() *DBSmithy {
if x != nil {
return x.Data
}
return nil
}
var File_smithy_smithy_msg_proto protoreflect.FileDescriptor
var file_smithy_smithy_msg_proto_rawDesc = []byte{
0x0a, 0x17, 0x73, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x2f, 0x73, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x5f,
0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x73, 0x6d, 0x69, 0x74, 0x68,
0x79, 0x2f, 0x73, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0x12, 0x0a, 0x10, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x4c, 0x69,
0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x32, 0x0a, 0x11, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47,
0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61,
0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69,
0x74, 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x39, 0x0a, 0x14, 0x53, 0x6d, 0x69,
0x74, 0x68, 0x79, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65,
0x71, 0x12, 0x21, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x0b, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x6e, 0x67, 0x52, 0x05, 0x6f,
0x72, 0x64, 0x65, 0x72, 0x22, 0x36, 0x0a, 0x15, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x43, 0x72,
0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a,
0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42,
0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x14, 0x0a, 0x12,
0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52,
0x65, 0x71, 0x22, 0x34, 0x0a, 0x13, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x47, 0x65, 0x74, 0x52,
0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74,
0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x42, 0x53, 0x6d, 0x69, 0x74,
0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x30, 0x0a, 0x10, 0x53, 0x6d, 0x69, 0x74,
0x68, 0x79, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09,
0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x09, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x22, 0x32, 0x0a, 0x11, 0x53, 0x6d,
0x69, 0x74, 0x68, 0x79, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x52, 0x65, 0x73, 0x70, 0x12,
0x1d, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e,
0x44, 0x42, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06,
0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_smithy_smithy_msg_proto_rawDescOnce sync.Once
file_smithy_smithy_msg_proto_rawDescData = file_smithy_smithy_msg_proto_rawDesc
)
func file_smithy_smithy_msg_proto_rawDescGZIP() []byte {
file_smithy_smithy_msg_proto_rawDescOnce.Do(func() {
file_smithy_smithy_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_smithy_smithy_msg_proto_rawDescData)
})
return file_smithy_smithy_msg_proto_rawDescData
}
var file_smithy_smithy_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_smithy_smithy_msg_proto_goTypes = []interface{}{
(*SmithyGetListReq)(nil), // 0: SmithyGetListReq
(*SmithyGetListResp)(nil), // 1: SmithyGetListResp
(*SmithyCreateOrderReq)(nil), // 2: SmithyCreateOrderReq
(*SmithyCreateOrderResp)(nil), // 3: SmithyCreateOrderResp
(*SmithyGetRewardReq)(nil), // 4: SmithyGetRewardReq
(*SmithyGetRewardResp)(nil), // 5: SmithyGetRewardResp
(*SmithySkillLvReq)(nil), // 6: SmithySkillLvReq
(*SmithySkillLvResp)(nil), // 7: SmithySkillLvResp
(*DBSmithy)(nil), // 8: DBSmithy
(*OrderClang)(nil), // 9: OrderClang
}
var file_smithy_smithy_msg_proto_depIdxs = []int32{
8, // 0: SmithyGetListResp.data:type_name -> DBSmithy
9, // 1: SmithyCreateOrderReq.order:type_name -> OrderClang
8, // 2: SmithyCreateOrderResp.data:type_name -> DBSmithy
8, // 3: SmithyGetRewardResp.data:type_name -> DBSmithy
8, // 4: SmithySkillLvResp.data:type_name -> DBSmithy
5, // [5:5] is the sub-list for method output_type
5, // [5:5] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_smithy_smithy_msg_proto_init() }
func file_smithy_smithy_msg_proto_init() {
if File_smithy_smithy_msg_proto != nil {
return
}
file_smithy_smithy_db_proto_init()
if !protoimpl.UnsafeEnabled {
file_smithy_smithy_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SmithyGetListReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_smithy_smithy_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SmithyGetListResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_smithy_smithy_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SmithyCreateOrderReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_smithy_smithy_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SmithyCreateOrderResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_smithy_smithy_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SmithyGetRewardReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_smithy_smithy_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SmithyGetRewardResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_smithy_smithy_msg_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SmithySkillLvReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_smithy_smithy_msg_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SmithySkillLvResp); 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{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_smithy_smithy_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_smithy_smithy_msg_proto_goTypes,
DependencyIndexes: file_smithy_smithy_msg_proto_depIdxs,
MessageInfos: file_smithy_smithy_msg_proto_msgTypes,
}.Build()
File_smithy_smithy_msg_proto = out.File
file_smithy_smithy_msg_proto_rawDesc = nil
file_smithy_smithy_msg_proto_goTypes = nil
file_smithy_smithy_msg_proto_depIdxs = nil
}

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 GameSmithy struct {
_dataMap map[int32]*GameSmithyData
_dataList []*GameSmithyData
}
func NewGameSmithy(_buf []map[string]interface{}) (*GameSmithy, error) {
_dataList := make([]*GameSmithyData, 0, len(_buf))
dataMap := make(map[int32]*GameSmithyData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameSmithyData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameSmithy{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameSmithy) GetDataMap() map[int32]*GameSmithyData {
return table._dataMap
}
func (table *GameSmithy) GetDataList() []*GameSmithyData {
return table._dataList
}
func (table *GameSmithy) Get(key int32) *GameSmithyData {
return table._dataMap[key]
}

View File

@ -0,0 +1,98 @@
//------------------------------------------------------------------------------
// <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 GameSmithyData struct {
Id int32
Type int32
Star int32
Starshow string
Before int32
Starupneed []*Gameatn
Sucess string
Floors int32
Dropshow []*Gameatn
Drop int32
Orderneed []*Gameatn
Desk string
Shelves string
}
const TypeId_GameSmithyData = 2042540316
func (*GameSmithyData) GetTypeId() int32 {
return 2042540316
}
func (_v *GameSmithyData)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["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star"].(float64); !_ok_ { err = errors.New("star error"); return }; _v.Star = int32(_tempNum_) }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["starshow"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Starshow error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Starshow, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["before"].(float64); !_ok_ { err = errors.New("before error"); return }; _v.Before = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["starupneed"].([]interface{}); !_ok_ { err = errors.New("starupneed error"); return }
_v.Starupneed = 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.Starupneed = append(_v.Starupneed, _list_v_)
}
}
{ var _ok_ bool; if _v.Sucess, _ok_ = _buf["sucess"].(string); !_ok_ { err = errors.New("sucess error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["floors"].(float64); !_ok_ { err = errors.New("floors error"); return }; _v.Floors = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["dropshow"].([]interface{}); !_ok_ { err = errors.New("dropshow error"); return }
_v.Dropshow = 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.Dropshow = append(_v.Dropshow, _list_v_)
}
}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["drop"].(float64); !_ok_ { err = errors.New("drop error"); return }; _v.Drop = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["orderneed"].([]interface{}); !_ok_ { err = errors.New("orderneed error"); return }
_v.Orderneed = 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.Orderneed = append(_v.Orderneed, _list_v_)
}
}
{ var _ok_ bool; if _v.Desk, _ok_ = _buf["desk"].(string); !_ok_ { err = errors.New("desk error"); return } }
{ var _ok_ bool; if _v.Shelves, _ok_ = _buf["shelves"].(string); !_ok_ { err = errors.New("shelves error"); return } }
return
}
func DeserializeGameSmithyData(_buf map[string]interface{}) (*GameSmithyData, error) {
v := &GameSmithyData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

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 GameSmithyStove struct {
_dataMap map[int32]*GameSmithyStoveData
_dataList []*GameSmithyStoveData
}
func NewGameSmithyStove(_buf []map[string]interface{}) (*GameSmithyStove, error) {
_dataList := make([]*GameSmithyStoveData, 0, len(_buf))
dataMap := make(map[int32]*GameSmithyStoveData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameSmithyStoveData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameSmithyStove{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameSmithyStove) GetDataMap() map[int32]*GameSmithyStoveData {
return table._dataMap
}
func (table *GameSmithyStove) GetDataList() []*GameSmithyStoveData {
return table._dataList
}
func (table *GameSmithyStove) Get(key int32) *GameSmithyStoveData {
return table._dataMap[key]
}

View File

@ -0,0 +1,64 @@
//------------------------------------------------------------------------------
// <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 GameSmithyStoveData struct {
Id int32
Star int32
Starshow string
Before int32
Starupneed []*Gameatn
Sucess string
Floors int32
Time int32
Desk string
}
const TypeId_GameSmithyStoveData = -1387348875
func (*GameSmithyStoveData) GetTypeId() int32 {
return -1387348875
}
func (_v *GameSmithyStoveData)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["star"].(float64); !_ok_ { err = errors.New("star error"); return }; _v.Star = int32(_tempNum_) }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["starshow"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Starshow error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Starshow, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["before"].(float64); !_ok_ { err = errors.New("before error"); return }; _v.Before = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["starupneed"].([]interface{}); !_ok_ { err = errors.New("starupneed error"); return }
_v.Starupneed = 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.Starupneed = append(_v.Starupneed, _list_v_)
}
}
{ var _ok_ bool; if _v.Sucess, _ok_ = _buf["sucess"].(string); !_ok_ { err = errors.New("sucess error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["floors"].(float64); !_ok_ { err = errors.New("floors error"); return }; _v.Floors = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["time"].(float64); !_ok_ { err = errors.New("time error"); return }; _v.Time = int32(_tempNum_) }
{ var _ok_ bool; if _v.Desk, _ok_ = _buf["desk"].(string); !_ok_ { err = errors.New("desk error"); return } }
return
}
func DeserializeGameSmithyStoveData(_buf map[string]interface{}) (*GameSmithyStoveData, error) {
v := &GameSmithyStoveData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}