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