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