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 {
|
||||
errdata = &pb.ErrorData{
|
||||
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 (
|
||||
stone *pb.DBStonehenge
|
||||
conf *cfg.GameStoneEventData
|
||||
@ -52,7 +52,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.StonehengeBatt
|
||||
}
|
||||
return
|
||||
}
|
||||
if errdata = this.ChallengeCheck(session, req); errdata != nil {
|
||||
if errdata = this.BattleCheck(session, req); errdata != nil {
|
||||
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) {
|
||||
var (
|
||||
isWin bool
|
||||
update map[string]interface{}
|
||||
roomConf *cfg.GameStoneRoomData
|
||||
eventConf *cfg.GameStoneEventData
|
||||
stone *pb.DBStonehenge
|
||||
newEvent int32 // 是否有新的事件
|
||||
err error
|
||||
isWin bool
|
||||
update map[string]interface{}
|
||||
roomConf *cfg.GameStoneRoomData
|
||||
eventConf *cfg.GameStoneEventData
|
||||
newEventConf *cfg.GameStoneEventData //新的事件配置
|
||||
stone *pb.DBStonehenge
|
||||
newEvent int32 // 是否有新的事件
|
||||
err error
|
||||
)
|
||||
|
||||
errdata, isWin = this.module.battle.CheckBattleReport(session, req.Report)
|
||||
if errdata != nil {
|
||||
return
|
||||
}
|
||||
if !isWin {
|
||||
if !isWin { // 战斗失败直接返回
|
||||
return
|
||||
}
|
||||
update = make(map[string]interface{})
|
||||
@ -56,7 +57,6 @@ func (this *apiComp) BattleOver(session comm.IUserSession, req *pb.StonehengeBat
|
||||
}
|
||||
return
|
||||
}
|
||||
update["stageID"] = stone.StageID
|
||||
if roomConf, err = this.module.configure.GetStoneRoomDataById(stone.Rooms.Roomid); err != nil {
|
||||
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 {
|
||||
return
|
||||
}
|
||||
stone.Rooms.Eventid[req.Eventid] = true
|
||||
// 校验事件有后续事件
|
||||
if eventConf.Probability >= comm.GetRandNum(0, 1000) { // 命中
|
||||
newEvent = eventConf.PostEvent
|
||||
stone.Rooms.Eventid[newEvent] = false //
|
||||
stone.Rooms.Eventid[req.Eventid] = true //
|
||||
stone.Rooms.Eventid[newEvent] = false //
|
||||
}
|
||||
|
||||
// 校验是否通关
|
||||
for _, v := range roomConf.Condition {
|
||||
if v == eventConf.EventType {
|
||||
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
|
||||
}
|
||||
stone.Hero = make(map[string]*pb.BattleRole)
|
||||
// 查库
|
||||
for _, hid := range req.Hid {
|
||||
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.Addweight = make(map[int32]int32, 0)
|
||||
stone.Etime = utils.WeekIntervalTime(0)
|
||||
stone.Hero = make(map[string]*pb.BattleRole)
|
||||
this.Add(uid, stone)
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user