public async Task <bool> Update() { if (_dataProvider.InAdventureScreen) { var shouldBreak = UpdateDungeonInfo(); if (shouldBreak) { return(true); } } else if (_dataProvider.InAiMatch && !string.IsNullOrEmpty(_dataProvider.OpponentHeroId)) { if (Cards.All.TryGetValue(_dataProvider.OpponentHeroId, out var card)) { if (new [] { CardSet.LOOTAPALOOZA, CardSet.GILNEAS, CardSet.DALARAN, CardSet.ULDUM }.Contains(card.Set) && card.Id.Contains("BOSS") || card.Set == CardSet.TROLL && card.Id.EndsWith("h")) { if (card.Set == CardSet.DALARAN) { UpdateDungeonInfo(); await Task.Delay(500); } var newRun = _initialOpponents.Contains(_dataProvider.OpponentHeroId) || _dataProvider.OpponentHeroHealth == 10; DungeonRunMatchStarted?.Invoke(newRun, card.Set); return(true); } } } return(false); }
public override UpdateResult Update() { if (_dataProvider.InAdventureScreen) { var dungeonInfo = _dataProvider.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; DungeonRunDeckUpdated?.Invoke(new DungeonRunDeckUpdatedEventArgs(BuildDeck(dungeonInfo[i]))); } } else { _prevCards[i] = null; } } if (_prevLootChoice.All(x => x > 0)) { return(UpdateResult.Break); } } else { _prevCards = new List <int>[] { null, null } }; } else if (_dataProvider.InAiMatch && !string.IsNullOrEmpty(_dataProvider.OpponentHeroId)) { if (Cards.All.TryGetValue(_dataProvider.OpponentHeroId, out var card)) { if (DungeonRun.IsDungeonBoss(card)) { var newRun = _initialOpponents.Contains(_dataProvider.OpponentHeroId); var deck = newRun ? DungeonRun.GetDefaultDeck(_dataProvider.LocalPlayerClass, card.Set) : null; DungeonRunMatchStarted?.Invoke(new DungeonRunMatchStartedEventArgs(newRun, deck)); return(UpdateResult.Break); } } } return(UpdateResult.Continue); }
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); }
internal virtual void OnDungeonRunMatchStarted(DungeonRunMatchStartedEventArgs args) => DungeonRunMatchStarted?.Invoke(args);