diff --git a/Heroes.ReplayParser/MPQFiles/ReplayInitData.cs b/Heroes.ReplayParser/MPQFiles/ReplayInitData.cs index 4d38ef6..47f2700 100644 --- a/Heroes.ReplayParser/MPQFiles/ReplayInitData.cs +++ b/Heroes.ReplayParser/MPQFiles/ReplayInitData.cs @@ -202,11 +202,9 @@ public static void Parse(Replay replay, byte[] buffer) // m_disabledHeroList var disabledHeroListLength = reader.Read(10); - // TODO: This has been '0' in all my games, so nothing to see here - // I'm not sure what it is for. Maybe it is just for ranked games, or something yet to be implemented in the game client for (var i = 0; i < disabledHeroListLength; i++) { - var disabledHero = new string(BitConverter.GetBytes(reader.Read(32)).Select(k => (char)k).Reverse().ToArray()); + replay.DisabledHeroes.Add(reader.ReadStringFromBits(32, true)); } } diff --git a/Heroes.ReplayParser/MPQFiles/ReplayServerBattlelobby.cs b/Heroes.ReplayParser/MPQFiles/ReplayServerBattlelobby.cs index 96de6ae..2f67999 100644 --- a/Heroes.ReplayParser/MPQFiles/ReplayServerBattlelobby.cs +++ b/Heroes.ReplayParser/MPQFiles/ReplayServerBattlelobby.cs @@ -126,7 +126,18 @@ private static void DetailedParse(BitReader bitReader, Replay replay, uint s2maC } if (replay.ReplayBuild >= 85027) - bitReader.ReadByte(); // could contain m_disabledHeroList + { + // m_disabledHeroList + uint disabledHeroListLength = bitReader.Read(8); + + for (int i = 0; i < disabledHeroListLength; i++) + { + string disabledHeroAttributeId = bitReader.ReadStringFromBits(32, true); + + if (replay.DisabledHeroes.Count == 0) + replay.DisabledHeroes.Add(disabledHeroAttributeId); + } + } // Player info // ------------------------ diff --git a/Heroes.ReplayParser/Replay.cs b/Heroes.ReplayParser/Replay.cs index 9dfff72..76ed64c 100644 --- a/Heroes.ReplayParser/Replay.cs +++ b/Heroes.ReplayParser/Replay.cs @@ -85,6 +85,9 @@ public class Replay /// Gets the draft order. Picks, bans, and swaps. public List DraftOrder { get; set; } = new List(); + /// Gets the disabled heroes as attributeIds. + public List DisabledHeroes { get; set; } = new List(); + public bool IsGameEventsParsedSuccessfully { get; set; } = false; public bool? IsStatisticsParsedSuccessfully { get; set; } = null; }