Skip to content

Commit

Permalink
chore(BattlegroundsQuestPickingViewModel): hide via SendChoices
Browse files Browse the repository at this point in the history
  • Loading branch information
beheh committed Dec 4, 2023
1 parent 3093e1d commit 4906092
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public void Reset()
_entities.Clear();
Quests = null;
Visibility = Collapsed;
_watchChoices = false;
Message.Clear();
}

Expand Down Expand Up @@ -123,30 +122,10 @@ private async Task Update()
if(choices.IsVisible)
Visibility = Visible;

WatchChoices();

if(Config.Instance.ShowBattlegroundsQuestPicking)
Core.Game.Metrics.Tier7QuestOverlayDisplayed = true;
}

private bool _watchChoices;
private async void WatchChoices()
{
_watchChoices = true;
while(_watchChoices)
{
await Task.Delay(100);
var choices = Reflection.Client.GetCardChoices();
if(choices == null)
{
_watchChoices = false;
Visibility = Collapsed;
break;
}
Visibility = choices.IsVisible ? Visible : Collapsed;
}
}

private BattlegroundsQuestStatsParams? GetApiParams()
{
var hero = Core.Game.Entities.Values.FirstOrDefault(x => x.IsPlayer && x.IsHero);
Expand Down
13 changes: 12 additions & 1 deletion Hearthstone Deck Tracker/GameEventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,18 @@ public void HandlePlayerSendChoices(Choice choice)
{
if(choice.ChoiceType == ChoiceType.MULLIGAN)
{
_game.SnapshotMulliganChoices(choice);
if(_game.IsBattlegroundsMatch)
{
Core.Overlay.BattlegroundsHeroPickingViewModel.Reset();
}
else if(_game.IsConstructedMatch)
{
_game.SnapshotMulliganChoices(choice);
}
}
else if(_game.IsBattlegroundsMatch)
{
Core.Overlay.BattlegroundsQuestPickingViewModel.Reset();
}
}

Expand Down

0 comments on commit 4906092

Please sign in to comment.