private static void CountCards(string line, int cards, int tokens, IMatch match) { var parser = new GameLogLine(line, match); Assert.AreEqual(cards, parser.Cards.Count()); Assert.AreEqual(tokens, parser.Tokens.Count()); }
public string HandleLine(GameLogLine gameLogLine) { foreach (var name in gameLogLine.Cards) { if (warnings.Contains(name)) { continue; } if (API.BuggedCards.IsCardBugged(name) is API.BuggedCards.Bug bug) { if (bug.Multiplayer && match.Players.Length < 3) { continue; } warnings.Add(name); string a_or_an(string word) // Yes, it's bad. { return("au".Contains(word.ToLower()[0]) ? "an" : "a"); } var a = a_or_an(bug.Classification); var v = new StringBuilder($"[sU]{name}[sU] has {a} {bug.Classification.ToLower()} bug.\n"); v.AppendLine(bug.Description.Replace("[", "").Replace("]", "")); if (bug.HelpWanted) { v.AppendLine("Our data about this bug is out of date. Please let us know if this card is still bugged (or if it's been fixed)."); v.AppendLine($"You can do so by PM'ing this bot, or by typing `!stillbugged {name}` or `!notbugged {name}`"); } return(v.ToString().Trim()); } } return(null); }
public string HandleLine(GameLogLine gameLogLine) { foreach (var name in gameLogLine.Cards) { if (warnings.Contains(name)) { // Already Acknowledged. } else if (!IsCardLegal(name)) { warnings.Add(name); IllegalCount++; const int nWarnings = 3; if (IllegalCount < nWarnings) { return($"[sR]{name}[sR] is not legal in {FormatName}."); } else if (IllegalCount == nWarnings) { return($"[sR]{name}[sR] is not legal in {FormatName}.\n" + "[sG] In order to prevent further spamming, I'll stop warning you now.\n" + (string.IsNullOrEmpty(MoreInfo) ? "" : $"[sG] For more information about {FormatName}, see {MoreInfo}")); } } } return(null); }
public string HandleLine(GameLogLine gameLogLine) { foreach (var name in gameLogLine.Cards) { if (HostRun == null || LeagueRunOpp == null) { return(null); } var InList = HostRun.ContainsCard(name) || LeagueRunOpp.ContainsCard(name) || BaseLegalityChecker.IsRearFace(name); if (!InList) { HostRun = LeagueRunOpp = null; match.Log("[League] Invalid Match"); return($"[sD][sR] {name} was not on a submitted league decklist. This is not a league match."); } } if (gameLogLine.Line.EndsWith("has lost the game due to inaction.")) { //DiscordService.SendLogToChannelAsync() } return(null); }
public string HandleLine(GameLogLine gameLogLine) { return(null); }
/// <summary> /// This is triggered every time a line is sent through the game log. /// If we have something to say, return a string. /// </summary> /// <param name="gameLogLine"></param> /// <returns></returns> public string HandleLine(GameLogLine gameLogLine) { // Don't care. return(null); }