public void SendClient(Player player, IgorrMessage message) { if (!message.Encoded) { Console.WriteLine("WARNING: Message not encoded: " + message.MessageType.ToString()); message.Encode(); } foreach (Client client in _clients.Values) if (client.PlayerID == player.ID) connection.SendMessage(message.GetMessage(), client.Connection, NetDeliveryMethod.ReliableOrdered,currentChannel); }
public void SendAllMapReliable(IMap map, IgorrMessage message, bool ordered) { List<NetConnection> recipients = new List<NetConnection>(); recipients.AddRange(_connections); for (int x = 0; x < recipients.Count; x++) { if (_clients[_clientids[recipients[x].RemoteUniqueIdentifier]].CurrentMap != map) { recipients.RemoveAt(x); x--; } } if (!message.Encoded) { Console.WriteLine("WARNING: Message not encoded: " + message.MessageType.ToString()); message.Encode(); } if (recipients.Count > 0) { if (ordered) connection.SendMessage(message.GetMessage(), recipients, NetDeliveryMethod.ReliableOrdered, currentChannel); else connection.SendMessage(message.GetMessage(), recipients, NetDeliveryMethod.ReliableUnordered, currentChannel); } }
public static void SendReliable(IgorrMessage m) { if (!_enabled) return; m.Encode(); if (connection.ServerConnection != null) connection.SendMessage(m.GetMessage(), NetDeliveryMethod.ReliableOrdered); }
public void SendAllExcept(IMap map, Player player, IgorrMessage message, bool Reliable) { Client client = getClient(player); if (_connections.Count > 1) { List<NetConnection> recipients = new List<NetConnection>(); recipients.AddRange(_connections); if (client != null) recipients.Remove(client.Connection); for (int x = 0; x < recipients.Count; x++) { if (_clients[_clientids[recipients[x].RemoteUniqueIdentifier]].CurrentMap != map) { recipients.RemoveAt(x); x--; } } if (!message.Encoded) { Console.WriteLine("WARNING: Message not encoded: " + message.MessageType.ToString()); message.Encode(); } if (recipients.Count > 0 && Reliable) connection.SendMessage(message.GetMessage(), recipients, NetDeliveryMethod.ReliableOrdered, currentChannel); else if (recipients.Count > 0 && !Reliable && !_enableSend) connection.SendMessage(message.GetMessage(), recipients, NetDeliveryMethod.Unreliable, currentChannel); } }
public static void Send(IgorrMessage message, bool Sequenced) { if (!_enabled) return; message.Encode(); if (connection.ServerConnection != null) if (!Sequenced) connection.SendMessage(message.GetMessage(), NetDeliveryMethod.Unreliable); else connection.SendMessage(message.GetMessage(), NetDeliveryMethod.UnreliableSequenced); //ProtocolHelper.Send(message, connection.ServerConnection); }