1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 23:31:13 -05:00

reworked some stats, redid the macro -> Tokens

added reset stats commands
broadcast for some commands
This commit is contained in:
RaidMax
2017-05-31 00:31:56 -05:00
parent 354cec0951
commit 063449d9c4
17 changed files with 322 additions and 240 deletions

View File

@ -2,6 +2,7 @@
using System.Threading;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.Collections.Generic;
namespace SharedLibrary
@ -120,27 +121,28 @@ namespace SharedLibrary
}
}
public static String LoadMacro(Dictionary<String, Object> Dict, String str)
public static String ProcessMessageToken(IList<MessageToken> tokens, String str)
{
MatchCollection Found = Regex.Matches(str, @"\{\{[A-Z]+\}\}", RegexOptions.IgnoreCase);
foreach (Match M in Found)
MatchCollection RegexMatches = Regex.Matches(str, @"\{\{[A-Z]+\}\}", RegexOptions.IgnoreCase);
foreach (Match M in RegexMatches)
{
String Match = M.Value;
String Identifier = M.Value.Substring(2, M.Length - 4);
Dict.TryGetValue(Identifier, out object foundVal);
String Replacement;
if (foundVal != null)
Replacement = foundVal.ToString();
else
Replacement = "";
var found = tokens.FirstOrDefault(t => t.Name.ToLower() == Identifier.ToLower());
str = str.Replace(Match, Replacement);
if (found != null)
str = str.Replace(Match, found.ToString());
}
return str;
}
public static bool IsBroadcastCommand(this string str)
{
return str[0] == '@';
}
/// <summary>
/// Get the full gametype name
/// </summary>