public static void DuelWin(ArenaClient winner) { if (!winner.IsDueling) { return; } var stream = ArenaClient.GetStream(ScriptMessages.DuelWin); stream.Write((ushort)winner.Character.ID); winner.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered); if (winner.DuelEnemy.IsConnected) { winner.DuelEnemy.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered); } winner.DuelEnemy.DuelDeaths++; winner.DuelEnemy.DuelScore--; winner.DuelKills++; winner.DuelScore += 2; winner.DuelEnemy.DuelEnemy = null; winner.DuelEnemy = null; }
void SelectTeam(int index) { if (!TDMMode.IsActive) { return; } var teams = TDMMode.ActiveMode.Scenario.Teams; if (index < 0 || index >= teams.Length) { return; } if ((int)PlayerInfo.HeroInfo.TeamID == index) { MenuClassSelect.Instance.Open(); Close(); return; } if (!lockTimer.IsReady) { return; } var stream = ArenaClient.GetStream(ScriptMessages.TDMTeamSelect); stream.Write((byte)index); ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); }
void SelectClass(int index) { if (!HordeMode.IsActive || PlayerInfo.HeroInfo.TeamID < TeamIdent.GMSpectator || GameMode.ActiveMode.Phase == GamePhase.FadeOut) { Close(); return; } if (!HordeMode.ActiveMode.Scenario.PlayerClasses.TryGet(index, out NPCClass classDef)) { return; } if (classDef == NPCClass.Hero) { Close(); return; } if (!lockTimer.IsReady) { return; } var stream = ArenaClient.GetStream(ScriptMessages.ModeClassSelect); stream.Write((byte)index); ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); NPCClass.Hero = classDef; Close(); }
void Spectate() { var stream = ArenaClient.GetScriptMessageStream(); stream.Write((byte)ScriptMessages.SpectateTeam); ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); Close(); }
void Spectate() { if (PlayerInfo.HeroInfo.TeamID != TeamIdent.GMSpectator) { var stream = ArenaClient.GetStream(ScriptMessages.ModeSpectate); ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered); } Close(); }
void Join() { if (PlayerInfo.HeroInfo.TeamID < TeamIdent.GMPlayer) { var stream = ArenaClient.GetStream(ScriptMessages.BRJoin); ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); } Close(); }
static void SendRequest(ArenaClient requester, ArenaClient target) { var stream = ArenaClient.GetScriptMessageStream(); stream.Write((byte)ScriptMessages.DuelRequest); stream.Write((ushort)requester.Character.ID); stream.Write((ushort)target.Character.ID); requester.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); target.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); }
public override void Close() { base.Close(); arrow.Hide(); var stream = ArenaClient.GetScriptMessageStream(); stream.Write((byte)ScriptMessages.TOTeamCount); ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); TeamMode.OnPhaseChange -= TOPhaseChanged; }
void GameModeStart() { if (ArenaClient.GMJoined) { GameMode.ActiveMode.OpenJoinMenu(); return; } var stream = ArenaClient.GetStream(ScriptMessages.ModeSpectate); ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered); Close(); }
public static void SendRequest(NPCInst target) { if (!requestTime.IsReady) { return; } var stream = ArenaClient.GetScriptMessageStream(); stream.Write((byte)ScriptMessages.DuelRequest); stream.Write((ushort)target.ID); ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Unreliable); }
static void DuelEnd(ArenaClient client) { if (!client.IsDueling) { return; } var stream = ArenaClient.GetScriptMessageStream(); stream.Write((byte)ScriptMessages.DuelEnd); client.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered); client.DuelEnemy.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered); client.DuelEnemy.DuelEnemy = null; client.DuelEnemy = null; }
static void DuelStart(ArenaClient player1, ArenaClient player2) { player1.DuelEnemy = player2; player2.DuelEnemy = player1; var stream = ArenaClient.GetScriptMessageStream(); stream.Write((byte)ScriptMessages.DuelStart); stream.Write((ushort)player2.Character.ID); player1.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered); stream = ArenaClient.GetScriptMessageStream(); stream.Write((byte)ScriptMessages.DuelStart); stream.Write((ushort)player1.Character.ID); player2.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered); }
public override void Open() { if (!TeamMode.IsRunning) { return; } base.Open(); SetTexts(); tdmName.Text = TeamMode.ActiveTODef.Name.ToUpper(); var stream = ArenaClient.GetScriptMessageStream(); stream.Write((byte)ScriptMessages.TOTeamCount); ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); TeamMode.OnPhaseChange += TOPhaseChanged; }
void SelectClass(int index) { if (TeamMode.TeamDef == null || TeamMode.Phase == TOPhases.None || TeamMode.Phase == TOPhases.Finish) { Sumpfkraut.Menus.ScreenScrollText.AddText("TeamObjective ist vorüber.", GUCView.Fonts.Menu); Close(); return; } var classDef = TeamMode.TeamDef.ClassDefs.ElementAtOrDefault(index); if (classDef == null) { return; } if (classDef == ArenaClient.Client.TOClass) { Close(); return; } if (!lockTimer.IsReady) { return; } var stream = ArenaClient.GetScriptMessageStream(); stream.Write((byte)ScriptMessages.TOSelectClass); stream.Write((byte)index); ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); ArenaClient.Client.TOClass = classDef; Close(); }
void SelectTeam(int index) { if (!TeamMode.IsRunning || TeamMode.Phase == TOPhases.Finish || TeamMode.Phase == TOPhases.None) { if (TeamMode.TeamDef == null) { Sumpfkraut.Menus.ScreenScrollText.AddText("TeamObjective ist vorüber.", GUCView.Fonts.Menu); } Close(); return; } var team = TeamMode.ActiveTODef.Teams.ElementAtOrDefault(index); if (team == null) { return; } if (team == TeamMode.TeamDef) { TOClassMenu.Menu.Open(); Close(); return; } if (!lockTimer.IsReady) { return; } var stream = ArenaClient.GetScriptMessageStream(); stream.Write((byte)ScriptMessages.TOJoinTeam); stream.Write((byte)index); ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); }