This commit is contained in:
liwei1dao 2022-06-28 18:20:05 +08:00
commit eec7fd58f3
38 changed files with 551 additions and 562 deletions

View File

@ -11,20 +11,20 @@ var (
friendBuilders = []*builder{ friendBuilders = []*builder{
{ {
//list //list
mainType: string(comm.SM_FriendModule), mainType: string(comm.ModuleFriend),
subType: friend.FriendSubTypeList, subType: friend.FriendSubTypeList,
req: &pb.FriendListReq{}, req: &pb.FriendListReq{},
rsp: &pb.FriendListRsp{}, rsp: &pb.FriendListRsp{},
enabled: true, enabled: true,
}, { }, {
//blacklist //blacklist
mainType: string(comm.SM_FriendModule), mainType: string(comm.ModuleFriend),
subType: friend.FriendSubTypeBlacklist, subType: friend.FriendSubTypeBlacklist,
req: &pb.FriendBlackListReq{}, req: &pb.FriendBlackListReq{},
rsp: &pb.FriendBlackListRsp{}, rsp: &pb.FriendBlackListRsp{},
}, { }, {
//search //search
mainType: string(comm.SM_FriendModule), mainType: string(comm.ModuleFriend),
subType: friend.FriendSubTypeSearch, subType: friend.FriendSubTypeSearch,
req: &pb.FriendSearchReq{ req: &pb.FriendSearchReq{
NickName: "", //设置测试参数 NickName: "", //设置测试参数
@ -32,32 +32,32 @@ var (
rsp: &pb.FriendSearchRsp{}, rsp: &pb.FriendSearchRsp{},
}, { }, {
//apply //apply
mainType: string(comm.SM_FriendModule), mainType: string(comm.ModuleFriend),
subType: friend.FriendSubTypeApply, subType: friend.FriendSubTypeApply,
req: &pb.FriendApplyReq{}, req: &pb.FriendApplyReq{},
rsp: &pb.FriendApplyRsp{}, rsp: &pb.FriendApplyRsp{},
enabled: true, enabled: true,
}, { }, {
//applylist //applylist
mainType: string(comm.SM_FriendModule), mainType: string(comm.ModuleFriend),
subType: friend.FriendSubTypeApplyList, subType: friend.FriendSubTypeApplyList,
req: &pb.FriendApplyListReq{}, req: &pb.FriendApplyListReq{},
rsp: &pb.FriendApplyListRsp{}, rsp: &pb.FriendApplyListRsp{},
}, { }, {
//agree //agree
mainType: string(comm.SM_FriendModule), mainType: string(comm.ModuleFriend),
subType: friend.FriendSubTypeAgree, subType: friend.FriendSubTypeAgree,
req: &pb.FriendAgreeReq{}, req: &pb.FriendAgreeReq{},
rsp: &pb.FriendAgreeRsp{}, rsp: &pb.FriendAgreeRsp{},
}, { }, {
//refuse //refuse
mainType: string(comm.SM_FriendModule), mainType: string(comm.ModuleFriend),
subType: friend.FriendSubTypeRefuse, subType: friend.FriendSubTypeRefuse,
req: &pb.FriendAgreeReq{}, req: &pb.FriendAgreeReq{},
rsp: &pb.FriendAgreeRsp{}, rsp: &pb.FriendAgreeRsp{},
}, { }, {
//addblack //addblack
mainType: string(comm.SM_FriendModule), mainType: string(comm.ModuleFriend),
subType: friend.FriendSubTypeAddBlack, subType: friend.FriendSubTypeAddBlack,
req: &pb.FriendBlackAddReq{ req: &pb.FriendBlackAddReq{
FriendId: "", FriendId: "",
@ -65,7 +65,7 @@ var (
rsp: &pb.FriendBlackAddRsp{}, rsp: &pb.FriendBlackAddRsp{},
}, { }, {
//delblack //delblack
mainType: string(comm.SM_FriendModule), mainType: string(comm.ModuleFriend),
subType: friend.FriendSubTypeDelBlack, subType: friend.FriendSubTypeDelBlack,
req: &pb.FriendDelBlackReq{}, req: &pb.FriendDelBlackReq{},
rsp: &pb.FriendDelBlackRsp{}, rsp: &pb.FriendDelBlackRsp{},

View File

@ -10,13 +10,15 @@ var (
//hero //hero
heroBuilders = []*builder{ heroBuilders = []*builder{
{ {
mainType: string(comm.SM_HeroModule), mainType: string(comm.ModuleHero),
subType: hero.HeroSubTypeList, subType: hero.HeroSubTypeList,
req: &pb.Hero_List_Req{}, req: &pb.HeroListReq{},
rsp: &pb.Hero_List_Rsp{}, rsp: &pb.HeroListRsp{},
enabled: true, enabled: true,
}, { }, {
mainType: string(comm.SM_HeroModule), mainType: string(comm.ModuleHero),
subType: hero.HeroSubTypeList,
req: &pb.HeroInfoReq{},
}, },
} }
) )

View File

@ -37,7 +37,7 @@ func (r *Robot) AccountLogin() {
log.Printf("区服:[%d] 账号:[%s] login...", r.opts.ServerId, r.opts.Account) log.Printf("区服:[%d] 账号:[%s] login...", r.opts.ServerId, r.opts.Account)
builders := []*builder{ builders := []*builder{
{ {
mainType: string(comm.SM_UserModule), mainType: string(comm.ModuleUser),
subType: user.UserSubTypeLogin, subType: user.UserSubTypeLogin,
req: &pb.UserLoginReq{ req: &pb.UserLoginReq{
Account: r.opts.Account, Account: r.opts.Account,

View File

@ -8,8 +8,8 @@ import (
var notify_builders = []*builder{ var notify_builders = []*builder{
{ {
//create //create
mainType: comm.MainType_Notify, mainType: comm.MainTypeNotify,
subType: comm.SubType_ErrorNotify, subType: comm.SubTypeErrorNotify,
rsp: &pb.ErrorNotify{}, rsp: &pb.ErrorNotify{},
enabled: true, enabled: true,
}, },

View File

@ -9,7 +9,7 @@ import (
var pack_builders = []*builder{ var pack_builders = []*builder{
{ {
//create //create
mainType: string(comm.SM_PackModule), mainType: string(comm.ModulePack),
subType: "queryuserpackreq", subType: "queryuserpackreq",
// req: &pb.Pack_Getlist_Req{IType: 1}, // req: &pb.Pack_Getlist_Req{IType: 1},
rsp: &pb.UserCreateRsp{}, rsp: &pb.UserCreateRsp{},

View File

@ -10,7 +10,7 @@ import (
var user_builders = []*builder{ var user_builders = []*builder{
{ {
//create //create
mainType: string(comm.SM_UserModule), mainType: string(comm.ModuleUser),
subType: user.UserSubTypeCreate, subType: user.UserSubTypeCreate,
req: &pb.UserCreateReq{ //设置请求参数 req: &pb.UserCreateReq{ //设置请求参数
NickName: "乐谷6281", NickName: "乐谷6281",

View File

@ -22,23 +22,23 @@ const (
//ERR //ERR
const ( const (
MainType_Notify = "notify" //通知 MainTypeNotify = "notify" //通知
SubType_ErrorNotify = "errornotify" //错误通知 SubTypeErrorNotify = "errornotify" //错误通知
) )
//模块名定义处 //模块名定义处
const ( const (
SM_GateModule core.M_Modules = "gateway" //gate模块 网关服务模块 ModuleGate core.M_Modules = "gateway" //gate模块 网关服务模块
SM_WebModule core.M_Modules = "web" //web模块 ModuleWeb core.M_Modules = "web" //web模块
SM_UserModule core.M_Modules = "user" //用户模块 ModuleUser core.M_Modules = "user" //用户模块
SM_PackModule core.M_Modules = "pack" //背包模块 ModulePack core.M_Modules = "pack" //背包模块
SM_MailModule core.M_Modules = "mail" //邮件模块 ModuleMail core.M_Modules = "mail" //邮件模块
SM_FriendModule core.M_Modules = "friend" //好友模块 ModuleFriend core.M_Modules = "friend" //好友模块
SM_LogModelModule core.M_Modules = "model" //日志模块 ModuleLogModel core.M_Modules = "model" //日志模块
SM_EquipmentModule core.M_Modules = "equipment" //装备模块 ModuleEquipment core.M_Modules = "equipment" //装备模块
SM_HeroModule core.M_Modules = "hero" //英雄模块 ModuleHero core.M_Modules = "hero" //英雄模块
SM_ForumModule core.M_Modules = "forum" //论坛模块 ModuleForum core.M_Modules = "forum" //论坛模块
SM_ItemsModule core.M_Modules = "item" ModuleItems core.M_Modules = "item"
) )
//RPC服务接口定义处 //RPC服务接口定义处
@ -55,13 +55,13 @@ const ( //Rpc
//事件类型定义处 //事件类型定义处
const ( const (
Event_UserLogin core.Event_Key = "Event_UserLogin" //登录事件 EventUserLogin core.Event_Key = "Event_UserLogin" //登录事件
Event_CreateUser core.Event_Key = "Event_CreateUser" //创建角色事件 EventCreateUser core.Event_Key = "Event_CreateUser" //创建角色事件
Event_UserOffline core.Event_Key = "Event_UserOffline" //用户离线事件 EventUserOffline core.Event_Key = "Event_UserOffline" //用户离线事件
) )
const ( const (
DBService_Status string = "DBService_status" DBServiceStatus string = "DBService_status"
) )
const ( const (

View File

@ -42,11 +42,11 @@ type (
// 获取英雄 // 获取英雄
// heroId 英雄ID // heroId 英雄ID
GetHero(uid, heroId string) (*pb.DB_HeroData, pb.ErrorCode) GetHero(uid, heroId string) (*pb.DBHero, pb.ErrorCode)
// 佩戴装备 // 佩戴装备
UpdateEquipment(hero *pb.DB_HeroData, equip []*pb.DB_Equipment) (code pb.ErrorCode) UpdateEquipment(hero *pb.DBHero, equip []*pb.DB_Equipment) (code pb.ErrorCode)
//获取玩家英雄列表 //获取玩家英雄列表
GetHeroList(uid string) []*pb.DB_HeroData GetHeroList(uid string) []*pb.DBHero
} }
//玩家 //玩家

View File

@ -30,7 +30,7 @@ func (this *DB_Comp) Start() (err error) {
err = this.MCompModel.Start() err = this.MCompModel.Start()
model_count := this.Model_TotalCount() model_count := this.Model_TotalCount()
if model_count > 0 { //1000 if model_count > 0 { //1000
this.Redis.Set(comm.DBService_Status, true, -1) this.Redis.Set(comm.DBServiceStatus, true, -1)
this.isInit = false this.isInit = false
} else { } else {
this.isInit = true this.isInit = true
@ -48,7 +48,7 @@ func (this *DB_Comp) run() {
this.Model_UpdateDBByLog("") this.Model_UpdateDBByLog("")
} }
if !this.isInit && this.Model_TotalCount() <= 0 { if !this.isInit && this.Model_TotalCount() <= 0 {
this.Redis.Delete(comm.DBService_Status) this.Redis.Delete(comm.DBServiceStatus)
} }
} }
} }

View File

@ -23,7 +23,7 @@ func (this *DBService) Init(service core.IService, module core.IModule, options
} }
func (this *DBService) GetType() core.M_Modules { func (this *DBService) GetType() core.M_Modules {
return comm.SM_LogModelModule return comm.ModuleLogModel
} }
func (this *DBService) OnInstallComp() { func (this *DBService) OnInstallComp() {

View File

@ -14,7 +14,7 @@ func (this *apiComp) EquipCheck(session comm.IUserSession, req *pb.Equipment_Equ
errorCode pb.ErrorCode errorCode pb.ErrorCode
confs []*cfg.Game_equipData confs []*cfg.Game_equipData
equipments []*pb.DB_Equipment equipments []*pb.DB_Equipment
hero *pb.DB_HeroData hero *pb.DBHero
) )
confs = make([]*cfg.Game_equipData, len(req.EquipmentId)) confs = make([]*cfg.Game_equipData, len(req.EquipmentId))
equipments = make([]*pb.DB_Equipment, len(req.EquipmentId)) equipments = make([]*pb.DB_Equipment, len(req.EquipmentId))
@ -53,13 +53,13 @@ func (this *apiComp) Equip(session comm.IUserSession, agrs map[string]interface{
equipment *pb.DB_Equipment equipment *pb.DB_Equipment
equipments []*pb.DB_Equipment equipments []*pb.DB_Equipment
updatequipment []*pb.DB_Equipment updatequipment []*pb.DB_Equipment
hero *pb.DB_HeroData hero *pb.DBHero
) )
confs = agrs["conf"].([]*cfg.Game_equipData) confs = agrs["conf"].([]*cfg.Game_equipData)
equipments = agrs["equipment"].([]*pb.DB_Equipment) equipments = agrs["equipment"].([]*pb.DB_Equipment)
updatequipment = make([]*pb.DB_Equipment, 0) updatequipment = make([]*pb.DB_Equipment, 0)
hero = agrs["hero"].(*pb.DB_HeroData) hero = agrs["hero"].(*pb.DBHero)
for i, v := range hero.EquipID { for i, v := range hero.EquipID {
if v != "" { if v != "" {

View File

@ -55,7 +55,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, agrs map[string]interfac
conf *cfg.Game_equipData conf *cfg.Game_equipData
intensify *cfg.Game_equipIntensifyData intensify *cfg.Game_equipIntensifyData
equipment *pb.DB_Equipment equipment *pb.DB_Equipment
hero *pb.DB_HeroData hero *pb.DBHero
equipments []*pb.DB_Equipment equipments []*pb.DB_Equipment
issucc bool issucc bool
) )

View File

@ -31,7 +31,7 @@ type Equipment struct {
//模块名 //模块名
func (this *Equipment) GetType() core.M_Modules { func (this *Equipment) GetType() core.M_Modules {
return comm.SM_EquipmentModule return comm.ModuleEquipment
} }
//模块初始化接口 注册用户创建角色事件 //模块初始化接口 注册用户创建角色事件
@ -45,7 +45,7 @@ func (this *Equipment) Init(service core.IService, module core.IModule, options
func (this *Equipment) Start() (err error) { func (this *Equipment) Start() (err error) {
err = this.ModuleBase.Start() err = this.ModuleBase.Start()
var module interface{} var module interface{}
if module, err = this.service.GetModule(comm.SM_HeroModule); err != nil { if module, err = this.service.GetModule(comm.ModuleHero); err != nil {
log.Errorf("Equipment Start err:%v", err) log.Errorf("Equipment Start err:%v", err)
return return
} }

View File

@ -25,7 +25,7 @@ type Forum struct {
//模块名 //模块名
func (this *Forum) GetType() core.M_Modules { func (this *Forum) GetType() core.M_Modules {
return comm.SM_EquipmentModule return comm.ModuleEquipment
} }
//模块初始化接口 注册用户创建角色事件 //模块初始化接口 注册用户创建角色事件

View File

@ -19,7 +19,7 @@ type Friend struct {
} }
func (this *Friend) GetType() core.M_Modules { func (this *Friend) GetType() core.M_Modules {
return comm.SM_FriendModule return comm.ModuleFriend
} }
func (this *Friend) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { func (this *Friend) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {

View File

@ -24,7 +24,7 @@ type Game struct {
//模块名 //模块名
func (this *Game) GetType() core.M_Modules { func (this *Game) GetType() core.M_Modules {
return comm.SM_EquipmentModule return comm.ModuleEquipment
} }
//模块初始化接口 注册用户创建角色事件 //模块初始化接口 注册用户创建角色事件

View File

@ -83,8 +83,8 @@ locp:
} else { } else {
data, _ := anypb.New(&pb.ErrorNotify{ReqMainType: msg.MainType, ReqSubType: msg.SubType, Code: pb.ErrorCode_SecKeyInvalid}) data, _ := anypb.New(&pb.ErrorNotify{ReqMainType: msg.MainType, ReqSubType: msg.SubType, Code: pb.ErrorCode_SecKeyInvalid})
if err = this.WriteMsg(&pb.UserMessage{ if err = this.WriteMsg(&pb.UserMessage{
MainType: comm.MainType_Notify, MainType: comm.MainTypeNotify,
SubType: comm.SubType_ErrorNotify, SubType: comm.SubTypeErrorNotify,
Data: data, Data: data,
}); err != nil { }); err != nil {
go this.Close() go this.Close()
@ -234,8 +234,8 @@ func (this *Agent) messageDistribution(msg *pb.UserMessage) (err error) {
if reply.Code != pb.ErrorCode_Success { if reply.Code != pb.ErrorCode_Success {
data, _ := anypb.New(&pb.ErrorNotify{ReqMainType: msg.MainType, ReqSubType: msg.SubType, Code: pb.ErrorCode(reply.Code.Number())}) data, _ := anypb.New(&pb.ErrorNotify{ReqMainType: msg.MainType, ReqSubType: msg.SubType, Code: pb.ErrorCode(reply.Code.Number())})
err = this.WriteMsg(&pb.UserMessage{ err = this.WriteMsg(&pb.UserMessage{
MainType: comm.MainType_Notify, MainType: comm.MainTypeNotify,
SubType: comm.SubType_ErrorNotify, SubType: comm.SubTypeErrorNotify,
Data: data, Data: data,
}) })
return return

View File

@ -29,7 +29,7 @@ type Gateway struct {
//模块名 //模块名
func (this *Gateway) GetType() core.M_Modules { func (this *Gateway) GetType() core.M_Modules {
return comm.SM_GateModule return comm.ModuleGate
} }
//模块自定义参数 //模块自定义参数

View File

@ -21,7 +21,7 @@ const ( //消息回复的头名称
//组件初始化接口 //组件初始化接口
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.MCompGate.Init(service, module, comp, options) err = this.MCompGate.Init(service, module, comp, options)
this.moduleHero = module.(*Hero) this.moduleHero = module.(*Hero)
this.service = service this.service = service
return return
@ -32,7 +32,7 @@ func (this *apiComp) Start() (err error) {
var module core.IModule var module core.IModule
if module, err = this.service.GetModule(comm.SM_UserModule); err != nil { if module, err = this.service.GetModule(comm.ModuleUser); err != nil {
return return
} }
this.user = module.(comm.IUser) this.user = module.(comm.IUser)

View File

@ -6,7 +6,7 @@ import (
) )
//参数校验 //参数校验
func (this *apiComp) StrengthenUpStarCheck(session comm.IUserSession, req *pb.Hero_StrengthenUpStar_Req) (result map[string]interface{}, code comm.ErrorCode) { func (this *apiComp) StrengthenUpStarCheck(session comm.IUserSession, req *pb.HeroStrengthenUpStarReq) (result map[string]interface{}, code comm.ErrorCode) {
if req.HeroObjID == "" { if req.HeroObjID == "" {
code.Code = pb.ErrorCode_ReqParameterError code.Code = pb.ErrorCode_ReqParameterError
return return
@ -17,11 +17,11 @@ func (this *apiComp) StrengthenUpStarCheck(session comm.IUserSession, req *pb.He
} }
/// 英雄升星 /// 英雄升星
func (this *apiComp) StrengthenUpStar(session comm.IUserSession, agrs map[string]interface{}, req *pb.Hero_StrengthenUpStar_Req) (code pb.ErrorCode) { func (this *apiComp) StrengthenUpStar(session comm.IUserSession, agrs map[string]interface{}, req *pb.HeroStrengthenUpStarReq) (code pb.ErrorCode) {
defer func() { defer func() {
if code == pb.ErrorCode_Success { if code == pb.ErrorCode_Success {
session.SendMsg(string(this.moduleHero.GetType()), StrengthenUplv, &pb.Hero_StrengthenUpStar_Resp{}) session.SendMsg(string(this.moduleHero.GetType()), StrengthenUplv, &pb.HeroStrengthenUpStarResp{})
} }
}() }()

View File

@ -7,7 +7,7 @@ import (
) )
//参数校验 //参数校验
func (this *apiComp) StrengthenUplvCheck(session comm.IUserSession, req *pb.Hero_StrengthenUplv_Req) (result map[string]interface{}, code comm.ErrorCode) { func (this *apiComp) StrengthenUplvCheck(session comm.IUserSession, req *pb.HeroStrengthenUplvReq) (result map[string]interface{}, code comm.ErrorCode) {
if req.HeroObjID == "" { if req.HeroObjID == "" {
code.Code = pb.ErrorCode_ReqParameterError code.Code = pb.ErrorCode_ReqParameterError
return return
@ -101,7 +101,7 @@ func (this *apiComp) StrengthenUplvCheck(session comm.IUserSession, req *pb.Hero
} }
/// 英雄升级 /// 英雄升级
func (this *apiComp) StrengthenUplv(session comm.IUserSession, agrs map[string]interface{}, req *pb.Hero_StrengthenUplv_Req) (code pb.ErrorCode) { func (this *apiComp) StrengthenUplv(session comm.IUserSession, agrs map[string]interface{}, req *pb.HeroStrengthenUplvReq) (code pb.ErrorCode) {
var ( var (
curLv int32 curLv int32
curExp int32 // 当前英雄的经验 curExp int32 // 当前英雄的经验
@ -111,7 +111,7 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, agrs map[string]i
) )
defer func() { defer func() {
if code == pb.ErrorCode_Success { if code == pb.ErrorCode_Success {
session.SendMsg(string(this.moduleHero.GetType()), StrengthenUplv, &pb.Hero_StrengthenUplv_Resp{}) session.SendMsg(string(this.moduleHero.GetType()), StrengthenUplv, &pb.HeroStrengthenUplvResp{})
} }
}() }()
costGold = agrs["costGold"].(int32) costGold = agrs["costGold"].(int32)

View File

@ -6,7 +6,7 @@ import (
) )
//参数校验 //参数校验
func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.Hero_Info_Req) (result map[string]interface{}, code comm.ErrorCode) { func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.HeroInfoReq) (result map[string]interface{}, code comm.ErrorCode) {
result = map[string]interface{}{} result = map[string]interface{}{}
hero := this.moduleHero.modelHero.getOneHero(session.GetUserId(), req.HeroId) hero := this.moduleHero.modelHero.getOneHero(session.GetUserId(), req.HeroId)
if hero == nil { if hero == nil {
@ -16,8 +16,8 @@ func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.Hero_Info_Req)
return return
} }
func (this *apiComp) Info(session comm.IUserSession, result map[string]interface{}, req *pb.Hero_Info_Req) (code pb.ErrorCode) { func (this *apiComp) Info(session comm.IUserSession, result map[string]interface{}, req *pb.HeroInfoReq) (code pb.ErrorCode) {
rsp := &pb.Hero_Info_Rsp{} rsp := &pb.HeroInfoRsp{}
defer func() { defer func() {
err := session.SendMsg(string(this.moduleHero.GetType()), HeroSubTypeInfo, rsp) err := session.SendMsg(string(this.moduleHero.GetType()), HeroSubTypeInfo, rsp)
if err != nil { if err != nil {
@ -27,7 +27,7 @@ func (this *apiComp) Info(session comm.IUserSession, result map[string]interface
}() }()
if v, ok := result["hero"]; ok { if v, ok := result["hero"]; ok {
rsp.Base = v.(*pb.DB_HeroData) rsp.Base = v.(*pb.DBHero)
} }
return return
} }

View File

@ -6,12 +6,12 @@ import (
) )
//参数校验 //参数校验
func (this *apiComp) ListCheck(session comm.IUserSession, req *pb.Hero_List_Req) (result map[string]interface{}, code comm.ErrorCode) { func (this *apiComp) ListCheck(session comm.IUserSession, req *pb.HeroListReq) (result map[string]interface{}, code comm.ErrorCode) {
return return
} }
func (this *apiComp) List(session comm.IUserSession, result map[string]interface{}, req *pb.Hero_List_Req) (code pb.ErrorCode) { func (this *apiComp) List(session comm.IUserSession, result map[string]interface{}, req *pb.HeroListReq) (code pb.ErrorCode) {
rsp := &pb.Hero_List_Rsp{} rsp := &pb.HeroListRsp{}
defer func() { defer func() {
err := session.SendMsg(string(this.moduleHero.GetType()), HeroSubTypeList, rsp) err := session.SendMsg(string(this.moduleHero.GetType()), HeroSubTypeList, rsp)

View File

@ -26,14 +26,14 @@ func (this *ModelHero) Init(service core.IService, module core.IModule, comp cor
} }
//初始化英雄 //初始化英雄
func (this *ModelHero) initHero(uid string, heroCfgId int32) *pb.DB_HeroData { func (this *ModelHero) initHero(uid string, heroCfgId int32) *pb.DBHero {
heroCfg := this.moduleHero.configure.GetHero(heroCfgId) heroCfg := this.moduleHero.configure.GetHero(heroCfgId)
if heroCfg == nil { if heroCfg == nil {
log.Errorf("%v hero not found from config %v", heroCfgId) log.Errorf("%v hero not found from config %v", heroCfgId)
return nil return nil
} }
objId := primitive.NewObjectID().Hex() objId := primitive.NewObjectID().Hex()
newHero := &pb.DB_HeroData{ newHero := &pb.DBHero{
Id: objId, Id: objId,
Uid: uid, Uid: uid,
HeroID: heroCfg.Hid, HeroID: heroCfg.Hid,
@ -77,8 +77,8 @@ func (this *ModelHero) createMultiHero(uid string, heroCfgIds ...int32) error {
} }
//获取一个英雄 //获取一个英雄
func (this *ModelHero) getOneHero(uid, heroId string) *pb.DB_HeroData { func (this *ModelHero) getOneHero(uid, heroId string) *pb.DBHero {
hero := &pb.DB_HeroData{} hero := &pb.DBHero{}
err := this.moduleHero.modelHero.GetListObj(uid, heroId, hero) err := this.moduleHero.modelHero.GetListObj(uid, heroId, hero)
if err != nil { if err != nil {
return nil return nil
@ -91,14 +91,14 @@ func (this *ModelHero) consumeOneHeroCard(uid, heroId string) error {
return this.moduleHero.modelHero.DelListlds(uid, heroId) return this.moduleHero.modelHero.DelListlds(uid, heroId)
} }
func (this *Hero) ModifyHero(heroId *pb.DB_HeroData) (*pb.DB_HeroData, pb.ErrorCode) { func (this *Hero) ModifyHero(heroId *pb.DBHero) (*pb.DBHero, pb.ErrorCode) {
return nil, pb.ErrorCode_HeroNoExist return nil, pb.ErrorCode_HeroNoExist
} }
//获取玩家的英雄列表 //获取玩家的英雄列表
func (this *ModelHero) getHeroList(uid string) ([]*pb.DB_HeroData, error) { func (this *ModelHero) getHeroList(uid string) ([]*pb.DBHero, error) {
heroes := make([]*pb.DB_HeroData, 0) heroes := make([]*pb.DBHero, 0)
err := this.GetList(uid, &heroes) err := this.GetList(uid, &heroes)
if err != nil { if err != nil {
return nil, err return nil, err
@ -120,7 +120,7 @@ func (this *ModelHero) setEquipment(uid, heroId string, equipIds []string) pb.Er
//指定英雄升级 //指定英雄升级
func (this *ModelHero) levelUp(uid string, heroId int32) error { func (this *ModelHero) levelUp(uid string, heroId int32) error {
var heroes []*pb.DB_HeroData var heroes []*pb.DBHero
err := this.moduleHero.modelHero.GetList(uid, heroes) err := this.moduleHero.modelHero.GetList(uid, heroes)
if err != nil { if err != nil {
log.Errorf("levelUp err:%v", err) log.Errorf("levelUp err:%v", err)

View File

@ -22,7 +22,7 @@ type Hero struct {
//模块名 //模块名
func (this *Hero) GetType() core.M_Modules { func (this *Hero) GetType() core.M_Modules {
return comm.SM_HeroModule return comm.ModuleHero
} }
//模块初始化接口 注册用户创建角色事件 //模块初始化接口 注册用户创建角色事件
@ -47,7 +47,7 @@ func (this *Hero) CreateHero(uid string, heroCfgId ...int32) error {
//消耗英雄卡 //消耗英雄卡
func (this *Hero) ChangeCard(uId string, heroCfgId int32, count int32) (code pb.ErrorCode) { func (this *Hero) ChangeCard(uId string, heroCfgId int32, count int32) (code pb.ErrorCode) {
heroes := this.GetHeroList(uId) heroes := this.GetHeroList(uId)
var curList []*pb.DB_HeroData var curList []*pb.DBHero
for _, v := range heroes { for _, v := range heroes {
if heroCfgId == v.HeroID { if heroCfgId == v.HeroID {
curList = append(curList, v) curList = append(curList, v)
@ -68,7 +68,7 @@ func (this *Hero) ChangeCard(uId string, heroCfgId int32, count int32) (code pb.
} }
//获取英雄 //获取英雄
func (this *Hero) GetHero(uid, heroId string) (*pb.DB_HeroData, pb.ErrorCode) { func (this *Hero) GetHero(uid, heroId string) (*pb.DBHero, pb.ErrorCode) {
hero := this.modelHero.getOneHero(uid, heroId) hero := this.modelHero.getOneHero(uid, heroId)
if hero == nil { if hero == nil {
return nil, pb.ErrorCode_HeroNoExist return nil, pb.ErrorCode_HeroNoExist
@ -77,7 +77,7 @@ func (this *Hero) GetHero(uid, heroId string) (*pb.DB_HeroData, pb.ErrorCode) {
} }
//佩戴装备 //佩戴装备
func (this *Hero) UpdateEquipment(hero *pb.DB_HeroData, equip []*pb.DB_Equipment) (code pb.ErrorCode) { func (this *Hero) UpdateEquipment(hero *pb.DBHero, equip []*pb.DB_Equipment) (code pb.ErrorCode) {
equipIds := make([]string, 4) equipIds := make([]string, 4)
for _, v := range equip { for _, v := range equip {
equipIds = append(equipIds, v.Id) equipIds = append(equipIds, v.Id)
@ -86,7 +86,7 @@ func (this *Hero) UpdateEquipment(hero *pb.DB_HeroData, equip []*pb.DB_Equipment
} }
//英雄列表 //英雄列表
func (this *Hero) GetHeroList(uid string) []*pb.DB_HeroData { func (this *Hero) GetHeroList(uid string) []*pb.DBHero {
list, err := this.modelHero.getHeroList(uid) list, err := this.modelHero.getHeroList(uid)
if err != nil { if err != nil {
return nil return nil

View File

@ -28,7 +28,7 @@ type Items struct {
//模块名称 //模块名称
func (this *Items) GetType() core.M_Modules { func (this *Items) GetType() core.M_Modules {
return comm.SM_ItemsModule return comm.ModuleItems
} }
//模块初始化接口 注册用户创建角色事件 //模块初始化接口 注册用户创建角色事件

View File

@ -34,7 +34,7 @@ func (this *apiComp) Start() (err error) {
err = this.MCompGate.Start() err = this.MCompGate.Start()
var module core.IModule var module core.IModule
if module, err = this.service.GetModule(comm.SM_ItemsModule); err != nil { if module, err = this.service.GetModule(comm.ModuleItems); err != nil {
return return
} }
this.items = module.(comm.IItems) this.items = module.(comm.IItems)

View File

@ -30,7 +30,7 @@ type Mail struct {
} }
func (this *Mail) GetType() core.M_Modules { func (this *Mail) GetType() core.M_Modules {
return comm.SM_MailModule return comm.ModuleMail
} }
func (this *Mail) OnInstallComp() { func (this *Mail) OnInstallComp() {

View File

@ -89,15 +89,15 @@ func (this *ModuleBase) CheckConsumeRes(uid string, res []*cfg.Game_atn) (code p
hero comm.IHero //英雄模块 hero comm.IHero //英雄模块
// equipment comm.IEquipment //装备模块 // equipment comm.IEquipment //装备模块
) )
if module, err = this.service.GetModule(comm.SM_UserModule); err == nil { if module, err = this.service.GetModule(comm.ModuleUser); err == nil {
return return
} }
user = module.(comm.IUser) user = module.(comm.IUser)
if module, err = this.service.GetModule(comm.SM_ItemsModule); err == nil { if module, err = this.service.GetModule(comm.ModuleItems); err == nil {
return return
} }
items = module.(comm.IItems) items = module.(comm.IItems)
if module, err = this.service.GetModule(comm.SM_HeroModule); err == nil { if module, err = this.service.GetModule(comm.ModuleHero); err == nil {
return return
} }
hero = module.(comm.IHero) hero = module.(comm.IHero)

View File

@ -33,7 +33,7 @@ func (this *apiComp) Start() (err error) {
var module core.IModule var module core.IModule
//get module hero //get module hero
if module, err = this.service.GetModule(comm.SM_HeroModule); err != nil { if module, err = this.service.GetModule(comm.ModuleHero); err != nil {
return return
} }
this.hero = module.(comm.IHero) this.hero = module.(comm.IHero)

View File

@ -33,7 +33,7 @@ func (this *apiComp) Login(session comm.IUserSession, result map[string]interfac
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
return return
} }
event.TriggerEvent(comm.Event_UserLogin, user.Uid) event.TriggerEvent(comm.EventUserLogin, user.Uid)
} }
}() }()

View File

@ -21,7 +21,7 @@ type User struct {
} }
func (this *User) GetType() core.M_Modules { func (this *User) GetType() core.M_Modules {
return comm.SM_UserModule return comm.ModuleUser
} }
func (this *User) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { func (this *User) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
@ -38,7 +38,7 @@ func (this *User) OnInstallComp() {
} }
//获取英雄列表 //获取英雄列表
func (this *User) GetHeroList(uid string) []*pb.DB_HeroData { func (this *User) GetHeroList(uid string) []*pb.DBHero {
return nil return nil
} }

View File

@ -27,7 +27,7 @@ type Web struct {
//模块名 //模块名
func (this *Web) GetType() core.M_Modules { func (this *Web) GetType() core.M_Modules {
return comm.SM_WebModule return comm.ModuleWeb
} }
//模块自定义参数 //模块自定义参数

View File

@ -75,7 +75,7 @@ func (x *SkillData) GetSkillLv() int32 {
return 0 return 0
} }
type DB_HeroData struct { type DBHero struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
@ -103,8 +103,8 @@ type DB_HeroData struct {
Count int32 `protobuf:"varint,21,opt,name=count,proto3" json:"count"` // 数量 Count int32 `protobuf:"varint,21,opt,name=count,proto3" json:"count"` // 数量
} }
func (x *DB_HeroData) Reset() { func (x *DBHero) Reset() {
*x = DB_HeroData{} *x = DBHero{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_hero_hero_db_proto_msgTypes[1] mi := &file_hero_hero_db_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -112,13 +112,13 @@ func (x *DB_HeroData) Reset() {
} }
} }
func (x *DB_HeroData) String() string { func (x *DBHero) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*DB_HeroData) ProtoMessage() {} func (*DBHero) ProtoMessage() {}
func (x *DB_HeroData) ProtoReflect() protoreflect.Message { func (x *DBHero) ProtoReflect() protoreflect.Message {
mi := &file_hero_hero_db_proto_msgTypes[1] mi := &file_hero_hero_db_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -130,152 +130,152 @@ func (x *DB_HeroData) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use DB_HeroData.ProtoReflect.Descriptor instead. // Deprecated: Use DBHero.ProtoReflect.Descriptor instead.
func (*DB_HeroData) Descriptor() ([]byte, []int) { func (*DBHero) Descriptor() ([]byte, []int) {
return file_hero_hero_db_proto_rawDescGZIP(), []int{1} return file_hero_hero_db_proto_rawDescGZIP(), []int{1}
} }
func (x *DB_HeroData) GetId() string { func (x *DBHero) GetId() string {
if x != nil { if x != nil {
return x.Id return x.Id
} }
return "" return ""
} }
func (x *DB_HeroData) GetUid() string { func (x *DBHero) GetUid() string {
if x != nil { if x != nil {
return x.Uid return x.Uid
} }
return "" return ""
} }
func (x *DB_HeroData) GetHeroID() int32 { func (x *DBHero) GetHeroID() int32 {
if x != nil { if x != nil {
return x.HeroID return x.HeroID
} }
return 0 return 0
} }
func (x *DB_HeroData) GetStar() int32 { func (x *DBHero) GetStar() int32 {
if x != nil { if x != nil {
return x.Star return x.Star
} }
return 0 return 0
} }
func (x *DB_HeroData) GetLv() int32 { func (x *DBHero) GetLv() int32 {
if x != nil { if x != nil {
return x.Lv return x.Lv
} }
return 0 return 0
} }
func (x *DB_HeroData) GetExp() int32 { func (x *DBHero) GetExp() int32 {
if x != nil { if x != nil {
return x.Exp return x.Exp
} }
return 0 return 0
} }
func (x *DB_HeroData) GetJuexingLv() int32 { func (x *DBHero) GetJuexingLv() int32 {
if x != nil { if x != nil {
return x.JuexingLv return x.JuexingLv
} }
return 0 return 0
} }
func (x *DB_HeroData) GetCaptainSkill() int32 { func (x *DBHero) GetCaptainSkill() int32 {
if x != nil { if x != nil {
return x.CaptainSkill return x.CaptainSkill
} }
return 0 return 0
} }
func (x *DB_HeroData) GetNormalSkill() []*SkillData { func (x *DBHero) GetNormalSkill() []*SkillData {
if x != nil { if x != nil {
return x.NormalSkill return x.NormalSkill
} }
return nil return nil
} }
func (x *DB_HeroData) GetProperty() map[int32]int32 { func (x *DBHero) GetProperty() map[int32]int32 {
if x != nil { if x != nil {
return x.Property return x.Property
} }
return nil return nil
} }
func (x *DB_HeroData) GetAddProperty() map[int32]int32 { func (x *DBHero) GetAddProperty() map[int32]int32 {
if x != nil { if x != nil {
return x.AddProperty return x.AddProperty
} }
return nil return nil
} }
func (x *DB_HeroData) GetFormation() int32 { func (x *DBHero) GetFormation() int32 {
if x != nil { if x != nil {
return x.Formation return x.Formation
} }
return 0 return 0
} }
func (x *DB_HeroData) GetCardType() int32 { func (x *DBHero) GetCardType() int32 {
if x != nil { if x != nil {
return x.CardType return x.CardType
} }
return 0 return 0
} }
func (x *DB_HeroData) GetCurSkin() int32 { func (x *DBHero) GetCurSkin() int32 {
if x != nil { if x != nil {
return x.CurSkin return x.CurSkin
} }
return 0 return 0
} }
func (x *DB_HeroData) GetSkins() []int32 { func (x *DBHero) GetSkins() []int32 {
if x != nil { if x != nil {
return x.Skins return x.Skins
} }
return nil return nil
} }
func (x *DB_HeroData) GetBlock() bool { func (x *DBHero) GetBlock() bool {
if x != nil { if x != nil {
return x.Block return x.Block
} }
return false return false
} }
func (x *DB_HeroData) GetEquipID() []string { func (x *DBHero) GetEquipID() []string {
if x != nil { if x != nil {
return x.EquipID return x.EquipID
} }
return nil return nil
} }
func (x *DB_HeroData) GetResonateNum() int32 { func (x *DBHero) GetResonateNum() int32 {
if x != nil { if x != nil {
return x.ResonateNum return x.ResonateNum
} }
return 0 return 0
} }
func (x *DB_HeroData) GetDistributionResonate() int32 { func (x *DBHero) GetDistributionResonate() int32 {
if x != nil { if x != nil {
return x.DistributionResonate return x.DistributionResonate
} }
return 0 return 0
} }
func (x *DB_HeroData) GetEnergy() map[int32]int32 { func (x *DBHero) GetEnergy() map[int32]int32 {
if x != nil { if x != nil {
return x.Energy return x.Energy
} }
return nil return nil
} }
func (x *DB_HeroData) GetCount() int32 { func (x *DBHero) GetCount() int32 {
if x != nil { if x != nil {
return x.Count return x.Count
} }
@ -290,62 +290,61 @@ var file_hero_hero_db_proto_rawDesc = []byte{
0x6c, 0x44, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x44, 0x12,
0x18, 0x0a, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x18, 0x0a, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
0x52, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x22, 0xe2, 0x06, 0x0a, 0x0b, 0x44, 0x42, 0x52, 0x07, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x4c, 0x76, 0x22, 0xce, 0x06, 0x0a, 0x06, 0x44, 0x42,
0x5f, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x48, 0x65, 0x72, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x44,
0x65, 0x72, 0x6f, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x68, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x44, 0x12, 0x12,
0x6f, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0a, 0x04, 0x73, 0x74, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x74,
0x05, 0x52, 0x04, 0x73, 0x74, 0x61, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x05, 0x20, 0x61, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02,
0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x06, 0x6c, 0x76, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52,
0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x78, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x6a, 0x75, 0x65, 0x03, 0x65, 0x78, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x6a, 0x75, 0x65, 0x78, 0x69, 0x6e, 0x67, 0x4c,
0x78, 0x69, 0x6e, 0x67, 0x4c, 0x76, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6a, 0x75, 0x76, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6a, 0x75, 0x65, 0x78, 0x69, 0x6e, 0x67,
0x65, 0x78, 0x69, 0x6e, 0x67, 0x4c, 0x76, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x74, 0x61, 0x4c, 0x76, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x70, 0x74, 0x61, 0x69, 0x6e, 0x53, 0x6b, 0x69,
0x69, 0x6e, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x63, 0x6c, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x63, 0x61, 0x70, 0x74, 0x61, 0x69,
0x61, 0x70, 0x74, 0x61, 0x69, 0x6e, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x12, 0x2f, 0x0a, 0x0b, 0x6e, 0x6e, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x12, 0x2f, 0x0a, 0x0b, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c,
0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62,
0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x52, 0x2e, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0b, 0x6e, 0x6f, 0x72, 0x6d,
0x0b, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x12, 0x39, 0x0a, 0x08, 0x61, 0x6c, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x12, 0x34, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65,
0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x72, 0x74, 0x79, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x44,
0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x5f, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e,
0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x70, 0x74, 0x72, 0x79, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x3d, 0x0a,
0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x42, 0x0a, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x0b, 0x20, 0x03,
0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x2e, 0x41,
0x62, 0x2e, 0x44, 0x42, 0x5f, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x41, 0x64, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52,
0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x1c, 0x0a, 0x09,
0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52,
0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x09, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61,
0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x72, 0x72, 0x64, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x61,
0x64, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x61, 0x72, 0x72, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x53, 0x6b, 0x69,
0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x53, 0x6b, 0x69, 0x6e, 0x6e, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x75, 0x72, 0x53, 0x6b, 0x69, 0x6e,
0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x75, 0x72, 0x53, 0x6b, 0x69, 0x6e, 0x12, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x6b, 0x69, 0x6e, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x05, 0x52,
0x14, 0x0a, 0x05, 0x73, 0x6b, 0x69, 0x6e, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x05, 0x52, 0x05, 0x05, 0x73, 0x6b, 0x69, 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18,
0x73, 0x6b, 0x69, 0x6e, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x10, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x18, 0x0a, 0x07,
0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x65, 0x71, 0x75, 0x69, 0x70, 0x49, 0x44, 0x18, 0x11, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x65,
0x71, 0x75, 0x69, 0x70, 0x49, 0x44, 0x18, 0x11, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x65, 0x71, 0x71, 0x75, 0x69, 0x70, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x6f, 0x6e, 0x61,
0x75, 0x69, 0x70, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x74, 0x65, 0x4e, 0x75, 0x6d, 0x18, 0x12, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x72, 0x65, 0x73,
0x65, 0x4e, 0x75, 0x6d, 0x18, 0x12, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x72, 0x65, 0x73, 0x6f, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x32, 0x0a, 0x14, 0x64, 0x69, 0x73, 0x74,
0x6e, 0x61, 0x74, 0x65, 0x4e, 0x75, 0x6d, 0x12, 0x32, 0x0a, 0x14, 0x64, 0x69, 0x73, 0x74, 0x72, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65,
0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x18, 0x18, 0x13, 0x20, 0x01, 0x28, 0x05, 0x52, 0x14, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75,
0x13, 0x20, 0x01, 0x28, 0x05, 0x52, 0x14, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x12, 0x2e, 0x0a, 0x06,
0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x74, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x65, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70,
0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x62, 0x62, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x2e, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x45,
0x2e, 0x44, 0x42, 0x5f, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x45, 0x6e, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x12, 0x14, 0x0a, 0x05,
0x72, 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x15, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75,
0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x15, 0x20, 0x01, 0x28, 0x05, 0x52, 0x6e, 0x74, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e,
0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a,
0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e,
0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a,
0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x39, 0x0a, 0x0b, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10,
0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x45, 0x6e, 0x74, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79,
0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -363,16 +362,16 @@ func file_hero_hero_db_proto_rawDescGZIP() []byte {
var file_hero_hero_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_hero_hero_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_hero_hero_db_proto_goTypes = []interface{}{ var file_hero_hero_db_proto_goTypes = []interface{}{
(*SkillData)(nil), // 0: pb.SkillData (*SkillData)(nil), // 0: pb.SkillData
(*DB_HeroData)(nil), // 1: pb.DB_HeroData (*DBHero)(nil), // 1: pb.DBHero
nil, // 2: pb.DB_HeroData.PropertyEntry nil, // 2: pb.DBHero.PropertyEntry
nil, // 3: pb.DB_HeroData.AddPropertyEntry nil, // 3: pb.DBHero.AddPropertyEntry
nil, // 4: pb.DB_HeroData.EnergyEntry nil, // 4: pb.DBHero.EnergyEntry
} }
var file_hero_hero_db_proto_depIdxs = []int32{ var file_hero_hero_db_proto_depIdxs = []int32{
0, // 0: pb.DB_HeroData.normalSkill:type_name -> pb.SkillData 0, // 0: pb.DBHero.normalSkill:type_name -> pb.SkillData
2, // 1: pb.DB_HeroData.property:type_name -> pb.DB_HeroData.PropertyEntry 2, // 1: pb.DBHero.property:type_name -> pb.DBHero.PropertyEntry
3, // 2: pb.DB_HeroData.addProperty:type_name -> pb.DB_HeroData.AddPropertyEntry 3, // 2: pb.DBHero.addProperty:type_name -> pb.DBHero.AddPropertyEntry
4, // 3: pb.DB_HeroData.energy:type_name -> pb.DB_HeroData.EnergyEntry 4, // 3: pb.DBHero.energy:type_name -> pb.DBHero.EnergyEntry
4, // [4:4] is the sub-list for method output_type 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 method input_type
4, // [4:4] is the sub-list for extension type_name 4, // [4:4] is the sub-list for extension type_name
@ -399,7 +398,7 @@ func file_hero_hero_db_proto_init() {
} }
} }
file_hero_hero_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { file_hero_hero_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DB_HeroData); i { switch v := v.(*DBHero); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:

File diff suppressed because it is too large Load Diff

View File

@ -2,19 +2,12 @@ syntax = "proto3";
option go_package = ".;pb"; option go_package = ".;pb";
package pb; package pb;
// enum PropertyType{
// Hp = 0; //
// Atk = 1; //
// Def = 2; //
// Speed = 3; //
// Crit = 4; //
// }
message SkillData { message SkillData {
int32 skillID = 1; int32 skillID = 1;
int32 skillLv = 2; int32 skillLv = 2;
} }
message DB_HeroData {
message DBHero {
string id = 1; //@go_tags(`bson:"_id"`) ID string id = 1; //@go_tags(`bson:"_id"`) ID
string uid = 2; string uid = 2;
int32 heroID = 3; //@go_tags(`bson:"heroID"`) ID int32 heroID = 3; //@go_tags(`bson:"heroID"`) ID

View File

@ -4,15 +4,15 @@ package pb;
import "hero/hero_db.proto"; import "hero/hero_db.proto";
// //
message Hero_Info_Req { message HeroInfoReq {
string heroId = 1; //ID string heroId = 1; //ID
} }
message Hero_Info_Rsp { DB_HeroData base = 1; } message HeroInfoRsp { DBHero base = 1; }
// //
message Hero_List_Req {} message HeroListReq {}
message Hero_List_Rsp { repeated DB_HeroData list = 1; } message HeroListRsp { repeated DBHero list = 1; }
/// : () /// : ()
/// : (使) /// : (使)
@ -24,15 +24,15 @@ message ItemData {
} }
// //
message Hero_StrengthenUplv_Req { message HeroStrengthenUplvReq {
string heroObjID = 1; // ID string heroObjID = 1; // ID
string expCardID = 2; // ID string expCardID = 2; // ID
int32 amount = 3; // } int32 amount = 3; // }
} }
// //
message Hero_StrengthenUplv_Resp { message HeroStrengthenUplvResp {
DB_HeroData hero = 1; // DBHero hero = 1; //
} }
message CostCardData { message CostCardData {
@ -40,69 +40,69 @@ message CostCardData {
int32 amount = 2; // int32 amount = 2; //
} }
// //
message Hero_StrengthenUpStar_Req { message HeroStrengthenUpStarReq {
string heroObjID = 1; // ID string heroObjID = 1; // ID
repeated CostCardData hero = 2; // ID repeated CostCardData hero = 2; // ID
repeated CostCardData heroRace = 3; // ID repeated CostCardData heroRace = 3; // ID
} }
// //
message Hero_StrengthenUpStar_Resp { message HeroStrengthenUpStarResp {
DB_HeroData hero = 1; // DBHero hero = 1; //
} }
// //
message Hero_StrengthenUpSkill_Req { message HeroStrengthenUpSkillReq {
string heroObjID = 1; // ID string heroObjID = 1; // ID
int32 skillIndex = 2; // int32 skillIndex = 2; //
CostCardData items = 3; // CostCardData items = 3; //
} }
// //
message Hero_StrengthenUpSkill_Resp { message HeroStrengthenUpSkillResp {
DB_HeroData hero = 1; // DBHero hero = 1; //
} }
// //
message Hero_Gongming_Req { message HeroGongmingReq {
string heroObjID = 1; // ID string heroObjID = 1; // ID
string costObjID = 2; // string costObjID = 2; //
} }
message Hero_Gongming_Resp { message HeroGongmingResp {
DB_HeroData hero = 1; // DBHero hero = 1; //
int32 energy = 2; // int32 energy = 2; //
DB_HeroData upStarCard = 3; // DBHero upStarCard = 3; //
} }
// //
message Hero_GongmingReset_Req { message HeroGongmingResetReq {
string heroObjID = 1; // ID string heroObjID = 1; // ID
} }
message Hero_GongmingReset_Resp { message HeroGongmingResetResp {
DB_HeroData hero = 1; // DBHero hero = 1; //
int32 energy = 2; // int32 energy = 2; //
} }
// 使 // 使
message Hero_GongmingUseEnergy_Req { message HeroGongmingUseEnergyReq {
string heroObjID = 1; // ID string heroObjID = 1; // ID
int32 useEnergy = 2; // 使 int32 useEnergy = 2; // 使
int32 useType = 3; // 使 int32 useType = 3; // 使
} }
message Hero_GongmingUseEnergy_Resp { message HeroGongmingUseEnergyResp {
DB_HeroData hero = 1; // DBHero hero = 1; //
} }
// //
message Hero_Juexing_Req { message HeroJuexingReq {
string heroObjID = 1; // ID string heroObjID = 1; // ID
ItemData costItmes = 2; // ItemData costItmes = 2; //
} }
// //
message Hero_Juexing_Resp { message HeroJuexingResp {
DB_HeroData hero = 1; // DBHero hero = 1; //
} }

View File

@ -166,7 +166,7 @@ func (this *SCompGateRoute) ReceiveMsg(ctx context.Context, args *pb.AgentMessag
//RPC_NoticeUserClose 接收用户离线通知 //RPC_NoticeUserClose 接收用户离线通知
func (this *SCompGateRoute) NoticeUserClose(ctx context.Context, args *pb.NoticeUserCloseReq, reply *pb.RPCMessageReply) error { func (this *SCompGateRoute) NoticeUserClose(ctx context.Context, args *pb.NoticeUserCloseReq, reply *pb.RPCMessageReply) error {
event.TriggerEvent(comm.Event_UserOffline, args.UserId) event.TriggerEvent(comm.EventUserOffline, args.UserId)
this.sessionslock.Lock() this.sessionslock.Lock()
delete(this.sessions, args.UserSessionId) delete(this.sessions, args.UserSessionId)
this.sessionslock.Unlock() this.sessionslock.Unlock()