You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
3.1 KiB
89 lines
3.1 KiB
using ProtoCSStruct;
|
|
using Sog;
|
|
|
|
namespace Game
|
|
{
|
|
public static class ChapterTest
|
|
{
|
|
public static void TestImport(PlayerOnGame player, int chapterId, int battleId)
|
|
{
|
|
{
|
|
var packet = new StructPacket();
|
|
packet.Header.Type = (int)CSGameMsgID.BattleBeginReq;
|
|
var parser = new StructMessageParser<OnBattleBeginReq>();
|
|
packet.Parser = parser;
|
|
ref var req = ref packet.GetMessage<OnBattleBeginReq>();
|
|
req.ChapterId = chapterId;
|
|
req.BattleId = battleId;
|
|
req.IsGm = true;
|
|
ChapterSvc.OnBattleBegin(player, packet);
|
|
}
|
|
|
|
{
|
|
OnBattleOption(player, ChapterOption.ActiveMonster);
|
|
}
|
|
}
|
|
|
|
private static int _seq = 0;
|
|
|
|
public static void OnAllKillMonsters(PlayerOnGame player)
|
|
{
|
|
var stages = player.RoleData.BattleRecord.StageInfo;
|
|
var stageId = player.RoleData.BattleRecord.MonsterStageId;
|
|
|
|
var index = -1;
|
|
for (int i = 0; i < stages.Count; i++)
|
|
{
|
|
if (stages[i].StageId == stageId)
|
|
{
|
|
index = i;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (index >= 0)
|
|
{
|
|
var stage = stages[index];
|
|
var monsters = stage.MonsterInfo;
|
|
for (int i = 0; i < monsters.Count; i++)
|
|
{
|
|
for (int j = 0; j < monsters[i].Value; j++)
|
|
{
|
|
var packet = new StructPacket();
|
|
packet.Header.Type = (int)CSGameMsgID.KilledMonsterReq;
|
|
var parser = new StructMessageParser<OnKilledMonsterReq>();
|
|
packet.Parser = parser;
|
|
ref var req = ref packet.GetMessage<OnKilledMonsterReq>();
|
|
req.StageId = stageId;
|
|
req.Seq = _seq++;
|
|
req.MonsterId = monsters[i].Id;
|
|
ChapterSvc.OnKilledMonsterReq(player, packet);
|
|
}
|
|
}
|
|
|
|
}
|
|
var stageDesc = ChapterBattleStageDescMgr.Instance.GetConfig(stageId);
|
|
if (stageDesc.stageType == ChapterBattleStageType.Boss)
|
|
{
|
|
OnBattleOption(player, ChapterOption.EndBattle);
|
|
return;
|
|
}
|
|
OnBattleOption(player, ChapterOption.ActiveMonster);
|
|
}
|
|
|
|
private static void OnBattleOption(PlayerOnGame player, ChapterOption option)
|
|
{
|
|
var packet = new StructPacket();
|
|
packet.Header.Type = (int)CSGameMsgID.BattleOptionReq;
|
|
var parser = new StructMessageParser<OnBattleOptionReq>();
|
|
packet.Parser = parser;
|
|
ref var req = ref packet.GetMessage<OnBattleOptionReq>();
|
|
req.Option = option;
|
|
ChapterSvc.OnBattleOption(player, packet);
|
|
if (option == ChapterOption.ActiveMonster)
|
|
{
|
|
OnAllKillMonsters(player);
|
|
}
|
|
}
|
|
}
|
|
}
|