Skip to content

Commit

Permalink
fix: hero guides not taking hero skins into account
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorMCesar committed Jan 31, 2025
1 parent 20dd1aa commit 7163823
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using HearthDb.Enums;
using Hearthstone_Deck_Tracker.Hearthstone;
using Hearthstone_Deck_Tracker.Utility.Logging;
using Hearthstone_Deck_Tracker.Utility.MVVM;
Expand Down Expand Up @@ -79,6 +80,12 @@ public void OnMulliganEnded()

var heroCard = Database.GetCardFromDbfId(heroDbfid.Value, false);

// The hero ID can be a skin, so we need to get the base hero id.
var baseHeroDbfid = heroCard?.BattlegroundsSkinParentId;

if(baseHeroDbfid is > 0)
heroCard = Database.GetCardFromDbfId(baseHeroDbfid.Value, false);

BattlegroundsHeroGuide? guide = null;
if(heroCard == null)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,16 @@ public Visibility HeroGuideVisibility
)
return Collapsed;

return Core.Game.BattlegroundsHeroPickState.OfferedHeroDbfIds.Contains(HoveredHeroDbfid.Value) ? Visible : Collapsed;
var offeredHeroDbfIds = Core.Game.BattlegroundsHeroPickState.OfferedHeroDbfIds;

// The offered hero IDs can be a skins, so we need to get the base hero id.
var baseHeroDbfIds = offeredHeroDbfIds.Select(dbfId =>
{
var heroCard = Database.GetCardFromDbfId(dbfId, false);
return heroCard?.BattlegroundsSkinParentId > 0 ? heroCard.BattlegroundsSkinParentId : dbfId;
}).ToList();

return baseHeroDbfIds.Contains(HoveredHeroDbfid.Value) ? Visible : Collapsed;
}
}
public bool IsGuidePublished => PublishedGuide != null && PublishedGuide.Any();
Expand Down

0 comments on commit 7163823

Please sign in to comment.