Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
7006b7cd0a
@ -1034,3 +1034,17 @@ const (
|
|||||||
SmithyToolsSkill4 = 4 // 每日顾客数量提升至{0}人
|
SmithyToolsSkill4 = 4 // 每日顾客数量提升至{0}人
|
||||||
SmithyToolsSkill5 = 5 // 顾客购买装备数量上限提高至{0}件
|
SmithyToolsSkill5 = 5 // 顾客购买装备数量上限提高至{0}件
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 坐骑属性
|
||||||
|
const (
|
||||||
|
Stime string = "stime"
|
||||||
|
Etime string = "etime"
|
||||||
|
Dhp string = "hp"
|
||||||
|
Moderate string = "moderate"
|
||||||
|
Sprint string = "sprint"
|
||||||
|
Acceleration string = "acceleration"
|
||||||
|
Deceleration string = "deceleration"
|
||||||
|
Itemsprint string = "itemsprint"
|
||||||
|
Caddtime string = "caddtime"
|
||||||
|
Csubtime string = "csubtime"
|
||||||
|
)
|
||||||
|
@ -21,9 +21,15 @@ func (this *apiComp) Train(session comm.IUserSession, req *pb.DragonTrainReq) (e
|
|||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
dragon *pb.DBDragon
|
dragon *pb.DBDragon
|
||||||
//addExp int32 // 获得的训练值
|
|
||||||
playConf *cfg.GameDragonPlayData
|
playConf *cfg.GameDragonPlayData
|
||||||
update map[string]interface{}
|
update map[string]interface{}
|
||||||
|
preType int32
|
||||||
|
curType int32 // 当前阶段
|
||||||
|
reward []*cfg.Gameatn
|
||||||
|
preLv int32 // 升级之前的等级
|
||||||
|
curLv int32 // 升级之后的等级
|
||||||
|
atno []*pb.UserAtno
|
||||||
|
speed int32
|
||||||
)
|
)
|
||||||
update = make(map[string]interface{})
|
update = make(map[string]interface{})
|
||||||
rsp := &pb.DragonTrainResp{}
|
rsp := &pb.DragonTrainResp{}
|
||||||
@ -40,7 +46,6 @@ func (this *apiComp) Train(session comm.IUserSession, req *pb.DragonTrainReq) (e
|
|||||||
}
|
}
|
||||||
if conf, err := this.module.configure.GetDragonConfById(dragon.Dragonid, dragon.Lv); err == nil {
|
if conf, err := this.module.configure.GetDragonConfById(dragon.Dragonid, dragon.Lv); err == nil {
|
||||||
if playConf, err = this.module.configure.GetDragonPlayConfById(dragon.Dragonid, conf.Type, req.Ttype); err == nil {
|
if playConf, err = this.module.configure.GetDragonPlayConfById(dragon.Dragonid, conf.Type, req.Ttype); err == nil {
|
||||||
//addExp = playConf.Exp
|
|
||||||
// 校验消耗
|
// 校验消耗
|
||||||
if errdata = this.module.CheckRes(session, playConf.Deplete); errdata != nil {
|
if errdata = this.module.CheckRes(session, playConf.Deplete); errdata != nil {
|
||||||
return
|
return
|
||||||
@ -53,13 +58,17 @@ func (this *apiComp) Train(session comm.IUserSession, req *pb.DragonTrainReq) (e
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
preLv = dragon.Lv
|
||||||
|
preType = conf.Type
|
||||||
dragon.Exp += playConf.Exp // 加经验
|
dragon.Exp += playConf.Exp // 加经验
|
||||||
|
|
||||||
for {
|
for {
|
||||||
if dragon.Exp >= conf.Exp {
|
if dragon.Exp >= conf.Exp {
|
||||||
dragon.Lv += 1
|
dragon.Lv += 1
|
||||||
dragon.Exp -= conf.Exp
|
dragon.Exp -= conf.Exp
|
||||||
|
if len(conf.Reward) > 0 {
|
||||||
|
reward = append(reward, conf.Reward...)
|
||||||
|
}
|
||||||
|
speed = conf.Etime
|
||||||
if conf, err = this.module.configure.GetDragonConfById(dragon.Dragonid, dragon.Lv); err != nil {
|
if conf, err = this.module.configure.GetDragonConfById(dragon.Dragonid, dragon.Lv); err != nil {
|
||||||
dragon.Lv -= 1
|
dragon.Lv -= 1
|
||||||
dragon.Exp += conf.Exp
|
dragon.Exp += conf.Exp
|
||||||
@ -69,6 +78,31 @@ func (this *apiComp) Train(session comm.IUserSession, req *pb.DragonTrainReq) (e
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
update["exp"] = dragon.Exp
|
||||||
|
update["lv"] = dragon.Lv
|
||||||
|
curType = conf.Type
|
||||||
|
curLv = dragon.Lv
|
||||||
|
}
|
||||||
|
|
||||||
|
if curType != preType { // 坐骑升阶 增加属性
|
||||||
|
if c, err := this.module.configure.GetDragonMount(dragon.Dragonid, curType); err != nil {
|
||||||
|
dragon.Property = make(map[string]int32)
|
||||||
|
dragon.Property["stime"] = c.Stime
|
||||||
|
dragon.Property["etime"] = c.Etime
|
||||||
|
dragon.Property["hp"] = c.Hp
|
||||||
|
dragon.Property["moderate"] = c.Moderate
|
||||||
|
dragon.Property["sprint"] = c.Sprint
|
||||||
|
dragon.Property["acceleration"] = c.Acceleration
|
||||||
|
dragon.Property["deceleration"] = c.Deceleration
|
||||||
|
dragon.Property["itemsprint"] = c.Itemsprint
|
||||||
|
dragon.Property["caddtime"] = c.Caddtime
|
||||||
|
dragon.Property["csubtime"] = c.Csubtime
|
||||||
|
update["property"] = dragon.Property // 更新属性
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if speed > 0 { // 更新最大速度
|
||||||
|
dragon.Property["etime"] = speed
|
||||||
|
update["property"] = dragon.Property
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验训练次数
|
// 校验训练次数
|
||||||
@ -77,6 +111,16 @@ func (this *apiComp) Train(session comm.IUserSession, req *pb.DragonTrainReq) (e
|
|||||||
}
|
}
|
||||||
dragon.Play[req.Ttype] += 1 // 次数+1
|
dragon.Play[req.Ttype] += 1 // 次数+1
|
||||||
update["play"] = dragon.Play
|
update["play"] = dragon.Play
|
||||||
|
|
||||||
|
if errdata = this.module.ConsumeRes(session, playConf.Deplete, true); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if curLv > preLv && len(reward) > 0 { // 看看有没有升级奖励
|
||||||
|
if errdata, atno = this.module.DispenseAtno(session, reward, true); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
rsp.Reward = atno
|
||||||
|
}
|
||||||
this.module.modelDragon.UpdateDragonData(session.GetUserId(), dragon.Id, update)
|
this.module.modelDragon.UpdateDragonData(session.GetUserId(), dragon.Id, update)
|
||||||
session.SendMsg(string(this.module.GetType()), "", rsp)
|
session.SendMsg(string(this.module.GetType()), "", rsp)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user