Skip to content

Commit

Permalink
Merge pull request #6 from arkein/achievements-log
Browse files Browse the repository at this point in the history
Switch to Achievements log
  • Loading branch information
arkein authored Mar 10, 2019
2 parents 7817277 + f55006c commit bac8ba2
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Hearthstone_Treasury
{
public class GameplayLogHandler
public class AchievementsLogHandler
{
/// <summary>
/// Copied form Hearthstone_Deck_Tracker.HsLogReaderConstants.GoldRewardRegex, extended with Origin info
Expand All @@ -15,13 +15,13 @@ public class GameplayLogHandler
private AchievementProvider _provider;
private TransactionListViewModel _transactionList;

public GameplayLogHandler(AchievementProvider provider, TransactionListViewModel list)
public AchievementsLogHandler(AchievementProvider provider, TransactionListViewModel list)
{
_provider = provider;
_transactionList = list;
}

public void HandleGameplayLogUpdate(string logLine)
public void HandleAchievementsLogUpdate(string logLine)
{
if (GoldRewardExtendedRegex.IsMatch(logLine))
{
Expand Down Expand Up @@ -49,7 +49,7 @@ public void HandleGameplayLogUpdate(string logLine)
}

/// <summary>
/// Prevents completely duplicated transactions which are sometimes invoked by HDT Gameplay log handler.
/// Prevents completely duplicated transactions which are sometimes invoked by HDT Achievements log handler.
/// </summary>
/// <param name="transaction">Transaction to check for duplication</param>
/// <returns>true if already in the list</returns>
Expand Down
6 changes: 3 additions & 3 deletions Hearthstone Treasury/Hearthstone Treasury.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
<ItemGroup>
<Reference Include="De.TorstenMandelkow.MetroChart, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d5b8d1bbc99c4a2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ThirdParty\Hearthstone-Deck-Tracker\v1.7.16-x86\De.TorstenMandelkow.MetroChart.dll</HintPath>
<HintPath>..\ThirdParty\Hearthstone-Deck-Tracker\master-x86\De.TorstenMandelkow.MetroChart.dll</HintPath>
</Reference>
<Reference Include="HearthstoneDeckTracker, Version=1.7.16.0, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ThirdParty\Hearthstone-Deck-Tracker\v1.7.16-x86\HearthstoneDeckTracker.exe</HintPath>
<HintPath>..\ThirdParty\Hearthstone-Deck-Tracker\master-x86\HearthstoneDeckTracker.exe</HintPath>
</Reference>
<Reference Include="MahApps.Metro, Version=1.1.2.0, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.1.2.0\lib\net45\MahApps.Metro.dll</HintPath>
Expand Down Expand Up @@ -136,7 +136,7 @@
<Compile Include="Enums\CategoryEnum.cs" />
<Compile Include="Enums\OriginEnum.cs" />
<Compile Include="Enums\RewardType.cs" />
<Compile Include="GameplayLogHandler.cs" />
<Compile Include="AchievementsLogHandler.cs" />
<Compile Include="HearthstoneTreasuryPlugin.cs" />
<Compile Include="Models\Achievement.cs" />
<Compile Include="Models\AchievementDbf.cs" />
Expand Down
4 changes: 2 additions & 2 deletions Hearthstone Treasury/HearthstoneTreasuryPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void OnLoad()
var transactions = TransactionHelper.LoadTransactions(TransactionsFile) ?? new ReactiveList<TransactionViewModel>() { ChangeTrackingEnabled = true };
var transactionList = new TransactionListViewModel(transactions);

var logHandler = new GameplayLogHandler(_achievementProvider, transactionList);
var logHandler = new AchievementsLogHandler(_achievementProvider, transactionList);

_mainWindowModel = new MainWindowViewModel(Settings, transactionList);

Expand All @@ -96,7 +96,7 @@ public void OnLoad()
}
};

Hearthstone_Deck_Tracker.API.LogEvents.OnGameplayLogLine.Add(logHandler.HandleGameplayLogUpdate);
Hearthstone_Deck_Tracker.API.LogEvents.OnAchievementsLogLine.Add(logHandler.HandleAchievementsLogUpdate);
}

private AchievementProvider CreateNewAchievementProvider()
Expand Down
4 changes: 2 additions & 2 deletions Hearthstone Treasury/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.0.0")]
[assembly: AssemblyFileVersion("0.5.0.0")]
[assembly: AssemblyVersion("0.5.1.0")]
[assembly: AssemblyFileVersion("0.5.1.0")]
14 changes: 7 additions & 7 deletions Tests/AchievementProviderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ public void IsOutdatedLineTest() {
};
var provider = CreateDbfProvider();
var transactionList = new TransactionListViewModel(new ReactiveList<TransactionViewModel>());
var handler = new GameplayLogHandler(provider, transactionList);
var handler = new AchievementsLogHandler(provider, transactionList);

foreach (var logline in loglines)
{
handler.HandleGameplayLogUpdate(logline);
handler.HandleAchievementsLogUpdate(logline);
}

Assert.That(transactionList.Transactions.Count, Is.EqualTo(3));
Expand Down Expand Up @@ -94,18 +94,18 @@ public void DuplicateLinesTest()
};
var provider = CreateDbfProvider();
var transactionList = new TransactionListViewModel(new ReactiveList<TransactionViewModel>());
var handler = new GameplayLogHandler(provider, transactionList);
var handler = new AchievementsLogHandler(provider, transactionList);

foreach (var logline in loglines)
{
handler.HandleGameplayLogUpdate(logline);
handler.HandleAchievementsLogUpdate(logline);
}

Assert.That(transactionList.Transactions.Count, Is.EqualTo(3));

foreach (var logline in loglines)
{
handler.HandleGameplayLogUpdate(logline);
handler.HandleAchievementsLogUpdate(logline);
}

Assert.That(transactionList.Transactions.Count, Is.EqualTo(3));
Expand All @@ -132,7 +132,7 @@ public void DuplicateLinesTest()
[Test]
public void GoldRewardExtendedRegexTest() {
string singleLogLine = @"D 23:12:35.5158504 RewardUtils.GetViewableRewards() - processing reward [GoldRewardData: Amount=40 Origin=ACHIEVEMENT OriginData=39]";
var reward = GameplayLogHandler.CreateReward(singleLogLine);
var reward = AchievementsLogHandler.CreateReward(singleLogLine);

Assert.That(reward.Amount == 40);
Assert.That(reward.Origin == Hearthstone_Treasury.Enums.OriginEnum.ACHIEVEMENT);
Expand All @@ -147,7 +147,7 @@ public void ProvideCommentTest()

string singleLogLine = @"D 23:12:35.5158504 RewardUtils.GetViewableRewards() - processing reward [GoldRewardData: Amount=40 Origin=ACHIEVEMENT OriginData=39]";

var reward = GameplayLogHandler.CreateReward(singleLogLine);
var reward = AchievementsLogHandler.CreateReward(singleLogLine);

provider.ProvideComment(reward);

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit bac8ba2

Please sign in to comment.