Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
568ff98d89
@ -454,6 +454,7 @@ type (
|
||||
// 任务完成通知
|
||||
TaskFinishNotify(uid string, taskId, fetterId int32) error
|
||||
IGetReddot
|
||||
GMCreateFavorability(uid string)
|
||||
}
|
||||
// 个人成长任务
|
||||
IGrowtask interface {
|
||||
|
@ -703,6 +703,22 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
|
||||
|
||||
module1.(comm.IGourmet).GMCreateAltas(session.GetUserId())
|
||||
|
||||
this.Debug("使用bingo命令:uid = %s ",
|
||||
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||
log.Field{Key: "0", Value: datas[0]},
|
||||
)
|
||||
} else if len(datas) == 1 && (datas[0] == "library") {
|
||||
var (
|
||||
err error
|
||||
)
|
||||
|
||||
module1, err := this.service.GetModule(comm.ModuleLibrary)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
module1.(comm.ILibrary).GMCreateFavorability(session.GetUserId())
|
||||
|
||||
this.Debug("使用bingo命令:uid = %s ",
|
||||
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||
log.Field{Key: "0", Value: datas[0]},
|
||||
|
@ -343,3 +343,24 @@ func (this *Library) AddHerosFetterData(uid string, heroConfIds []string) (errda
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (this *Library) GMCreateFavorability(uid string) {
|
||||
fetter := this.GetHeroFetterList(uid)
|
||||
update := map[string]interface{}{}
|
||||
for _, v := range fetter {
|
||||
|
||||
if conf, er := this.configure.GetFavorabilityExp(v.Heroid); er == nil {
|
||||
// 达到最大等级不让继续升级
|
||||
v.Favorlv = int32(len(conf))
|
||||
v.Favorexp = 0
|
||||
update["favorlv"] = v.Favorlv
|
||||
update["favorexp"] = v.Favorexp
|
||||
|
||||
if err := this.modelFetter.ChangeList(uid, v.Id, update); err != nil {
|
||||
this.Errorf("modelFetter ChangeList error: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ func (this *ModuleRobot_Hero) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskDa
|
||||
return
|
||||
}
|
||||
|
||||
case comm.Rtype199:
|
||||
case comm.Rtype199, comm.Rtype39, comm.Rtype40:
|
||||
req := &pb.HeroTalentLearnReq{
|
||||
TalentID: 0,
|
||||
ObjId: "",
|
||||
@ -215,6 +215,7 @@ func (this *ModuleRobot_Hero) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskDa
|
||||
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
return
|
||||
}
|
||||
|
79
modules/robot/modulerobot_smithy.go
Normal file
79
modules/robot/modulerobot_smithy.go
Normal file
@ -0,0 +1,79 @@
|
||||
package robot
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
//用户模块 机器人
|
||||
type ModuleRobot_Smithy struct {
|
||||
smithy *pb.DBStove
|
||||
}
|
||||
|
||||
func (this *ModuleRobot_Smithy) Init() (err error) {
|
||||
this.smithy = &pb.DBStove{
|
||||
Id: "",
|
||||
Uid: "",
|
||||
Lv: 0,
|
||||
Data: map[int32]*pb.Mastery{},
|
||||
Skill: map[int32]int32{},
|
||||
Forge: map[int32]int32{},
|
||||
Temperature: 0,
|
||||
RecoveTime: 0,
|
||||
Hit: map[int32]int32{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//接收到消息
|
||||
func (this *ModuleRobot_Smithy) Receive(robot IRobot, stype string, message proto.Message) (err error) {
|
||||
switch stype {
|
||||
case "list":
|
||||
resp := message.(*pb.SmithyGetStoveInfoResp)
|
||||
this.smithy = resp.Data
|
||||
break
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//机器人执行流
|
||||
func (this *ModuleRobot_Smithy) DoPipeline(robot IRobot) (err error) {
|
||||
var (
|
||||
errdata *pb.ErrorData
|
||||
)
|
||||
if _, errdata = robot.SendMessage("smithy", "getstoveinfo", &pb.SmithyGetStoveInfoReq{}); errdata != nil {
|
||||
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//做任务
|
||||
func (this *ModuleRobot_Smithy) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskData, condconf *cfg.GameBuriedCondiData) (err error) {
|
||||
var (
|
||||
errdata *pb.ErrorData
|
||||
)
|
||||
switch comm.TaskType(condconf.Type) {
|
||||
case comm.Rtype51:
|
||||
// 在铁匠铺中获得xx件xx星装备
|
||||
if _, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "hero", "drawcard",
|
||||
&pb.SmithyForgeEquipReq{
|
||||
ReelId: condconf.Filter[0],
|
||||
Lava: 0,
|
||||
Quality: 0,
|
||||
SuiteId: 0,
|
||||
Position: 0,
|
||||
Hit: map[int32]int32{},
|
||||
Count: 1,
|
||||
}); errdata != nil {
|
||||
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
@ -245,6 +245,7 @@ type GameGlobalData struct {
|
||||
BuzkashiSendtime int32
|
||||
BuzkashiSpeedbumptime int32
|
||||
BuzkashiSpeedbumphp int32
|
||||
BuzkashiSprintbumpscore int32
|
||||
BuzkashiBumpdis float32
|
||||
BuzkashiRecovertime int32
|
||||
BuzkashiRecoverHp int32
|
||||
@ -1007,6 +1008,7 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["buzkashi_sendtime"].(float64); !_ok_ { err = errors.New("buzkashi_sendtime error"); return }; _v.BuzkashiSendtime = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["buzkashi_speedbumptime"].(float64); !_ok_ { err = errors.New("buzkashi_speedbumptime error"); return }; _v.BuzkashiSpeedbumptime = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["buzkashi_speedbumphp"].(float64); !_ok_ { err = errors.New("buzkashi_speedbumphp error"); return }; _v.BuzkashiSpeedbumphp = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["buzkashi_sprintbumpscore"].(float64); !_ok_ { err = errors.New("buzkashi_sprintbumpscore error"); return }; _v.BuzkashiSprintbumpscore = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["buzkashi_bumpdis"].(float64); !_ok_ { err = errors.New("buzkashi_bumpdis error"); return }; _v.BuzkashiBumpdis = float32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["buzkashi_recovertime"].(float64); !_ok_ { err = errors.New("buzkashi_recovertime error"); return }; _v.BuzkashiRecovertime = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["buzkashi_recoverHp"].(float64); !_ok_ { err = errors.New("buzkashi_recoverHp error"); return }; _v.BuzkashiRecoverHp = int32(_tempNum_) }
|
||||
|
Loading…
Reference in New Issue
Block a user