上传equipment 模块代码
This commit is contained in:
parent
db9910c066
commit
6f0ebc4a93
1
bin/json/game_equipment.json
Normal file
1
bin/json/game_equipment.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[]
|
15
comm/core.go
15
comm/core.go
@ -30,13 +30,14 @@ const (
|
|||||||
|
|
||||||
//模块名定义处
|
//模块名定义处
|
||||||
const (
|
const (
|
||||||
SM_GateModule core.M_Modules = "gateway" //gate模块 网关服务模块
|
SM_GateModule core.M_Modules = "gateway" //gate模块 网关服务模块
|
||||||
SM_WebModule core.M_Modules = "web" //web模块
|
SM_WebModule core.M_Modules = "web" //web模块
|
||||||
SM_UserModule core.M_Modules = "user" //用户模块
|
SM_UserModule core.M_Modules = "user" //用户模块
|
||||||
SM_PackModule core.M_Modules = "pack" //背包模块
|
SM_PackModule core.M_Modules = "pack" //背包模块
|
||||||
SM_MailModule core.M_Modules = "mail" //邮件模块
|
SM_MailModule core.M_Modules = "mail" //邮件模块
|
||||||
SM_FriendModule core.M_Modules = "friend" //好友模块
|
SM_FriendModule core.M_Modules = "friend" //好友模块
|
||||||
SM_LogModelModule core.M_Modules = "model" //日志模块
|
SM_LogModelModule core.M_Modules = "model" //日志模块
|
||||||
|
SM_EquipmentModule core.M_Modules = "equipment" //装备模块
|
||||||
)
|
)
|
||||||
|
|
||||||
//RPC服务接口定义处
|
//RPC服务接口定义处
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package comm
|
package comm
|
||||||
|
|
||||||
|
import "go_dreamfactory/pb"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
业务模块 对外接口定义处
|
业务模块 对外接口定义处
|
||||||
*/
|
*/
|
||||||
@ -13,9 +15,11 @@ type (
|
|||||||
IPack interface {
|
IPack interface {
|
||||||
//查询用户背包物品数量
|
//查询用户背包物品数量
|
||||||
QueryUserPackItemAmount(uId string, itemid int32) (amount uint32)
|
QueryUserPackItemAmount(uId string, itemid int32) (amount uint32)
|
||||||
|
//查询用户背包多个物品数量
|
||||||
|
QueryUserPackItemsAmount(uId string, itemid ...int32) (result map[int32]uint32)
|
||||||
///添加单个物品到背包 (可以加物品和减物品)
|
///添加单个物品到背包 (可以加物品和减物品)
|
||||||
AddItemToUserPack(uId string, itemid, addnum int32) (err error)
|
AddItemToUserPack(uId string, itemid, addnum int32) (code pb.ErrorCode)
|
||||||
///添加多个物品到背包 (可以加物品和减物品)
|
///添加多个物品到背包 (可以加物品和减物品)
|
||||||
AddItemsToUserPack(uId string, items map[int32]int32) (err error)
|
AddItemsToUserPack(uId string, items map[int32]int32) (code pb.ErrorCode)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
29
modules/equipment/api.go
Normal file
29
modules/equipment/api.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package equipment
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
装备模块 API
|
||||||
|
*/
|
||||||
|
type Api_Comp struct {
|
||||||
|
modules.MComp_GateComp
|
||||||
|
service core.IService
|
||||||
|
module *Equipment
|
||||||
|
}
|
||||||
|
|
||||||
|
//组件初始化接口
|
||||||
|
func (this *Api_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
|
this.MComp_GateComp.Init(service, module, comp, options)
|
||||||
|
this.module = module.(*Equipment)
|
||||||
|
this.service = service
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Api_Comp) Start() (err error) {
|
||||||
|
err = this.MComp_GateComp.Start()
|
||||||
|
return
|
||||||
|
}
|
23
modules/equipment/api_equip.go
Normal file
23
modules/equipment/api_equip.go
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package equipment
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
//参数校验
|
||||||
|
func (this *Api_Comp) Equip_Check(session comm.IUserSession, req *pb.Equipment_Equip_Req) (result map[string]interface{}, code comm.ErrorCode) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
///英雄挂在装备
|
||||||
|
func (this *Api_Comp) Equip(session comm.IUserSession, agrs map[string]interface{}, req *pb.Equipment_Equip_Req) (code pb.ErrorCode) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if code == pb.ErrorCode_Success {
|
||||||
|
session.SendMsg(string(this.module.GetType()), "", &pb.Equipment_Equip_Resp{})
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
31
modules/equipment/api_getlist.go
Normal file
31
modules/equipment/api_getlist.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package equipment
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego/sys/log"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
//参数校验
|
||||||
|
func (this *Api_Comp) Getlist_Check(session comm.IUserSession, req *pb.Equipment_GetList_Req) (result map[string]interface{}, code comm.ErrorCode) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
///获取用户装备列表
|
||||||
|
func (this *Api_Comp) Getlist(session comm.IUserSession, agrs map[string]interface{}, req *pb.Equipment_GetList_Req) (code pb.ErrorCode) {
|
||||||
|
var (
|
||||||
|
err error
|
||||||
|
items []*pb.DB_Equipment
|
||||||
|
)
|
||||||
|
defer func() {
|
||||||
|
if code == pb.ErrorCode_Success {
|
||||||
|
session.SendMsg(string(this.module.GetType()), "", &pb.Equipment_GetList_Resp{Equipments: items})
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
if items, err = this.module.model_equipment_comp.Equipment_QueryUserEquipmentsPack(session.GetUserId()); err != nil {
|
||||||
|
log.Errorf("QueryUserPackReq err:%v", err)
|
||||||
|
code = pb.ErrorCode_CacheReadError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
23
modules/equipment/api_upgrade.go
Normal file
23
modules/equipment/api_upgrade.go
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package equipment
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
//参数校验
|
||||||
|
func (this *Api_Comp) Upgrade_Check(session comm.IUserSession, req *pb.Equipment_Upgrade_Req) (result map[string]interface{}, code comm.ErrorCode) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
///英雄挂在装备
|
||||||
|
func (this *Api_Comp) Upgrade(session comm.IUserSession, agrs map[string]interface{}, req *pb.Equipment_Upgrade_Req) (code pb.ErrorCode) {
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if code == pb.ErrorCode_Success {
|
||||||
|
session.SendMsg(string(this.module.GetType()), "", &pb.Equipment_Upgrade_Resp{})
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
42
modules/equipment/configure_comp.go
Normal file
42
modules/equipment/configure_comp.go
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
package equipment
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
|
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
game_equipment = "game_equipment.json"
|
||||||
|
)
|
||||||
|
|
||||||
|
///背包配置管理组件
|
||||||
|
type Configure_Comp struct {
|
||||||
|
modules.MComp_Configure
|
||||||
|
}
|
||||||
|
|
||||||
|
//组件初始化接口
|
||||||
|
func (this *Configure_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
|
this.ModuleCompBase.Init(service, module, comp, options)
|
||||||
|
this.LoadConfigure(game_equipment, cfg.NewGame_equipment)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取装备配置数据
|
||||||
|
func (this *Configure_Comp) GetEquipmentConfigure() (configure *cfg.Game_equipment, err error) {
|
||||||
|
var (
|
||||||
|
v interface{}
|
||||||
|
ok bool
|
||||||
|
)
|
||||||
|
if v, err = this.GetConfigure(game_equipment); err != nil {
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
if configure, ok = v.(*cfg.Game_equipment); !ok {
|
||||||
|
err = fmt.Errorf("%T no is *cfg.Game_equipment", v)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
100
modules/equipment/model_equipment_comp.go
Normal file
100
modules/equipment/model_equipment_comp.go
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
package equipment
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/lego/sys/log"
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
|
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||||
|
)
|
||||||
|
|
||||||
|
///装备 数据组件
|
||||||
|
type Model_Equipment_Comp struct {
|
||||||
|
modules.Model_Comp
|
||||||
|
module *Equipment
|
||||||
|
}
|
||||||
|
|
||||||
|
//组件初始化接口
|
||||||
|
func (this *Model_Equipment_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) {
|
||||||
|
this.Model_Comp.Init(service, module, comp, opt)
|
||||||
|
this.module = module.(*Equipment)
|
||||||
|
this.TableName = "equipment"
|
||||||
|
//创建uid索引
|
||||||
|
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||||
|
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询用户装备数据
|
||||||
|
func (this *Model_Equipment_Comp) Equipment_QueryUserEquipmentsPackById(uId, id string) (equipment *pb.DB_Equipment, err error) {
|
||||||
|
equipment = &pb.DB_Equipment{}
|
||||||
|
err = this.GetListObj(uId, id, equipment)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
///查询用户的武器背包
|
||||||
|
func (this *Model_Equipment_Comp) Equipment_QueryUserEquipmentsPack(uId string) (equipments []*pb.DB_Equipment, err error) {
|
||||||
|
equipments = make([]*pb.DB_Equipment, 0)
|
||||||
|
err = this.GetList(uId, &equipments)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加装备
|
||||||
|
func (this *Model_Equipment_Comp) Equipment_AddEquipmentsToPack(uId string, cIds map[int32]uint32) (err error) {
|
||||||
|
var (
|
||||||
|
configure *cfg.Game_equipment
|
||||||
|
equipments []*pb.DB_Equipment
|
||||||
|
iskeep bool
|
||||||
|
add map[string]*pb.DB_Equipment
|
||||||
|
update map[string]*pb.DB_Equipment
|
||||||
|
)
|
||||||
|
if configure, err = this.module.configure_comp.GetEquipmentConfigure(); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if equipments, err = this.Equipment_QueryUserEquipmentsPack(uId); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
add = make(map[string]*pb.DB_Equipment)
|
||||||
|
update = make(map[string]*pb.DB_Equipment)
|
||||||
|
for k, v := range cIds {
|
||||||
|
iskeep = false
|
||||||
|
for _, equipment := range equipments {
|
||||||
|
if equipment.CId == k && equipment.IsInitialState {
|
||||||
|
update[equipment.Id] = equipment
|
||||||
|
equipment.OverlayNum += v
|
||||||
|
iskeep = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !iskeep {
|
||||||
|
if _, ok := configure.GetDataMap()[k]; ok {
|
||||||
|
id := primitive.NewObjectID().Hex()
|
||||||
|
add[id] = &pb.DB_Equipment{
|
||||||
|
Id: id,
|
||||||
|
CId: k,
|
||||||
|
UId: uId,
|
||||||
|
MainEntry: make(map[uint32]int32),
|
||||||
|
AdverbEntry: make(map[uint32]int32),
|
||||||
|
OverlayNum: v,
|
||||||
|
IsInitialState: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err = this.AddLists(uId, add); err != nil {
|
||||||
|
log.Errorf("[Equipment] Equipment_AddEquipmentsToPack err:%v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, v := range update {
|
||||||
|
if err = this.ChangeList(uId, v.Id, map[string]interface{}{"overlayNum": v.OverlayNum}); err != nil {
|
||||||
|
log.Errorf("[Equipment] Equipment_AddEquipmentsToPack err:%v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
43
modules/equipment/module.go
Normal file
43
modules/equipment/module.go
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
package equipment
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
模块名:装备
|
||||||
|
描述:用户装备管理以及装备升级强化相关
|
||||||
|
开发:李伟
|
||||||
|
*/
|
||||||
|
func NewModule() core.IModule {
|
||||||
|
m := new(Equipment)
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
|
||||||
|
type Equipment struct {
|
||||||
|
modules.ModuleBase
|
||||||
|
api_comp *Api_Comp
|
||||||
|
configure_comp *Configure_Comp
|
||||||
|
model_equipment_comp *Model_Equipment_Comp
|
||||||
|
}
|
||||||
|
|
||||||
|
//模块名
|
||||||
|
func (this *Equipment) GetType() core.M_Modules {
|
||||||
|
return comm.SM_EquipmentModule
|
||||||
|
}
|
||||||
|
|
||||||
|
//模块初始化接口 注册用户创建角色事件
|
||||||
|
func (this *Equipment) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||||
|
err = this.ModuleBase.Init(service, module, options)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//装备组件
|
||||||
|
func (this *Equipment) OnInstallComp() {
|
||||||
|
this.ModuleBase.OnInstallComp()
|
||||||
|
this.api_comp = this.RegisterComp(new(Api_Comp)).(*Api_Comp)
|
||||||
|
this.model_equipment_comp = this.RegisterComp(new(Model_Equipment_Comp)).(*Model_Equipment_Comp)
|
||||||
|
this.configure_comp = this.RegisterComp(new(Configure_Comp)).(*Configure_Comp)
|
||||||
|
}
|
74
modules/equipment/module_test.go
Normal file
74
modules/equipment/module_test.go
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
package equipment
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego"
|
||||||
|
"go_dreamfactory/lego/base/rpcx"
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/lego/sys/log"
|
||||||
|
"go_dreamfactory/services"
|
||||||
|
"go_dreamfactory/sys/cache"
|
||||||
|
"go_dreamfactory/sys/configure"
|
||||||
|
"go_dreamfactory/sys/db"
|
||||||
|
"os"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newService(ops ...rpcx.Option) core.IService {
|
||||||
|
s := new(TestService)
|
||||||
|
s.Configure(ops...)
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
//梦工厂基础服务对象
|
||||||
|
type TestService struct {
|
||||||
|
rpcx.RPCXService
|
||||||
|
}
|
||||||
|
|
||||||
|
//初始化相关系统
|
||||||
|
func (this *TestService) InitSys() {
|
||||||
|
this.RPCXService.InitSys()
|
||||||
|
if err := cache.OnInit(this.GetSettings().Sys["cache"]); err != nil {
|
||||||
|
panic(fmt.Sprintf("init sys.cache err: %s", err.Error()))
|
||||||
|
} else {
|
||||||
|
log.Infof("init sys.cache success!")
|
||||||
|
}
|
||||||
|
if err := db.OnInit(this.GetSettings().Sys["db"]); err != nil {
|
||||||
|
panic(fmt.Sprintf("init sys.db err: %s", err.Error()))
|
||||||
|
} else {
|
||||||
|
log.Infof("init sys.db success!")
|
||||||
|
}
|
||||||
|
if err := configure.OnInit(this.GetSettings().Sys["configure"]); err != nil {
|
||||||
|
panic(fmt.Sprintf("init sys.configure err: %s", err.Error()))
|
||||||
|
} else {
|
||||||
|
log.Infof("init sys.configure success!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var service core.IService
|
||||||
|
var s_gateComp comm.ISC_GateRouteComp = services.NewGateRouteComp()
|
||||||
|
var module = new(Equipment)
|
||||||
|
|
||||||
|
//测试环境下初始化db和cache 系统
|
||||||
|
func TestMain(m *testing.M) {
|
||||||
|
service = newService(
|
||||||
|
rpcx.SetConfPath("../../bin/conf/worker_1.yaml"),
|
||||||
|
rpcx.SetVersion("1.0.0.0"),
|
||||||
|
)
|
||||||
|
service.OnInstallComp( //装备组件
|
||||||
|
s_gateComp, //此服务需要接受用户的消息 需要装备网关组件
|
||||||
|
)
|
||||||
|
go func() {
|
||||||
|
lego.Run(service, //运行模块
|
||||||
|
module,
|
||||||
|
)
|
||||||
|
}()
|
||||||
|
time.Sleep(time.Second * 3)
|
||||||
|
defer os.Exit(m.Run())
|
||||||
|
}
|
||||||
|
|
||||||
|
func Test_Module(t *testing.T) {
|
||||||
|
|
||||||
|
}
|
@ -28,23 +28,23 @@ func (this *Api_Comp) GetUserMailAttachment(session comm.IUserSession, agrs map[
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
_data, err := this.module.db_comp.Mail_GetMailAttachment(req.ObjID)
|
_data, err := this.module.db_comp.Mail_GetMailAttachment(req.ObjID)
|
||||||
if err != nil {
|
if err == nil {
|
||||||
if len(_data) > 0 {
|
if len(_data) > 0 {
|
||||||
// todo 领取附件
|
// todo 领取附件
|
||||||
_items := make(map[int32]int32, 0)
|
_items := make(map[int32]int32, 0)
|
||||||
for _, v := range _data {
|
for _, v := range _data {
|
||||||
_items[int32(v.ItemId)] += int32(v.ItemCount)
|
_items[int32(v.ItemId)] += int32(v.ItemCount)
|
||||||
}
|
}
|
||||||
bRet := this.pack.AddItemsToUserPack(mail.Uid, _items)
|
code = this.pack.AddItemsToUserPack(mail.Uid, _items)
|
||||||
if bRet != nil {
|
if code == pb.ErrorCode_Success {
|
||||||
// 修改状态
|
// 修改状态
|
||||||
this.module.db_comp.Mail_UpdateMailAttachmentState(req.ObjID)
|
this.module.db_comp.Mail_UpdateMailAttachmentState(req.ObjID)
|
||||||
mail.Reward = true
|
mail.Reward = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
}
|
||||||
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ func (this *Model_Comp) Add(uid string, data interface{}, attrs ...*cache.Operat
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//添加新的数据
|
//添加新的数据到列表
|
||||||
func (this *Model_Comp) AddList(uid string, id string, data interface{}, attrs ...*cache.OperationAttr) (err error) {
|
func (this *Model_Comp) AddList(uid string, id string, data interface{}, attrs ...*cache.OperationAttr) (err error) {
|
||||||
key := this.ukeylist(uid, id)
|
key := this.ukeylist(uid, id)
|
||||||
if err = this.Redis.HMSet(key, data); err != nil {
|
if err = this.Redis.HMSet(key, data); err != nil {
|
||||||
@ -139,6 +139,46 @@ func (this *Model_Comp) AddList(uid string, id string, data interface{}, attrs .
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//添加新的多个数据到列表 data map[string]type
|
||||||
|
func (this *Model_Comp) AddLists(uid string, data interface{}, attrs ...*cache.OperationAttr) (err error) {
|
||||||
|
vof := reflect.ValueOf(data)
|
||||||
|
if !vof.IsValid() {
|
||||||
|
return fmt.Errorf("Model_Comp: AddLists(nil)")
|
||||||
|
}
|
||||||
|
if vof.Kind() != reflect.Map {
|
||||||
|
return fmt.Errorf("Model_Comp: AddLists(non-pointer %T)", data)
|
||||||
|
}
|
||||||
|
listskeys := make(map[string]string)
|
||||||
|
keys := vof.MapKeys()
|
||||||
|
lists := make([]interface{}, len(keys))
|
||||||
|
for i, k := range keys {
|
||||||
|
value := vof.MapIndex(k)
|
||||||
|
keydata := k.Interface().(string)
|
||||||
|
valuedata := value.Interface()
|
||||||
|
key := this.ukeylist(uid, keydata)
|
||||||
|
if err = this.Redis.HMSet(key, valuedata); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
listskeys[keydata] = key
|
||||||
|
lists[i] = valuedata
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = this.Redis.HMSet(this.ukey(uid), listskeys); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if ret := cache.OperationAttrs(attrs).Find(cache.ATTR_EXPIRE).Unwrap_Or(nil); ret != nil {
|
||||||
|
this.Redis.Expire(this.ukey(uid), ret.(time.Duration))
|
||||||
|
for _, v := range listskeys {
|
||||||
|
this.Redis.Expire(v, ret.(time.Duration))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ret := cache.OperationAttrs(attrs).Find(cache.ATTR_MGOLOG).Unwrap_Or(nil); ret == nil {
|
||||||
|
err = this.InsertModelLogs(this.TableName, uid, lists)
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
//修改数据多个字段 uid 作为主键
|
//修改数据多个字段 uid 作为主键
|
||||||
func (this *Model_Comp) Change(uid string, data map[string]interface{}, attrs ...*cache.OperationAttr) (err error) {
|
func (this *Model_Comp) Change(uid string, data map[string]interface{}, attrs ...*cache.OperationAttr) (err error) {
|
||||||
if err = this.Redis.HMSet(this.ukey(uid), data); err != nil {
|
if err = this.Redis.HMSet(this.ukey(uid), data); err != nil {
|
||||||
@ -194,23 +234,17 @@ func (this *Model_Comp) GetList(uid string, data interface{}) (err error) {
|
|||||||
if t.Kind() == reflect.Slice {
|
if t.Kind() == reflect.Slice {
|
||||||
t = t.Elem()
|
t = t.Elem()
|
||||||
} else {
|
} else {
|
||||||
panic("Input param is not a slice")
|
err = fmt.Errorf("Input param is not a slice")
|
||||||
}
|
}
|
||||||
|
|
||||||
sl := reflect.ValueOf(data)
|
sl := reflect.ValueOf(data)
|
||||||
|
|
||||||
if t.Kind() == reflect.Ptr {
|
if t.Kind() == reflect.Ptr {
|
||||||
sl = sl.Elem()
|
sl = sl.Elem()
|
||||||
}
|
}
|
||||||
|
|
||||||
st := sl.Type()
|
st := sl.Type()
|
||||||
fmt.Printf("Slice Type %s:\n", st)
|
|
||||||
|
|
||||||
sliceType := st.Elem()
|
sliceType := st.Elem()
|
||||||
if sliceType.Kind() == reflect.Ptr {
|
if sliceType.Kind() == reflect.Ptr {
|
||||||
sliceType = sliceType.Elem()
|
sliceType = sliceType.Elem()
|
||||||
}
|
}
|
||||||
fmt.Printf("Slice Elem Type %v:\n", sliceType)
|
|
||||||
err = this.Redis.HGetAll(this.ukey(uid), keys)
|
err = this.Redis.HGetAll(this.ukey(uid), keys)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
for _, v := range keys {
|
for _, v := range keys {
|
||||||
|
@ -74,7 +74,7 @@ func (this *Model_Pack_Comp) Pack_DeleteUserPack(uId string, gridIds ...string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//查询用户背包物品数量
|
//查询用户背包物品数量
|
||||||
func (this *Model_Pack_Comp) Pack_QueryUserPackItemAmount(uId string, itemid int32) (amount uint32) {
|
func (this *Model_Pack_Comp) Pack_QueryUserPackItemsAmount(uId string, itemid ...int32) (result map[int32]uint32) {
|
||||||
var (
|
var (
|
||||||
itmes []*pb.DB_UserItemData
|
itmes []*pb.DB_UserItemData
|
||||||
err error
|
err error
|
||||||
@ -82,9 +82,12 @@ func (this *Model_Pack_Comp) Pack_QueryUserPackItemAmount(uId string, itemid int
|
|||||||
if itmes, err = this.Pack_QueryUserPack(uId); err != nil {
|
if itmes, err = this.Pack_QueryUserPack(uId); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
result = map[int32]uint32{}
|
||||||
for _, v := range itmes {
|
for _, v := range itmes {
|
||||||
if !v.IsEmpty && v.ItemId == itemid {
|
for _, v1 := range itemid {
|
||||||
amount += v.Amount
|
if !v.IsEmpty && v.ItemId == v1 {
|
||||||
|
result[v1] += v.Amount
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -3,6 +3,7 @@ package pack
|
|||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
@ -49,7 +50,16 @@ func (this *Pack) OnInstallComp() {
|
|||||||
///查询用户背包物品数量
|
///查询用户背包物品数量
|
||||||
func (this *Pack) QueryUserPackItemAmount(uId string, itemid int32) (amount uint32) {
|
func (this *Pack) QueryUserPackItemAmount(uId string, itemid int32) (amount uint32) {
|
||||||
defer log.Debugf("获取物品 uId:%s itemid:%d addnum:%d ", uId, itemid, amount)
|
defer log.Debugf("获取物品 uId:%s itemid:%d addnum:%d ", uId, itemid, amount)
|
||||||
amount = this.model_pack_comp.Pack_QueryUserPackItemAmount(uId, itemid)
|
amount = 0
|
||||||
|
if result := this.model_pack_comp.Pack_QueryUserPackItemsAmount(uId, itemid); result != nil && len(result) > 0 {
|
||||||
|
return result[itemid]
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
///查询用户背包多个物品数量
|
||||||
|
func (this *Pack) QueryUserPackItemsAmount(uId string, itemid ...int32) (result map[int32]uint32) {
|
||||||
|
result = this.model_pack_comp.Pack_QueryUserPackItemsAmount(uId, itemid...)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,10 +73,18 @@ func (this *Pack) AddItemToUserPack(uId string, itemid, addnum int32) (err error
|
|||||||
}
|
}
|
||||||
|
|
||||||
///添加多个物品到背包 (可以加物品和减物品)
|
///添加多个物品到背包 (可以加物品和减物品)
|
||||||
func (this *Pack) AddItemsToUserPack(uId string, items map[int32]int32) (err error) {
|
func (this *Pack) AddItemsToUserPack(uId string, items map[int32]int32) (code pb.ErrorCode) {
|
||||||
|
var err error
|
||||||
defer log.Debugf("给用户添加物品 uId:%s items:%d items:%v", uId, items, err == nil)
|
defer log.Debugf("给用户添加物品 uId:%s items:%d items:%v", uId, items, err == nil)
|
||||||
if err = this.model_pack_comp.Pack_AddItemsToUserPack(uId, items); err != nil {
|
if err = this.model_pack_comp.Pack_AddItemsToUserPack(uId, items); err != nil {
|
||||||
log.Errorf("给用户添加物品 uId:%s items:%d err:%v", uId, items, err)
|
log.Errorf("给用户添加物品 uId:%s items:%d err:%v", uId, items, err)
|
||||||
|
if err == ItemNotEnoughError {
|
||||||
|
code = pb.ErrorCode_PackNoEnough
|
||||||
|
} else if err == PackGridNumUpper {
|
||||||
|
code = pb.ErrorCode_PackGridNumUpper
|
||||||
|
} else {
|
||||||
|
code = pb.ErrorCode_Unknown
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
81
modules/pack/module_test.go
Normal file
81
modules/pack/module_test.go
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
package pack
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego"
|
||||||
|
"go_dreamfactory/lego/base/rpcx"
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/lego/sys/log"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/services"
|
||||||
|
"go_dreamfactory/sys/cache"
|
||||||
|
"go_dreamfactory/sys/configure"
|
||||||
|
"go_dreamfactory/sys/db"
|
||||||
|
"os"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/golang/protobuf/ptypes"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newService(ops ...rpcx.Option) core.IService {
|
||||||
|
s := new(TestService)
|
||||||
|
s.Configure(ops...)
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
//梦工厂基础服务对象
|
||||||
|
type TestService struct {
|
||||||
|
rpcx.RPCXService
|
||||||
|
}
|
||||||
|
|
||||||
|
//初始化相关系统
|
||||||
|
func (this *TestService) InitSys() {
|
||||||
|
this.RPCXService.InitSys()
|
||||||
|
if err := cache.OnInit(this.GetSettings().Sys["cache"]); err != nil {
|
||||||
|
panic(fmt.Sprintf("init sys.cache err: %s", err.Error()))
|
||||||
|
} else {
|
||||||
|
log.Infof("init sys.cache success!")
|
||||||
|
}
|
||||||
|
if err := db.OnInit(this.GetSettings().Sys["db"]); err != nil {
|
||||||
|
panic(fmt.Sprintf("init sys.db err: %s", err.Error()))
|
||||||
|
} else {
|
||||||
|
log.Infof("init sys.db success!")
|
||||||
|
}
|
||||||
|
if err := configure.OnInit(this.GetSettings().Sys["configure"]); err != nil {
|
||||||
|
panic(fmt.Sprintf("init sys.configure err: %s", err.Error()))
|
||||||
|
} else {
|
||||||
|
log.Infof("init sys.configure success!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var service core.IService
|
||||||
|
var s_gateComp comm.ISC_GateRouteComp = services.NewGateRouteComp()
|
||||||
|
var module = new(Pack)
|
||||||
|
|
||||||
|
//测试环境下初始化db和cache 系统
|
||||||
|
func TestMain(m *testing.M) {
|
||||||
|
service = newService(
|
||||||
|
rpcx.SetConfPath("../../bin/conf/worker_1.yaml"),
|
||||||
|
rpcx.SetVersion("1.0.0.0"),
|
||||||
|
)
|
||||||
|
service.OnInstallComp( //装备组件
|
||||||
|
s_gateComp, //此服务需要接受用户的消息 需要装备网关组件
|
||||||
|
)
|
||||||
|
go func() {
|
||||||
|
lego.Run(service, //运行模块
|
||||||
|
module,
|
||||||
|
)
|
||||||
|
}()
|
||||||
|
time.Sleep(time.Second * 3)
|
||||||
|
defer os.Exit(m.Run())
|
||||||
|
}
|
||||||
|
|
||||||
|
func Test_Log(t *testing.T) {
|
||||||
|
data, _ := ptypes.MarshalAny(&pb.Pack_Getlist_Req{})
|
||||||
|
s_gateComp.ReceiveMsg(context.Background(), &pb.AgentMessage{Method: "pack.getlist", Message: data}, &pb.RPCMessageReply{})
|
||||||
|
// items, err := module.db_comp.Pack_QueryUserPack("liwei1dao")
|
||||||
|
// log.Debugf("item:%v err:%v", items, err)
|
||||||
|
}
|
@ -1,158 +0,0 @@
|
|||||||
package pack
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"go_dreamfactory/comm"
|
|
||||||
"go_dreamfactory/lego"
|
|
||||||
"go_dreamfactory/lego/base/rpcx"
|
|
||||||
"go_dreamfactory/lego/core"
|
|
||||||
"go_dreamfactory/lego/sys/log"
|
|
||||||
"go_dreamfactory/pb"
|
|
||||||
"go_dreamfactory/services"
|
|
||||||
"go_dreamfactory/sys/cache"
|
|
||||||
"go_dreamfactory/sys/configure"
|
|
||||||
"go_dreamfactory/sys/db"
|
|
||||||
"os"
|
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
||||||
)
|
|
||||||
|
|
||||||
func newService(ops ...rpcx.Option) core.IService {
|
|
||||||
s := new(TestService)
|
|
||||||
s.Configure(ops...)
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
|
||||||
//梦工厂基础服务对象
|
|
||||||
type TestService struct {
|
|
||||||
rpcx.RPCXService
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化相关系统
|
|
||||||
func (this *TestService) InitSys() {
|
|
||||||
this.RPCXService.InitSys()
|
|
||||||
if err := cache.OnInit(this.GetSettings().Sys["cache"]); err != nil {
|
|
||||||
panic(fmt.Sprintf("init sys.cache err: %s", err.Error()))
|
|
||||||
} else {
|
|
||||||
log.Infof("init sys.cache success!")
|
|
||||||
}
|
|
||||||
if err := db.OnInit(this.GetSettings().Sys["db"]); err != nil {
|
|
||||||
panic(fmt.Sprintf("init sys.db err: %s", err.Error()))
|
|
||||||
} else {
|
|
||||||
log.Infof("init sys.db success!")
|
|
||||||
}
|
|
||||||
if err := configure.OnInit(this.GetSettings().Sys["configure"]); err != nil {
|
|
||||||
panic(fmt.Sprintf("init sys.configure err: %s", err.Error()))
|
|
||||||
} else {
|
|
||||||
log.Infof("init sys.configure success!")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var service core.IService
|
|
||||||
var s_gateComp comm.ISC_GateRouteComp = services.NewGateRouteComp()
|
|
||||||
var module = new(Pack)
|
|
||||||
|
|
||||||
//测试环境下初始化db和cache 系统
|
|
||||||
func TestMain(m *testing.M) {
|
|
||||||
service = newService(
|
|
||||||
rpcx.SetConfPath("../../bin/conf/worker_2.yaml"),
|
|
||||||
rpcx.SetVersion("1.0.0.0"),
|
|
||||||
)
|
|
||||||
service.OnInstallComp( //装备组件
|
|
||||||
s_gateComp, //此服务需要接受用户的消息 需要装备网关组件
|
|
||||||
)
|
|
||||||
go func() {
|
|
||||||
lego.Run(service, //运行模块
|
|
||||||
module,
|
|
||||||
)
|
|
||||||
}()
|
|
||||||
time.Sleep(time.Second * 3)
|
|
||||||
defer os.Exit(m.Run())
|
|
||||||
}
|
|
||||||
|
|
||||||
func Test_Log(t *testing.T) {
|
|
||||||
// data, _ := ptypes.MarshalAny(&pb.Pack_Getlist_Req{})
|
|
||||||
// s_gateComp.ReceiveMsg(context.Background(), &pb.AgentMessage{Method: "pack.getlist", Message: data}, &pb.RPCMessageReply{})
|
|
||||||
itmes := make([]*pb.DB_UserItemData, 0)
|
|
||||||
err := module.model_pack_comp.GetList("0_62a9afd994fe03b7aaee6773", &itmes)
|
|
||||||
log.Debugf("item:%v err:%v", itmes, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Test_Pack_UpdateGridToUserPack(t *testing.T) {
|
|
||||||
uid := "0_62a9afd994fe03b7aaee6773"
|
|
||||||
Pack_UpdateGridToUserPack(
|
|
||||||
uid,
|
|
||||||
&pb.DB_UserItemData{
|
|
||||||
GridId: primitive.NewObjectID().Hex(),
|
|
||||||
UId: uid,
|
|
||||||
IsEmpty: false,
|
|
||||||
ItemId: 1001,
|
|
||||||
Amount: 99,
|
|
||||||
CTime: time.Now().Unix(),
|
|
||||||
IsNewItem: true,
|
|
||||||
},
|
|
||||||
&pb.DB_UserItemData{
|
|
||||||
GridId: primitive.NewObjectID().Hex(),
|
|
||||||
UId: uid,
|
|
||||||
IsEmpty: false,
|
|
||||||
ItemId: 1001,
|
|
||||||
Amount: 12,
|
|
||||||
CTime: time.Now().Unix(),
|
|
||||||
IsNewItem: true,
|
|
||||||
},
|
|
||||||
&pb.DB_UserItemData{
|
|
||||||
GridId: primitive.NewObjectID().Hex(),
|
|
||||||
UId: uid,
|
|
||||||
IsEmpty: false,
|
|
||||||
ItemId: 1002,
|
|
||||||
Amount: 99,
|
|
||||||
CTime: time.Now().Unix(),
|
|
||||||
IsNewItem: true,
|
|
||||||
},
|
|
||||||
&pb.DB_UserItemData{
|
|
||||||
GridId: primitive.NewObjectID().Hex(),
|
|
||||||
UId: uid,
|
|
||||||
IsEmpty: false,
|
|
||||||
ItemId: 1003,
|
|
||||||
Amount: 78,
|
|
||||||
CTime: time.Now().Unix(),
|
|
||||||
IsNewItem: true,
|
|
||||||
},
|
|
||||||
&pb.DB_UserItemData{
|
|
||||||
GridId: primitive.NewObjectID().Hex(),
|
|
||||||
UId: uid,
|
|
||||||
IsEmpty: false,
|
|
||||||
ItemId: 1004,
|
|
||||||
Amount: 99,
|
|
||||||
CTime: time.Now().Unix(),
|
|
||||||
IsNewItem: true,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//更新背包格子数据
|
|
||||||
func Pack_UpdateGridToUserPack(uId string, grids ...*pb.DB_UserItemData) (err error) {
|
|
||||||
// models := make([]mongo.WriteModel, len(grids))
|
|
||||||
// for i, v := range grids {
|
|
||||||
// models[i] = mongo.NewUpdateOneModel().SetFilter(bson.M{"_id": v.GridId}).SetUpdate(
|
|
||||||
// bson.M{"$set": bson.M{
|
|
||||||
// "uid": v.UId,
|
|
||||||
// "isempty": v.IsEmpty,
|
|
||||||
// "itemid": v.ItemId,
|
|
||||||
// "amount": v.Amount,
|
|
||||||
// "ctime": v.CTime,
|
|
||||||
// "etime": v.ETime,
|
|
||||||
// "isnewitem": v.IsNewItem,
|
|
||||||
// }}).SetUpsert(true)
|
|
||||||
// }
|
|
||||||
// module.model_pack_comp.DB.BulkWrite(DB_PackTable, models, options.BulkWrite().SetOrdered(false))
|
|
||||||
data := make([]interface{}, len(grids))
|
|
||||||
for i, v := range grids {
|
|
||||||
data[i] = v
|
|
||||||
}
|
|
||||||
module.model_pack_comp.DB.InsertMany(DB_PackTable, data)
|
|
||||||
return
|
|
||||||
}
|
|
2
pb.bat
2
pb.bat
@ -13,6 +13,6 @@ protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=import %SRC%\user\*.pro
|
|||||||
protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=import %SRC%\friend\*.proto
|
protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=import %SRC%\friend\*.proto
|
||||||
protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=import %SRC%\pack\*.proto
|
protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=import %SRC%\pack\*.proto
|
||||||
protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=import %SRC%\mail\*.proto
|
protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=import %SRC%\mail\*.proto
|
||||||
|
protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=import %SRC%\equipment\*.proto
|
||||||
|
|
||||||
pause
|
pause
|
341
pb/equipment_db.pb.go
Normal file
341
pb/equipment_db.pb.go
Normal file
@ -0,0 +1,341 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.28.0
|
||||||
|
// protoc v3.20.0
|
||||||
|
// source: equipment/equipment_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 EquipmentMainEntry int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
EquipmentMainEntry_Hp EquipmentMainEntry = 0
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum value maps for EquipmentMainEntry.
|
||||||
|
var (
|
||||||
|
EquipmentMainEntry_name = map[int32]string{
|
||||||
|
0: "Hp",
|
||||||
|
}
|
||||||
|
EquipmentMainEntry_value = map[string]int32{
|
||||||
|
"Hp": 0,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (x EquipmentMainEntry) Enum() *EquipmentMainEntry {
|
||||||
|
p := new(EquipmentMainEntry)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x EquipmentMainEntry) String() string {
|
||||||
|
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (EquipmentMainEntry) Descriptor() protoreflect.EnumDescriptor {
|
||||||
|
return file_equipment_equipment_db_proto_enumTypes[0].Descriptor()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (EquipmentMainEntry) Type() protoreflect.EnumType {
|
||||||
|
return &file_equipment_equipment_db_proto_enumTypes[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x EquipmentMainEntry) Number() protoreflect.EnumNumber {
|
||||||
|
return protoreflect.EnumNumber(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use EquipmentMainEntry.Descriptor instead.
|
||||||
|
func (EquipmentMainEntry) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return file_equipment_equipment_db_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
//装备副词条
|
||||||
|
type EquipmentAdverbEntry int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
EquipmentAdverbEntry_Crit EquipmentAdverbEntry = 0
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum value maps for EquipmentAdverbEntry.
|
||||||
|
var (
|
||||||
|
EquipmentAdverbEntry_name = map[int32]string{
|
||||||
|
0: "Crit",
|
||||||
|
}
|
||||||
|
EquipmentAdverbEntry_value = map[string]int32{
|
||||||
|
"Crit": 0,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (x EquipmentAdverbEntry) Enum() *EquipmentAdverbEntry {
|
||||||
|
p := new(EquipmentAdverbEntry)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x EquipmentAdverbEntry) String() string {
|
||||||
|
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (EquipmentAdverbEntry) Descriptor() protoreflect.EnumDescriptor {
|
||||||
|
return file_equipment_equipment_db_proto_enumTypes[1].Descriptor()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (EquipmentAdverbEntry) Type() protoreflect.EnumType {
|
||||||
|
return &file_equipment_equipment_db_proto_enumTypes[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x EquipmentAdverbEntry) Number() protoreflect.EnumNumber {
|
||||||
|
return protoreflect.EnumNumber(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use EquipmentAdverbEntry.Descriptor instead.
|
||||||
|
func (EquipmentAdverbEntry) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return file_equipment_equipment_db_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
type DB_Equipment struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Id string `protobuf:"bytes,1,opt,name=Id,proto3" json:"Id"` //装备id
|
||||||
|
CId int32 `protobuf:"zigzag32,2,opt,name=cId,proto3" json:"cId"` //配置Id
|
||||||
|
UId string `protobuf:"bytes,3,opt,name=uId,proto3" json:"uId"` //所属玩家Id
|
||||||
|
IsEquip bool `protobuf:"varint,4,opt,name=IsEquip,proto3" json:"IsEquip"` //是否装备
|
||||||
|
Lv int32 `protobuf:"zigzag32,5,opt,name=lv,proto3" json:"lv"` //装备强化等级
|
||||||
|
KeepFailNum int32 `protobuf:"zigzag32,6,opt,name=keepFailNum,proto3" json:"keepFailNum"` //连续强化失败次数
|
||||||
|
MainEntry map[uint32]int32 `protobuf:"bytes,7,rep,name=MainEntry,proto3" json:"MainEntry" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //装备主词条
|
||||||
|
AdverbEntry map[uint32]int32 `protobuf:"bytes,8,rep,name=AdverbEntry,proto3" json:"AdverbEntry" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //装备副词条
|
||||||
|
OverlayNum uint32 `protobuf:"varint,9,opt,name=OverlayNum,proto3" json:"OverlayNum"` //叠加数量
|
||||||
|
IsInitialState bool `protobuf:"varint,10,opt,name=IsInitialState,proto3" json:"IsInitialState"` //是否初始状态
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DB_Equipment) Reset() {
|
||||||
|
*x = DB_Equipment{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_equipment_equipment_db_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DB_Equipment) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*DB_Equipment) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *DB_Equipment) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_equipment_equipment_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 DB_Equipment.ProtoReflect.Descriptor instead.
|
||||||
|
func (*DB_Equipment) Descriptor() ([]byte, []int) {
|
||||||
|
return file_equipment_equipment_db_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DB_Equipment) GetId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DB_Equipment) GetCId() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.CId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DB_Equipment) GetUId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.UId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DB_Equipment) GetIsEquip() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.IsEquip
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DB_Equipment) GetLv() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Lv
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DB_Equipment) GetKeepFailNum() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.KeepFailNum
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DB_Equipment) GetMainEntry() map[uint32]int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.MainEntry
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DB_Equipment) GetAdverbEntry() map[uint32]int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.AdverbEntry
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DB_Equipment) GetOverlayNum() uint32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.OverlayNum
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DB_Equipment) GetIsInitialState() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.IsInitialState
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_equipment_equipment_db_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_equipment_equipment_db_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x1c, 0x65, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x65, 0x71, 0x75, 0x69,
|
||||||
|
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd2,
|
||||||
|
0x03, 0x0a, 0x0c, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x12,
|
||||||
|
0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12,
|
||||||
|
0x10, 0x0a, 0x03, 0x63, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x11, 0x52, 0x03, 0x63, 0x49,
|
||||||
|
0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
|
||||||
|
0x75, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x49, 0x73, 0x45, 0x71, 0x75, 0x69, 0x70, 0x18, 0x04,
|
||||||
|
0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x49, 0x73, 0x45, 0x71, 0x75, 0x69, 0x70, 0x12, 0x0e, 0x0a,
|
||||||
|
0x02, 0x6c, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x11, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x20, 0x0a,
|
||||||
|
0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75, 0x6d, 0x18, 0x06, 0x20, 0x01,
|
||||||
|
0x28, 0x11, 0x52, 0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75, 0x6d, 0x12,
|
||||||
|
0x3a, 0x0a, 0x09, 0x4d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x03,
|
||||||
|
0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e,
|
||||||
|
0x74, 0x2e, 0x4d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79,
|
||||||
|
0x52, 0x09, 0x4d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x40, 0x0a, 0x0b, 0x41,
|
||||||
|
0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b,
|
||||||
|
0x32, 0x1e, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2e,
|
||||||
|
0x41, 0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79,
|
||||||
|
0x52, 0x0b, 0x41, 0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x1e, 0x0a,
|
||||||
|
0x0a, 0x4f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75, 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28,
|
||||||
|
0x0d, 0x52, 0x0a, 0x4f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75, 0x6d, 0x12, 0x26, 0x0a,
|
||||||
|
0x0e, 0x49, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18,
|
||||||
|
0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x49, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c,
|
||||||
|
0x53, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x3c, 0x0a, 0x0e, 0x4d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74,
|
||||||
|
0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01,
|
||||||
|
0x20, 0x01, 0x28, 0x0d, 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, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74,
|
||||||
|
0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01,
|
||||||
|
0x20, 0x01, 0x28, 0x0d, 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, 0x2a, 0x1c, 0x0a, 0x12, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74,
|
||||||
|
0x4d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x06, 0x0a, 0x02, 0x48, 0x70, 0x10,
|
||||||
|
0x00, 0x2a, 0x20, 0x0a, 0x14, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x64,
|
||||||
|
0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x72, 0x69,
|
||||||
|
0x74, 0x10, 0x00, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||||
|
0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_equipment_equipment_db_proto_rawDescOnce sync.Once
|
||||||
|
file_equipment_equipment_db_proto_rawDescData = file_equipment_equipment_db_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_equipment_equipment_db_proto_rawDescGZIP() []byte {
|
||||||
|
file_equipment_equipment_db_proto_rawDescOnce.Do(func() {
|
||||||
|
file_equipment_equipment_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_equipment_equipment_db_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_equipment_equipment_db_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_equipment_equipment_db_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
|
||||||
|
var file_equipment_equipment_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||||
|
var file_equipment_equipment_db_proto_goTypes = []interface{}{
|
||||||
|
(EquipmentMainEntry)(0), // 0: EquipmentMainEntry
|
||||||
|
(EquipmentAdverbEntry)(0), // 1: EquipmentAdverbEntry
|
||||||
|
(*DB_Equipment)(nil), // 2: DB_Equipment
|
||||||
|
nil, // 3: DB_Equipment.MainEntryEntry
|
||||||
|
nil, // 4: DB_Equipment.AdverbEntryEntry
|
||||||
|
}
|
||||||
|
var file_equipment_equipment_db_proto_depIdxs = []int32{
|
||||||
|
3, // 0: DB_Equipment.MainEntry:type_name -> DB_Equipment.MainEntryEntry
|
||||||
|
4, // 1: DB_Equipment.AdverbEntry:type_name -> DB_Equipment.AdverbEntryEntry
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_equipment_equipment_db_proto_init() }
|
||||||
|
func file_equipment_equipment_db_proto_init() {
|
||||||
|
if File_equipment_equipment_db_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_equipment_equipment_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*DB_Equipment); 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_equipment_equipment_db_proto_rawDesc,
|
||||||
|
NumEnums: 2,
|
||||||
|
NumMessages: 3,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_equipment_equipment_db_proto_goTypes,
|
||||||
|
DependencyIndexes: file_equipment_equipment_db_proto_depIdxs,
|
||||||
|
EnumInfos: file_equipment_equipment_db_proto_enumTypes,
|
||||||
|
MessageInfos: file_equipment_equipment_db_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_equipment_equipment_db_proto = out.File
|
||||||
|
file_equipment_equipment_db_proto_rawDesc = nil
|
||||||
|
file_equipment_equipment_db_proto_goTypes = nil
|
||||||
|
file_equipment_equipment_db_proto_depIdxs = nil
|
||||||
|
}
|
482
pb/equipment_msg.pb.go
Normal file
482
pb/equipment_msg.pb.go
Normal file
@ -0,0 +1,482 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.28.0
|
||||||
|
// protoc v3.20.0
|
||||||
|
// source: equipment/equipment_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 Equipment_GetList_Req struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_GetList_Req) Reset() {
|
||||||
|
*x = Equipment_GetList_Req{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_equipment_equipment_msg_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_GetList_Req) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Equipment_GetList_Req) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Equipment_GetList_Req) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_equipment_equipment_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 Equipment_GetList_Req.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Equipment_GetList_Req) Descriptor() ([]byte, []int) {
|
||||||
|
return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取装备列表请求 回应
|
||||||
|
type Equipment_GetList_Resp struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Equipments []*DB_Equipment `protobuf:"bytes,1,rep,name=Equipments,proto3" json:"Equipments"` //装备列表
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_GetList_Resp) Reset() {
|
||||||
|
*x = Equipment_GetList_Resp{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_equipment_equipment_msg_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_GetList_Resp) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Equipment_GetList_Resp) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Equipment_GetList_Resp) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_equipment_equipment_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 Equipment_GetList_Resp.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Equipment_GetList_Resp) Descriptor() ([]byte, []int) {
|
||||||
|
return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_GetList_Resp) GetEquipments() []*DB_Equipment {
|
||||||
|
if x != nil {
|
||||||
|
return x.Equipments
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
//装备挂在到英雄上
|
||||||
|
type Equipment_Equip_Req struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
EquipmentId string `protobuf:"bytes,1,opt,name=EquipmentId,proto3" json:"EquipmentId"` //装备Id
|
||||||
|
HeroCardId string `protobuf:"bytes,2,opt,name=HeroCardId,proto3" json:"HeroCardId"` //英雄卡Id
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_Equip_Req) Reset() {
|
||||||
|
*x = Equipment_Equip_Req{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_equipment_equipment_msg_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_Equip_Req) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Equipment_Equip_Req) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Equipment_Equip_Req) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_equipment_equipment_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 Equipment_Equip_Req.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Equipment_Equip_Req) Descriptor() ([]byte, []int) {
|
||||||
|
return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_Equip_Req) GetEquipmentId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.EquipmentId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_Equip_Req) GetHeroCardId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.HeroCardId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
//装备挂在到英雄上 回应
|
||||||
|
type Equipment_Equip_Resp struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
EquipmentId string `protobuf:"bytes,1,opt,name=EquipmentId,proto3" json:"EquipmentId"` //装备Id
|
||||||
|
HeroCardId string `protobuf:"bytes,2,opt,name=HeroCardId,proto3" json:"HeroCardId"` //英雄卡Id
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_Equip_Resp) Reset() {
|
||||||
|
*x = Equipment_Equip_Resp{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_equipment_equipment_msg_proto_msgTypes[3]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_Equip_Resp) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Equipment_Equip_Resp) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Equipment_Equip_Resp) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_equipment_equipment_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 Equipment_Equip_Resp.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Equipment_Equip_Resp) Descriptor() ([]byte, []int) {
|
||||||
|
return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{3}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_Equip_Resp) GetEquipmentId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.EquipmentId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_Equip_Resp) GetHeroCardId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.HeroCardId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
//装备升级
|
||||||
|
type Equipment_Upgrade_Req struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
EquipmentId string `protobuf:"bytes,1,opt,name=EquipmentId,proto3" json:"EquipmentId"` //装备Id
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_Upgrade_Req) Reset() {
|
||||||
|
*x = Equipment_Upgrade_Req{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_equipment_equipment_msg_proto_msgTypes[4]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_Upgrade_Req) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Equipment_Upgrade_Req) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Equipment_Upgrade_Req) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_equipment_equipment_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 Equipment_Upgrade_Req.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Equipment_Upgrade_Req) Descriptor() ([]byte, []int) {
|
||||||
|
return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{4}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_Upgrade_Req) GetEquipmentId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.EquipmentId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
//装备升级 回应
|
||||||
|
type Equipment_Upgrade_Resp struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
EquipmentId string `protobuf:"bytes,1,opt,name=EquipmentId,proto3" json:"EquipmentId"` //装备Id
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_Upgrade_Resp) Reset() {
|
||||||
|
*x = Equipment_Upgrade_Resp{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_equipment_equipment_msg_proto_msgTypes[5]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_Upgrade_Resp) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Equipment_Upgrade_Resp) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Equipment_Upgrade_Resp) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_equipment_equipment_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 Equipment_Upgrade_Resp.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Equipment_Upgrade_Resp) Descriptor() ([]byte, []int) {
|
||||||
|
return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{5}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Equipment_Upgrade_Resp) GetEquipmentId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.EquipmentId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_equipment_equipment_msg_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_equipment_equipment_msg_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x1d, 0x65, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x65, 0x71, 0x75, 0x69,
|
||||||
|
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
|
||||||
|
0x1c, 0x65, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x65, 0x71, 0x75, 0x69, 0x70,
|
||||||
|
0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x17, 0x0a,
|
||||||
|
0x15, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x47, 0x65, 0x74, 0x4c, 0x69,
|
||||||
|
0x73, 0x74, 0x5f, 0x52, 0x65, 0x71, 0x22, 0x47, 0x0a, 0x16, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d,
|
||||||
|
0x65, 0x6e, 0x74, 0x5f, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x5f, 0x52, 0x65, 0x73, 0x70,
|
||||||
|
0x12, 0x2d, 0x0a, 0x0a, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01,
|
||||||
|
0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d,
|
||||||
|
0x65, 0x6e, 0x74, 0x52, 0x0a, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22,
|
||||||
|
0x57, 0x0a, 0x13, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x45, 0x71, 0x75,
|
||||||
|
0x69, 0x70, 0x5f, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d,
|
||||||
|
0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x71, 0x75,
|
||||||
|
0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x48, 0x65, 0x72, 0x6f,
|
||||||
|
0x43, 0x61, 0x72, 0x64, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x48, 0x65,
|
||||||
|
0x72, 0x6f, 0x43, 0x61, 0x72, 0x64, 0x49, 0x64, 0x22, 0x58, 0x0a, 0x14, 0x45, 0x71, 0x75, 0x69,
|
||||||
|
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x5f, 0x52, 0x65, 0x73, 0x70,
|
||||||
|
0x12, 0x20, 0x0a, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18,
|
||||||
|
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74,
|
||||||
|
0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x61, 0x72, 0x64, 0x49, 0x64,
|
||||||
|
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x61, 0x72, 0x64,
|
||||||
|
0x49, 0x64, 0x22, 0x39, 0x0a, 0x15, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f,
|
||||||
|
0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x5f, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x0b, 0x45,
|
||||||
|
0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||||
|
0x52, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x3a, 0x0a,
|
||||||
|
0x16, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x55, 0x70, 0x67, 0x72, 0x61,
|
||||||
|
0x64, 0x65, 0x5f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x20, 0x0a, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70,
|
||||||
|
0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x71,
|
||||||
|
0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
|
||||||
|
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_equipment_equipment_msg_proto_rawDescOnce sync.Once
|
||||||
|
file_equipment_equipment_msg_proto_rawDescData = file_equipment_equipment_msg_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_equipment_equipment_msg_proto_rawDescGZIP() []byte {
|
||||||
|
file_equipment_equipment_msg_proto_rawDescOnce.Do(func() {
|
||||||
|
file_equipment_equipment_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_equipment_equipment_msg_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_equipment_equipment_msg_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_equipment_equipment_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||||
|
var file_equipment_equipment_msg_proto_goTypes = []interface{}{
|
||||||
|
(*Equipment_GetList_Req)(nil), // 0: Equipment_GetList_Req
|
||||||
|
(*Equipment_GetList_Resp)(nil), // 1: Equipment_GetList_Resp
|
||||||
|
(*Equipment_Equip_Req)(nil), // 2: Equipment_Equip_Req
|
||||||
|
(*Equipment_Equip_Resp)(nil), // 3: Equipment_Equip_Resp
|
||||||
|
(*Equipment_Upgrade_Req)(nil), // 4: Equipment_Upgrade_Req
|
||||||
|
(*Equipment_Upgrade_Resp)(nil), // 5: Equipment_Upgrade_Resp
|
||||||
|
(*DB_Equipment)(nil), // 6: DB_Equipment
|
||||||
|
}
|
||||||
|
var file_equipment_equipment_msg_proto_depIdxs = []int32{
|
||||||
|
6, // 0: Equipment_GetList_Resp.Equipments:type_name -> DB_Equipment
|
||||||
|
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_equipment_equipment_msg_proto_init() }
|
||||||
|
func file_equipment_equipment_msg_proto_init() {
|
||||||
|
if File_equipment_equipment_msg_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
file_equipment_equipment_db_proto_init()
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_equipment_equipment_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Equipment_GetList_Req); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_equipment_equipment_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Equipment_GetList_Resp); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_equipment_equipment_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Equipment_Equip_Req); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_equipment_equipment_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Equipment_Equip_Resp); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_equipment_equipment_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Equipment_Upgrade_Req); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_equipment_equipment_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Equipment_Upgrade_Resp); 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_equipment_equipment_msg_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 6,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_equipment_equipment_msg_proto_goTypes,
|
||||||
|
DependencyIndexes: file_equipment_equipment_msg_proto_depIdxs,
|
||||||
|
MessageInfos: file_equipment_equipment_msg_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_equipment_equipment_msg_proto = out.File
|
||||||
|
file_equipment_equipment_msg_proto_rawDesc = nil
|
||||||
|
file_equipment_equipment_msg_proto_goTypes = nil
|
||||||
|
file_equipment_equipment_msg_proto_depIdxs = nil
|
||||||
|
}
|
25
pb/proto/equipment/equipment_db.proto
Normal file
25
pb/proto/equipment/equipment_db.proto
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
option go_package = ".;pb";
|
||||||
|
|
||||||
|
//装备主词条
|
||||||
|
enum EquipmentMainEntry {
|
||||||
|
Hp = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//装备副词条
|
||||||
|
enum EquipmentAdverbEntry {
|
||||||
|
Crit = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DB_Equipment {
|
||||||
|
string Id = 1; //装备id
|
||||||
|
sint32 cId = 2; //配置Id
|
||||||
|
string uId = 3; //所属玩家Id
|
||||||
|
bool IsEquip = 4; //是否装备
|
||||||
|
sint32 lv = 5; //装备强化等级
|
||||||
|
sint32 keepFailNum = 6; //连续强化失败次数
|
||||||
|
map<uint32,int32> MainEntry = 7; //装备主词条
|
||||||
|
map<uint32,int32> AdverbEntry = 8; //装备副词条
|
||||||
|
uint32 OverlayNum = 9; //叠加数量
|
||||||
|
bool IsInitialState = 10; //是否初始状态
|
||||||
|
}
|
34
pb/proto/equipment/equipment_msg.proto
Normal file
34
pb/proto/equipment/equipment_msg.proto
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
option go_package = ".;pb";
|
||||||
|
import "equipment/equipment_db.proto";
|
||||||
|
|
||||||
|
//获取装备列表请求
|
||||||
|
message Equipment_GetList_Req {
|
||||||
|
|
||||||
|
}
|
||||||
|
//获取装备列表请求 回应
|
||||||
|
message Equipment_GetList_Resp {
|
||||||
|
repeated DB_Equipment Equipments = 1; //装备列表
|
||||||
|
}
|
||||||
|
|
||||||
|
//装备挂在到英雄上
|
||||||
|
message Equipment_Equip_Req{
|
||||||
|
string EquipmentId = 1; //装备Id
|
||||||
|
string HeroCardId = 2; //英雄卡Id
|
||||||
|
}
|
||||||
|
|
||||||
|
//装备挂在到英雄上 回应
|
||||||
|
message Equipment_Equip_Resp{
|
||||||
|
string EquipmentId = 1; //装备Id
|
||||||
|
string HeroCardId = 2; //英雄卡Id
|
||||||
|
}
|
||||||
|
|
||||||
|
//装备升级
|
||||||
|
message Equipment_Upgrade_Req{
|
||||||
|
string EquipmentId = 1; //装备Id
|
||||||
|
}
|
||||||
|
|
||||||
|
//装备升级 回应
|
||||||
|
message Equipment_Upgrade_Resp{
|
||||||
|
string EquipmentId = 1; //装备Id
|
||||||
|
}
|
@ -14,9 +14,10 @@ enum ErrorCode {
|
|||||||
NoLogin = 18; //未登录
|
NoLogin = 18; //未登录
|
||||||
UserSessionNobeing = 19; //用户不存在
|
UserSessionNobeing = 19; //用户不存在
|
||||||
StateInvalid = 20; //无效状态
|
StateInvalid = 20; //无效状态
|
||||||
DBError = 21; // 数据库操作失败
|
DBError = 21; //数据库操作失败
|
||||||
SystemError = 22; // 通用错误
|
SystemError = 22; //通用错误
|
||||||
Exception = 100; //程序执行异常
|
Exception = 100; //程序执行异常
|
||||||
|
Unknown = 101; //未知错误
|
||||||
|
|
||||||
// user
|
// user
|
||||||
SecKeyInvalid = 1000; //秘钥无效
|
SecKeyInvalid = 1000; //秘钥无效
|
||||||
@ -36,4 +37,10 @@ enum ErrorCode {
|
|||||||
FriendApplyError = 1109; //申请失败
|
FriendApplyError = 1109; //申请失败
|
||||||
FriendBlackMax = 1110; //黑名单最大数量
|
FriendBlackMax = 1110; //黑名单最大数量
|
||||||
FriendSearchNameEmpty = 1111; //查询昵称为空
|
FriendSearchNameEmpty = 1111; //查询昵称为空
|
||||||
|
|
||||||
|
//pack
|
||||||
|
PackNoEnough = 1200; //背包物品不足
|
||||||
|
PackNoFoundGird = 1201; //背包未找到物品格子
|
||||||
|
PackGridNumUpper = 1202; //背包格子数量已达上限
|
||||||
|
PackGirdAmountUpper = 1203; //背包格子容量已达上限
|
||||||
}
|
}
|
39
sys/configure/structs/game.equipment.go
Normal file
39
sys/configure/structs/game.equipment.go
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <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 Game_equipment struct {
|
||||||
|
_dataMap map[int32]*Game_equipmentData
|
||||||
|
_dataList []*Game_equipmentData
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGame_equipment(_buf []map[string]interface{}) (*Game_equipment, error) {
|
||||||
|
_dataList := make([]*Game_equipmentData, 0, len(_buf))
|
||||||
|
dataMap := make(map[int32]*Game_equipmentData)
|
||||||
|
for _, _ele_ := range _buf {
|
||||||
|
if _v, err2 := NewGame_equipmentData(_ele_); err2 != nil {
|
||||||
|
return nil, err2
|
||||||
|
} else {
|
||||||
|
_dataList = append(_dataList, _v)
|
||||||
|
dataMap[_v.Id] = _v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return &Game_equipment{_dataList: _dataList, _dataMap: dataMap}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (table *Game_equipment) GetDataMap() map[int32]*Game_equipmentData {
|
||||||
|
return table._dataMap
|
||||||
|
}
|
||||||
|
|
||||||
|
func (table *Game_equipment) GetDataList() []*Game_equipmentData {
|
||||||
|
return table._dataList
|
||||||
|
}
|
||||||
|
|
||||||
|
func (table *Game_equipment) Get(key int32) *Game_equipmentData {
|
||||||
|
return table._dataMap[key]
|
||||||
|
}
|
33
sys/configure/structs/game.equipmentData.go
Normal file
33
sys/configure/structs/game.equipmentData.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <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 Game_equipmentData struct {
|
||||||
|
Id int32
|
||||||
|
Name string
|
||||||
|
Star int32
|
||||||
|
Quality int32
|
||||||
|
Station int32
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Game_equipmentData) GetTypeId() int {
|
||||||
|
return 859081052
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGame_equipmentData(_buf map[string]interface{}) (_v *Game_equipmentData, err error) {
|
||||||
|
_v = &Game_equipmentData{}
|
||||||
|
{ 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; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } }
|
||||||
|
{ 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 _tempNum_ float64; if _tempNum_, _ok_ = _buf["quality"].(float64); !_ok_ { err = errors.New("quality error"); return }; _v.Quality = int32(_tempNum_) }
|
||||||
|
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["station"].(float64); !_ok_ { err = errors.New("station error"); return }; _v.Station = int32(_tempNum_) }
|
||||||
|
return
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user