void SendUpdate(ArenaClient client) { if (client.IsConnected) { client.SendScriptMessage(packet, packet.Length, NetPriority.Low, NetReliability.Unreliable); } }
void SendToggleMessage(bool open) { var stream = ArenaClient.GetStream(msgID); stream.Write(open); ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); }
public static void SendTeamMessage(string message) { var stream = ArenaClient.GetScriptMessageStream(); stream.Write((byte)ScriptMessages.ChatTeamMessage); stream.Write(message); ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); }
void Spectate() { var stream = ArenaClient.GetScriptMessageStream(); stream.Write((byte)ScriptMessages.HordeSpectate); ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); Close(); }
static void SendGameInfo(ArenaClient client) { var stream = ArenaClient.GetScriptMessageStream(); stream.Write((byte)ScriptMessages.GameInfo); stream.Write((byte)client.ID); stream.Write((byte)ArenaClient.GetCount()); ArenaClient.ForEach(c => c.WritePlayerInfo(stream)); GameMode.WriteGameInfo(stream); client.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered); }
public static void JoinTeam(ArenaClient client, TOTeamInst team) { if (client.Team == team) { return; } if (team != null && (!IsRunning || Phase == TOPhases.None || Phase == TOPhases.Finish)) { return; } client.KillCharacter(); int index = teams.IndexOf(team); if (index >= 0) { // don't join a team which has already more players than the others //if (!teams.TrueForAll(t => team.Players.Count <= t.Players.Count - (t == client.Team ? 1 : 0))) // return; if (client.Team != null) { client.Team.Players.Remove(client); } client.Team = team; team.Players.Add(client); } else if (client.Team != null) { client.Team.Players.Remove(client); client.Team = null; } client.TOClass = null; var stream = ArenaClient.GetScriptMessageStream(); stream.Write((byte)ScriptMessages.TOJoinTeam); stream.Write((sbyte)index); client.SendScriptMessage(stream, NetPriority.Low, NetReliability.ReliableOrdered); SpawnCharacter(client); OnChangeTeamComposition?.Invoke(); }
public static void Toggle(ArenaClient client) { if (!clients.Remove(client)) { clients.Add(client); client.SendScriptMessage(GetData(), NetPriority.Low, NetReliability.Unreliable); if (clients.Count == 1) { TeamMode.OnChangeTeamComposition += WriteUpdate; } } else { if (clients.Count == 0) { TeamMode.OnChangeTeamComposition -= WriteUpdate; } } }
void SelectClass(int index) { if (HordeMode.Phase != HordePhase.WarmUp) { Sumpfkraut.Menus.ScreenScrollText.AddText("Dem Horde-Modus kann nur beim Start beigtreten werden.", GUCView.Fonts.Menu); Close(); return; } var classDef = HordeMode.ActiveDef.Classes.ElementAtOrDefault(index); if (classDef == null) { return; } if (classDef == ArenaClient.Client.HordeClass) { Close(); return; } if (!lockTimer.IsReady) { return; } var stream = ArenaClient.GetScriptMessageStream(); stream.Write((byte)ScriptMessages.HordeJoin); stream.Write((byte)index); ArenaClient.SendScriptMessage(stream, NetPriority.Low, NetReliability.Reliable); ArenaClient.Client.HordeClass = classDef; Close(); }