上传代码
This commit is contained in:
parent
6804421972
commit
5cba1c5aa9
@ -31,6 +31,7 @@ const (
|
||||
///配置管理基础组件
|
||||
type MCompConfigure struct {
|
||||
cbase.ModuleCompBase
|
||||
module core.IModule
|
||||
hlock sync.RWMutex
|
||||
_dropMap map[int32][]*cfg.GameDropData // 掉落表 key 是DiropId
|
||||
_sign map[int32]*cfg.GameSignData
|
||||
@ -39,6 +40,7 @@ type MCompConfigure struct {
|
||||
//组件初始化接口
|
||||
func (this *MCompConfigure) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
err = this.ModuleCompBase.Init(service, module, comp, options)
|
||||
this.module = module
|
||||
//err = this.LoadConfigure(game_gamecolor, cfg.NewGameGameColor)
|
||||
err = this.LoadConfigure(new_hero, cfg.NewGameHero)
|
||||
err = this.LoadConfigure(game_playerlv, cfg.NewGamePlayerlv)
|
||||
@ -122,17 +124,17 @@ func (this *MCompConfigure) GetPlayerlvConfList() (list []*cfg.GamePlayerlvData)
|
||||
}
|
||||
|
||||
// 玩家等级经验配置表
|
||||
func (this *MCompConfigure) GetPlayerlvConf(lv int32) (data *cfg.GamePlayerlvData) {
|
||||
if v, err := this.GetConfigure(game_playerlv); err != nil {
|
||||
func (this *MCompConfigure) GetPlayerlvConf(lv int32) (conf *cfg.GamePlayerlvData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
ok bool
|
||||
)
|
||||
if v, err = this.GetConfigure(game_playerlv); err != nil {
|
||||
return
|
||||
} else {
|
||||
if configure, ok := v.(*cfg.GamePlayerlv); !ok {
|
||||
err = fmt.Errorf("%T no is *cfg.Game_playerlv", v)
|
||||
if conf, ok = v.(*cfg.GamePlayerlv).GetDataMap()[lv]; !ok {
|
||||
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_playerlv, lv)
|
||||
return
|
||||
} else {
|
||||
if configure != nil {
|
||||
data = configure.GetDataMap()[lv]
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
|
@ -586,7 +586,7 @@ func (this *configureComp) GetHeroByPoolExcept(pool string, cards map[string]str
|
||||
}
|
||||
|
||||
// 获取英雄升级属性变化相关配置数据
|
||||
func (this *configureComp) GetHeroLvUpR(star int32, lv int32) (conf *cfg.GameHeroLeveluprewardData, err error) {
|
||||
func (this *configureComp) GetHeroLvUpWardData(star int32, lv int32) (conf *cfg.GameHeroLeveluprewardData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
)
|
||||
|
@ -404,10 +404,17 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero,
|
||||
tasks []*pb.BuriedParam
|
||||
changeupdate map[string]interface{} = make(map[string]interface{})
|
||||
maxlvhero *pb.DBHero
|
||||
upwardconf *cfg.GameHeroLeveluprewardData
|
||||
upwardconfs []*cfg.GameHeroLeveluprewardData
|
||||
upwardatns []*cfg.Gameatn
|
||||
err error
|
||||
)
|
||||
curAddExp = make(map[string]int32, len(heros))
|
||||
for _, hero := range heros {
|
||||
var (
|
||||
user *pb.DBUser
|
||||
expConf *cfg.GamePlayerlvData
|
||||
|
||||
preLv int32 //加经验之前的等级
|
||||
curExp int32 // 加经验之后的经验
|
||||
curLv int32 // 加经验之后的等级
|
||||
@ -427,14 +434,23 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero,
|
||||
var maxLv int32 // 校验等级达到上限
|
||||
maxLv = this.module.configure.GetHeroMaxLv(hero.Star)
|
||||
// 校验玩家等级
|
||||
if _user, err := this.module.GetUserForSession(session); err == nil {
|
||||
if expConf := this.module.configure.GetPlayerlvConf(_user.Lv); expConf != nil {
|
||||
if maxLv > expConf.HeroLv {
|
||||
maxLv = expConf.HeroLv // 英雄最大等级限制
|
||||
}
|
||||
if user, err = this.module.GetUserForSession(session); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if expConf, err = this.module.configure.GetPlayerlvConf(user.Lv); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if maxLv > expConf.HeroLv {
|
||||
maxLv = expConf.HeroLv // 英雄最大等级限制
|
||||
}
|
||||
|
||||
_data := this.module.configure.GetHeroLv(curLv)
|
||||
if _data == nil {
|
||||
errdata = &pb.ErrorData{
|
||||
@ -503,6 +519,7 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero,
|
||||
update["horoscopeProperty"] = hero.HoroscopeProperty
|
||||
update["talentProperty"] = hero.TalentProperty
|
||||
update["juexProperty"] = hero.JuexProperty
|
||||
|
||||
}
|
||||
changeupdate[hero.Id] = update
|
||||
if curLv-preLv > 0 { // 升级了 统计任务
|
||||
@ -514,6 +531,9 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero,
|
||||
// szTask = append(szTask, comm.GetBuriedParam(comm.Rtype29, 1, hero.Lv, utils.ToInt32(hero.HeroID)))
|
||||
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype23, hero.HeroID, hero.Star, hero.Lv))
|
||||
if cfg, _ := this.module.configure.GetHeroConfig(hero.HeroID); cfg != nil {
|
||||
if upwardconf, err = this.module.configure.GetHeroLvUpWardData(cfg.Star, curLv); err != nil {
|
||||
upwardconfs = append(upwardconfs, upwardconf)
|
||||
}
|
||||
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype32, hero.HeroID, cfg.Color, hero.Lv))
|
||||
//xx英雄满级、共鸣、觉醒至最高状态
|
||||
nextAwaken, _ := this.module.configure.GetHeroAwakenConfig(hero.HeroID, hero.JuexingLv+1)
|
||||
@ -573,6 +593,12 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero,
|
||||
this.module.passon.HeroUpLv(session, maxlvhero.HeroID, maxlvhero.Lv)
|
||||
}
|
||||
this.module.ModuleBuried.TriggerBuried(session, tasks...)
|
||||
if len(upwardconfs) > 0 {
|
||||
for _, v := range upwardconfs {
|
||||
upwardatns = append(upwardatns, v.Starup...)
|
||||
}
|
||||
this.module.DispenseAtno(session, upwardatns, true)
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
@ -494,7 +494,9 @@ func (this *ModelItemsComp) buyTicket(session comm.IUserSession, buy int32) (inf
|
||||
}
|
||||
return
|
||||
}
|
||||
this.module.modelItems.recoverTicket(session)
|
||||
if errdata = this.module.modelItems.recoverTicket(session); errdata != nil {
|
||||
return
|
||||
}
|
||||
if maxbuy, err = this.module.configure.GetchallengeDataCount(); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
@ -559,6 +561,7 @@ func (this *ModelItemsComp) recoverTicket(session comm.IUserSession) (errdata *p
|
||||
info *pb.DBUserExpand
|
||||
duration time.Duration
|
||||
ticketitem *cfg.Gameatn
|
||||
playerlv *cfg.GamePlayerlvData
|
||||
ticket int32
|
||||
ticketNum int32
|
||||
err error
|
||||
@ -593,7 +596,13 @@ func (this *ModelItemsComp) recoverTicket(session comm.IUserSession) (errdata *p
|
||||
info.Buyunifiedticket = 0
|
||||
}
|
||||
global := this.module.ModuleTools.GetGlobalConf()
|
||||
playerlv := this.module.configure.GetPlayerlvConf(user.Lv)
|
||||
if playerlv, err = this.module.configure.GetPlayerlvConf(user.Lv); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
ticket = int32(this.module.ModuleItems.QueryItemAmount(session.GetUserId(), ticketitem.T))
|
||||
if ticket < global.DreamlandFightnum && info.Recovertimeunifiedticket > 0 {
|
||||
duration = configure.Now().Sub(time.Unix(info.Recovertimeunifiedticket, 0))
|
||||
|
@ -248,13 +248,14 @@ func (this *ModelUser) computeLevel(change *pb.UserResChangedPush) (lvchange boo
|
||||
var (
|
||||
curLv int32 = change.Lv
|
||||
nextLvConf *cfg.GamePlayerlvData
|
||||
curLvConf *cfg.GamePlayerlvData
|
||||
curExp int64 = change.Exp
|
||||
res int64
|
||||
err error
|
||||
)
|
||||
rewards = make([]*cfg.Gameatn, 0)
|
||||
for {
|
||||
nextLvConf = this.module.configure.GetPlayerlvConf(curLv + 1)
|
||||
if nextLvConf == nil {
|
||||
if nextLvConf, err = this.module.configure.GetPlayerlvConf(curLv + 1); err != nil {
|
||||
break
|
||||
}
|
||||
if curExp >= int64(nextLvConf.Exp) {
|
||||
@ -268,7 +269,10 @@ func (this *ModelUser) computeLevel(change *pb.UserResChangedPush) (lvchange boo
|
||||
}
|
||||
|
||||
if nextLvConf == nil { //满级了
|
||||
curLvConf := this.module.configure.GetPlayerlvConf(curLv)
|
||||
if curLvConf, err = this.module.configure.GetPlayerlvConf(curLv); err != nil {
|
||||
log.Errorln(err)
|
||||
return
|
||||
}
|
||||
reward := this.module.globalConf.OverexpReward
|
||||
if curExp > int64(curLvConf.Exp) {
|
||||
loseexp = int32(curExp) - curLvConf.Exp
|
||||
|
@ -1077,16 +1077,18 @@ func (this *User) BingoSetUserLv(session comm.IUserSession, lv int32) error {
|
||||
// 玩家体力恢复
|
||||
func (this *User) recoverUserPs(user *pb.DBUser) (change bool, total int32, nexttime int64) {
|
||||
var (
|
||||
yu int32
|
||||
add int32
|
||||
yu int32
|
||||
add int32
|
||||
pconf *cfg.GamePlayerlvData
|
||||
err error
|
||||
)
|
||||
cur := configure.Now().Unix()
|
||||
ggd := this.ModuleTools.GetGlobalConf()
|
||||
if ggd == nil {
|
||||
return
|
||||
}
|
||||
pconf := this.configure.GetPlayerlvConf(user.Lv)
|
||||
if pconf == nil {
|
||||
if pconf, err = this.configure.GetPlayerlvConf(user.Lv); err != nil {
|
||||
log.Errorln(err)
|
||||
return
|
||||
}
|
||||
if user.Ps >= pconf.PsCeiling {
|
||||
|
Loading…
Reference in New Issue
Block a user