diff --git a/src/Lurker.UI/App.config b/src/Lurker.UI/App.config
index 13c8e050..79a12435 100644
--- a/src/Lurker.UI/App.config
+++ b/src/Lurker.UI/App.config
@@ -4,8 +4,9 @@
-
-
+
+
+
diff --git a/src/Lurker.UI/Helpers/MessageHelper.cs b/src/Lurker.UI/Helpers/MessageHelper.cs
index 7c64f3ff..e6ad835e 100644
--- a/src/Lurker.UI/Helpers/MessageHelper.cs
+++ b/src/Lurker.UI/Helpers/MessageHelper.cs
@@ -16,8 +16,12 @@ public static class MessageHelper
{
#region Fields
+ private static readonly string DefaultStillInterestedMessage = $"Are you still interested in my {TokenHelper.ItemName} listed for {TokenHelper.Price}";
+ private static readonly string DefaultSoldMessage = $"I'm sorry, my {TokenHelper.ItemName} has already been sold.";
+
private static readonly Lazy BusyMessageLazy = new Lazy(() => GetSettingValue("BusyMessage", "I'm busy right now I'll send you a party invite."));
- private static readonly Lazy SoldMessageLazy = new Lazy(() => GetSettingValue("SoldMessage", "I'm sorry, that item has already been sold."));
+ private static readonly Lazy SoldMessageLazy = new Lazy(() => GetSettingValue("SoldMessage", DefaultSoldMessage));
+ private static readonly Lazy StillInterestedMessageLazy = new Lazy(() => GetSettingValue("StillInterestedMessage", DefaultStillInterestedMessage));
private static readonly Lazy ThanksMessageLazy = new Lazy(() => GetSettingValue("ThanksMessage", string.Empty));
#endregion
@@ -39,6 +43,11 @@ public static class MessageHelper
///
public static string ThanksMessage => ThanksMessageLazy.Value;
+ ///
+ /// Gets the still interested message.
+ ///
+ public static string StillInterestedMessage => StillInterestedMessageLazy.Value;
+
#endregion
#region Methods
diff --git a/src/Lurker.UI/Helpers/TokenHelper.cs b/src/Lurker.UI/Helpers/TokenHelper.cs
new file mode 100644
index 00000000..2df105ed
--- /dev/null
+++ b/src/Lurker.UI/Helpers/TokenHelper.cs
@@ -0,0 +1,40 @@
+//-----------------------------------------------------------------------
+//
+// Missing Copyright information from a valid stylecop.json file.
+//
+//-----------------------------------------------------------------------
+
+namespace Lurker.UI.Helpers
+{
+ using Lurker.UI.ViewModels;
+ using System.Text.RegularExpressions;
+
+ public static class TokenHelper
+ {
+ #region Fields
+
+ public static readonly string ItemName = "{ItemName}";
+ public static readonly string BuyerName = "{BuyerName}";
+ public static readonly string Price = "{Price}";
+
+ #endregion
+
+ #region Methods
+
+ ///
+ /// Replaces the token.
+ ///
+ /// The message.
+ /// The offer.
+ /// The string with token replaced
+ public static string ReplaceToken(string message, OfferViewModel offer)
+ {
+ message = Regex.Replace(message, ItemName, offer.ItemName, RegexOptions.IgnoreCase);
+ message = Regex.Replace(message, BuyerName, offer.PlayerName, RegexOptions.IgnoreCase);
+ message = Regex.Replace(message, Price, offer.Price.ToString(), RegexOptions.IgnoreCase);
+ return message;
+ }
+
+ #endregion
+ }
+}
diff --git a/src/Lurker.UI/Lurker.UI.csproj b/src/Lurker.UI/Lurker.UI.csproj
index 3818b7c7..3a57d1eb 100644
--- a/src/Lurker.UI/Lurker.UI.csproj
+++ b/src/Lurker.UI/Lurker.UI.csproj
@@ -127,6 +127,7 @@
+
diff --git a/src/Lurker.UI/Properties/AssemblyInfo.cs b/src/Lurker.UI/Properties/AssemblyInfo.cs
index f228cc6d..98cb231f 100644
--- a/src/Lurker.UI/Properties/AssemblyInfo.cs
+++ b/src/Lurker.UI/Properties/AssemblyInfo.cs
@@ -57,5 +57,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("1.2.0.0")]
-[assembly: AssemblyFileVersion("1.2.0.0")]
+[assembly: AssemblyVersion("1.2.1.0")]
+[assembly: AssemblyFileVersion("1.2.1.0")]
diff --git a/src/Lurker.UI/ViewModels/OfferViewModel.cs b/src/Lurker.UI/ViewModels/OfferViewModel.cs
index 73bb1b8e..37bfb7bf 100644
--- a/src/Lurker.UI/ViewModels/OfferViewModel.cs
+++ b/src/Lurker.UI/ViewModels/OfferViewModel.cs
@@ -70,6 +70,11 @@ public OfferViewModel(TradeEvent tradeEvent, PoeKeyboardHelper keyboardHelper, T
///
public CurrencyType CurrencyType => this._tradeEvent.Price.CurrencyType;
+ ///
+ /// Gets the price.
+ ///
+ public Price Price => this._tradeEvent.Price;
+
///
/// Gets or sets a value indicating whether this instance is invite sended.
///
@@ -158,7 +163,7 @@ public void Wait()
{
this._skipMainAction = true;
this.Waiting = true;
- this._keyboardHelper.Whisper(this.PlayerName, MessageHelper.BusyMessage);
+ this.Whisper(MessageHelper.BusyMessage);
}
///
@@ -166,7 +171,6 @@ public void Wait()
///
public void MainAction()
{
- // Alt cannot be use since we send Enter to the Keyboard
if (Keyboard.IsKeyDown(Key.LeftAlt) || Keyboard.IsKeyDown(Key.RightAlt))
{
this._tradebarContext.SetActiveOffer(this);
@@ -181,6 +185,12 @@ public void MainAction()
if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
{
+ if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
+ {
+ this.StillInterested();
+ return;
+ }
+
this.Sold();
return;
}
@@ -202,10 +212,18 @@ public void MainAction()
///
private void Sold()
{
- this._keyboardHelper.Whisper(this.PlayerName, MessageHelper.SoldMessage);
+ this.Whisper(MessageHelper.SoldMessage);
this.RemoveFromTradebar();
}
+ ///
+ /// Stills the interested.
+ ///
+ private void StillInterested()
+ {
+ this.Whisper(MessageHelper.StillInterestedMessage);
+ }
+
///
/// Invites the buyer.
///
@@ -233,6 +251,15 @@ private void RemoveFromTradebar()
this._tradebarContext.RemoveOffer(this);
}
+ ///
+ /// Whispers the specified message.
+ ///
+ /// The message.
+ private void Whisper(string message)
+ {
+ this._keyboardHelper.Whisper(this.PlayerName, TokenHelper.ReplaceToken(message, this));
+ }
+
#endregion
}
}
diff --git a/src/Lurker/Events/TradeEvent.cs b/src/Lurker/Events/TradeEvent.cs
index 7516da00..695fcfe5 100644
--- a/src/Lurker/Events/TradeEvent.cs
+++ b/src/Lurker/Events/TradeEvent.cs
@@ -41,6 +41,7 @@ public TradeEvent(string logLine)
var greetingMarker = GreetingMarkers.FirstOrDefault(m => this.Message.Contains(m));
this.ItemName = this.Message.Substring(greetingMarker.Length + 1, textBeforeMarker.Length - greetingMarker.Length -2);
+ this.SimplifyItemName();
// Location
var locationMarkerIndex = this.Message.IndexOf(LocationMarker);
@@ -128,7 +129,15 @@ public static Price ParsePrice(string priceValue)
};
}
- #endregion
+ private void SimplifyItemName()
+ {
+ var mapTierIndex = this.ItemName.IndexOf(" (T");
+ if (mapTierIndex != -1)
+ {
+ this.ItemName = this.ItemName.Substring(0, mapTierIndex);
+ }
+ }
+ #endregion
}
}