Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
aec58a4c2d
@ -10,7 +10,7 @@ import (
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.EnchantChallengeReq) (code pb.ErrorCode) {
|
||||
if req.BossType <= 0 || req.Battle != nil {
|
||||
if req.BossType <= 0 || req.Battle == nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
equip_suit = "game_equipsuit.json" //装备套装表
|
||||
new_hero = "game_hero.json" //英雄
|
||||
hero_stargrow = "game_herostargrow.json" //英雄品质系数
|
||||
hero_levelgrow = "game_herolevelgrow.json" //英雄成长系数
|
||||
@ -51,6 +52,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
||||
err = this.MCompConfigure.Init(service, module, comp, options)
|
||||
this.module = module.(*Hero)
|
||||
err = this.LoadMultiConfigure(map[string]interface{}{
|
||||
equip_suit: cfg.NewGameEquipSuit,
|
||||
new_hero: cfg.NewGameHero,
|
||||
hero_stargrow: cfg.NewGameHeroStargrow,
|
||||
hero_levelgrow: cfg.NewGameHeroLevelgrow,
|
||||
@ -498,3 +500,19 @@ func (this *configureComp) GetHeroStargrowConfigByStar(star int32) int32 {
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
// 获取英雄升级属性变化相关配置数据
|
||||
func (this *configureComp) GetEquipsuit(id int32) (configure *cfg.GameEquipSuitData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
ok bool
|
||||
)
|
||||
if v, err = this.GetConfigure(equip_suit); err == nil {
|
||||
if configure, ok = v.(*cfg.GameEquipSuit).GetDataMap()[id]; !ok {
|
||||
err = fmt.Errorf("%T no is *cfg.GameEquipSuit", v)
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -307,22 +307,6 @@ func (this *ModelHero) setEquipProperty(hero *pb.DBHero, equip []*pb.DB_Equipmen
|
||||
for _, v := range v.AdverbEntry {
|
||||
addProperty[v.AttrName] += v.Value + v.EnchValue //附加属性
|
||||
}
|
||||
for k, v := range addProperty {
|
||||
switch k {
|
||||
case comm.AtkPro:
|
||||
addProperty[comm.Atk] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Atk])))
|
||||
addProperty[comm.AtkPro] = 0
|
||||
case comm.DefPro:
|
||||
addProperty[comm.Def] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Def])))
|
||||
addProperty[comm.DefPro] = 0
|
||||
case comm.HpPro:
|
||||
addProperty[comm.Hp] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Hp])))
|
||||
addProperty[comm.HpPro] = 0
|
||||
case comm.SpeedPro:
|
||||
addProperty[comm.Speed] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Speed])))
|
||||
addProperty[comm.SpeedPro] = 0
|
||||
}
|
||||
}
|
||||
if v.Adverbskill != nil {
|
||||
for _, v := range v.Adverbskill {
|
||||
equipSkill = append(equipSkill, &pb.SkillData{
|
||||
@ -332,6 +316,37 @@ func (this *ModelHero) setEquipProperty(hero *pb.DBHero, equip []*pb.DB_Equipmen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if hero.SuiteId != 0 { //套装
|
||||
if configure, err := this.moduleHero.configure.GetEquipsuit(hero.SuiteId); err != nil {
|
||||
this.moduleHero.Errorln(err)
|
||||
} else {
|
||||
for k, v := range configure.SetBonuses {
|
||||
addProperty[k] += v
|
||||
}
|
||||
}
|
||||
}
|
||||
if hero.SuiteExtId != 0 { //套装
|
||||
if configure, err := this.moduleHero.configure.GetEquipsuit(hero.SuiteExtId); err != nil {
|
||||
this.moduleHero.Errorln(err)
|
||||
} else {
|
||||
for k, v := range configure.SetBonuses {
|
||||
addProperty[k] += v
|
||||
}
|
||||
}
|
||||
}
|
||||
for k, v := range addProperty {
|
||||
switch k {
|
||||
case comm.AtkPro:
|
||||
addProperty[comm.Atk] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Atk])))
|
||||
case comm.DefPro:
|
||||
addProperty[comm.Def] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Def])))
|
||||
case comm.HpPro:
|
||||
addProperty[comm.Hp] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Hp])))
|
||||
case comm.SpeedPro:
|
||||
addProperty[comm.Speed] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Speed])))
|
||||
}
|
||||
}
|
||||
this.mergeAddProperty(hero.Uid, hero, addProperty, equipSkill)
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.HuntingChallengeReq) (code pb.ErrorCode) {
|
||||
if req.BossType <= 0 && req.Difficulty > 0 || req.Battle != nil {
|
||||
if req.BossType <= 0 && req.Difficulty > 0 || req.Battle == nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) SellItemCheck(session comm.IUserSession, req *pb.ItemsSellItemReq) (code pb.ErrorCode) {
|
||||
func (this *apiComp) DecomposeCheck(session comm.IUserSession, req *pb.ItemsDecomposeReq) (code pb.ErrorCode) {
|
||||
if req.GridId == "" || req.Amount <= 0 {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
}
|
||||
@ -17,14 +17,14 @@ func (this *apiComp) SellItemCheck(session comm.IUserSession, req *pb.ItemsSellI
|
||||
}
|
||||
|
||||
//出售道具
|
||||
func (this *apiComp) SellItem(session comm.IUserSession, req *pb.ItemsSellItemReq) (code pb.ErrorCode, data proto.Message) {
|
||||
func (this *apiComp) Decompose(session comm.IUserSession, req *pb.ItemsDecomposeReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
err error
|
||||
item *pb.DB_UserItemData
|
||||
itemcf *cfg.GameItemData
|
||||
sale []*cfg.Gameatn
|
||||
)
|
||||
if code = this.SellItemCheck(session, req); code != pb.ErrorCode_Success {
|
||||
if code = this.DecomposeCheck(session, req); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
if item, err = this.module.modelItems.QueryUserPackByGridId(session.GetUserId(), req.GridId); err != nil {
|
||||
@ -73,6 +73,6 @@ func (this *apiComp) SellItem(session comm.IUserSession, req *pb.ItemsSellItemRe
|
||||
if code = this.module.AddItemforGrid(session, req.GridId, -1*int32(req.Amount), true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "sellitem", &pb.ItemsSellItemResp{GridId: req.GridId, Amount: req.Amount, Issucc: true})
|
||||
session.SendMsg(string(this.module.GetType()), "decompose", &pb.ItemsDecomposeResp{GridId: req.GridId, Amount: req.Amount, Issucc: true})
|
||||
return
|
||||
}
|
||||
|
@ -9,22 +9,22 @@ import (
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) DecomposeCheck(session comm.IUserSession, req *pb.ItemsDecomposeReq) (code pb.ErrorCode) {
|
||||
func (this *apiComp) SellItemCheck(session comm.IUserSession, req *pb.ItemsSellItemReq) (code pb.ErrorCode) {
|
||||
if req.GridId == "" || req.Amount <= 0 {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//出售道具
|
||||
func (this *apiComp) Decompose(session comm.IUserSession, req *pb.ItemsDecomposeReq) (code pb.ErrorCode, data proto.Message) {
|
||||
//分解道具
|
||||
func (this *apiComp) SellItem(session comm.IUserSession, req *pb.ItemsSellItemReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
err error
|
||||
item *pb.DB_UserItemData
|
||||
itemcf *cfg.GameItemData
|
||||
sale []*cfg.Gameatn
|
||||
)
|
||||
if code = this.DecomposeCheck(session, req); code != pb.ErrorCode_Success {
|
||||
if code = this.SellItemCheck(session, req); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
if item, err = this.module.modelItems.QueryUserPackByGridId(session.GetUserId(), req.GridId); err != nil {
|
||||
@ -44,7 +44,7 @@ func (this *apiComp) Decompose(session comm.IUserSession, req *pb.ItemsDecompose
|
||||
this.module.Errorf("SellItemCheck over all amount:[%d:%d]", req.Amount, item.Amount)
|
||||
return
|
||||
}
|
||||
sale = make([]*cfg.Gameatn, len(itemcf.Sale))
|
||||
sale = make([]*cfg.Gameatn, len(itemcf.DecomposeDeplete))
|
||||
for i, v := range itemcf.Sale {
|
||||
temp := *v
|
||||
sale[i] = &temp
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.VikingChallengeReq) (code pb.ErrorCode) {
|
||||
if req.BossId <= 0 && req.Difficulty > 0 || req.Battle != nil {
|
||||
if req.BossId <= 0 && req.Difficulty > 0 || req.Battle == nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ type GameEquipSuitData struct {
|
||||
Skill int32
|
||||
Skillname string
|
||||
Skillintr string
|
||||
SetBonuses map[string]float32
|
||||
SetBonuses map[string]int32
|
||||
}
|
||||
|
||||
const TypeId_GameEquipSuitData = -1986764885
|
||||
@ -36,15 +36,15 @@ func (_v *GameEquipSuitData)Deserialize(_buf map[string]interface{}) (err error)
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["SetBonuses"].([]interface{}); !_ok_ { err = errors.New("SetBonuses error"); return }
|
||||
|
||||
_v.SetBonuses = make(map[string]float32)
|
||||
_v.SetBonuses = make(map[string]int32)
|
||||
|
||||
for _, _e_ := range _arr_ {
|
||||
var _kv_ []interface{}
|
||||
if _kv_, _ok_ = _e_.([]interface{}); !_ok_ || len(_kv_) != 2 { err = errors.New("SetBonuses error"); return }
|
||||
var _key_ string
|
||||
{ if _key_, _ok_ = _kv_[0].(string); !_ok_ { err = errors.New("_key_ error"); return } }
|
||||
var _value_ float32
|
||||
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _kv_[1].(float64); !_ok_ { err = errors.New("_value_ error"); return }; _value_ = float32(_x_) }
|
||||
var _value_ int32
|
||||
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _kv_[1].(float64); !_ok_ { err = errors.New("_value_ error"); return }; _value_ = int32(_x_) }
|
||||
_v.SetBonuses[_key_] = _value_
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user