private static void InitializeGameState(GameV2 game) { _game = game; _gameState = new HsGameState(game); _gameState.GameHandler = new GameEventHandler(game); _gameState.GameHandler.ResetConstructedImporting(); _gameState.Reset(); }
public int AdjustedCount(GameV2 game) { return((Config.Instance.AutoGrayoutSecrets && (game.CurrentGameMode == GameMode.Casual || game.CurrentGameMode == GameMode.Ranked || game.CurrentGameMode == GameMode.Friendly || game.CurrentGameMode == GameMode.Practice || ActiveDeckIsConstructed) && game.Opponent.RevealedCards.Where(x => x != null && x.Entity != null) .Count(x => x.Entity.Id < 68 && x.Entity.CardId == CardId) >= 2) ? 0 : Count); }
public DebugWindow(GameV2 game) { _game = game; InitializeComponent(); _update = true; Closing += (sender, args) => _update = false; Update(); }
public int AdjustedCount(GameV2 game) { return((Config.Instance.AutoGrayoutSecrets && (game.CurrentGameMode == GameMode.Casual || game.CurrentGameMode == GameMode.Ranked || game.CurrentGameMode == GameMode.Brawl || game.CurrentGameMode == GameMode.Friendly || game.CurrentGameMode == GameMode.Practice) && game.OpponentCards.Any(x => !x.IsStolen && x.Id == CardId & x.Count >= 2)) ? 0 : Count); }
public void TestDreadscaleIsActual() { Card c = new Card { Id = "AT_063t", Name = "Dreadscale", Type = "Minion" }; Assert.IsTrue(GameV2.IsActualCard(c)); }
public void Stop() { if(_game == null) return; Log.Info("Stopping turn timer"); _timer.Stop(); _game = null; }
public void Load(GameV2 game) { _game = game; CheckboxHighlightCardsInHand.IsChecked = Config.Instance.HighlightCardsInHand; CheckboxRemoveCards.IsChecked = Config.Instance.RemoveCardsFromDeck; CheckboxHighlightLastDrawn.IsChecked = Config.Instance.HighlightLastDrawn; CheckboxShowPlayerGet.IsChecked = Config.Instance.ShowPlayerGet; SliderPlayerOpacity.Value = Config.Instance.PlayerOpacity; SliderOverlayPlayerScaling.Value = Config.Instance.OverlayPlayerScaling; TextBoxScaling.Text = Config.Instance.OverlayPlayerScaling.ToString(CultureInfo.InvariantCulture); CheckboxSameScaling.IsChecked = Config.Instance.UseSameScaling; CheckBoxCenterDeckVertically.IsChecked = Config.Instance.OverlayCenterPlayerStackPanel; CheckBoxAttack.IsChecked = !Config.Instance.HidePlayerAttackIcon; ComboBoxCthun.ItemsSource = Enum.GetValues(typeof(DisplayMode)).Cast <DisplayMode>(); ComboBoxCthun.SelectedItem = Config.Instance.PlayerCthunCounter; ComboBoxSpells.ItemsSource = Enum.GetValues(typeof(DisplayMode)).Cast <DisplayMode>(); ComboBoxSpells.SelectedItem = Config.Instance.PlayerSpellsCounter; ComboBoxJade.ItemsSource = Enum.GetValues(typeof(DisplayMode)).Cast <DisplayMode>(); ComboBoxJade.SelectedItem = Config.Instance.PlayerJadeCounter; ElementSorterPlayer.IsPlayer = true; foreach (var panel in Config.Instance.DeckPanelOrderPlayer) { switch (panel) { case Enums.DeckPanel.Cards: ElementSorterPlayer.AddItem(new ElementSorterItem(panel, !Config.Instance.HidePlayerCards, value => Config.Instance.HidePlayerCards = !value, true)); break; case Enums.DeckPanel.CardCounter: ElementSorterPlayer.AddItem(new ElementSorterItem(panel, !Config.Instance.HidePlayerCardCount, value => Config.Instance.HidePlayerCardCount = !value, true)); break; case Enums.DeckPanel.DrawChances: ElementSorterPlayer.AddItem(new ElementSorterItem(panel, !Config.Instance.HideDrawChances, value => Config.Instance.HideDrawChances = !value, true)); break; case Enums.DeckPanel.Fatigue: ElementSorterPlayer.AddItem(new ElementSorterItem(panel, !Config.Instance.HidePlayerFatigueCount, value => Config.Instance.HidePlayerFatigueCount = !value, true)); break; case Enums.DeckPanel.DeckTitle: ElementSorterPlayer.AddItem(new ElementSorterItem(panel, Config.Instance.ShowDeckTitle, value => Config.Instance.ShowDeckTitle = value, true)); break; case Enums.DeckPanel.Wins: ElementSorterPlayer.AddItem(new ElementSorterItem(panel, Config.Instance.ShowDeckWins, value => Config.Instance.ShowDeckWins = value, true)); break; } } _initialized = true; }
public void Setup() { Core.Game = null; _game = new GameV2(); Core.Game = _game; _gameEventHandler = new GameEventHandler(_game); _heroPlayer = CreateNewEntity("HERO_01"); _heroPlayer.SetTag(GameTag.CARDTYPE, (int)CardType.HERO); _heroPlayer.IsPlayer = true; _heroOpponent = CreateNewEntity("HERO_02"); _heroOpponent.SetTag(GameTag.CARDTYPE, (int)CardType.HERO); _heroOpponent.SetTag(GameTag.CONTROLLER, _heroOpponent.Id); _heroOpponent.IsPlayer = false; _game.Entities.Add(0, _heroPlayer); _game.Player.Id = _heroPlayer.Id; _game.Entities.Add(1, _heroOpponent); _game.Opponent.Id = _heroOpponent.Id; _playerMinion1 = CreateNewEntity("EX1_010"); _playerMinion1.SetTag(GameTag.CARDTYPE, (int)CardType.MINION); _playerMinion1.SetTag(GameTag.CONTROLLER, _heroPlayer.Id); _opponentMinion1 = CreateNewEntity("EX1_020"); _opponentMinion1.SetTag(GameTag.CARDTYPE, (int)CardType.MINION); _opponentMinion1.SetTag(GameTag.CONTROLLER, _heroOpponent.Id); _opponentMinion2 = CreateNewEntity("EX1_021"); _opponentMinion2.SetTag(GameTag.CARDTYPE, (int)CardType.MINION); _opponentMinion2.SetTag(GameTag.CONTROLLER, _heroOpponent.Id); _playerSpell1 = CreateNewEntity("CS2_029"); _playerSpell1.SetTag(GameTag.CARDTYPE, (int)CardType.SPELL); _playerSpell1.SetTag(GameTag.CARD_TARGET, _opponentMinion1.Id); _playerSpell1.SetTag(GameTag.CONTROLLER, _heroPlayer.Id); _playerSpell2 = CreateNewEntity("CS2_025"); _playerSpell2.SetTag(GameTag.CARDTYPE, (int)CardType.SPELL); _playerSpell2.SetTag(GameTag.CONTROLLER, _heroPlayer.Id); _game.Entities.Add(2, _playerMinion1); _game.Entities.Add(3, _opponentMinion1); _game.Entities.Add(4, _opponentMinion2); _secretHunter1 = CreateNewEntity(""); _secretHunter1.SetTag(GameTag.CLASS, (int)CardClass.HUNTER); _secretHunter2 = CreateNewEntity(""); _secretHunter2.SetTag(GameTag.CLASS, (int)CardClass.HUNTER); _secretMage1 = CreateNewEntity(""); _secretMage1.SetTag(GameTag.CLASS, (int)CardClass.MAGE); _secretMage2 = CreateNewEntity(""); _secretMage2.SetTag(GameTag.CLASS, (int)CardClass.MAGE); _secretPaladin1 = CreateNewEntity(""); _secretPaladin1.SetTag(GameTag.CLASS, (int)CardClass.PALADIN); _secretPaladin2 = CreateNewEntity(""); _secretPaladin2.SetTag(GameTag.CLASS, (int)CardClass.PALADIN); _gameEventHandler.HandleOpponentSecretPlayed(_secretHunter1, "", 0, 0, Zone.HAND, _secretHunter1.Id); _gameEventHandler.HandleOpponentSecretPlayed(_secretMage1, "", 0, 0, Zone.HAND, _secretMage1.Id); _gameEventHandler.HandleOpponentSecretPlayed(_secretPaladin1, "", 0, 0, Zone.HAND, _secretPaladin1.Id); }
public OverlayWindow(GameV2 game) { _game = game; InitializeComponent(); _heroNotificationBehavior = new OverlayElementBehavior(HeroNotificationPanel) { GetRight = () => 0, GetBottom = () => Height * 0.04, GetScaling = () => AutoScaling, AnchorSide = Side.Bottom, HideCallback = () => { ShowBgsTopBar(); }, EntranceAnimation = AnimationType.Slide, ExitAnimation = AnimationType.Slide, }; _bgsTopBarBehavior = new OverlayElementBehavior(BgsTopBar) { GetRight = () => 0, GetTop = () => 0, GetScaling = () => AutoScaling, AnchorSide = Side.Top, EntranceAnimation = AnimationType.Slide, ExitAnimation = AnimationType.Slide, }; if (Config.Instance.ExtraFeatures && Config.Instance.ForceMouseHook) { HookMouse(); } ShowInTaskbar = Config.Instance.ShowInTaskbar; if (Config.Instance.VisibleOverlay) { Background = (SolidColorBrush) new BrushConverter().ConvertFrom("#4C0000FF"); } _offsetX = Config.Instance.OffsetX; _offsetY = Config.Instance.OffsetY; _customWidth = Config.Instance.CustomWidth; _customHeight = Config.Instance.CustomHeight; if (Config.Instance.ShowBatteryLife) { EnableBatteryMonitor(); } InitializeCollections(); GridMain.Visibility = Hidden; if (User32.GetHearthstoneWindow() != IntPtr.Zero) { UpdatePosition(); } Update(true); UpdateScaling(); UpdatePlayerLayout(); UpdateOpponentLayout(); GridMain.Visibility = Visible; }
private async void BtnIdString_Click(object sender, RoutedEventArgs e) { try { var settings = new MetroDialogSettings(); var clipboard = Clipboard.ContainsText() ? Clipboard.GetText() : ""; if (clipboard.Count(c => c == ':') > 0 && clipboard.Count(c => c == ';') > 0) { settings.DefaultText = clipboard; } //import dialog var idString = await this.ShowInputAsync("Import deck", "id:count;id2:count2;... (e.g. EX1_050:2;EX1_556:1;)\nObtained from: \nEXPORT > COPY IDS TO CLIPBOARD", settings); if (string.IsNullOrEmpty(idString)) { return; } var deck = new Deck(); foreach (var entry in idString.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) { var splitEntry = entry.Split(':'); if (splitEntry.Length != 2) { continue; } var card = GameV2.GetCardFromId(splitEntry[0]); if (card.Id == "UNKNOWN") { continue; } int count; int.TryParse(splitEntry[1], out count); card.Count = count; if (string.IsNullOrEmpty(deck.Class) && card.GetPlayerClass != "Neutral") { deck.Class = card.GetPlayerClass; } deck.Cards.Add(card); } SetNewDeck(deck); if (Config.Instance.AutoSaveOnImport) { SaveDeckWithOverwriteCheck(); } } catch (Exception ex) { Logger.WriteLine("Error importing deck from clipboard(id string): " + ex, "Import"); } }
public void HandleOpponentPlayToDeck(string cardId, int turn) { LogEvent("OpponentPlayToDeck", cardId, turn); _game.OpponentPlayToDeck(cardId, turn); _game.AddPlayToCurrentGame(PlayType.OpponentPlayToDeck, turn, cardId); Helper.MainWindow.Overlay.ListViewOpponent.Items.Refresh(); Helper.MainWindow.OpponentWindow.ListViewOpponent.Items.Refresh(); GameEvents.OnOpponentPlayToDeck.Execute(GameV2.GetCardFromId(cardId)); }
public void Start(IGameHandler gh, GameV2 game) { _gameState.AddToTurn = -1; _gameState.First = true; _gameState.DoUpdate = true; _gameState.GameHandler = gh; _gameState.GameEnded = false; ReadFileAsync(); }
private void InitializeGameState(GameV2 game) { _game = game; _gameState = new HsGameState(game) { GameHandler = new GameEventHandler(game) }; _gameState.Reset(); }
public void Start(GameV2 game) { _game = game; _gameState = new HsGameState(game); _gameState.GameHandler = new GameEventHandler(game); _gameState.GameHandler.ResetConstructedImporting(); _gameState.LastGameStart = DateTime.Now; Start(_gameState.GameHandler, game); }
public void Load(GameV2 game) { _game = game; CheckboxHighlightDiscarded.IsChecked = Config.Instance.HighlightDiscarded; SliderOpponentOpacity.Value = Config.Instance.OpponentOpacity; SliderOverlayOpponentScaling.Value = Config.Instance.OverlayOpponentScaling; CheckboxSameScaling.IsChecked = Config.Instance.UseSameScaling; SliderSecretOpacity.Value = Config.Instance.SecretsOpacity; CheckBoxCenterDeckVertically.IsChecked = Config.Instance.OverlayCenterOpponentStackPanel; CheckboxIncludeCreated.IsChecked = Config.Instance.OpponentIncludeCreated; CheckBoxAttack.IsChecked = !Config.Instance.HideOpponentAttackIcon; ComboBoxCthun.ItemsSource = Enum.GetValues(typeof(DisplayMode)).Cast <DisplayMode>(); ComboBoxCthun.SelectedItem = Config.Instance.OpponentCthunCounter; ComboBoxSpells.ItemsSource = new[] { DisplayMode.Always, DisplayMode.Never }; ComboBoxSpells.SelectedItem = Config.Instance.OpponentSpellsCounter; ComboBoxJade.ItemsSource = Enum.GetValues(typeof(DisplayMode)).Cast <DisplayMode>(); ComboBoxJade.SelectedItem = Config.Instance.OpponentJadeCounter; CheckboxHideOpponentCardAge.IsChecked = Config.Instance.HideOpponentCardAge; CheckboxHideOpponentCardMarks.IsChecked = Config.Instance.HideOpponentCardMarks; CheckboxHideSecrets.IsChecked = Config.Instance.HideSecrets; ElementSorterOpponent.IsPlayer = false; foreach (var panel in Config.Instance.DeckPanelOrderOpponent) { switch (panel) { case Enums.DeckPanel.Winrate: ElementSorterOpponent.AddItem(new ElementSorterItem(panel, Config.Instance.ShowWinRateAgainst, value => Config.Instance.ShowWinRateAgainst = value, false)); break; case Enums.DeckPanel.Cards: ElementSorterOpponent.AddItem(new ElementSorterItem(panel, !Config.Instance.HideOpponentCards, value => Config.Instance.HideOpponentCards = !value, false)); break; case Enums.DeckPanel.CardCounter: ElementSorterOpponent.AddItem(new ElementSorterItem(panel, !Config.Instance.HideOpponentCardCount, value => Config.Instance.HideOpponentCardCount = !value, false)); break; case Enums.DeckPanel.DrawChances: ElementSorterOpponent.AddItem(new ElementSorterItem(panel, !Config.Instance.HideOpponentDrawChances, value => Config.Instance.HideOpponentDrawChances = !value, false)); break; case Enums.DeckPanel.Fatigue: ElementSorterOpponent.AddItem(new ElementSorterItem(panel, !Config.Instance.HideOpponentFatigueCount, value => Config.Instance.HideOpponentFatigueCount = !value, false)); break; } } Core.Overlay.UpdateOpponentLayout(); Core.Windows.OpponentWindow.UpdateOpponentLayout(); _initialized = true; }
private void ReadLogFile() { _running = true; FindInitialOffset(); while (!_stop) { lock (_sync) { if (_collected) { _lines.Clear(); _collected = false; } var fileInfo = new FileInfo(_filePath); if (fileInfo.Exists) { using (var fs = new FileStream(_filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { fs.Seek(_offset, SeekOrigin.Begin); if (fs.Length == _offset) { Thread.Sleep(Config.Instance.UpdateDelay); continue; } using (var sr = new StreamReader(fs)) { string line; while (!sr.EndOfStream && (line = sr.ReadLine()) != null) { if (!line.StartsWith("D ") || (!sr.EndOfStream && sr.Peek() != 'D')) { break; } if (_info.Name == "Power") { GameV2.AddHSLogLine(line); } if (!_info.HasFilters || _info.StartsWithFilters.Any(x => line.Substring(19).StartsWith(x)) || _info.ContainsFilters.Any(x => line.Substring(19).Contains(x))) { var logLine = new LogLineItem(_info.Name, line, fileInfo.LastWriteTime); if (logLine.Time >= _startingPoint) { _lines.Add(logLine); } } _offset += Encoding.UTF8.GetByteCount(line + Environment.NewLine); } } } } } Thread.Sleep(Config.Instance.UpdateDelay); } _running = false; }
public string GetAdditionalInfo() { if (Type == KeyPointType.Victory || Type == KeyPointType.Defeat) { return(Type.ToString()); } var cardId = GetCardId(); return(string.IsNullOrEmpty(cardId) ? "Entity " + Id : GameV2.GetCardFromId(GetCardId()).LocalizedName); }
public void TestHeroSkins() { var Alleria = GameV2.GetHeroNameFromId("HERO_05a"); Assert.AreEqual("Hunter", Alleria); var AlleriaPower = GameV2.GetCardFromId("DS1h_292_H1"); Assert.AreEqual("Steady Shot", AlleriaPower.Name); }
public void TestBrawlCards() { var Rotten = GameV2.GetCardFromId("TB_008"); Assert.AreEqual("Rotten Banana", Rotten.Name); var Moira = GameV2.GetCardFromId("BRMC_87"); Assert.AreEqual("Moira Bronzebeard", Moira.Name); }
public static async Task Start(GameV2 game) { if (!Helper.HearthstoneDirExists) { await FindHearthstone(); } InitializeGameState(game); InitializeLogReaders(); _startingPoint = GetStartingPoint(); StartLogReaders(); }
public void HandlePlayerBackToHand(string cardId, int turn) { if (string.IsNullOrEmpty(cardId)) { return; } LogEvent("PlayerBackToHand", cardId); _game.PlayerGet(cardId, true, turn); _game.AddPlayToCurrentGame(PlayType.PlayerBackToHand, turn, cardId); GameEvents.OnPlayerPlayToHand.Execute(GameV2.GetCardFromId(cardId)); }
public void LoadConfig(GameV2 game) { _game = game; CheckboxPlayerDraw.IsChecked = Config.Instance.GameDetails.ShowPlayerDraw; CheckboxOpponentDraw.IsChecked = Config.Instance.GameDetails.ShowOpponentDraw; CheckboxPlayerPlay.IsChecked = Config.Instance.GameDetails.ShowPlayerPlay; CheckboxOpponentPlay.IsChecked = Config.Instance.GameDetails.ShowOpponentPlay; CheckboxPlayerMulligan.IsChecked = Config.Instance.GameDetails.ShowPlayerMulligan; CheckboxOpponentMulligan.IsChecked = Config.Instance.GameDetails.ShowOpponentMulligan; _initialized = true; }
public void HandleOpponentDeckDiscard(string cardId, int turn) { LogEvent("OpponentDeckDiscard", cardId); _game.OpponentDeckDiscard(cardId); //there seems to be an issue with the overlay not updating here. //possibly a problem with order of logs? Helper.MainWindow.Overlay.ListViewOpponent.Items.Refresh(); Helper.MainWindow.OpponentWindow.ListViewOpponent.Items.Refresh(); _game.AddPlayToCurrentGame(PlayType.OpponentDeckDiscard, turn, cardId); GameEvents.OnOpponentDeckDiscard.Execute(GameV2.GetCardFromId(cardId)); }
public GameDetailItem(TurnStats.Play play, int turn) { Turn = turn.ToString(); Player = play.Type.ToString().StartsWith("Player") ? "Player" : "Opponent"; Action = play.Type.ToString().Replace("Player", string.Empty).Replace("Opponent", string.Empty); Card = GameV2.GetCardFromId(play.CardId); if (play.Type == PlayType.PlayerHandDiscard || play.Type == PlayType.OpponentHandDiscard && (Card != null && Card.Type == "Spell")) { Action = "Play/Discard"; } }
public override string ToString() { var additionalInfo = ""; if (Type == KeyPointType.Attack) { var attackerId = Data[0].GetTag(GAME_TAG.PROPOSED_ATTACKER); var attackerCardId = Data.First(x => x.Id == attackerId).CardId; if (!string.IsNullOrEmpty(attackerCardId)) { additionalInfo += GameV2.GetCardFromId(attackerCardId).LocalizedName; } additionalInfo += " -> "; var defenderId = Data[0].GetTag(GAME_TAG.PROPOSED_DEFENDER); var defenderCardId = Data.First(x => x.Id == defenderId).CardId; if (!string.IsNullOrEmpty(defenderCardId)) { additionalInfo += GameV2.GetCardFromId(defenderCardId).LocalizedName; } } else if (Type == KeyPointType.PlaySpell) { var entity = Data.First(x => x.Id == Id); if (!string.IsNullOrEmpty(entity.CardId)) { additionalInfo += GameV2.GetCardFromId(entity.CardId).LocalizedName; } additionalInfo += " -> "; var targetId = entity.GetTag(GAME_TAG.CARD_TARGET); var targetCardId = Data.First(x => x.Id == targetId).CardId; if (!string.IsNullOrEmpty(targetCardId)) { additionalInfo += GameV2.GetCardFromId(targetCardId).LocalizedName; } } else { var entityCardId = Data.First(x => x.Id == Id).CardId; if (!string.IsNullOrEmpty(entityCardId)) { additionalInfo = GameV2.GetCardFromId(entityCardId).LocalizedName; } else { additionalInfo = "Entity " + Id; } } return(string.Format("{1} {2}", Player, Type, additionalInfo)); }
public async Task Start(GameV2 game) { if (!Helper.HearthstoneDirExists) { await FindHearthstone(); } InitializeGameState(game); _stop = false; var logDirectory = Path.Combine(Config.Instance.HearthstoneDirectory, Config.Instance.HearthstoneLogsDirectoryName); _logWatcher.Start(logDirectory); }
public void Load(GameV2 game) { _game = game; CheckboxHighlightCardsInHand.IsChecked = Config.Instance.HighlightCardsInHand; CheckboxRemoveCards.IsChecked = Config.Instance.RemoveCardsFromDeck; CheckboxHighlightLastDrawn.IsChecked = Config.Instance.HighlightLastDrawn; CheckboxShowPlayerGet.IsChecked = Config.Instance.ShowPlayerGet; SliderPlayerOpacity.Value = Config.Instance.PlayerOpacity; SliderOverlayPlayerScaling.Value = Config.Instance.OverlayPlayerScaling; TextBoxScaling.Text = Config.Instance.OverlayPlayerScaling.ToString(CultureInfo.InvariantCulture); CheckboxSameScaling.IsChecked = Config.Instance.UseSameScaling; ElementSorterPlayer.IsPlayer = true; foreach (var itemName in Config.Instance.PanelOrderPlayer) { switch (itemName) { case "Deck Title": ElementSorterPlayer.AddItem(new ElementSorterItem("Deck Title", Config.Instance.ShowDeckTitle, value => Config.Instance.ShowDeckTitle = value, true)); break; case "Cards": ElementSorterPlayer.AddItem(new ElementSorterItem("Cards", !Config.Instance.HidePlayerCards, value => Config.Instance.HidePlayerCards = !value, true)); break; case "Card Counter": ElementSorterPlayer.AddItem(new ElementSorterItem("Card Counter", !Config.Instance.HidePlayerCardCount, value => Config.Instance.HidePlayerCardCount = !value, true)); break; case "Fatigue Counter": ElementSorterPlayer.AddItem(new ElementSorterItem("Fatigue Counter", !Config.Instance.HidePlayerFatigueCount, value => Config.Instance.HidePlayerFatigueCount = !value, true)); break; case "Draw Chances": ElementSorterPlayer.AddItem(new ElementSorterItem("Draw Chances", !Config.Instance.HideDrawChances, value => Config.Instance.HideDrawChances = !value, true)); break; case "Wins": ElementSorterPlayer.AddItem(new ElementSorterItem("Wins", Config.Instance.ShowDeckWins, value => Config.Instance.ShowDeckWins = value, true)); break; } } Core.Overlay.UpdatePlayerLayout(); Core.Windows.PlayerWindow.UpdatePlayerLayout(); _initialized = true; }
public void HandlePossibleArenaCard(string id) { var card = GameV2.GetCardFromId(id); if (!GameV2.IsActualCard(card)) { return; } if (!_game.PossibleArenaCards.Contains(card)) { _game.PossibleArenaCards.Add(card); } }
private void Analyze(string log) { var logLines = log.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); foreach (var rawLogLine in logLines) { var logLine = new string(rawLogLine.Skip(25).ToArray()); _gameState.CurrentOffset += logLine.Length + 1; if (logLine.StartsWith("[")) { GameV2.AddHSLogLine(logLine); API.LogEvents.OnLogLine.Execute(logLine); } if (logLine.StartsWith("[Power] GameState.")) { _powerGameStateLineHandler.Handle(logLine, _gameState, _game); } else if (logLine.StartsWith("[Power]")) { _powerLineHandler.Handle(logLine, _gameState, _game); } else if (logLine.StartsWith("[Asset]")) { _assetHandler.Handle(logLine, _gameState, _game); } else if (logLine.StartsWith("[Bob]")) { _bobHandler.Handle(logLine, _gameState, _game); } else if (logLine.StartsWith("[Rachelle]")) { _rachelleHandler.Handle(logLine, _gameState, _game); } else if (logLine.StartsWith("[Zone]")) { _zoneHandler.Handle(logLine, _gameState); } else if (logLine.StartsWith("[Arena]")) { _arenaHandler.Handle(logLine, _gameState, _game); } if (_gameState.First) { break; } } }
public void HandlePlayerPlay(string cardId, int turn) { if (string.IsNullOrEmpty(cardId)) { return; } LogEvent("PlayerPlay", cardId); _game.PlayerPlayed(cardId); Helper.MainWindow.Overlay.ListViewPlayer.Items.Refresh(); Helper.MainWindow.PlayerWindow.ListViewPlayer.Items.Refresh(); _game.AddPlayToCurrentGame(PlayType.PlayerPlay, turn, cardId); GameEvents.OnPlayerPlay.Execute(GameV2.GetCardFromId(cardId)); }