From c852f93d64b9e963e36458deabfb3742e4f7c45e Mon Sep 17 00:00:00 2001 From: liwei <2211068034@qq.com> Date: Fri, 28 Jul 2023 14:19:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=88=98=E6=96=97=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/academy/api_challenge.go | 5 +++-- modules/academy/api_teaching.go | 5 +++-- modules/arena/api_challenge.go | 5 +++-- modules/arena/api_plot.go | 5 +++-- modules/combat/api_challenge.go | 5 +++-- modules/enchant/api_challenge.go | 5 +++-- modules/guildgve/api_challenge.go | 1 + modules/hunting/api_challenge.go | 5 +++-- modules/mainline/api_challenge.go | 1 + modules/mline/api_challenge.go | 5 +++-- modules/moonfantasy/api_battle.go | 1 + modules/pagoda/api_challenge.go | 5 +++-- modules/pagoda/api_racechallenge.go | 5 +++-- modules/practice/api_npcbattkle.go | 5 +++-- modules/pvp/module.go | 25 +++++++++++++------------ modules/viking/api_challenge.go | 5 +++-- modules/worldtask/api_battlestart.go | 1 + modules/wtask/api_battlestart.go | 1 + 18 files changed, 54 insertions(+), 36 deletions(-) diff --git a/modules/academy/api_challenge.go b/modules/academy/api_challenge.go index 5a335b2b7..466155b28 100644 --- a/modules/academy/api_challenge.go +++ b/modules/academy/api_challenge.go @@ -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, diff --git a/modules/academy/api_teaching.go b/modules/academy/api_teaching.go index 1000b453b..f4cc2dd34 100644 --- a/modules/academy/api_teaching.go +++ b/modules/academy/api_teaching.go @@ -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, diff --git a/modules/arena/api_challenge.go b/modules/arena/api_challenge.go index 01585a46e..53766bd9e 100644 --- a/modules/arena/api_challenge.go +++ b/modules/arena/api_challenge.go @@ -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}, diff --git a/modules/arena/api_plot.go b/modules/arena/api_plot.go index 3e54cf776..81330d609 100644 --- a/modules/arena/api_plot.go +++ b/modules/arena/api_plot.go @@ -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]}, diff --git a/modules/combat/api_challenge.go b/modules/combat/api_challenge.go index b0c68b0a5..02e90c95e 100644 --- a/modules/combat/api_challenge.go +++ b/modules/combat/api_challenge.go @@ -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, diff --git a/modules/enchant/api_challenge.go b/modules/enchant/api_challenge.go index 0b8994287..0607f590c 100644 --- a/modules/enchant/api_challenge.go +++ b/modules/enchant/api_challenge.go @@ -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, diff --git a/modules/guildgve/api_challenge.go b/modules/guildgve/api_challenge.go index aa4e9c636..942c40389 100644 --- a/modules/guildgve/api_challenge.go +++ b/modules/guildgve/api_challenge.go @@ -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, diff --git a/modules/hunting/api_challenge.go b/modules/hunting/api_challenge.go index 6a5a90346..86cce3ce5 100644 --- a/modules/hunting/api_challenge.go +++ b/modules/hunting/api_challenge.go @@ -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, diff --git a/modules/mainline/api_challenge.go b/modules/mainline/api_challenge.go index 42d7820b2..2e97fbdcf 100644 --- a/modules/mainline/api_challenge.go +++ b/modules/mainline/api_challenge.go @@ -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, diff --git a/modules/mline/api_challenge.go b/modules/mline/api_challenge.go index b88a7fce2..3e0be6489 100644 --- a/modules/mline/api_challenge.go +++ b/modules/mline/api_challenge.go @@ -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, diff --git a/modules/moonfantasy/api_battle.go b/modules/moonfantasy/api_battle.go index db02620d8..cdfb5c04e 100644 --- a/modules/moonfantasy/api_battle.go +++ b/modules/moonfantasy/api_battle.go @@ -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, diff --git a/modules/pagoda/api_challenge.go b/modules/pagoda/api_challenge.go index abba8ed13..63672d91b 100644 --- a/modules/pagoda/api_challenge.go +++ b/modules/pagoda/api_challenge.go @@ -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, diff --git a/modules/pagoda/api_racechallenge.go b/modules/pagoda/api_racechallenge.go index 2905581e6..21a74e7fc 100644 --- a/modules/pagoda/api_racechallenge.go +++ b/modules/pagoda/api_racechallenge.go @@ -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, diff --git a/modules/practice/api_npcbattkle.go b/modules/practice/api_npcbattkle.go index b6d67cd9d..b9e2621e0 100644 --- a/modules/practice/api_npcbattkle.go +++ b/modules/practice/api_npcbattkle.go @@ -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, diff --git a/modules/pvp/module.go b/modules/pvp/module.go index 76ac97a49..403a274b1 100644 --- a/modules/pvp/module.go +++ b/modules/pvp/module.go @@ -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 diff --git a/modules/viking/api_challenge.go b/modules/viking/api_challenge.go index 938a19826..d9c335fb4 100644 --- a/modules/viking/api_challenge.go +++ b/modules/viking/api_challenge.go @@ -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, diff --git a/modules/worldtask/api_battlestart.go b/modules/worldtask/api_battlestart.go index 052ee021b..e13f80383 100644 --- a/modules/worldtask/api_battlestart.go +++ b/modules/worldtask/api_battlestart.go @@ -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, diff --git a/modules/wtask/api_battlestart.go b/modules/wtask/api_battlestart.go index aa3aa625f..8f2215668 100644 --- a/modules/wtask/api_battlestart.go +++ b/modules/wtask/api_battlestart.go @@ -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,