消耗英雄卡片

This commit is contained in:
meixiongfeng 2022-07-04 10:59:57 +08:00
parent 4a17e34518
commit 13648d9471
3 changed files with 4 additions and 4 deletions

View File

@ -36,7 +36,7 @@ type (
//查询用户卡片数量
QueryHeroAmount(uId string, heroCfgId int32) (amount uint32)
//消耗卡片
ChangeCard(uId string, heroCfgId int32, count int32) (code pb.ErrorCode)
ConsumeCard(uId string, heroCfgId int32, count int32) (code pb.ErrorCode)
//创建新英雄
CreateHero(uid string, heroCfgId ...int32) error

View File

@ -45,7 +45,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) ConsumeCard(uId string, heroCfgId int32, count int32) (code pb.ErrorCode) {
heroes := this.GetHeroList(uId)
var curList []*pb.DBHero
for _, v := range heroes {

View File

@ -165,7 +165,7 @@ func (this *ModuleBase) CheckConsumeRes(uid string, res []*cfg.Game_atn) (code p
this.ModuleItems.AddItem(source, uid, int32(resID), -1*v.N)
} else if v.A == comm.CardType { //卡片资源
resID, _ = strconv.Atoi(v.T)
this.ModuleHero.ChangeCard(uid, int32(resID), -1*v.N)
this.ModuleHero.ConsumeCard(uid, int32(resID), -1*v.N)
}
// } else if v.A == comm.EquipmentType {
// resID, _ = strconv.Atoi(v.T)
@ -194,7 +194,7 @@ func (this *ModuleBase) DispenseRes(uid string, res []*cfg.Game_atn) (code pb.Er
this.ModuleItems.AddItem(source, uid, int32(resID), v.N)
} else if v.A == comm.CardType { //卡片资源
resID, _ = strconv.Atoi(v.T)
this.ModuleHero.ChangeCard(uid, int32(resID), v.N)
this.ModuleHero.ConsumeCard(uid, int32(resID), v.N)
} else if v.A == comm.EquipmentType {
resID, _ = strconv.Atoi(v.T)
this.ModuleEquipment.AddNewEquipments(source, uid, map[int32]uint32{int32(resID): uint32(v.N)})