获得指定星级等级英雄数量赋值
This commit is contained in:
parent
303a6969b7
commit
1bb3d823e2
@ -49,7 +49,7 @@ type (
|
||||
//清理玩家英雄数据
|
||||
CleanData(uid string)
|
||||
// 获取指定星级等级的英雄
|
||||
GetSpecifiedHero(session IUserSession, heroConfId string, star, lv int32) (*pb.DBHero, error)
|
||||
GetSpecifiedHero(session IUserSession, heroConfId string, star, lv, amount int32) (*pb.DBHero, error)
|
||||
}
|
||||
|
||||
//玩家
|
||||
|
@ -123,8 +123,8 @@ func (this *Hero) CleanData(uid string) {
|
||||
}
|
||||
|
||||
// 创建一些特殊的英雄
|
||||
func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string, star, lv int32) (hero *pb.DBHero, err error) {
|
||||
if session.GetUserId() == "" || heroConfId == "" || star == 0 || lv == 0 {
|
||||
func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string, star, lv, amount int32) (hero *pb.DBHero, err error) {
|
||||
if session.GetUserId() == "" || heroConfId == "" || star == 0 || lv == 0 || amount == 0 {
|
||||
return nil, errors.New("parameter err")
|
||||
}
|
||||
hero, err = this.modelHero.createOneHero(session.GetUserId(), heroConfId)
|
||||
@ -133,10 +133,12 @@ func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string,
|
||||
}
|
||||
hero.Lv = lv
|
||||
hero.Star = star
|
||||
hero.SameCount = amount
|
||||
_heroMap := map[string]interface{}{
|
||||
"lv": hero.Lv,
|
||||
"star": hero.Star,
|
||||
"isOverlying": false,
|
||||
"sameCount": amount,
|
||||
}
|
||||
// 保存数据
|
||||
err = this.modelHero.ChangeList(session.GetUserId(), hero.Id, _heroMap)
|
||||
@ -144,11 +146,8 @@ func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string,
|
||||
log.Errorf("GetSpecified failed:%v", err)
|
||||
return
|
||||
}
|
||||
list := make([]*pb.DBHero, 0)
|
||||
|
||||
list = append(list, hero)
|
||||
// push change
|
||||
session.SendMsg("hero", "change", &pb.HeroChangePush{List: list})
|
||||
session.SendMsg("hero", "change", &pb.HeroChangePush{List: []*pb.DBHero{hero}})
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user