初始化英雄
This commit is contained in:
parent
69d8663f90
commit
773736f089
@ -65,7 +65,15 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
PropertyHp = 1 //生命
|
PropertyHp int32 = 1 //生命
|
||||||
PropertyAtk = 2 //攻击
|
PropertyAtk int32 = 2 //攻击
|
||||||
PropertyDef = 3 //防御
|
PropertyDef int32 = 3 //防御
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
CardTypeHero int32 = 1 //英雄卡
|
||||||
|
CardTypeStar int32 = 2 //升星卡
|
||||||
|
CardTypeLevel int32 = 3 //升级卡
|
||||||
|
CardTypeSkill int32 = 4 //技能升级卡
|
||||||
|
CardTypeMonster int32 = 5 //怪物卡
|
||||||
)
|
)
|
||||||
|
@ -34,11 +34,11 @@ type (
|
|||||||
//英雄
|
//英雄
|
||||||
IHero interface {
|
IHero interface {
|
||||||
//查询用户卡片数量
|
//查询用户卡片数量
|
||||||
QueryCardAmount(uId string, cardId int32) (amount uint32)
|
QueryHeroAmount(uId string, heroCfgId int32) (amount uint32)
|
||||||
//添加/减少卡片
|
//消耗卡片
|
||||||
AddCard(uId string, cardId int32, add int32) (code pb.ErrorCode)
|
ChangeCard(uId string, heroCfgId int32, count int32) (code pb.ErrorCode)
|
||||||
//创建新英雄
|
//创建新英雄
|
||||||
CreatMultiHero(uid string, heroCfgId ...int32) error
|
CreatHero(uid string, heroCfgId ...int32) error
|
||||||
|
|
||||||
// 获取英雄
|
// 获取英雄
|
||||||
// heroId 英雄ID
|
// heroId 英雄ID
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
type Api_Comp struct {
|
type Api_Comp struct {
|
||||||
modules.MComp_GateComp
|
modules.MComp_GateComp
|
||||||
service core.IService
|
service core.IService
|
||||||
module *Hero
|
moduleHero *Hero
|
||||||
}
|
}
|
||||||
|
|
||||||
const ( //消息回复的头名称
|
const ( //消息回复的头名称
|
||||||
@ -20,7 +20,7 @@ const ( //消息回复的头名称
|
|||||||
//组件初始化接口
|
//组件初始化接口
|
||||||
func (this *Api_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
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.MComp_GateComp.Init(service, module, comp, options)
|
||||||
this.module = module.(*Hero)
|
this.moduleHero = module.(*Hero)
|
||||||
this.service = service
|
this.service = service
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -11,12 +11,12 @@ func (this *Api_Comp) StrengthenUplv_Check(session comm.IUserSession, req *pb.He
|
|||||||
code.Code = pb.ErrorCode_ReqParameterError
|
code.Code = pb.ErrorCode_ReqParameterError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_hero, err := this.module.model_hero.moduleHero.GetHeroInfoByObjID(req.HeroObjID) // 校验升级的对象是否存在
|
_hero, err := this.moduleHero.model_hero.moduleHero.GetHeroInfoByObjID(req.HeroObjID) // 校验升级的对象是否存在
|
||||||
if err != 0 {
|
if err != 0 {
|
||||||
code.Code = pb.ErrorCode_HeroNoExist
|
code.Code = pb.ErrorCode_HeroNoExist
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_expHero, err := this.module.model_hero.moduleHero.GetHeroInfoByObjID(req.ExpCardID) // 校验需要消耗经验卡牌的对象是否存在
|
_expHero, err := this.moduleHero.model_hero.moduleHero.GetHeroInfoByObjID(req.ExpCardID) // 校验需要消耗经验卡牌的对象是否存在
|
||||||
if err != 0 {
|
if err != 0 {
|
||||||
code.Code = pb.ErrorCode_HeroNoExist
|
code.Code = pb.ErrorCode_HeroNoExist
|
||||||
return
|
return
|
||||||
@ -30,7 +30,7 @@ func (this *Api_Comp) StrengthenUplv_Check(session comm.IUserSession, req *pb.He
|
|||||||
var costGold int32 // 当前需要消耗金币的数量
|
var costGold int32 // 当前需要消耗金币的数量
|
||||||
var addExp int32 // 需要增加的经验
|
var addExp int32 // 需要增加的经验
|
||||||
// 查询 本次消耗会获得多少经验
|
// 查询 本次消耗会获得多少经验
|
||||||
expConf := this.module.configure_comp.GetHeroExp(_expHero.HeroID)
|
expConf := this.moduleHero.configure_comp.GetHeroExp(_expHero.HeroID)
|
||||||
if expConf != nil {
|
if expConf != nil {
|
||||||
addExp = expConf.Heroexp * req.Amount
|
addExp = expConf.Heroexp * req.Amount
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ func (this *Api_Comp) StrengthenUplv_Check(session comm.IUserSession, req *pb.He
|
|||||||
code.Code = pb.ErrorCode_HeroMaxLv
|
code.Code = pb.ErrorCode_HeroMaxLv
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if _data := this.module.configure_comp.GetHeroLv(curLv); _data != nil {
|
if _data := this.moduleHero.configure_comp.GetHeroLv(curLv); _data != nil {
|
||||||
costGold += _data.Gold[0].N
|
costGold += _data.Gold[0].N
|
||||||
curExp += addExp // 先把经验加上
|
curExp += addExp // 先把经验加上
|
||||||
// 当前升级需要消耗的经验
|
// 当前升级需要消耗的经验
|
||||||
@ -53,7 +53,7 @@ func (this *Api_Comp) StrengthenUplv_Check(session comm.IUserSession, req *pb.He
|
|||||||
curExp = _data.Heroexp[0].N
|
curExp = _data.Heroexp[0].N
|
||||||
if curExp >= 0 { // 大于下一级经验
|
if curExp >= 0 { // 大于下一级经验
|
||||||
curLv += 1 // 经验够了 那么等级+1
|
curLv += 1 // 经验够了 那么等级+1
|
||||||
if _data := this.module.configure_comp.GetHeroLv(curLv); _data != nil {
|
if _data := this.moduleHero.configure_comp.GetHeroLv(curLv); _data != nil {
|
||||||
if _data.Heroexp[0].N > curExp { // 经验不足则 直接返回
|
if _data.Heroexp[0].N > curExp { // 经验不足则 直接返回
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ func (this *Api_Comp) StrengthenUplv(session comm.IUserSession, agrs map[string]
|
|||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if code == pb.ErrorCode_Success {
|
if code == pb.ErrorCode_Success {
|
||||||
session.SendMsg(string(this.module.GetType()), StrengthenUplv, &pb.Hero_StrengthenUplv_Resp{})
|
session.SendMsg(string(this.moduleHero.GetType()), StrengthenUplv, &pb.Hero_StrengthenUplv_Resp{})
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
//参数校验
|
//参数校验
|
||||||
func (this *Api_Comp) Info_Check(session comm.IUserSession, req *pb.Hero_Info_Req) (result map[string]interface{}, code comm.ErrorCode) {
|
func (this *Api_Comp) Info_Check(session comm.IUserSession, req *pb.Hero_Info_Req) (result map[string]interface{}, code comm.ErrorCode) {
|
||||||
result = map[string]interface{}{}
|
result = map[string]interface{}{}
|
||||||
hero := this.module.model_hero.getOneHero(session.GetUserId(), req.HeroId)
|
hero := this.moduleHero.model_hero.getOneHero(session.GetUserId(), req.HeroId)
|
||||||
if hero == nil {
|
if hero == nil {
|
||||||
code = comm.ErrorCode{Code: pb.ErrorCode_HeroNoExist}
|
code = comm.ErrorCode{Code: pb.ErrorCode_HeroNoExist}
|
||||||
}
|
}
|
||||||
@ -19,7 +19,7 @@ func (this *Api_Comp) Info_Check(session comm.IUserSession, req *pb.Hero_Info_Re
|
|||||||
func (this *Api_Comp) Info(session comm.IUserSession, result map[string]interface{}, req *pb.Hero_Info_Req) (code pb.ErrorCode) {
|
func (this *Api_Comp) Info(session comm.IUserSession, result map[string]interface{}, req *pb.Hero_Info_Req) (code pb.ErrorCode) {
|
||||||
rsp := &pb.Hero_Info_Rsp{}
|
rsp := &pb.Hero_Info_Rsp{}
|
||||||
defer func() {
|
defer func() {
|
||||||
err := session.SendMsg(string(this.module.GetType()), Hero_SubType_Info, rsp)
|
err := session.SendMsg(string(this.moduleHero.GetType()), Hero_SubType_Info, rsp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
|
@ -14,13 +14,13 @@ func (this *Api_Comp) List(session comm.IUserSession, result map[string]interfac
|
|||||||
rsp := &pb.Hero_List_Rsp{}
|
rsp := &pb.Hero_List_Rsp{}
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
err := session.SendMsg(this.module.api_comp.service.GetType(), Hero_SubType_List, rsp)
|
err := session.SendMsg(this.moduleHero.api_comp.service.GetType(), Hero_SubType_List, rsp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
list, err := this.module.model_hero.getHeroList(session.GetUserId())
|
list, err := this.moduleHero.model_hero.getHeroList(session.GetUserId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
|
@ -37,11 +37,12 @@ func (this *ModelHero) initHero(uid string, heroCfgId int32) *pb.DB_HeroData {
|
|||||||
Id: objId,
|
Id: objId,
|
||||||
Uid: uid,
|
Uid: uid,
|
||||||
HeroID: heroCfg.Hid,
|
HeroID: heroCfg.Hid,
|
||||||
Star: heroCfg.Star,
|
Star: heroCfg.Star, //初始星级
|
||||||
Lv: 1, //初始等级
|
Lv: 1, //初始等级
|
||||||
NormalSkill: []*pb.SkillData{},
|
NormalSkill: []*pb.SkillData{}, //初始技能
|
||||||
|
|
||||||
Skins: []int32{},
|
Skins: []int32{},
|
||||||
EquipID: make([]string, 6),
|
EquipID: make([]string, 6), //初始装备
|
||||||
AddProperty: make(map[int32]int32),
|
AddProperty: make(map[int32]int32),
|
||||||
Energy: make(map[int32]int32),
|
Energy: make(map[int32]int32),
|
||||||
Property: make(map[int32]int32),
|
Property: make(map[int32]int32),
|
||||||
@ -58,10 +59,10 @@ func (this *ModelHero) createOneHero(uid string, heroCfgId int32) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//创建多个指定的英雄
|
//创建多个指定的英雄 heroCfgIds可填入多个英雄ID
|
||||||
func (this *ModelHero) createMultiHero(uid string, heroCfgId ...int32) error {
|
func (this *ModelHero) createMultiHero(uid string, heroCfgIds ...int32) error {
|
||||||
data := make(map[string]interface{})
|
data := make(map[string]interface{})
|
||||||
for _, v := range heroCfgId {
|
for _, v := range heroCfgIds {
|
||||||
hero := this.initHero(uid, v)
|
hero := this.initHero(uid, v)
|
||||||
if hero != nil {
|
if hero != nil {
|
||||||
data[hero.Id] = hero
|
data[hero.Id] = hero
|
||||||
@ -80,6 +81,16 @@ func (this *ModelHero) getOneHero(uid, heroId string) *pb.DB_HeroData {
|
|||||||
return hero
|
return hero
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//消耗一张英雄卡
|
||||||
|
func (this *ModelHero) consumeOneHeroCard(uid, heroId string) error {
|
||||||
|
return this.moduleHero.model_hero.DelListlds(uid, heroId)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Hero) ModifyHero(heroId *pb.DB_HeroData) (*pb.DB_HeroData, pb.ErrorCode) {
|
||||||
|
|
||||||
|
return nil, pb.ErrorCode_HeroNoExist
|
||||||
|
}
|
||||||
|
|
||||||
//获取玩家的英雄列表
|
//获取玩家的英雄列表
|
||||||
func (this *ModelHero) getHeroList(uid string) ([]*pb.DB_HeroData, error) {
|
func (this *ModelHero) getHeroList(uid string) ([]*pb.DB_HeroData, error) {
|
||||||
herokeys := make(map[string]string)
|
herokeys := make(map[string]string)
|
||||||
|
@ -45,10 +45,33 @@ func (this *Hero) GetHeroInfoByObjID(id string) (*pb.DB_HeroData, pb.ErrorCode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//创建新英雄
|
//创建新英雄
|
||||||
func (this *Hero) CreatMultiHero(uid string, heroCfgId ...int32) error {
|
func (this *Hero) CreatHero(uid string, heroCfgId ...int32) error {
|
||||||
return this.model_hero.createMultiHero(uid, heroCfgId...)
|
return this.model_hero.createMultiHero(uid, heroCfgId...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//消耗英雄卡
|
||||||
|
func (this *Hero) ChangeCard(uId string, heroCfgId int32, count int32) (code pb.ErrorCode) {
|
||||||
|
heroes := this.GetHeroList(uId)
|
||||||
|
var curList []*pb.DB_HeroData
|
||||||
|
for _, v := range heroes {
|
||||||
|
if heroCfgId == v.HeroID {
|
||||||
|
curList = append(curList, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if int32(len(curList)) < count {
|
||||||
|
return pb.ErrorCode_HeroNoEnough
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range curList {
|
||||||
|
err := this.model_hero.consumeOneHeroCard(uId, v.Id)
|
||||||
|
if err != nil {
|
||||||
|
return pb.ErrorCode_DBError
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pb.ErrorCode_Success
|
||||||
|
}
|
||||||
|
|
||||||
//获取英雄
|
//获取英雄
|
||||||
func (this *Hero) GetHero(uid, heroId string) (*pb.DB_HeroData, pb.ErrorCode) {
|
func (this *Hero) GetHero(uid, heroId string) (*pb.DB_HeroData, pb.ErrorCode) {
|
||||||
hero := this.model_hero.getOneHero(uid, heroId)
|
hero := this.model_hero.getOneHero(uid, heroId)
|
||||||
@ -58,11 +81,6 @@ func (this *Hero) GetHero(uid, heroId string) (*pb.DB_HeroData, pb.ErrorCode) {
|
|||||||
return hero, pb.ErrorCode_Success
|
return hero, pb.ErrorCode_Success
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Hero) ModifyHero(heroId *pb.DB_HeroData) (*pb.DB_HeroData, pb.ErrorCode) {
|
|
||||||
|
|
||||||
return nil, pb.ErrorCode_HeroNoExist
|
|
||||||
}
|
|
||||||
|
|
||||||
//佩戴装备
|
//佩戴装备
|
||||||
func (this *Hero) UpdateEquipment(hero *pb.DB_HeroData, equip []*pb.DB_Equipment) (code pb.ErrorCode) {
|
func (this *Hero) UpdateEquipment(hero *pb.DB_HeroData, equip []*pb.DB_Equipment) (code pb.ErrorCode) {
|
||||||
equipIds := make([]string, 4)
|
equipIds := make([]string, 4)
|
||||||
@ -81,12 +99,13 @@ func (this *Hero) GetHeroList(uid string) []*pb.DB_HeroData {
|
|||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Hero) AddCard(uId string, cardId int32, add int32) (code pb.ErrorCode) {
|
//查询英雄数量
|
||||||
return
|
func (this *Hero) QueryHeroAmount(uId string, heroCfgId int32) (amount uint32) {
|
||||||
|
heroes := this.GetHeroList(uId)
|
||||||
|
for _, v := range heroes {
|
||||||
|
if v.HeroID == heroCfgId {
|
||||||
|
amount++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return amount
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Hero) QueryCardAmount(uId string, cardId int32) (amount uint32) {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ func (this *ModuleBase) CheckConsumeRes(uid string, res []*cfg.Game_atn) (code p
|
|||||||
code = pb.ErrorCode_ConfigurationException
|
code = pb.ErrorCode_ConfigurationException
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if amount = int32(hero.QueryCardAmount(uid, int32(resID))); amount < v.N {
|
if amount = int32(hero.QueryHeroAmount(uid, int32(resID))); amount < v.N {
|
||||||
code = pb.ErrorCode_ResNoEnough
|
code = pb.ErrorCode_ResNoEnough
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ func (this *ModuleBase) CheckConsumeRes(uid string, res []*cfg.Game_atn) (code p
|
|||||||
items.AddItem(source, uid, int32(resID), -1*v.N)
|
items.AddItem(source, uid, int32(resID), -1*v.N)
|
||||||
} else if v.A == comm.CardType { //卡片资源
|
} else if v.A == comm.CardType { //卡片资源
|
||||||
resID, _ = strconv.Atoi(v.T)
|
resID, _ = strconv.Atoi(v.T)
|
||||||
hero.AddCard(uid, int32(resID), -1*v.N)
|
hero.ChangeCard(uid, int32(resID), -1*v.N)
|
||||||
} else if v.A == comm.EquipmentType {
|
} else if v.A == comm.EquipmentType {
|
||||||
resID, _ = strconv.Atoi(v.T)
|
resID, _ = strconv.Atoi(v.T)
|
||||||
equipment.AddNewEquipments(source, uid, resID, -1*v.N)
|
equipment.AddNewEquipments(source, uid, resID, -1*v.N)
|
||||||
|
@ -39,8 +39,13 @@ func (this *Api_Comp) Create(session comm.IUserSession, result map[string]interf
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//初始化英雄
|
//初始化英雄卡
|
||||||
// this.hero.
|
defaultHero := []int32{15001, 25001} //TODO 从配置中读取
|
||||||
|
err = this.hero.CreatHero(session.GetUserId(), defaultHero...)
|
||||||
|
if err != nil {
|
||||||
|
code = pb.ErrorCode_HeroInitCreat
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,7 @@ const (
|
|||||||
ErrorCode_HeroNoExist ErrorCode = 1300 //英雄不存在
|
ErrorCode_HeroNoExist ErrorCode = 1300 //英雄不存在
|
||||||
ErrorCode_HeroNoEnough ErrorCode = 1301 //英雄数量不足
|
ErrorCode_HeroNoEnough ErrorCode = 1301 //英雄数量不足
|
||||||
ErrorCode_HeroMaxLv ErrorCode = 1302 //英雄达到最大等级
|
ErrorCode_HeroMaxLv ErrorCode = 1302 //英雄达到最大等级
|
||||||
|
ErrorCode_HeroInitCreat ErrorCode = 1303 //初始化英雄
|
||||||
// equipment
|
// equipment
|
||||||
ErrorCode_EquipmentOnFoundEquipment ErrorCode = 1400 // 未找到武器
|
ErrorCode_EquipmentOnFoundEquipment ErrorCode = 1400 // 未找到武器
|
||||||
ErrorCode_EquipmentLvlimitReached ErrorCode = 1401 // 武器等级已达上限
|
ErrorCode_EquipmentLvlimitReached ErrorCode = 1401 // 武器等级已达上限
|
||||||
@ -117,6 +118,7 @@ var (
|
|||||||
1300: "HeroNoExist",
|
1300: "HeroNoExist",
|
||||||
1301: "HeroNoEnough",
|
1301: "HeroNoEnough",
|
||||||
1302: "HeroMaxLv",
|
1302: "HeroMaxLv",
|
||||||
|
1303: "HeroInitCreat",
|
||||||
1400: "EquipmentOnFoundEquipment",
|
1400: "EquipmentOnFoundEquipment",
|
||||||
1401: "EquipmentLvlimitReached",
|
1401: "EquipmentLvlimitReached",
|
||||||
}
|
}
|
||||||
@ -162,6 +164,7 @@ var (
|
|||||||
"HeroNoExist": 1300,
|
"HeroNoExist": 1300,
|
||||||
"HeroNoEnough": 1301,
|
"HeroNoEnough": 1301,
|
||||||
"HeroMaxLv": 1302,
|
"HeroMaxLv": 1302,
|
||||||
|
"HeroInitCreat": 1303,
|
||||||
"EquipmentOnFoundEquipment": 1400,
|
"EquipmentOnFoundEquipment": 1400,
|
||||||
"EquipmentLvlimitReached": 1401,
|
"EquipmentLvlimitReached": 1401,
|
||||||
}
|
}
|
||||||
@ -198,7 +201,7 @@ var File_errorcode_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
var file_errorcode_proto_rawDesc = []byte{
|
var file_errorcode_proto_rawDesc = []byte{
|
||||||
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x6f, 0x2a, 0x92, 0x07, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
0x6f, 0x2a, 0xa6, 0x07, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
||||||
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
|
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
|
||||||
0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12,
|
0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12,
|
||||||
0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||||
@ -251,12 +254,13 @@ var file_errorcode_proto_rawDesc = []byte{
|
|||||||
0x10, 0xb3, 0x09, 0x12, 0x10, 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x45, 0x78, 0x69,
|
0x10, 0xb3, 0x09, 0x12, 0x10, 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x45, 0x78, 0x69,
|
||||||
0x73, 0x74, 0x10, 0x94, 0x0a, 0x12, 0x11, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x45,
|
0x73, 0x74, 0x10, 0x94, 0x0a, 0x12, 0x11, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x45,
|
||||||
0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x95, 0x0a, 0x12, 0x0e, 0x0a, 0x09, 0x48, 0x65, 0x72, 0x6f,
|
0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x95, 0x0a, 0x12, 0x0e, 0x0a, 0x09, 0x48, 0x65, 0x72, 0x6f,
|
||||||
0x4d, 0x61, 0x78, 0x4c, 0x76, 0x10, 0x96, 0x0a, 0x12, 0x1e, 0x0a, 0x19, 0x45, 0x71, 0x75, 0x69,
|
0x4d, 0x61, 0x78, 0x4c, 0x76, 0x10, 0x96, 0x0a, 0x12, 0x12, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f,
|
||||||
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4f, 0x6e, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x45, 0x71, 0x75, 0x69,
|
0x49, 0x6e, 0x69, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x10, 0x97, 0x0a, 0x12, 0x1e, 0x0a, 0x19,
|
||||||
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0xf8, 0x0a, 0x12, 0x1c, 0x0a, 0x17, 0x45, 0x71, 0x75, 0x69,
|
0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4f, 0x6e, 0x46, 0x6f, 0x75, 0x6e, 0x64,
|
||||||
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x76, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x63,
|
0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0xf8, 0x0a, 0x12, 0x1c, 0x0a, 0x17,
|
||||||
0x68, 0x65, 0x64, 0x10, 0xf9, 0x0a, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
|
0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x76, 0x6c, 0x69, 0x6d, 0x69, 0x74,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x52, 0x65, 0x61, 0x63, 0x68, 0x65, 0x64, 0x10, 0xf9, 0x0a, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
|
||||||
|
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -51,6 +51,7 @@ enum ErrorCode {
|
|||||||
HeroNoExist = 1300; //英雄不存在
|
HeroNoExist = 1300; //英雄不存在
|
||||||
HeroNoEnough = 1301; //英雄数量不足
|
HeroNoEnough = 1301; //英雄数量不足
|
||||||
HeroMaxLv = 1302; //英雄达到最大等级
|
HeroMaxLv = 1302; //英雄达到最大等级
|
||||||
|
HeroInitCreat = 1303; //初始化英雄
|
||||||
// equipment
|
// equipment
|
||||||
EquipmentOnFoundEquipment = 1400; // 未找到武器
|
EquipmentOnFoundEquipment = 1400; // 未找到武器
|
||||||
EquipmentLvlimitReached = 1401; // 武器等级已达上限
|
EquipmentLvlimitReached = 1401; // 武器等级已达上限
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
@ -11,9 +10,9 @@ package cfg
|
|||||||
import "errors"
|
import "errors"
|
||||||
|
|
||||||
type Game_atn struct {
|
type Game_atn struct {
|
||||||
A string
|
A string //资源类型
|
||||||
T string
|
T string //资源名称
|
||||||
N int32
|
N int32 //数量
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Game_atn) GetTypeId() int {
|
func (Game_atn) GetTypeId() int {
|
||||||
@ -22,8 +21,28 @@ func (Game_atn) GetTypeId() int {
|
|||||||
|
|
||||||
func NewGame_atn(_buf map[string]interface{}) (_v *Game_atn, err error) {
|
func NewGame_atn(_buf map[string]interface{}) (_v *Game_atn, err error) {
|
||||||
_v = &Game_atn{}
|
_v = &Game_atn{}
|
||||||
{ var _ok_ bool; if _v.A, _ok_ = _buf["a"].(string); !_ok_ { err = errors.New("a error"); return } }
|
{
|
||||||
{ var _ok_ bool; if _v.T, _ok_ = _buf["t"].(string); !_ok_ { err = errors.New("t error"); return } }
|
var _ok_ bool
|
||||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["n"].(float64); !_ok_ { err = errors.New("n error"); return }; _v.N = int32(_tempNum_) }
|
if _v.A, _ok_ = _buf["a"].(string); !_ok_ {
|
||||||
|
err = errors.New("a error")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var _ok_ bool
|
||||||
|
if _v.T, _ok_ = _buf["t"].(string); !_ok_ {
|
||||||
|
err = errors.New("t error")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var _ok_ bool
|
||||||
|
var _tempNum_ float64
|
||||||
|
if _tempNum_, _ok_ = _buf["n"].(float64); !_ok_ {
|
||||||
|
err = errors.New("n error")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_v.N = int32(_tempNum_)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user