mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-17 03:10:39 -04:00
Merge pull request #36 from Venom983/master
Added all Emotes back and added "weather" to Env's help
This commit is contained in:
commit
f53e9e8a5a
@ -50,7 +50,7 @@ namespace MCGalaxy.Commands
|
||||
{
|
||||
p.SendMessage("/env [target] [variable] [value]");
|
||||
p.SendMessage("Valid targets: player, level [Abbreviated as p and l]");
|
||||
p.SendMessage("Valid variables: fog, cloud, sky, sun, shadow, level, horizon, border");
|
||||
p.SendMessage("Valid variables: fog, cloud, sky, sun, shadow, level, horizon, border, weather");
|
||||
p.SendMessage("Using 'normal' as a value will reset the variable");
|
||||
|
||||
}
|
||||
|
171
Player/Player.cs
171
Player/Player.cs
@ -37,6 +37,165 @@ namespace MCGalaxy {
|
||||
/// Value - IP
|
||||
/// All players who have left this restart.
|
||||
/// </summary>
|
||||
public Dictionary<string, object> ExtraData = new Dictionary<string, object>();
|
||||
private static readonly char[] UnicodeReplacements = " ☺☻♥♦♣♠•◘○\n♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼".ToCharArray();
|
||||
public static readonly Dictionary<string, char> EmoteKeywords = new Dictionary<string, char> {
|
||||
{ "darksmile", '\u0001' },
|
||||
|
||||
{ "smile", '\u0002' }, // ☻
|
||||
|
||||
{ "heart", '\u0003' }, // ♥
|
||||
{ "hearts", '\u0003' },
|
||||
|
||||
{ "diamond", '\u0004' }, // ♦
|
||||
{ "diamonds", '\u0004' },
|
||||
{ "rhombus", '\u0004' },
|
||||
|
||||
{ "club", '\u0005' }, // ♣
|
||||
{ "clubs", '\u0005' },
|
||||
{ "clover", '\u0005' },
|
||||
{ "shamrock", '\u0005' },
|
||||
|
||||
{ "spade", '\u0006' }, // ♠
|
||||
{ "spades", '\u0006' },
|
||||
|
||||
{ "*", '\u0007' }, // •
|
||||
{ "bullet", '\u0007' },
|
||||
{ "dot", '\u0007' },
|
||||
{ "point", '\u0007' },
|
||||
|
||||
{ "hole", '\u0008' }, // ◘
|
||||
|
||||
{ "circle", '\u0009' }, // ○
|
||||
{ "o", '\u0009' },
|
||||
|
||||
{ "male", '\u000B' }, // ♂
|
||||
{ "mars", '\u000B' },
|
||||
|
||||
{ "female", '\u000C' }, // ♀
|
||||
{ "venus", '\u000C' },
|
||||
|
||||
{ "8", '\u000D' }, // ♪
|
||||
{ "note", '\u000D' },
|
||||
{ "quaver", '\u000D' },
|
||||
|
||||
{ "notes", '\u000E' }, // ♫
|
||||
{ "music", '\u000E' },
|
||||
|
||||
{ "sun", '\u000F' }, // ☼
|
||||
{ "celestia", '\u000F' },
|
||||
|
||||
{ ">>", '\u0010' }, // ►
|
||||
{ "right", '\u0010' },
|
||||
|
||||
{ "<<", '\u0011' }, // ◄
|
||||
{ "left", '\u0011' },
|
||||
|
||||
{ "updown", '\u0012' }, // ↕
|
||||
{ "^v", '\u0012' },
|
||||
|
||||
{ "!!", '\u0013' }, // ‼
|
||||
|
||||
{ "p", '\u0014' }, // ¶
|
||||
{ "para", '\u0014' },
|
||||
{ "pilcrow", '\u0014' },
|
||||
{ "paragraph", '\u0014' },
|
||||
|
||||
{ "s", '\u0015' }, // §
|
||||
{ "sect", '\u0015' },
|
||||
{ "section", '\u0015' },
|
||||
|
||||
{ "-", '\u0016' }, // ▬
|
||||
{ "_", '\u0016' },
|
||||
{ "bar", '\u0016' },
|
||||
{ "half", '\u0016' },
|
||||
|
||||
{ "updown2", '\u0017' }, // ↨
|
||||
{ "^v_", '\u0017' },
|
||||
|
||||
{ "^", '\u0018' }, // ↑
|
||||
{ "uparrow", '\u0018' },
|
||||
|
||||
{ "v", '\u0019' }, // ↓
|
||||
{ "downarrow", '\u0019' },
|
||||
|
||||
{ "->", '\u001A' }, // →
|
||||
{ "rightarrow", '\u001A' },
|
||||
|
||||
{ "<-", '\u001B' }, // ←
|
||||
{ "leftarrow", '\u001B' },
|
||||
|
||||
{ "l", '\u001C' }, // ∟
|
||||
{ "angle", '\u001C' },
|
||||
{ "corner", '\u001C' },
|
||||
|
||||
{ "<>", '\u001D' }, // ↔
|
||||
{ "<->", '\u001D' },
|
||||
{ "leftright", '\u001D' },
|
||||
|
||||
{ "^^", '\u001E' }, // ▲
|
||||
{ "up", '\u001E' },
|
||||
|
||||
{ "vv", '\u001F' }, // ▼
|
||||
{ "down", '\u001F' },
|
||||
|
||||
{ "house", '\u007F' } // ⌂
|
||||
};
|
||||
public static string ReplaceEmoteKeywords(string message)
|
||||
{
|
||||
if (message == null)
|
||||
throw new ArgumentNullException("message");
|
||||
int startIndex = message.IndexOf('(');
|
||||
if (startIndex == -1)
|
||||
{
|
||||
return message;
|
||||
}
|
||||
|
||||
StringBuilder output = new StringBuilder(message.Length);
|
||||
int lastAppendedIndex = 0;
|
||||
while (startIndex != -1)
|
||||
{
|
||||
int endIndex = message.IndexOf(')', startIndex + 1);
|
||||
if (endIndex == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
bool escaped = false;
|
||||
for (int i = startIndex - 1; i >= 0 && message[i] == '\\'; i--)
|
||||
{
|
||||
escaped = !escaped;
|
||||
}
|
||||
|
||||
string keyword = message.Substring(startIndex + 1, endIndex - startIndex - 1);
|
||||
char substitute;
|
||||
if (EmoteKeywords.TryGetValue(keyword.ToLowerInvariant(), out substitute))
|
||||
{
|
||||
if (escaped)
|
||||
{
|
||||
startIndex++;
|
||||
output.Append(message, lastAppendedIndex, startIndex - lastAppendedIndex - 2);
|
||||
lastAppendedIndex = startIndex - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
output.Append(message, lastAppendedIndex, startIndex - lastAppendedIndex);
|
||||
output.Append(substitute);
|
||||
startIndex = endIndex + 1;
|
||||
lastAppendedIndex = startIndex;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
startIndex++;
|
||||
}
|
||||
startIndex = message.IndexOf('(', startIndex);
|
||||
}
|
||||
output.Append(message, lastAppendedIndex, message.Length - lastAppendedIndex);
|
||||
return output.ToString();
|
||||
}
|
||||
private static readonly Regex EmoteSymbols = new Regex("[\x00-\x1F\x7F☺☻♥♦♣♠•◘○\n♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼⌂]");
|
||||
public void ClearChat() { OnChat = null; }
|
||||
public static Dictionary<string, string> left = new Dictionary<string, string>();
|
||||
/// <summary>
|
||||
///
|
||||
@ -955,6 +1114,7 @@ namespace MCGalaxy {
|
||||
SendExtEntry("EnvMapAppearance", 1);
|
||||
SendExtEntry("EnvWeatherType", 1);
|
||||
SendExtEntry("HackControl", 1);
|
||||
SendExtEntry("EmoteFix", 1);
|
||||
SendCustomBlockSupportLevel(1);
|
||||
}
|
||||
foreach (Player p in players)
|
||||
@ -2804,7 +2964,7 @@ return;
|
||||
sb.Replace("<3", "(heart)");
|
||||
}
|
||||
|
||||
byte[] stored = new byte[1];
|
||||
/*byte[] stored = new byte[1];
|
||||
|
||||
stored[0] = (byte)1;
|
||||
sb.Replace("(darksmile)", enc.GetString(stored));
|
||||
@ -2841,9 +3001,9 @@ return;
|
||||
stored[0] = (byte)30;
|
||||
sb.Replace("(up)", enc.GetString(stored));
|
||||
stored[0] = (byte)31;
|
||||
sb.Replace("(down)", enc.GetString(stored));
|
||||
sb.Replace("(down)", enc.GetString(stored));*/
|
||||
|
||||
message = sb.ToString();
|
||||
message = ReplaceEmoteKeywords(sb.ToString());
|
||||
int totalTries = 0;
|
||||
if ( MessageRecieve != null )
|
||||
MessageRecieve(this, message);
|
||||
@ -2858,7 +3018,10 @@ return;
|
||||
foreach ( string line in Wordwrap(message) ) {
|
||||
string newLine = line;
|
||||
if ( newLine.TrimEnd(' ')[newLine.TrimEnd(' ').Length - 1] < '!' ) {
|
||||
newLine += '\'';
|
||||
if (HasExtension("EmoteFix"))
|
||||
{
|
||||
newLine += '\'';
|
||||
}
|
||||
}
|
||||
StringFormat(newLine, 64).CopyTo(buffer, 1);
|
||||
SendRaw(13, buffer);
|
||||
|
Loading…
x
Reference in New Issue
Block a user