Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
c3ee1c11cd
@ -25,8 +25,9 @@ const (
|
|||||||
// gamesearchitembox = "game_searchitembox.json"
|
// gamesearchitembox = "game_searchitembox.json"
|
||||||
// game_worlddeal = "game_worlddeal.json"
|
// game_worlddeal = "game_worlddeal.json"
|
||||||
// game_worldrd = "game_worldrd.json"
|
// game_worldrd = "game_worldrd.json"
|
||||||
game_pagoda = "game_pagoda.json"
|
game_pagoda = "game_pagoda.json"
|
||||||
hero_talent = "game_herotalent.json" // 天赋详细数据
|
hero_talent = "game_herotalent.json" // 天赋详细数据
|
||||||
|
game_playerlv = "game_playerlv.json"
|
||||||
)
|
)
|
||||||
|
|
||||||
type configureComp struct {
|
type configureComp struct {
|
||||||
@ -46,6 +47,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
|||||||
configure.RegisterConfigure(game_pagoda, cfg.NewGamePagoda, nil)
|
configure.RegisterConfigure(game_pagoda, cfg.NewGamePagoda, nil)
|
||||||
configure.RegisterConfigure(equip_suit, cfg.NewGameEquipSuit, nil)
|
configure.RegisterConfigure(equip_suit, cfg.NewGameEquipSuit, nil)
|
||||||
configure.RegisterConfigure(hero_talent, cfg.NewGameHeroTalent, nil)
|
configure.RegisterConfigure(hero_talent, cfg.NewGameHeroTalent, nil)
|
||||||
|
configure.RegisterConfigure(game_playerlv, cfg.NewGamePlayerlv, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ func (this *ModuleRobot_Hero) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskDa
|
|||||||
}
|
}
|
||||||
|
|
||||||
case comm.Rtype199:
|
case comm.Rtype199:
|
||||||
resp := &pb.HeroTalentLearnReq{
|
req := &pb.HeroTalentLearnReq{
|
||||||
TalentID: 0,
|
TalentID: 0,
|
||||||
ObjId: "",
|
ObjId: "",
|
||||||
Heroid: "",
|
Heroid: "",
|
||||||
@ -83,12 +83,11 @@ func (this *ModuleRobot_Hero) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskDa
|
|||||||
// check 该英雄天赋满级
|
// check 该英雄天赋满级
|
||||||
bMax := false
|
bMax := false
|
||||||
// 获取英雄数据
|
// 获取英雄数据
|
||||||
var bFound bool
|
|
||||||
for _, v := range this.heros {
|
for _, v := range this.heros {
|
||||||
if c, err := this.GMGetTalentByHeroId(v.HeroID); err == nil {
|
if c, err := this.GMGetTalentByHeroId(v.HeroID); err == nil {
|
||||||
if this.talent == nil {
|
if this.talent == nil {
|
||||||
resp.TalentID = c[0].Skillid
|
req.TalentID = c[0].Skillid
|
||||||
resp.Heroid = v.HeroID
|
req.Heroid = v.HeroID
|
||||||
} else {
|
} else {
|
||||||
for _, v1 := range this.talent {
|
for _, v1 := range this.talent {
|
||||||
if len(v1.Talent) == len(c) {
|
if len(v1.Talent) == len(c) {
|
||||||
@ -96,18 +95,16 @@ func (this *ModuleRobot_Hero) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskDa
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
if v1.HeroId == v.HeroID {
|
if v1.HeroId == v.HeroID {
|
||||||
bFound = true
|
req.ObjId = v1.Id
|
||||||
resp.ObjId = v1.Id
|
req.Heroid = v.HeroID
|
||||||
resp.Heroid = v.HeroID
|
|
||||||
// 依次往后学
|
// 依次往后学
|
||||||
if len(v1.Talent) < len(c) {
|
if len(v1.Talent) < len(c) {
|
||||||
resp.TalentID = c[len(v1.Talent)].Skillid
|
req.TalentID = c[len(v1.Talent)].Skillid
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if !bMax { // 当前英雄全满共鸣后 继续找下一个英雄
|
if !bMax { // 当前英雄全满共鸣后 继续找下一个英雄
|
||||||
continue
|
continue
|
||||||
@ -115,10 +112,70 @@ func (this *ModuleRobot_Hero) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskDa
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if !bFound {
|
if _, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "hero", "talentlearn", req); errdata != nil {
|
||||||
resp.ObjId = ""
|
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if _, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "hero", "talentlearn", resp); errdata != nil {
|
case comm.Rtype6: // 升星
|
||||||
|
req := &pb.HeroStrengthenUpStarReq{}
|
||||||
|
for _, v := range this.heros {
|
||||||
|
req.HeroObjID = v.Id
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "hero", "strengthenupstar", req); errdata != nil {
|
||||||
|
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
case comm.Rtype24: // 升级
|
||||||
|
var (
|
||||||
|
itemmodule *ModuleRobot_Item
|
||||||
|
items map[string]*pb.DB_UserItemData
|
||||||
|
use map[string]int32
|
||||||
|
heroMaxLv int32 // 当前英雄最大等级
|
||||||
|
)
|
||||||
|
use = make(map[string]int32)
|
||||||
|
req := &pb.HeroStrengthenUplvReq{
|
||||||
|
HeroObjID: "",
|
||||||
|
Item: map[string]int32{},
|
||||||
|
}
|
||||||
|
// 取任务等级
|
||||||
|
usermodule := robot.GetModule(comm.ModuleUser).(*ModuleRobot_User)
|
||||||
|
|
||||||
|
if c := this.GetPlayerlvConf(usermodule.user.Lv); c != nil {
|
||||||
|
heroMaxLv = c.HeroLv
|
||||||
|
}
|
||||||
|
// 找最大等级的英雄
|
||||||
|
for _, v := range this.heros {
|
||||||
|
if v.Lv > 1 && v.Lv < heroMaxLv {
|
||||||
|
req.HeroObjID = v.Id
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if req.HeroObjID == "" { // 随机找一个1级的英雄进行升级
|
||||||
|
for _, v := range this.heros {
|
||||||
|
if v.Lv == 1 {
|
||||||
|
req.HeroObjID = v.Id
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
itemmodule = robot.GetModule(comm.ModuleItems).(*ModuleRobot_Item)
|
||||||
|
items = itemmodule.items
|
||||||
|
if _, ok := items["10000008"]; ok {
|
||||||
|
use["10000008"] = 1
|
||||||
|
}
|
||||||
|
if _, ok := items["10000009"]; ok && len(use) == 0 {
|
||||||
|
use["10000009"] = 1
|
||||||
|
}
|
||||||
|
if _, ok := items["10000010"]; ok && len(use) == 0 {
|
||||||
|
use["10000010"] = 1
|
||||||
|
}
|
||||||
|
if len(use) > 0 {
|
||||||
|
req.Item = use
|
||||||
|
}
|
||||||
|
if _, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "hero", "strengthenuplv", req); errdata != nil {
|
||||||
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
|
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -179,3 +236,20 @@ func (this *ModuleRobot_Hero) GMGetTalentByHeroId(hid string) (data []*cfg.GameH
|
|||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 玩家等级经验配置表
|
||||||
|
func (this *ModuleRobot_Hero) GetPlayerlvConf(lv int32) (data *cfg.GamePlayerlvData) {
|
||||||
|
if v, err := configure.GetConfigure(game_playerlv); err != nil {
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
if configure, ok := v.(*cfg.GamePlayerlv); !ok {
|
||||||
|
err = fmt.Errorf("%T no is *cfg.Game_playerlv", v)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
if configure != nil {
|
||||||
|
data = configure.GetDataMap()[lv]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user