Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
440758cad8
@ -8,7 +8,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
//参数校验
|
//参数校验
|
||||||
func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.StonehengeBattleReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) BattleCheck(session comm.IUserSession, req *pb.StonehengeBattleReq) (errdata *pb.ErrorData) {
|
||||||
if req.Eventid == 0 {
|
if req.Eventid == 0 {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ReqParameterError,
|
Code: pb.ErrorCode_ReqParameterError,
|
||||||
@ -19,7 +19,7 @@ func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.Stoneheng
|
|||||||
}
|
}
|
||||||
|
|
||||||
///挑战主线关卡
|
///挑战主线关卡
|
||||||
func (this *apiComp) Challenge(session comm.IUserSession, req *pb.StonehengeBattleReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) Battle(session comm.IUserSession, req *pb.StonehengeBattleReq) (errdata *pb.ErrorData) {
|
||||||
var (
|
var (
|
||||||
stone *pb.DBStonehenge
|
stone *pb.DBStonehenge
|
||||||
conf *cfg.GameStoneEventData
|
conf *cfg.GameStoneEventData
|
||||||
@ -52,7 +52,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.StonehengeBatt
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if errdata = this.ChallengeCheck(session, req); errdata != nil {
|
if errdata = this.BattleCheck(session, req); errdata != nil {
|
||||||
return // 参数校验失败直接返回
|
return // 参数校验失败直接返回
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
@ -22,20 +22,21 @@ func (this *apiComp) BattleOverCheck(session comm.IUserSession, req *pb.Stonehen
|
|||||||
// /挑战主线关卡
|
// /挑战主线关卡
|
||||||
func (this *apiComp) BattleOver(session comm.IUserSession, req *pb.StonehengeBattleOverReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) BattleOver(session comm.IUserSession, req *pb.StonehengeBattleOverReq) (errdata *pb.ErrorData) {
|
||||||
var (
|
var (
|
||||||
isWin bool
|
isWin bool
|
||||||
update map[string]interface{}
|
update map[string]interface{}
|
||||||
roomConf *cfg.GameStoneRoomData
|
roomConf *cfg.GameStoneRoomData
|
||||||
eventConf *cfg.GameStoneEventData
|
eventConf *cfg.GameStoneEventData
|
||||||
stone *pb.DBStonehenge
|
newEventConf *cfg.GameStoneEventData //新的事件配置
|
||||||
newEvent int32 // 是否有新的事件
|
stone *pb.DBStonehenge
|
||||||
err error
|
newEvent int32 // 是否有新的事件
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
errdata, isWin = this.module.battle.CheckBattleReport(session, req.Report)
|
errdata, isWin = this.module.battle.CheckBattleReport(session, req.Report)
|
||||||
if errdata != nil {
|
if errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !isWin {
|
if !isWin { // 战斗失败直接返回
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
update = make(map[string]interface{})
|
update = make(map[string]interface{})
|
||||||
@ -56,7 +57,6 @@ func (this *apiComp) BattleOver(session comm.IUserSession, req *pb.StonehengeBat
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
update["stageID"] = stone.StageID
|
|
||||||
if roomConf, err = this.module.configure.GetStoneRoomDataById(stone.Rooms.Roomid); err != nil {
|
if roomConf, err = this.module.configure.GetStoneRoomDataById(stone.Rooms.Roomid); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -64,17 +64,31 @@ func (this *apiComp) BattleOver(session comm.IUserSession, req *pb.StonehengeBat
|
|||||||
if eventConf, err = this.module.configure.GetStoneEventDataById(req.Eventid); err != nil {
|
if eventConf, err = this.module.configure.GetStoneEventDataById(req.Eventid); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
stone.Rooms.Eventid[req.Eventid] = true
|
||||||
// 校验事件有后续事件
|
// 校验事件有后续事件
|
||||||
if eventConf.Probability >= comm.GetRandNum(0, 1000) { // 命中
|
if eventConf.Probability >= comm.GetRandNum(0, 1000) { // 命中
|
||||||
newEvent = eventConf.PostEvent
|
newEvent = eventConf.PostEvent
|
||||||
stone.Rooms.Eventid[newEvent] = false //
|
stone.Rooms.Eventid[newEvent] = false //
|
||||||
stone.Rooms.Eventid[req.Eventid] = true //
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验是否通关
|
// 校验是否通关
|
||||||
for _, v := range roomConf.Condition {
|
for _, v := range roomConf.Condition {
|
||||||
if v == eventConf.EventType {
|
if v == eventConf.EventType {
|
||||||
stone.Rooms.Complete = true
|
stone.Rooms.Complete = true
|
||||||
|
if newEventConf, err = this.module.configure.GetStoneEventDataById(req.Eventid); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, v := range roomConf.Condition {
|
||||||
|
if v == newEventConf.EventType {
|
||||||
|
stone.Rooms.Complete = false // 判断新的事件导致传送门关闭
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ func (this *apiComp) EnterLevel(session comm.IUserSession, req *pb.StonehengeEnt
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
stone.Hero = make(map[string]*pb.BattleRole)
|
||||||
// 查库
|
// 查库
|
||||||
for _, hid := range req.Hid {
|
for _, hid := range req.Hid {
|
||||||
if hero, err := this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), hid); err != nil {
|
if hero, err := this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), hid); err != nil {
|
||||||
|
@ -60,6 +60,7 @@ func (this *MStonehenge) GetStonehengeData(uid string) *pb.DBStonehenge {
|
|||||||
stone.Reward = make(map[int32]bool, 0)
|
stone.Reward = make(map[int32]bool, 0)
|
||||||
stone.Addweight = make(map[int32]int32, 0)
|
stone.Addweight = make(map[int32]int32, 0)
|
||||||
stone.Etime = utils.WeekIntervalTime(0)
|
stone.Etime = utils.WeekIntervalTime(0)
|
||||||
|
stone.Hero = make(map[string]*pb.BattleRole)
|
||||||
this.Add(uid, stone)
|
this.Add(uid, stone)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user