public static void SendTo(YiObj player, string message, MsgTextType action) { if (string.IsNullOrEmpty(message)) { return; } player.GetMessage(Constants.System, player.Name, message, action); }
public static void WriteLine(Player player, string to, string message, MsgTextType packetChannel) { if (!LogEntries.ContainsKey(player.Name)) { LogEntries.TryAdd(player.Name, new List <string>()); } LogEntries[player.Name].Add($"{DateTime.Now} | {player.Name.Size16()} -> {to.Size16()} {packetChannel.ToString().Size16()} -> {message}"); }
public static bool SendTo(string to, string message, MsgTextType type) { if (GameWorld.Find(to, out YiObj target)) { target.GetMessage(Constants.System, to, message, type); } return(target != null); }
public static void Broadcast(string from, string message, MsgTextType channel) { foreach (var value in GameWorld.Maps.Values) { foreach (var entity in value.Entities.Values.OfType <Player>()) { entity.GetMessage(from, entity.Name, message, channel); } } }
public static unsafe byte[] Create(string from, string to, string message, MsgTextType type) { from = from.Replace("\0", ""); to = to.Replace("\0", ""); message = message.Replace("\0", ""); // ReSharper disable once UseObjectOrCollectionInitializer var packet = new MsgText { Size = (ushort)(29 + from.Length + to.Length + message.Length), Id = 1004, StringCount = 4, Channel = type, SenderUniqueId = Environment.TickCount, Color = 0x00FF00FF, }; if (GameWorld.Find(to, out YiObj found)) { packet.Look1 = (int)found.Look; } if (GameWorld.Find(from, out YiObj found1)) { packet.Look2 = (int)found1.Look; } packet.Data[0] = (byte)from.Length; for (var i = 0; i < from.Length; i++) { packet.Data[1 + i] = (byte)from[i]; } packet.Data[1 + from.Length] = (byte)to.Length; for (var i = 0; i < to.Length; i++) { packet.Data[2 + from.Length + i] = (byte)to[i]; } packet.Data[2 + from.Length + to.Length] = 0; packet.Data[3 + from.Length + to.Length] = (byte)message.Length; for (var i = 0; i < message.Length; i++) { packet.Data[4 + from.Length + to.Length + i] = (byte)message[i]; } return(packet); }
public virtual void GetMessage(string @from, string to, string message, MsgTextType type) { }