Skip to content

Commit

Permalink
Add GoodItem sound
Browse files Browse the repository at this point in the history
  • Loading branch information
C1rdec committed Nov 18, 2021
1 parent 23454cf commit b85066b
Show file tree
Hide file tree
Showing 27 changed files with 290 additions and 46 deletions.
6 changes: 3 additions & 3 deletions Lurker.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29418.71
# Visual Studio Version 17
VisualStudioVersion = 17.1.31903.286
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lurker.Console", "src\Lurker.Console\Lurker.Console.csproj", "{70F00AAB-C386-4656-946D-EF9E9334BC14}"
EndProject
Expand All @@ -23,7 +23,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
appveyor.yml = appveyor.yml
PoeLurker.ruleset = PoeLurker.ruleset
stylecop.json = stylecop.json
XpertdocVsPowerTools-Settings.json = XpertdocVsPowerTools-Settings.json
WoshVsPowerTools-Settings.json = WoshVsPowerTools-Settings.json
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lurker.Uninstall", "src\Lurker.Uninstall\Lurker.Uninstall.csproj", "{0BC827AB-E8E2-4D60-8394-5B07841285DA}"
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/Lurker.Console/Lurker.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
<Reference Include="LiteDB, Version=5.0.4.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
<HintPath>..\..\packages\LiteDB.5.0.4\lib\net45\LiteDB.dll</HintPath>
</Reference>
<Reference Include="Lurker.Patreon, Version=1.3.10.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Lurker.Patreon.1.3.10\lib\net48\Lurker.Patreon.dll</HintPath>
<Reference Include="Lurker.Patreon, Version=1.3.12.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Lurker.Patreon.1.3.12\lib\net48\Lurker.Patreon.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
Expand Down Expand Up @@ -78,7 +78,7 @@
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Evaluation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fc6d2b461e7db6ac, processorArchitecture=MSIL">
<HintPath>..\..\packages\Lurker.Patreon.1.3.10\lib\net48\System.Evaluation.dll</HintPath>
<HintPath>..\..\packages\Lurker.Patreon.1.3.12\lib\net48\System.Evaluation.dll</HintPath>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
Expand Down
2 changes: 1 addition & 1 deletion src/Lurker.Console/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<packages>
<package id="ConfOxide" version="1.4.2.0" targetFramework="net48" />
<package id="LiteDB" version="5.0.4" targetFramework="net48" />
<package id="Lurker.Patreon" version="1.3.10" targetFramework="net48" />
<package id="Lurker.Patreon" version="1.3.12" targetFramework="net48" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net48" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net48" />
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.7" targetFramework="net48" />
Expand Down
6 changes: 3 additions & 3 deletions src/Lurker.DataParser/Lurker.DataParser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
<Reference Include="LiteDB, Version=5.0.4.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
<HintPath>..\..\packages\LiteDB.5.0.4\lib\net45\LiteDB.dll</HintPath>
</Reference>
<Reference Include="Lurker.Patreon, Version=1.3.10.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Lurker.Patreon.1.3.10\lib\net48\Lurker.Patreon.dll</HintPath>
<Reference Include="Lurker.Patreon, Version=1.3.12.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Lurker.Patreon.1.3.12\lib\net48\Lurker.Patreon.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin, Version=2.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Owin.2.0.2\lib\net45\Microsoft.Owin.dll</HintPath>
Expand All @@ -68,7 +68,7 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Evaluation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fc6d2b461e7db6ac, processorArchitecture=MSIL">
<HintPath>..\..\packages\Lurker.Patreon.1.3.10\lib\net48\System.Evaluation.dll</HintPath>
<HintPath>..\..\packages\Lurker.Patreon.1.3.12\lib\net48\System.Evaluation.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion src/Lurker.DataParser/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<package id="ConfOxide" version="1.4.2.0" targetFramework="net48" />
<package id="KeraLua" version="1.2.6" targetFramework="net48" />
<package id="LiteDB" version="5.0.4" targetFramework="net48" />
<package id="Lurker.Patreon" version="1.3.10" targetFramework="net48" />
<package id="Lurker.Patreon" version="1.3.12" targetFramework="net48" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net48" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net48" />
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.7" targetFramework="net48" />
Expand Down
15 changes: 12 additions & 3 deletions src/Lurker.UI/Lurker.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@
<Reference Include="LottieSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\LottieSharp.1.0.0\lib\net461\LottieSharp.dll</HintPath>
</Reference>
<Reference Include="Lurker.Patreon, Version=1.3.10.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Lurker.Patreon.1.3.10\lib\net48\Lurker.Patreon.dll</HintPath>
<Reference Include="Lurker.Patreon, Version=1.3.12.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Lurker.Patreon.1.3.12\lib\net48\Lurker.Patreon.dll</HintPath>
</Reference>
<Reference Include="MahApps.Metro, Version=1.6.5.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\MahApps.Metro.1.6.5\lib\net47\MahApps.Metro.dll</HintPath>
Expand Down Expand Up @@ -183,7 +183,7 @@
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Evaluation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fc6d2b461e7db6ac, processorArchitecture=MSIL">
<HintPath>..\..\packages\Lurker.Patreon.1.3.10\lib\net48\System.Evaluation.dll</HintPath>
<HintPath>..\..\packages\Lurker.Patreon.1.3.12\lib\net48\System.Evaluation.dll</HintPath>
</Reference>
<Reference Include="System.IO.Compression" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
Expand Down Expand Up @@ -294,6 +294,7 @@
<Compile Include="Models\SkillTimelineMessage.cs" />
<Compile Include="Models\TimelineInformation.cs" />
<Compile Include="Models\TimelineMessage.cs" />
<Compile Include="Models\TradeCompletedEvent.cs" />
<Compile Include="Models\UpdateState.cs" />
<Compile Include="Models\DoubleClickCommand.cs" />
<Compile Include="Models\BulbMessage.cs" />
Expand All @@ -317,6 +318,7 @@
<Compile Include="ViewModels\DeviceViewModel.cs" />
<Compile Include="ViewModels\GroupItemViewModel.cs" />
<Compile Include="ViewModels\HotkeyViewModel.cs" />
<Compile Include="ViewModels\LeagueViewModel.cs" />
<Compile Include="ViewModels\MapAffixViewModel.cs" />
<Compile Include="ViewModels\MapViewModel.cs" />
<Compile Include="ViewModels\OfferDetailsViewModel.cs" />
Expand Down Expand Up @@ -409,6 +411,9 @@
<Compile Include="Views\ItemOverlayView.xaml.cs">
<DependentUpon>ItemOverlayView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\LeagueView.xaml.cs">
<DependentUpon>LeagueView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\LineChartView.xaml.cs">
<DependentUpon>LineChartView.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -570,6 +575,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\LeagueView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\LineChartView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
15 changes: 15 additions & 0 deletions src/Lurker.UI/Models/TradeCompletedEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//-----------------------------------------------------------------------
// <copyright file="TradeCompletedEvent.cs" company="Wohs Inc.">
// Copyright © Wohs Inc.
// </copyright>
//-----------------------------------------------------------------------

namespace Lurker.UI.Models
{
/// <summary>
/// Represents an event when a trade is completed.
/// </summary>
public class TradeCompletedEvent
{
}
}
6 changes: 6 additions & 0 deletions src/Lurker.UI/ViewModels/BulbViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ protected virtual void SetAction(BulbMessage message)
this._stickyActionView = this._actionView;
}

var disposableView = this.ActionView as IDisposable;
if (disposableView != null)
{
disposableView.Dispose();
}

this.Action = message.Action;
this.ActionView = message.View;

Expand Down
8 changes: 4 additions & 4 deletions src/Lurker.UI/ViewModels/DashboardViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ namespace Lurker.UI.ViewModels
using System.Collections.Generic;
using System.Linq;
using Caliburn.Micro;
using Lurker.Patreon;
using Lurker.Patreon.Events;
using Lurker.Patreon.Models;
using Lurker.Patreon.Services;
using Lurker.UI.Extensions;
using Lurker.UI.Models;
using Patreon = Lurker.Patreon.Models;

/// <summary>
/// Represents the DashboardViewModel.
Expand Down Expand Up @@ -366,7 +366,7 @@ private List<League> FilterLeagueNames(IEnumerable<string> leagues)
/// <param name="e">The e.</param>
private void ItemClassChart_OnSerieClick(object sender, LiveCharts.ChartPoint e)
{
if (Enum.TryParse<ItemClass>(e.SeriesView.Title, true, out var value))
if (Enum.TryParse<Patreon.ItemClass>(e.SeriesView.Title, true, out var value))
{
var trades = this._leagueTrades.Where(t => t.ItemClass == value);
var chart = new ColumnChartViewModel(trades.Select(t => t.ItemName).ToArray());
Expand Down Expand Up @@ -476,7 +476,7 @@ private PieChartViewModel CreateItemClassChart()
/// <param name="e">The e.</param>
private void OnSerieClick(object sender, LiveCharts.ChartPoint e)
{
if (Enum.TryParse<CurrencyType>(e.SeriesView.Title, true, out var value))
if (Enum.TryParse<Patreon.CurrencyType>(e.SeriesView.Title, true, out var value))
{
var trades = this._leagueTrades.Where(t => t.Price.CurrencyType == value);
var chart = new ColumnChartViewModel(trades.Select(t => t.ItemName).ToArray());
Expand Down
1 change: 1 addition & 0 deletions src/Lurker.UI/ViewModels/HideoutViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace Lurker.UI.ViewModels
using Lurker.Helpers;
using Lurker.Models;
using Lurker.Services;
using Lurker.UI.Models;

/// <summary>
/// Represents the Hideout overlay.
Expand Down
5 changes: 5 additions & 0 deletions src/Lurker.UI/ViewModels/ItemOverlayViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public ItemOverlayViewModel(PoeItem item)

#region Properties

/// <summary>
/// Gets a value indicating whether the item is good.
/// </summary>
public bool IsGood => this._item.IsGood();

/// <summary>
/// Gets the suffix count.
/// </summary>
Expand Down
111 changes: 111 additions & 0 deletions src/Lurker.UI/ViewModels/LeagueViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
//-----------------------------------------------------------------------
// <copyright file="LeagueViewModel.cs" company="Wohs Inc.">
// Copyright © Wohs Inc.
// </copyright>
//-----------------------------------------------------------------------

namespace Lurker.UI.ViewModels
{
using System;
using System.Linq;
using System.Threading.Tasks;
using Caliburn.Micro;
using Lurker.Patreon.Extensions;
using Lurker.Patreon.Services;
using Lurker.UI.Models;

/// <summary>
/// Represents a league.
/// </summary>
public class LeagueViewModel : Caliburn.Micro.PropertyChangedBase, IDisposable, IHandle<TradeCompletedEvent>
{
#region Fields

private IEventAggregator _eventAggregator;
private bool _animate;
private Task _currentTask;

#endregion

#region Constructors

/// <summary>
/// Initializes a new instance of the <see cref="LeagueViewModel"/> class.
/// </summary>
/// <param name="eventAggregator">The event aggregator.</param>
public LeagueViewModel(IEventAggregator eventAggregator)
{
this._eventAggregator = eventAggregator;
this._eventAggregator.Subscribe(this);
}

#endregion

#region Properties

/// <summary>
/// Gets or sets a value indicating whether animate.
/// </summary>
public bool Animate
{
get
{
return this._animate;
}

set
{
this._animate = value;
this.NotifyOfPropertyChange();
}
}

/// <summary>
/// Gets or sets the trade value.
/// </summary>
public double Value { get; set; }

/// <summary>
/// Dispose.
/// </summary>
public void Dispose()
{
this._eventAggregator.Unsubscribe(this);
}

#endregion

#region MyRegion

/// <summary>
/// Handle trade complemented event.
/// </summary>
/// <param name="message">The message.</param>
public async void Handle(TradeCompletedEvent message)
{
if (this._currentTask != null)
{
await this._currentTask;
this._currentTask = null;
}

this._currentTask = this.SetValue();
}

private async Task SetValue()
{
using (var service = new DatabaseService())
{
var league = service.GetLatestLeague();
this.Value = league.Trades.Where(t => !t.IsOutgoing).Select(t => t.Price.CalculateValue()).Sum();
this.NotifyOfPropertyChange(() => this.Value);
}

this.Animate = true;
await Task.Delay(4000);
this.Animate = false;
}

#endregion
}
}
2 changes: 1 addition & 1 deletion src/Lurker.UI/ViewModels/ManaBulbViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ namespace Lurker.UI.ViewModels
using Lurker.Models;
using Lurker.Services;
using Lurker.UI.Models;
using Lurker.UI.Views;

/// <summary>
/// Represents the Manabulbviewmodel.
Expand Down Expand Up @@ -181,6 +180,7 @@ private void Lurker_LocationChanged(object sender, Patreon.Events.LocationChange
var message = new ManaBulbMessage()
{
Action = this.DefaultAction,
View = new LeagueViewModel(this._eventAggregator),
};
this.SetAction(message);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Lurker.UI/ViewModels/OutgoingbarViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace Lurker.UI.ViewModels
using Lurker.Helpers;
using Lurker.Models;
using Lurker.Patreon.Events;
using Lurker.Patreon.Services;
using Lurker.Services;
using Lurker.UI.Extensions;
using Lurker.UI.Models;
Expand Down Expand Up @@ -278,7 +279,7 @@ private async void Lurker_TradeAccepted(object sender, Patreon.Events.TradeAccep
/// <param name="tradeEvent">The trade event.</param>
private void InsertEvent(TradeEvent tradeEvent)
{
using (var service = new Patreon.DatabaseService())
using (var service = new DatabaseService())
{
service.Insert(tradeEvent);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Lurker.UI/ViewModels/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,14 +378,14 @@ public bool NotConnected
{
get
{
return !new Patreon.TokenService().Connected;
return !new TokenService().Connected;
}
}

/// <summary>
/// Gets the patreon identifier.
/// </summary>
public string PatreonId => new Patreon.TokenService().PatreonId;
public string PatreonId => new TokenService().PatreonId;

/// <summary>
/// Gets or sets a value indicating whether this <see cref="SettingsViewModel"/> is pledging.
Expand Down
Loading

0 comments on commit b85066b

Please sign in to comment.