public bool Update() { if (_dataProvider.InAdventureScreen) { var dungeonInfo = Reflection.GetDungeonInfo(); if (dungeonInfo != null) { for (var i = 0; i < dungeonInfo.Length; i++) { if (dungeonInfo[i]?.RunActive ?? false) { if (_prevCards[i] == null || !dungeonInfo[i].DbfIds.SequenceEqual(_prevCards[i]) || _prevLootChoice[i] != dungeonInfo[i].PlayerChosenLoot || _prevTreasureChoice[i] != dungeonInfo[i].PlayerChosenTreasure) { _prevCards[i] = dungeonInfo[i].DbfIds.ToList(); _prevLootChoice[i] = dungeonInfo[i].PlayerChosenLoot; _prevTreasureChoice[i] = dungeonInfo[i].PlayerChosenTreasure; DungeonInfoChanged?.Invoke(dungeonInfo[i]); } } else { _prevCards[i] = null; } } if (_prevLootChoice.All(x => x > 0) && _prevTreasureChoice.All(x => x > 0)) { return(true); } } else { _prevCards = new List <int>[] { null, null, null }; } } else if (_dataProvider.InAiMatch && !string.IsNullOrEmpty(_dataProvider.OpponentHeroId)) { if (Cards.All.TryGetValue(_dataProvider.OpponentHeroId, out var card)) { if (new [] { CardSet.LOOTAPALOOZA, CardSet.GILNEAS }.Contains(card.Set) && card.Id.Contains("BOSS") || card.Set == CardSet.TROLL && card.Id.EndsWith("h")) { var newRun = _initialOpponents.Contains(_dataProvider.OpponentHeroId) || _dataProvider.OpponentHeroHealth == 10; DungeonRunMatchStarted?.Invoke(newRun); return(true); } } } return(false); }
public bool Update() { if (_dataProvider.InAdventureScreen) { var dungeonInfo = Reflection.GetDungeonInfo(); if (dungeonInfo?.RunActive ?? false) { if (_prevCards == null || !dungeonInfo.DbfIds.SequenceEqual(_prevCards) || _prevLootChoice != dungeonInfo.PlayerChosenLoot || _prevTreasureChoice != dungeonInfo.PlayerChosenTreasure) { _prevCards = dungeonInfo.DbfIds.ToList(); _prevLootChoice = dungeonInfo.PlayerChosenLoot; _prevTreasureChoice = dungeonInfo.PlayerChosenTreasure; DungeonInfoChanged?.Invoke(dungeonInfo); if (_prevLootChoice > 0 && _prevTreasureChoice > 0) { return(true); } } } else { _prevCards = null; } } else if (_dataProvider.InAiMatch && !string.IsNullOrEmpty(_dataProvider.OpponentHeroId)) { if (Cards.All.TryGetValue(_dataProvider.OpponentHeroId, out var card)) { if (card.Set == CardSet.LOOTAPALOOZA && card.Id.Contains("BOSS")) { var newRun = _initialOpponents.Contains(_dataProvider.OpponentHeroId); DungeonRunMatchStarted?.Invoke(newRun); return(true); } } } return(false); }
public bool UpdateDungeonInfo() { var dungeonInfo = Reflection.GetDungeonInfo(); if (dungeonInfo != null) { for (var i = 0; i < dungeonInfo.Length; i++) { if (dungeonInfo[i] != null && (dungeonInfo[i].RunActive || dungeonInfo[i].SelectedDeckId != 0)) { if (_prevCards[i] == null || _prevCards[i].Count != (dungeonInfo[i].DbfIds?.Count ?? 0) || _prevLootChoice[i] != dungeonInfo[i].PlayerChosenLoot || _prevTreasureChoice[i] != dungeonInfo[i].PlayerChosenTreasure) { _prevCards[i] = dungeonInfo[i].DbfIds?.ToList() ?? new List <int>(); _prevLootChoice[i] = dungeonInfo[i].PlayerChosenLoot; _prevTreasureChoice[i] = dungeonInfo[i].PlayerChosenTreasure; DungeonInfoChanged?.Invoke(dungeonInfo[i]); } } else { _prevCards[i] = null; } } if (_prevLootChoice.All(x => x > 0) && _prevTreasureChoice.All(x => x > 0)) { return(true); } } else { _prevCards = new List <int>[] { null, null, null, null, null, null, null }; } return(false); }