forked from HearthSim/Hearthstone-Deck-Tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created V2. Pulled some LogReader bulk into Handlers
- Loading branch information
Showing
16 changed files
with
1,352 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
using System.Text.RegularExpressions; | ||
using Hearthstone_Deck_Tracker.Enums; | ||
using Hearthstone_Deck_Tracker.Hearthstone; | ||
|
||
namespace Hearthstone_Deck_Tracker.LogReader | ||
{ | ||
public class AssetHandler | ||
{ | ||
public void Handle(string logLine, HsGameState gameState) | ||
{ | ||
if (gameState.AwaitingRankedDetection) | ||
{ | ||
gameState.LastAssetUnload = DateTime.Now; | ||
gameState.WaitingForFirstAssetUnload = false; | ||
} | ||
if (logLine.Contains("Medal_Ranked_")) | ||
{ | ||
var match = Regex.Match(logLine, "Medal_Ranked_(?<rank>(\\d+))"); | ||
if (match.Success) | ||
{ | ||
int rank; | ||
if (int.TryParse(match.Groups["rank"].Value, out rank)) | ||
gameState.GameHandler.SetRank(rank); | ||
} | ||
} | ||
else if (logLine.Contains("rank_window")) | ||
{ | ||
gameState.FoundRanked = true; | ||
gameState.GameHandler.SetGameMode(GameMode.Ranked); | ||
} | ||
else if (HsLogReaderConstants.UnloadCardRegex.IsMatch(logLine)) | ||
{ | ||
var id = HsLogReaderConstants.UnloadCardRegex.Match(logLine).Groups["id"].Value; | ||
if (Game.CurrentGameMode == GameMode.Arena) | ||
gameState.GameHandler.HandlePossibleArenaCard(id); | ||
else | ||
gameState.GameHandler.HandlePossibleConstructedCard(id, true); | ||
} | ||
else if (HsLogReaderConstants.UnloadBrawlAsset.IsMatch(logLine)) | ||
{ | ||
gameState.GameHandler.SetGameMode(GameMode.Brawl); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using Hearthstone_Deck_Tracker.Enums; | ||
using Hearthstone_Deck_Tracker.Hearthstone; | ||
|
||
namespace Hearthstone_Deck_Tracker.LogReader.Handlers | ||
{ | ||
public class BobHandler | ||
{ | ||
public void Handle(string logLine, HsGameState gameState) | ||
{ | ||
if (logLine.StartsWith("[Bob] ---RegisterScreenPractice---")) | ||
gameState.GameHandler.SetGameMode(GameMode.Practice); | ||
else if (logLine.StartsWith("[Bob] ---RegisterScreenTourneys---")) | ||
gameState.GameHandler.SetGameMode(GameMode.Casual); | ||
else if (logLine.StartsWith("[Bob] ---RegisterScreenForge---")) | ||
{ | ||
gameState.GameHandler.SetGameMode(GameMode.Arena); | ||
Game.ResetArenaCards(); | ||
} | ||
else if (logLine.StartsWith("[Bob] ---RegisterScreenFriendly---")) | ||
gameState.GameHandler.SetGameMode(GameMode.Friendly); | ||
else if (logLine.StartsWith("[Bob] ---RegisterScreenBox---")) | ||
{ | ||
//game ended - back in menu | ||
if (Game.CurrentGameMode == GameMode.Spectator) | ||
gameState.GameEnd(); | ||
} | ||
else if (logLine.StartsWith("[Bob] ---RegisterFriendChallenge---")) | ||
gameState.GameHandler.HandleInMenu(); | ||
else if (logLine.StartsWith("[Bob] ---RegisterScreenCollectionManager---")) | ||
gameState.GameHandler.ResetConstructedImporting(); | ||
else if (logLine.StartsWith("[Bob] ---RegisterProfileNotices---")) | ||
gameState.GameLoaded = true; | ||
} | ||
} | ||
} |
Oops, something went wrong.