上传战斗协议
This commit is contained in:
parent
8c8c670279
commit
c852f93d64
@ -6,13 +6,13 @@ import (
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
// 参数校验
|
||||
func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.AcademyChallengeReq) (errdata *pb.ErrorData) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
///挑战
|
||||
// /挑战
|
||||
func (this *apiComp) Challenge(session comm.IUserSession, req *pb.AcademyChallengeReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
level *cfg.GameTeachingData
|
||||
@ -30,6 +30,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.AcademyChallen
|
||||
return
|
||||
}
|
||||
if errdata, record = this.module.battle.CreateEveBattle(session, &pb.BattleEVEReq{
|
||||
Rulesid: level.Battleready,
|
||||
Ptype: pb.PlayType_academy,
|
||||
Format: nil,
|
||||
Sysformat: level.UsFormatList,
|
||||
|
@ -6,13 +6,13 @@ import (
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
// 参数校验
|
||||
func (this *apiComp) TeachingCheck(session comm.IUserSession, req *pb.AcademyTeachingReq) (errdata *pb.ErrorData) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
///挑战
|
||||
// /挑战
|
||||
func (this *apiComp) Teaching(session comm.IUserSession, req *pb.AcademyTeachingReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
level *cfg.GameHeroStrategyData
|
||||
@ -32,6 +32,7 @@ func (this *apiComp) Teaching(session comm.IUserSession, req *pb.AcademyTeaching
|
||||
return
|
||||
}
|
||||
if errdata, record = this.module.battle.CreateEveBattle(session, &pb.BattleEVEReq{
|
||||
Rulesid: level.Battleready,
|
||||
Ptype: pb.PlayType_heroteaching,
|
||||
Format: nil,
|
||||
Sysformat: level.UsFormatList,
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
// 参数校验
|
||||
func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.ArenaChallengeReq) (errdata *pb.ErrorData) {
|
||||
if (!req.Isai && req.Playerid == "") || (req.Isai && req.MformatId == 0) || req.Battle.Format == nil || len(req.Battle.Format) != 5 {
|
||||
errdata = &pb.ErrorData{
|
||||
@ -17,7 +17,7 @@ func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.ArenaChal
|
||||
return
|
||||
}
|
||||
|
||||
///挑战
|
||||
// /挑战
|
||||
func (this *apiComp) Challenge(session comm.IUserSession, req *pb.ArenaChallengeReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
red *pb.DBArenaUser
|
||||
@ -116,6 +116,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.ArenaChallenge
|
||||
return
|
||||
}
|
||||
if errdata, record = this.module.battle.CreatePvpBattle(session, &pb.BattlePVPReq{
|
||||
Rulesid: 105,
|
||||
Ptype: pb.PlayType_arena,
|
||||
Redformat: &pb.PVPFormation{Uid: red.Uid, Leadpos: red.Attack.Leadpos, Format: red.Attack.Formt},
|
||||
Buleformat: &pb.PVPFormation{Uid: bule.Uid, Leadpos: bule.Defend.Leadpos, Format: bule.Defend.Formt},
|
||||
|
@ -8,13 +8,13 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
// 参数校验
|
||||
func (this *apiComp) PlotCheck(session comm.IUserSession, req *pb.ArenaPlotReq) (errdata *pb.ErrorData) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
///获取自己的排行榜信息
|
||||
// /获取自己的排行榜信息
|
||||
func (this *apiComp) Plot(session comm.IUserSession, req *pb.ArenaPlotReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
npc *cfg.GameArenaChallengeNpcData
|
||||
@ -59,6 +59,7 @@ func (this *apiComp) Plot(session comm.IUserSession, req *pb.ArenaPlotReq) (errd
|
||||
index = ndata.Index
|
||||
}
|
||||
if errdata, record = this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Rulesid: npc.BattleReadyID,
|
||||
Ptype: pb.PlayType_arena,
|
||||
Format: req.Battle,
|
||||
Mformat: []int32{npc.MonsterformatId[index]},
|
||||
|
@ -6,13 +6,13 @@ import (
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
// 参数校验
|
||||
func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.CombatChallengeReq) (errdata *pb.ErrorData) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
///挑战
|
||||
// /挑战
|
||||
func (this *apiComp) Challenge(session comm.IUserSession, req *pb.CombatChallengeReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
manster *cfg.GameCombatMansterData
|
||||
@ -32,6 +32,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.CombatChalleng
|
||||
return
|
||||
}
|
||||
if errdata, record = this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Rulesid: manster.BattleReadyID,
|
||||
Ptype: pb.PlayType_combat,
|
||||
Format: req.Battle,
|
||||
Mformat: manster.FormatList,
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
// 参数校验
|
||||
func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.EnchantChallengeReq) (errdata *pb.ErrorData) {
|
||||
if req.BossType <= 0 || req.Battle == nil {
|
||||
errdata = &pb.ErrorData{
|
||||
@ -18,7 +18,7 @@ func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.EnchantCh
|
||||
return
|
||||
}
|
||||
|
||||
///挑战主线关卡
|
||||
// /挑战主线关卡
|
||||
func (this *apiComp) Challenge(session comm.IUserSession, req *pb.EnchantChallengeReq) (errdata *pb.ErrorData) {
|
||||
|
||||
errdata = this.ChallengeCheck(session, req)
|
||||
@ -70,6 +70,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.EnchantChallen
|
||||
}
|
||||
}
|
||||
errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Rulesid: battleconf.BattleReadyID,
|
||||
Ptype: pb.PlayType_enchant,
|
||||
Title: "",
|
||||
Format: req.Battle,
|
||||
|
@ -69,6 +69,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.GuildGveChalle
|
||||
// }
|
||||
|
||||
if errdata, record = this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Rulesid: conf.BattleReadyID,
|
||||
Ptype: pb.PlayType_moonfantasy,
|
||||
Format: req.Battle,
|
||||
Mformat: conf.Boss,
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
// 参数校验
|
||||
func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.HuntingChallengeReq) (errdata *pb.ErrorData) {
|
||||
if req.BossType <= 0 && req.Difficulty > 0 || req.Battle == nil {
|
||||
errdata = &pb.ErrorData{
|
||||
@ -19,7 +19,7 @@ func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.HuntingCh
|
||||
return
|
||||
}
|
||||
|
||||
///挑战主线关卡
|
||||
// /挑战主线关卡
|
||||
func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallengeReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
ps int32
|
||||
@ -101,6 +101,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
|
||||
}
|
||||
|
||||
errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Rulesid: cfgData.BattleReadyID,
|
||||
Ptype: pb.PlayType_hunting,
|
||||
Title: "",
|
||||
Format: req.Battle,
|
||||
|
@ -78,6 +78,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MainlineChalle
|
||||
}
|
||||
|
||||
errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Rulesid: conf.BattleReadyID,
|
||||
Ptype: pb.PlayType_mainline,
|
||||
Title: "",
|
||||
Format: req.Battle,
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
// 参数校验
|
||||
func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.MlineChallengeReq) (errdata *pb.ErrorData) {
|
||||
if req.StageId == 0 {
|
||||
errdata = &pb.ErrorData{
|
||||
@ -19,7 +19,7 @@ func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.MlineChal
|
||||
return
|
||||
}
|
||||
|
||||
///挑战主线关卡
|
||||
// /挑战主线关卡
|
||||
func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallengeReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
curChapter *pb.DBMline // 当前章节信息
|
||||
@ -118,6 +118,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.MlineChallenge
|
||||
}
|
||||
}
|
||||
errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Rulesid: stageConf.BattleReadyID,
|
||||
Ptype: pb.PlayType_mainline,
|
||||
Title: "",
|
||||
Format: req.Battle,
|
||||
|
@ -107,6 +107,7 @@ func (this *apiComp) Battle(session comm.IUserSession, req *pb.MoonfantasyBattle
|
||||
}
|
||||
|
||||
if errdata, record = this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Rulesid: boss.BattleReadyID,
|
||||
Ptype: pb.PlayType_moonfantasy,
|
||||
Format: req.Battle,
|
||||
Mformat: boss.Monsterformatid,
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
// 参数校验
|
||||
func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.PagodaChallengeReq) (errdata *pb.ErrorData) {
|
||||
if req.Cid <= 0 {
|
||||
errdata = &pb.ErrorData{
|
||||
@ -17,7 +17,7 @@ func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.PagodaCha
|
||||
return
|
||||
}
|
||||
|
||||
///挑战主线关卡
|
||||
// /挑战主线关卡
|
||||
func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChallengeReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
pagoda *pb.DBPagoda
|
||||
@ -77,6 +77,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChalleng
|
||||
}
|
||||
}
|
||||
errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Rulesid: conf.BattleReadyID,
|
||||
Ptype: pb.PlayType_pagoda,
|
||||
Title: "",
|
||||
Format: req.Battle,
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"go_dreamfactory/sys/configure"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
// 参数校验
|
||||
func (this *apiComp) ChallengeRaceCheck(session comm.IUserSession, req *pb.PagodaChallengeRaceReq) (errdata *pb.ErrorData) {
|
||||
if req.Cid <= 0 {
|
||||
errdata = &pb.ErrorData{
|
||||
@ -18,7 +18,7 @@ func (this *apiComp) ChallengeRaceCheck(session comm.IUserSession, req *pb.Pagod
|
||||
return
|
||||
}
|
||||
|
||||
///阵营塔开始挑战
|
||||
// /阵营塔开始挑战
|
||||
func (this *apiComp) ChallengeRace(session comm.IUserSession, req *pb.PagodaChallengeRaceReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
pagoda *pb.DBPagodaRace
|
||||
@ -114,6 +114,7 @@ func (this *apiComp) ChallengeRace(session comm.IUserSession, req *pb.PagodaChal
|
||||
pType = pb.PlayType_race
|
||||
}
|
||||
errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Rulesid: conf.BattlereadyID,
|
||||
Ptype: pType,
|
||||
Title: "",
|
||||
Format: req.Battle,
|
||||
|
@ -5,13 +5,13 @@ import (
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
// 参数校验
|
||||
func (this *apiComp) NPCBattkleCheck(session comm.IUserSession, req *pb.PracticeNPCBattkleReq) (errdata *pb.ErrorData) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
///npc 战斗请求
|
||||
// /npc 战斗请求
|
||||
func (this *apiComp) NPCBattkle(session comm.IUserSession, req *pb.PracticeNPCBattkleReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
err error
|
||||
@ -28,6 +28,7 @@ func (this *apiComp) NPCBattkle(session comm.IUserSession, req *pb.PracticeNPCBa
|
||||
}
|
||||
|
||||
if errdata, record = this.module.battle.CreateLPVEBattle(session, &pb.BattleLPVEReq{
|
||||
Rulesid: 111,
|
||||
Ptype: pb.PlayType_practicenpc,
|
||||
Format: req.Formation,
|
||||
Monsterleadpos: room.Captain,
|
||||
|
@ -39,12 +39,12 @@ type Pvp struct {
|
||||
battles map[string]*BattleItem
|
||||
}
|
||||
|
||||
//模块名
|
||||
// 模块名
|
||||
func (this *Pvp) GetType() core.M_Modules {
|
||||
return comm.ModulePvp
|
||||
}
|
||||
|
||||
//模块初始化接口 注册用户创建角色事件
|
||||
// 模块初始化接口 注册用户创建角色事件
|
||||
func (this *Pvp) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
this.battles = make(map[string]*BattleItem)
|
||||
err = this.ModuleBase.Init(service, module, options)
|
||||
@ -68,7 +68,7 @@ func (this *Pvp) Start() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
//装备组件
|
||||
// 装备组件
|
||||
func (this *Pvp) OnInstallComp() {
|
||||
this.ModuleBase.OnInstallComp()
|
||||
this.apicomp = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||
@ -80,7 +80,7 @@ func (this *Pvp) QueryBattle(id string) (battle *pb.DBPvpBattle, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
//创建Pvp
|
||||
// 创建Pvp
|
||||
func (this *Pvp) CreatePvp(red, blue *pb.PvpUserInfo, ptype pb.PvpType) (battleId string, errdata *pb.ErrorData) {
|
||||
this.Debug("CreatePvp", log.Field{Key: "ptype", Value: ptype.String()}, log.Field{Key: "red", Value: red.String()}, log.Field{Key: "blue", Value: blue.String()})
|
||||
var (
|
||||
@ -132,7 +132,7 @@ func (this *Pvp) CreatePvp(red, blue *pb.PvpUserInfo, ptype pb.PvpType) (battleI
|
||||
return
|
||||
}
|
||||
|
||||
//推送战斗输出指令
|
||||
// 推送战斗输出指令
|
||||
func (this *Pvp) PvpOutCmdPush(out *pb.PvpOutCmdPush) {
|
||||
this.Debug("PvpOutCmdPush", log.Field{Key: "args", Value: out})
|
||||
var (
|
||||
@ -195,7 +195,7 @@ func (this *Pvp) PvpOutCmdPush(out *pb.PvpOutCmdPush) {
|
||||
}
|
||||
}
|
||||
|
||||
//推送战斗结束
|
||||
// 推送战斗结束
|
||||
func (this *Pvp) PvpFinishPush(out *pb.BattleFinishPush) {
|
||||
var (
|
||||
battle *BattleItem
|
||||
@ -225,7 +225,7 @@ func (this *Pvp) PvpFinishPush(out *pb.BattleFinishPush) {
|
||||
}
|
||||
}
|
||||
|
||||
//准备超时 取消战斗
|
||||
// 准备超时 取消战斗
|
||||
func (this *Pvp) readyTimeOut(task *timewheel.Task, args ...interface{}) {
|
||||
this.Debug("readyTimeOut", log.Field{Key: "args", Value: args})
|
||||
var (
|
||||
@ -268,7 +268,7 @@ func (this *Pvp) readyTimeOut(task *timewheel.Task, args ...interface{}) {
|
||||
}
|
||||
}
|
||||
|
||||
//操作倒计时
|
||||
// 操作倒计时
|
||||
func (this *Pvp) operateTimeOut(task *timewheel.Task, args ...interface{}) {
|
||||
this.Debug("operateTimeOut", log.Field{Key: "args", Value: args})
|
||||
var (
|
||||
@ -299,7 +299,7 @@ func (this *Pvp) operateTimeOut(task *timewheel.Task, args ...interface{}) {
|
||||
}
|
||||
}
|
||||
|
||||
//开始战斗
|
||||
// 开始战斗
|
||||
func (this *Pvp) startBattle(battle *BattleItem) {
|
||||
this.Debug("PVPStart", log.Field{Key: "battleId", Value: battle.Id})
|
||||
var (
|
||||
@ -309,6 +309,7 @@ func (this *Pvp) startBattle(battle *BattleItem) {
|
||||
err error
|
||||
)
|
||||
if errdata, record = this.battle.CreateRtPvpBattle(&pb.BattleRTPVPReq{
|
||||
Rulesid: 111,
|
||||
Ptype: pb.PlayType_friendsmeet,
|
||||
Title: "",
|
||||
RedCompId: battle.Red.Uid,
|
||||
@ -368,7 +369,7 @@ func (this *Pvp) startBattle(battle *BattleItem) {
|
||||
}
|
||||
}
|
||||
|
||||
//用户离线处理 弃用
|
||||
// 用户离线处理 弃用
|
||||
func (this *Pvp) userlogin(session comm.IUserSession) {
|
||||
// var (
|
||||
// result []*pb.DBPvpBattle
|
||||
@ -407,7 +408,7 @@ func (this *Pvp) userlogin(session comm.IUserSession) {
|
||||
// this.Debug("GetPvpInfo", log.Field{Key: "uid", Value: session.GetSessionId()}, log.Field{Key: "list", Value: push.String()})
|
||||
}
|
||||
|
||||
//用户离线处理
|
||||
// 用户离线处理
|
||||
func (this *Pvp) useroffline(uid, sessionid string) {
|
||||
var (
|
||||
result []*pb.DBPvpBattle
|
||||
@ -448,7 +449,7 @@ func (this *Pvp) useroffline(uid, sessionid string) {
|
||||
|
||||
}
|
||||
|
||||
//托管
|
||||
// 托管
|
||||
func (this *Pvp) trusteeship(ctx context.Context, req *pb.RPC_PVPTrusteeshipReq, resp *pb.RPC_PVPTrusteeshipResp) (err error) {
|
||||
var (
|
||||
battle *BattleItem
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
// 参数校验
|
||||
func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.VikingChallengeReq) (errdata *pb.ErrorData) {
|
||||
if req.BossId <= 0 && req.Difficulty > 0 || req.Battle == nil {
|
||||
errdata = &pb.ErrorData{
|
||||
@ -18,7 +18,7 @@ func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.VikingCha
|
||||
return
|
||||
}
|
||||
|
||||
///挑战主线关卡
|
||||
// /挑战主线关卡
|
||||
func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChallengeReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
ps int32
|
||||
@ -97,6 +97,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChalleng
|
||||
}
|
||||
|
||||
errdata, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Rulesid: cfgData.BattleReadyID,
|
||||
Ptype: pb.PlayType_viking,
|
||||
Title: "",
|
||||
Format: req.Battle,
|
||||
|
@ -53,6 +53,7 @@ func (this *apiComp) Battlestart(session comm.IUserSession, req *pb.WorldtaskBat
|
||||
record *pb.DBBattleRecord
|
||||
)
|
||||
errdata, record = b.CreateEveBattle(session, &pb.BattleEVEReq{
|
||||
Rulesid: battleConf.BattleReadyID,
|
||||
Ptype: pb.PlayType_rtask,
|
||||
Format: req.Battle,
|
||||
Buleformat: battleConf.FormatList,
|
||||
|
@ -41,6 +41,7 @@ func (this *apiComp) BattleStart(session comm.IUserSession, req *pb.WTaskBattleS
|
||||
}
|
||||
|
||||
if errdata, record = this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
|
||||
Rulesid: battleConf.BattleReadyID,
|
||||
Ptype: pb.PlayType_moonfantasy,
|
||||
Format: req.Battle,
|
||||
Mformat: battleConf.FormatList,
|
||||
|
Loading…
Reference in New Issue
Block a user