public static string Format(string message, Player p, bool tokens = true, bool emotes = true) { message = Colors.Escape(message); StringBuilder sb = new StringBuilder(message); Colors.Cleanup(sb, p.hasTextColors); if (tokens) { ChatTokens.Apply(sb, p); } if (!emotes) { return(sb.ToString()); } if (p.parseEmotes) { sb.Replace(":)", "(darksmile)"); sb.Replace(":D", "(smile)"); sb.Replace("<3", "(heart)"); } message = EmotesHandler.Replace(sb.ToString()); return(message); }
static void SpawnRaw(Player dst, byte id, Entity entity, Position pos, Orientation rot, string skin, string name, string model) { // NOTE: Fix for standard clients if (id == Entities.SelfID) { pos.Y -= 22; } name = Colors.Cleanup(name, dst.hasTextColors); if (dst.Supports(CpeExt.ExtPlayerList, 2)) { dst.Send(Packet.ExtAddEntity2(id, skin, name, pos, rot, dst.hasCP437, dst.hasExtPositions)); } else if (dst.hasExtList) { dst.Send(Packet.ExtAddEntity(id, skin, name, dst.hasCP437)); dst.Send(Packet.Teleport(id, pos, rot, dst.hasExtPositions)); } else { dst.Send(Packet.AddEntity(id, name, pos, rot, dst.hasCP437, dst.hasExtPositions)); } if (dst.hasChangeModel && !model.CaselessEq("humanoid")) { SendModel(dst, id, model); } if (dst.Supports(CpeExt.EntityProperty)) { dst.Send(Packet.EntityProperty(id, EntityProp.RotX, Orientation.PackedToDegrees(rot.RotX))); dst.Send(Packet.EntityProperty(id, EntityProp.RotZ, Orientation.PackedToDegrees(rot.RotZ))); SendModelScales(dst, id, entity); } }
/// <summary> Adds the given player to that player's tab list (if their client supports it). </summary> public static void Add(Player dst, Player p, byte id) { if (!dst.hasExtList) { return; } byte grpPerm = (byte)(offset - p.Rank); if (!ServerConfig.TablistRankSorted) { grpPerm = 0; } string name, group; GetEntry(p, dst, out name, out group); name = Colors.Cleanup(name, dst.hasTextColors); group = Colors.Cleanup(group, dst.hasTextColors); dst.Send(Packet.ExtAddPlayerName(id, p.truename, name, group, grpPerm, dst.hasCP437)); }