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