public void Handle(LogLine logLine, IHsGameState gameState, IGame game) { var match = LogConstants.GameModeRegex.Match(logLine.Line); if (match.Success) { game.CurrentMode = GetMode(match.Groups["curr"].Value); game.PreviousMode = GetMode(match.Groups["prev"].Value); if ((DateTime.Now - logLine.Time).TotalSeconds < 5 && _lastAutoImport < logLine.Time && game.CurrentMode == Mode.TOURNAMENT) { _lastAutoImport = logLine.Time; var decks = DeckImporter.FromConstructed(); if (decks.Any() && (Config.Instance.ConstructedAutoImportNew || Config.Instance.ConstructedAutoUpdate)) { DeckManager.ImportDecks(decks, false, Config.Instance.ConstructedAutoImportNew, Config.Instance.ConstructedAutoUpdate); } } if (game.PreviousMode == Mode.GAMEPLAY && game.CurrentMode != Mode.GAMEPLAY) { gameState.GameHandler.HandleInMenu(); } if (game.CurrentMode == Mode.HUB && !_checkedMirrorStatus && (DateTime.Now - logLine.Time).TotalSeconds < 5) { CheckMirrorStatus(); } if (game.CurrentMode == Mode.DRAFT) { Watchers.ArenaWatcher.Run(); } else { Watchers.ArenaWatcher.Stop(); } if (game.CurrentMode == Mode.PACKOPENING) { Watchers.PackWatcher.Run(); } else { Watchers.PackWatcher.Stop(); } if (game.CurrentMode == Mode.TAVERN_BRAWL) { Core.Game.CacheBrawlInfo(); } } else if (logLine.Line.Contains("Gameplay.Start")) { gameState.Reset(); gameState.GameHandler.HandleGameStart(logLine.Time); } }
internal async void ShowImportDialog(bool brawl) { DeckImportingFlyout.Reset(brawl); FlyoutDeckImporting.IsOpen = true; if (!Core.Game.IsRunning) { Log.Info("Waiting for game..."); while (!Core.Game.IsRunning) { await Task.Delay(500); } } DeckImportingFlyout.StartedGame(); var mode = brawl ? Mode.TAVERN_BRAWL : Mode.TOURNAMENT; if (Core.Game.CurrentMode != mode) { Log.Info($"Waiting for {mode} screen..."); while (Core.Game.CurrentMode != mode) { await Task.Delay(500); } } var decks = brawl ? DeckImporter.FromBrawl() : DeckImporter.FromConstructed(); DeckImportingFlyout.SetDecks(decks); Core.MainWindow.ActivateWindow(); }
public void Handle(LogLineItem logLine, IHsGameState gameState, IGame game) { var match = HsLogReaderConstants.GameModeRegex.Match(logLine.Line); if (!match.Success) { return; } game.CurrentMode = GetMode(match.Groups["curr"].Value); game.PreviousMode = GetMode(match.Groups["prev"].Value); if ((DateTime.Now - logLine.Time).TotalSeconds < 5 && _lastAutoImport < logLine.Time && game.CurrentMode == Mode.TOURNAMENT) { _lastAutoImport = logLine.Time; var decks = DeckImporter.FromConstructed(); if (decks.Any() && (Config.Instance.ConstructedAutoImportNew || Config.Instance.ConstructedAutoUpdate)) { DeckManager.ImportDecks(decks, false, Config.Instance.ConstructedAutoImportNew, Config.Instance.ConstructedAutoUpdate); } } if (game.PreviousMode == Mode.GAMEPLAY) { gameState.GameHandler.HandleInMenu(); } if (game.CurrentMode == Mode.HUB && !_checkedMirrorStatus && (DateTime.Now - logLine.Time).TotalSeconds < 5) { CheckMirrorStatus(); } }
public static bool AutoImportConstructed(bool select, bool brawl = false) { var decks = brawl ? DeckImporter.FromBrawl() : DeckImporter.FromConstructed(); if (decks.Any() && (Config.Instance.ConstructedAutoImportNew || Config.Instance.ConstructedAutoUpdate)) { ImportDecks(decks, brawl, Config.Instance.ConstructedAutoImportNew, Config.Instance.ConstructedAutoUpdate, select); return(true); } return(false); }
public void Handle(LogLine logLine, IHsGameState gameState, IGame game) { var match = LogConstants.GameModeRegex.Match(logLine.Line); if (match.Success) { game.CurrentMode = GetMode(match.Groups["curr"].Value); game.PreviousMode = GetMode(match.Groups["prev"].Value); if ((DateTime.Now - logLine.Time).TotalSeconds < 5) { if (_lastAutoImport < logLine.Time && game.CurrentMode == Mode.TOURNAMENT) { _lastAutoImport = logLine.Time; var decks = DeckImporter.FromConstructed(); if (decks.Any() && (Config.Instance.ConstructedAutoImportNew || Config.Instance.ConstructedAutoUpdate)) { DeckManager.ImportDecks(decks, false, Config.Instance.ConstructedAutoImportNew, Config.Instance.ConstructedAutoUpdate); } } if (game.PreviousMode == Mode.COLLECTIONMANAGER || game.CurrentMode == Mode.COLLECTIONMANAGER || game.PreviousMode == Mode.PACKOPENING) { CollectionHelper.UpdateCollection().Forget(); } if (game.CurrentMode == Mode.HUB) { if (!_checkedMirrorStatus) { CheckMirrorStatus(); } } } if (ShowExperienceDuringMode.Contains(game.CurrentMode)) { Core.Overlay.ShowExperienceCounter(); } else { if (ShowExperienceDuringMode.Contains(game.PreviousMode)) { Core.Overlay.HideExperienceCounter(); } } if (game.PreviousMode == Mode.GAMEPLAY && game.CurrentMode != Mode.GAMEPLAY) { gameState.GameHandler.HandleInMenu(); } if (game.CurrentMode == Mode.DRAFT) { Watchers.ArenaWatcher.Run(); } else { Watchers.ArenaWatcher.Stop(); } if (game.CurrentMode == Mode.PACKOPENING) { Watchers.PackWatcher.Run(); } else { Watchers.PackWatcher.Stop(); } if (game.CurrentMode == Mode.TAVERN_BRAWL) { Core.Game.CacheBrawlInfo(); } if (game.CurrentMode == Mode.BACON) { Core.Game.CacheBattlegroundRatingInfo(); } if (game.CurrentMode == Mode.ADVENTURE || game.PreviousMode == Mode.ADVENTURE && game.CurrentMode == Mode.GAMEPLAY) { Watchers.DungeonRunWatcher.Run(); } else { Watchers.DungeonRunWatcher.Stop(); } if (game.CurrentMode == Mode.PVP_DUNGEON_RUN || game.PreviousMode == Mode.PVP_DUNGEON_RUN && game.CurrentMode == Mode.GAMEPLAY) { Watchers.PVPDungeonRunWatcher.Run(); } else { Watchers.PVPDungeonRunWatcher.Stop(); } if (game.PlayerChallengeable && Config.Instance.ChallengeAction != Enums.HsActionType.None) { Watchers.FriendlyChallengeWatcher.Run(); } else { Watchers.FriendlyChallengeWatcher.Stop(); } API.GameEvents.OnModeChanged.Execute(game.CurrentMode); } else if (logLine.Line.Contains("Gameplay.Start")) { gameState.Reset(); gameState.GameHandler.HandleGameStart(logLine.Time); } }
public void Handle(LogLine logLine, IHsGameState gameState, IGame game) { var match = LogConstants.GameModeRegex.Match(logLine.Line); if (match.Success) { game.CurrentMode = GetMode(match.Groups["curr"].Value); game.PreviousMode = GetMode(match.Groups["prev"].Value); if ((DateTime.Now - logLine.Time).TotalSeconds < 5 && _lastAutoImport < logLine.Time && game.CurrentMode == Mode.TOURNAMENT) { _lastAutoImport = logLine.Time; var decks = DeckImporter.FromConstructed(); if (decks.Any() && (Config.Instance.ConstructedAutoImportNew || Config.Instance.ConstructedAutoUpdate)) { DeckManager.ImportDecks(decks, false, Config.Instance.ConstructedAutoImportNew, Config.Instance.ConstructedAutoUpdate); } } if (game.PreviousMode == Mode.GAMEPLAY && game.CurrentMode != Mode.GAMEPLAY) { gameState.GameHandler.HandleInMenu(); } if (game.CurrentMode == Mode.HUB && !_checkedMirrorStatus && (DateTime.Now - logLine.Time).TotalSeconds < 5) { CheckMirrorStatus(); if (CollectionHelper.IsAwaitingUpdate) { CollectionHelper.TryUpdateCollection().Forget(); } } if (game.CurrentMode == Mode.DRAFT) { Watchers.ArenaWatcher.Run(); } else { Watchers.ArenaWatcher.Stop(); } if (game.CurrentMode == Mode.PACKOPENING) { Watchers.PackWatcher.Run(); } else { Watchers.PackWatcher.Stop(); } if (game.CurrentMode == Mode.TAVERN_BRAWL) { Core.Game.CacheBrawlInfo(); } if (game.CurrentMode == Mode.ADVENTURE || game.PreviousMode == Mode.ADVENTURE && game.CurrentMode == Mode.GAMEPLAY) { Watchers.DungeonRunWatcher.Run(); } else { Watchers.DungeonRunWatcher.Stop(); } if (Config.Instance.FlashHsOnFriendlyChallenge) { if (game.PlayerChallengeable) { Watchers.FriendlyChallengeWatcher.Run(); } else { Watchers.FriendlyChallengeWatcher.Stop(); } } API.GameEvents.OnModeChanged.Execute(game.CurrentMode); } else if (logLine.Line.Contains("Gameplay.Start")) { gameState.Reset(); gameState.GameHandler.HandleGameStart(logLine.Time); } }