From 8273253828c10a0c9a1c32c6724b6c7188437930 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 30 Aug 2017 12:58:53 +1000 Subject: [PATCH] Remove FullCP437Handler emotes. Very rarely used and the only client that supports them, lets you type them in by pressing left alt anyways. --- MCGalaxy/Chat/Chat.cs | 1 - MCGalaxy/Chat/EmotesHandler.cs | 10 ++- MCGalaxy/Chat/FullCP437Handler.cs | 108 ------------------------- MCGalaxy/Commands/Fun/CmdTeam.cs | 14 ++-- MCGalaxy/MCGalaxy_.csproj | 1 - MCGalaxy/Network/IRCPlugin/IRCBot.cs | 1 - MCGalaxy/util/Extensions/StringExts.cs | 8 +- 7 files changed, 20 insertions(+), 123 deletions(-) delete mode 100644 MCGalaxy/Chat/FullCP437Handler.cs diff --git a/MCGalaxy/Chat/Chat.cs b/MCGalaxy/Chat/Chat.cs index 501f8f50a..7043b17ed 100644 --- a/MCGalaxy/Chat/Chat.cs +++ b/MCGalaxy/Chat/Chat.cs @@ -166,7 +166,6 @@ namespace MCGalaxy { sb.Replace("<3", "(heart)"); } message = EmotesHandler.Replace(sb.ToString()); - message = FullCP437Handler.Replace(message); return message; } diff --git a/MCGalaxy/Chat/EmotesHandler.cs b/MCGalaxy/Chat/EmotesHandler.cs index 0b494fec6..a78c048fd 100644 --- a/MCGalaxy/Chat/EmotesHandler.cs +++ b/MCGalaxy/Chat/EmotesHandler.cs @@ -39,7 +39,15 @@ namespace MCGalaxy { { "vv", '▼' }, { "down", '▼' }, { "house", '⌂' } }; - + + /// Conversion for code page 437 characters from index 0 to 31 to unicode. + public const string ControlCharReplacements = "\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼"; + + /// Conversion for code page 437 characters from index 127 to 255 to unicode. + public const string ExtendedCharReplacements = "⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»" + + "░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌" + + "█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\u00a0"; + public static string Replace(string message) { return Unescape(message, '(', ')', EmoteKeywords); } diff --git a/MCGalaxy/Chat/FullCP437Handler.cs b/MCGalaxy/Chat/FullCP437Handler.cs deleted file mode 100644 index 2075ef31b..000000000 --- a/MCGalaxy/Chat/FullCP437Handler.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace MCGalaxy -{ - public static class FullCP437Handler - { - public static readonly Dictionary Replacements = new Dictionary { - { "big-c-cedilla", 'Ç' }, - { "small-u-diaeresis", 'ü' }, - { "small-e-acute", 'é' }, - { "small-a-circumflex", 'â' }, - { "small-a-diaeresis", 'ä' }, - { "small-a-grave", 'à' }, - { "small-a-ring above", 'å' }, - { "small-c-cedilla", 'ç' }, - { "small-e-circumflex", 'ê' }, - { "small-e-diaeresis", 'ë' }, - { "small-e-grave", 'è' }, - { "small-i-diaeresis", 'ï' }, - { "small-i-circumflex", 'î' }, - { "small-i-grave", 'ì' }, - { "big-a-diaeresis", 'Ä' }, - { "big-a-ring above", 'Å' }, - { "big-e-acute", 'É' }, - { "small-ae", 'æ' }, - { "big-ae", 'Æ' }, - { "small-o-circumflex", 'ô' }, - { "small-o-diaeresis", 'ö' }, - { "small-o-grave", 'ò' }, - { "small-u-circumflex", 'û' }, - { "small-u-grave", 'ù' }, - { "small-y-diaeresis", 'ÿ' }, - { "big-o-diaeresis", 'Ö' }, - { "big-u-diaeresis", 'Ü' }, - { "cents", '¢' }, - { "pound", '£' }, - { "yen", '¥' }, - { "peseta", '₧' }, - { "small-f-hook", 'ƒ' }, - { "small-a-acute", 'á' }, - { "small-i-acute", 'í' }, - { "small-o-acute", 'ó' }, - { "small-u-acute", 'ú' }, - { "small-n-tilde", 'ñ' }, - { "big-n-tilde", 'Ñ' }, - { "feminine-ordinal-indicator", 'ª' }, - { "masculine-ordinal-indicator", 'º' }, - { "inverted-question", '¿' }, - { "reversed-not", '⌐' }, - { "not", '¬' }, - { "fraction-half", '½' }, - { "fraction-quarter", '¼' }, - { "inverted-exclamation", '¡' }, - { "left-pointing-quotation", '«' }, - { "right-pointing-quotation", '»' }, - { "square-light", '░' }, - { "square-medium", '▒' }, - { "square-dark", '▓' }, - - { "small-alpha", 'α' }, - { "big-double-s", 'ß' }, - { "big-gamma", 'Γ' }, - { "pi", 'π' }, - { "big-sigma", 'Σ' }, - { "small-sigma", 'σ' }, - { "micro", 'µ' }, - { "tau", 'τ' }, - { "big-phi", 'Φ' }, - { "theta", 'Θ' }, - { "omega", 'Ω' }, - { "delta", 'δ' }, - { "infinity", '∞' }, - { "small-phi", 'φ' }, - { "epsilon", 'ε' }, - { "intersect", '∩' }, - { "identical", '≡' }, - { "plus-minus", '±' }, - { "gequal", '≥' }, - { "lequal", '≤' }, - { "top-integral", '⌠' }, - { "bottom-integral", '⌡' }, - { "divide", '÷' }, - { "almost-equal", '≈' }, - { "degree", '°' }, - { "bullet-operator", '∙' }, - { "middle-dot", '·' }, - { "root", '√' }, - { "sqroot", '√' }, - { "superscript-n", 'ⁿ' }, - { "superscript-two", '²' }, - { "black-square", '■' }, - }; - - public static string Replace(string message) { - return EmotesHandler.Unescape(message, '{', '}', Replacements); - } - - /// Conversion for code page 437 characters from index 0 to 31 to unicode. - public const string ControlCharReplacements = "\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼"; - - /// Conversion for code page 437 characters from index 127 to 255 to unicode. - public const string ExtendedCharReplacements = "⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»" + - "░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌" + - "█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\u00a0"; - } -} diff --git a/MCGalaxy/Commands/Fun/CmdTeam.cs b/MCGalaxy/Commands/Fun/CmdTeam.cs index 4671870f7..931bd5b05 100644 --- a/MCGalaxy/Commands/Fun/CmdTeam.cs +++ b/MCGalaxy/Commands/Fun/CmdTeam.cs @@ -191,15 +191,15 @@ namespace MCGalaxy.Commands.Fun { } public override void Help(Player p) { - Player.Message(p, "%T/Team owner [name] %H-Sets the player who has owner privileges for the team."); - Player.Message(p, "%T/Team kick [name] %H-Removes that player from the team you are in."); - Player.Message(p, "%T/Team color [color] %H-Sets the color of the team name shown in chat."); + Player.Message(p, "%T/Team owner [name] %H- Sets the player who has owner privileges for the team."); + Player.Message(p, "%T/Team kick [name] %H- Removes that player from the team you are in."); + Player.Message(p, "%T/Team color [color] %H- Sets the color of the team name shown in chat."); Player.Message(p, "%T/Team create %H- Creates a new team."); - Player.Message(p, "%T/Team join %H-Joins the team you last received an invite to."); - Player.Message(p, "%T/Team invite [name] %H-Invites that player to join your team."); - Player.Message(p, "%T/Team leave %H-Removes you from the team you are in."); - Player.Message(p, "%T/Team members [name] %H-Lists the players within that team."); + Player.Message(p, "%T/Team join %H- Joins the team you last received an invite to."); + Player.Message(p, "%T/Team invite [name] %H- Invites that player to join your team."); + Player.Message(p, "%T/Team leave %H- Removes you from the team you are in."); + Player.Message(p, "%T/Team members [name] %H- Lists the players within that team."); Player.Message(p, "%HAnything else is sent as a message to all members of the team."); } } diff --git a/MCGalaxy/MCGalaxy_.csproj b/MCGalaxy/MCGalaxy_.csproj index a721afff6..00ed026ec 100644 --- a/MCGalaxy/MCGalaxy_.csproj +++ b/MCGalaxy/MCGalaxy_.csproj @@ -113,7 +113,6 @@ - diff --git a/MCGalaxy/Network/IRCPlugin/IRCBot.cs b/MCGalaxy/Network/IRCPlugin/IRCBot.cs index fd41a1270..8ff41520a 100644 --- a/MCGalaxy/Network/IRCPlugin/IRCBot.cs +++ b/MCGalaxy/Network/IRCPlugin/IRCBot.cs @@ -131,7 +131,6 @@ namespace MCGalaxy { if (String.IsNullOrEmpty(message.Trim())) message = "."; message = EmotesHandler.Replace(message); - message = FullCP437Handler.Replace(message); message = ChatTokens.ApplyCustom(message); if (color) diff --git a/MCGalaxy/util/Extensions/StringExts.cs b/MCGalaxy/util/Extensions/StringExts.cs index 2a6544e9d..3f1120d90 100644 --- a/MCGalaxy/util/Extensions/StringExts.cs +++ b/MCGalaxy/util/Extensions/StringExts.cs @@ -83,11 +83,11 @@ namespace MCGalaxy { /// Converts a code page 437 indice into unicode. public static char Cp437ToUnicode(this char c) { if (c < 0x20) { - return FullCP437Handler.ControlCharReplacements[c]; + return EmotesHandler.ControlCharReplacements[c]; } else if (c < 0x7F) { return c; } else if (c <= 0xFF) { - return FullCP437Handler.ExtendedCharReplacements[c - 0x7F]; + return EmotesHandler.ExtendedCharReplacements[c - 0x7F]; } return '?'; } @@ -97,9 +97,9 @@ namespace MCGalaxy { int cpIndex = 0; if (c >= ' ' && c <= '~') { return c; - } else if ((cpIndex = FullCP437Handler.ControlCharReplacements.IndexOf(c)) >= 0 ) { + } else if ((cpIndex = EmotesHandler.ControlCharReplacements.IndexOf(c)) >= 0 ) { return (char)cpIndex; - } else if ((cpIndex = FullCP437Handler.ExtendedCharReplacements.IndexOf(c)) >= 0 ) { + } else if ((cpIndex = EmotesHandler.ExtendedCharReplacements.IndexOf(c)) >= 0 ) { return (char)(cpIndex + 127); } return '?';