解决冲突

This commit is contained in:
zhaocy 2022-06-27 20:02:13 +08:00
parent 35c5689bb5
commit 01cd864ba1
2 changed files with 25 additions and 11 deletions

View File

@ -37,7 +37,7 @@ type (
QueryCardAmount(uId string, cardId int32) (amount uint32) QueryCardAmount(uId string, cardId int32) (amount uint32)
//添加/减少卡片 //添加/减少卡片
AddCard(uId string, cardId int32, add int32) (code pb.ErrorCode) AddCard(uId string, cardId int32, add int32) (code pb.ErrorCode)
//创建一个新英雄 //创建新英雄
CreatMultiHero(uid string, heroCfgId ...int32) error CreatMultiHero(uid string, heroCfgId ...int32) error
// 获取英雄 // 获取英雄
@ -47,7 +47,6 @@ type (
UpdateEquipment(hero *pb.DB_HeroData, equip []*pb.DB_Equipment) (code pb.ErrorCode) UpdateEquipment(hero *pb.DB_HeroData, equip []*pb.DB_Equipment) (code pb.ErrorCode)
//获取玩家英雄列表 //获取玩家英雄列表
GetHeroList(uid string) []*pb.DB_HeroData GetHeroList(uid string) []*pb.DB_HeroData
} }
//玩家 //玩家
@ -56,7 +55,6 @@ type (
QueryAttributeValue(uid string, attr string) (value int32) QueryAttributeValue(uid string, attr string) (value int32)
//添加/减少属性值 //添加/减少属性值
AddAttributeValue(uid string, attr string, add int32) (code pb.ErrorCode) AddAttributeValue(uid string, attr string, add int32) (code pb.ErrorCode)
} }
//武器模块 //武器模块
IEquipment interface { IEquipment interface {

View File

@ -44,10 +44,18 @@ func (this *Hero) GetHeroInfoByObjID(id string) (*pb.DB_HeroData, pb.ErrorCode)
return nil, pb.ErrorCode_HeroNoExist return nil, pb.ErrorCode_HeroNoExist
} }
//获取英雄 //创建新英雄
func (this *Hero) GetHero(heroId int32) (*pb.DB_HeroData, pb.ErrorCode) { func (this *Hero) CreatMultiHero(uid string, heroCfgId ...int32) error {
return this.model_hero.createMultiHero(uid, heroCfgId...)
}
//获取英雄
func (this *Hero) GetHero(uid, heroId string) (*pb.DB_HeroData, pb.ErrorCode) {
hero := this.model_hero.getOneHero(uid, heroId)
if hero == nil {
return nil, pb.ErrorCode_HeroNoExist return nil, pb.ErrorCode_HeroNoExist
}
return hero, pb.ErrorCode_Success
} }
func (this *Hero) ModifyHero(heroId *pb.DB_HeroData) (*pb.DB_HeroData, pb.ErrorCode) { func (this *Hero) ModifyHero(heroId *pb.DB_HeroData) (*pb.DB_HeroData, pb.ErrorCode) {
@ -56,11 +64,19 @@ func (this *Hero) ModifyHero(heroId *pb.DB_HeroData) (*pb.DB_HeroData, pb.ErrorC
} }
//佩戴装备 //佩戴装备
func (this *Hero) InstallEquip(heroId, equipId string) pb.ErrorCode { func (this *Hero) UpdateEquipment(hero *pb.DB_HeroData, equip []*pb.DB_Equipment) (code pb.ErrorCode) {
return pb.ErrorCode_Success equipIds := make([]string, 4)
for _, v := range equip {
equipIds = append(equipIds, v.Id)
}
return this.model_hero.setEquipment(hero.Uid, hero.Id, equipIds)
} }
// 卸载装备 //英雄列表
func (this *Hero) UninstallEquip(heroId, equipId string) pb.ErrorCode { func (this *Hero) GetHeroList(uid string) []*pb.DB_HeroData {
return pb.ErrorCode_Success list, err := this.model_hero.getHeroList(uid)
if err != nil {
return nil
}
return list
} }