Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
c68217f47d
@ -132,8 +132,8 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
|
||||
|
||||
res = append(res, talentConf.Thing...)
|
||||
// 消耗指定的天赋点数
|
||||
t := this.module.configure.GetHeroTalentBoxItem(talent.HeroId)
|
||||
if t != "" && talentConf.Point > 0 {
|
||||
t, err := this.module.configure.GetHeroTalentBoxItem(talent.HeroId)
|
||||
if err != nil && talentConf.Point > 0 {
|
||||
curItemCount := int32(this.module.ModuleItems.QueryItemAmount(session.GetUserId(), t))
|
||||
if curItemCount < talentConf.Point { // 如果数量不够 则取找其他物品替代
|
||||
leftCount := talentConf.Point - curItemCount // 需要其他物品的数量
|
||||
@ -157,6 +157,13 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
|
||||
}
|
||||
res = append(res, point)
|
||||
}
|
||||
} else {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if errdata = this.module.ConsumeRes(session, res, true); errdata != nil {
|
||||
return
|
||||
|
@ -62,7 +62,7 @@ func (this *apiComp) TalentReset(session comm.IUserSession, req *pb.HeroTalentRe
|
||||
return
|
||||
}
|
||||
}
|
||||
if t := this.module.configure.GetHeroTalentBoxItem(_talent.HeroId); t != "" {
|
||||
if t, e := this.module.configure.GetHeroTalentBoxItem(_talent.HeroId); e == nil {
|
||||
res := &cfg.Gameatn{
|
||||
A: "item",
|
||||
T: t,
|
||||
@ -75,6 +75,13 @@ func (this *apiComp) TalentReset(session comm.IUserSession, req *pb.HeroTalentRe
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
this.module.WriteUserLog(session.GetUserId(), req, comm.GMResAddType, "HeroTalentResetReq", res)
|
||||
})
|
||||
} else {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: e.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if len(_talent.Talent) > 0 {
|
||||
|
@ -412,15 +412,20 @@ func (this *configureComp) GetHeroTalent(id int32) (data *cfg.GameHeroTalentData
|
||||
}
|
||||
|
||||
// 天赋指定消耗
|
||||
func (this *configureComp) GetHeroTalentBoxItem(heroid string) (itemid string) {
|
||||
if v, err := this.GetConfigure(hero_talentbox); err == nil {
|
||||
func (this *configureComp) GetHeroTalentBoxItem(heroid string) (itemid string, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
)
|
||||
if v, err = this.GetConfigure(hero_talentbox); err == nil {
|
||||
if configure, ok := v.(*cfg.GameTalentBox); ok {
|
||||
itemid = configure.Get(heroid).Itemid
|
||||
return
|
||||
if configure.Get(heroid) != nil {
|
||||
itemid = configure.Get(heroid).Itemid
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
this.module.Errorf("cfg.GameItemBoxData GetHeroTalentBoxItem:skillId = %d", heroid)
|
||||
return ""
|
||||
err = comm.NewNotFoundConfErr(moduleName, hero_talentbox, heroid)
|
||||
return
|
||||
}
|
||||
|
||||
// 读取商品
|
||||
@ -613,11 +618,11 @@ func (this *configureComp) GetAllDrawRewardConf() (data map[int32]*cfg.GamedrawR
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *configureComp) GetHeroByPoolExcept(pool string, cards map[string]struct{}) (hid string, err error) {
|
||||
this.hlock.RLock()
|
||||
defer this.hlock.RUnlock()
|
||||
if v, ok := this.cardPool[pool]; ok {
|
||||
|
||||
var sz []int32
|
||||
for _, v1 := range v {
|
||||
if _, ok := cards[v1.Id]; !ok {
|
||||
@ -640,16 +645,15 @@ func (this *configureComp) GetHeroLvUpWardData(star int32, lv int32) (conf *cfg.
|
||||
var (
|
||||
v interface{}
|
||||
)
|
||||
if v, err = this.GetConfigure(game_herolevelupreward); err != nil {
|
||||
|
||||
}
|
||||
|
||||
for _, conf = range v.(*cfg.GameHeroLevelupreward).GetDataList() {
|
||||
if conf.Star == star && lv == conf.Level {
|
||||
return
|
||||
if v, err = this.GetConfigure(game_herolevelupreward); err == nil {
|
||||
for _, conf = range v.(*cfg.GameHeroLevelupreward).GetDataList() {
|
||||
if conf.Star == star && lv == conf.Level {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
err = fmt.Errorf("no found")
|
||||
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_herolevelupreward, fmt.Sprintf(":%d,%d", star, lv))
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user