diff --git a/Artemis/Artemis/App.config b/Artemis/Artemis/App.config
index 6eb4fe3f8..e85c8a403 100644
--- a/Artemis/Artemis/App.config
+++ b/Artemis/Artemis/App.config
@@ -36,6 +36,18 @@
True
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
diff --git a/Artemis/Artemis/KeyboardProviders/Corsair/CorsairRGB.cs b/Artemis/Artemis/KeyboardProviders/Corsair/CorsairRGB.cs
index 219b237da..0eb38f5e3 100644
--- a/Artemis/Artemis/KeyboardProviders/Corsair/CorsairRGB.cs
+++ b/Artemis/Artemis/KeyboardProviders/Corsair/CorsairRGB.cs
@@ -74,19 +74,24 @@ namespace Artemis.KeyboardProviders.Corsair
Height = 7;
Width = 24;
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(1, 0), new Point(1, 20)));
+ KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(2, 21), new Point(7, 25)));
break;
case "K70 RGB":
Height = 7;
Width = 21;
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(1, 0), new Point(1, 16)));
+ KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(2, 17), new Point(7, 21)));
break;
case "K65 RGB":
Height = 7;
Width = 18;
+ KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(1, 0), new Point(1, 16)));
+ KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(2, 17), new Point(7, 21)));
break;
case "STRAFE RGB":
Height = 7;
KeyboardRegions.Add(new KeyboardRegion("TopRow", new Point(1, 0), new Point(1, 16)));
+ KeyboardRegions.Add(new KeyboardRegion("NumPad", new Point(2, 17), new Point(7, 21)));
Width = 22;
break;
}
diff --git a/Artemis/Artemis/KeyboardProviders/Logitech/Orion.cs b/Artemis/Artemis/KeyboardProviders/Logitech/Orion.cs
index ffdf2bba0..e41080672 100644
--- a/Artemis/Artemis/KeyboardProviders/Logitech/Orion.cs
+++ b/Artemis/Artemis/KeyboardProviders/Logitech/Orion.cs
@@ -16,7 +16,11 @@ namespace Artemis.KeyboardProviders.Logitech
"If needed, you can select a different keyboard in Artemis under settings.";
Height = 6;
Width = 21;
- KeyboardRegions = new List {new KeyboardRegion("TopRow", new Point(0, 0), new Point(0, 16))};
+ KeyboardRegions = new List
+ {
+ new KeyboardRegion("TopRow", new Point(0, 0), new Point(0, 16)),
+ new KeyboardRegion("NumPad", new Point(0, 17), new Point(0, 25))
+ };
}
public override bool CanEnable()
diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2.Designer.cs b/Artemis/Artemis/Modules/Games/Dota2/Dota2.Designer.cs
index f40fe2afa..07b71ff5c 100644
--- a/Artemis/Artemis/Modules/Games/Dota2/Dota2.Designer.cs
+++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2.Designer.cs
@@ -70,5 +70,53 @@ namespace Artemis.Modules.Games.Dota2 {
this["ShowHealth"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool ShowDayCycle {
+ get {
+ return ((bool)(this["ShowDayCycle"]));
+ }
+ set {
+ this["ShowDayCycle"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool CanCastItem {
+ get {
+ return ((bool)(this["CanCastItem"]));
+ }
+ set {
+ this["CanCastItem"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool ShowMana {
+ get {
+ return ((bool)(this["ShowMana"]));
+ }
+ set {
+ this["ShowMana"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool ShowDead {
+ get {
+ return ((bool)(this["ShowDead"]));
+ }
+ set {
+ this["ShowDead"] = value;
+ }
+ }
}
}
diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings b/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings
index 7444214e6..e1b994e94 100644
--- a/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings
+++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings
@@ -14,5 +14,17 @@
True
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs b/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs
index d0c1f362f..caea1d196 100644
--- a/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs
+++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
+using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -20,6 +21,7 @@ namespace Artemis.Modules.Games.Dota2
{
private KeyboardRegion _topRow;
+ private KeyboardRegion _keyPad;
public Dota2Model(MainManager mainManager, Dota2Settings settings) : base(mainManager)
{
Settings = settings;
@@ -35,8 +37,10 @@ namespace Artemis.Modules.Games.Dota2
public Dota2Settings Settings { get; set; }
public Dota2DataModel.Rootobject D2Json { get; set; }
public int Scale { get; set; }
- public KeyboardRectangle HealthRect { get; set; }
-
+ public KeyboardRectangle HealthRectangle { get; set; }
+ public KeyboardRectangle EventRectangle { get; set; }
+ public KeyboardRectangle DayCycleRectangle { get; set; }
+ public KeyboardRectangle ManaRectangle { get; set; }
#endregion
@@ -50,10 +54,38 @@ namespace Artemis.Modules.Games.Dota2
{
Initialized = false;
_topRow = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRegions.First(r => r.RegionName == "TopRow");
- HealthRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, _topRow.TopLeft.X,
- new List(),
- LinearGradientMode.Horizontal)
+ _keyPad = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRegions.First(r => r.RegionName == "NumPad");
+ HealthRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard
+ , 0
+ , _topRow.TopLeft.X
+ , new List()
+ , LinearGradientMode.Horizontal)
{ Height = Scale, ContainedBrush = false };
+
+ ManaRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard
+ , 0
+ , _topRow.TopLeft.X+1
+ , new List()
+ , LinearGradientMode.Horizontal)
+ { Height = Scale, ContainedBrush = false };
+
+ EventRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard
+ , 0
+ , _topRow.TopLeft.X + 2
+ , new List()
+ , LinearGradientMode.Horizontal )
+ {Height = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale - Scale
+ , Width = MainManager.KeyboardManager.ActiveKeyboard.Width*Scale-Scale-12};
+
+ DayCycleRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard
+ , _keyPad.BottomRight.X * 3
+ , _keyPad.TopLeft.X
+ , new List()
+ , LinearGradientMode.Horizontal)
+ {
+ Height = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale - Scale,
+ Width = MainManager.KeyboardManager.ActiveKeyboard.Width - (MainManager.KeyboardManager.ActiveKeyboard.Width * Scale - Scale - 12)
+ };
MainManager.GameStateWebServer.GameDataReceived += HandleGameData;
Initialized = true;
}
@@ -63,41 +95,90 @@ namespace Artemis.Modules.Games.Dota2
if (D2Json == null)
return;
+ if (Settings.ShowDead)
+ UpdateDead();
if (Settings.CanCastAbility)
UpdateAbilities();
if (Settings.ShowHealth)
UpdateHealth();
- /*
- * if (Settings.ShowDayCycle)
- * UpdateDay();
- * if (Settings.ShowMana) //Not sure if this is in the Json. Will check when I get home
- * UpdateMana();
- * if (Settings.CanCastItems)
- * UpdateItems();
- * if (Settings.) //Add something
- */
+ if (Settings.ShowDayCycle)
+ UpdateDay();
+ if (Settings.ShowMana)
+ UpdateMana();
+ if (Settings.CanCastItem)
+ UpdateItems();
+
}
- private void UpdateHealth()
+ private void UpdateDead()
{
- var health = D2Json.hero.health_percent;
- if(health > 66)
- HealthRect.Colors = new List { Color.Lime };
- else if (health > 33)
- HealthRect.Colors = new List {Color.Yellow};
- else
- HealthRect.Colors = new List {Color.Red};
-
+ if (D2Json?.hero?.alive == null)
+ return;
+
+ EventRectangle.Colors = D2Json.hero.alive ? new List { Color.Lime } : new List {Color.LightGray};
+ }
+
+ private void UpdateDay()
+ {
+
+ if (D2Json?.map?.daytime == null)
+ return;
+
+ if (D2Json.map.nightstalker_night)
+ {
+ DayCycleRectangle.Colors = new List { Color.Blue };
+ return;
+ }
+
+ var timeLeft = 240 - (D2Json.map.clock_time % 240);
+ double width = (int) ((MainManager.KeyboardManager.ActiveKeyboard.Width*Scale - (MainManager.KeyboardManager.ActiveKeyboard.Width * Scale - Scale*Scale)) * (timeLeft/240D)) ;
+ DayCycleRectangle.Width = (int) (width/2) > 1 ? (int)(width / 2)+1 : (int)(width / 2);
+ DayCycleRectangle.Colors = D2Json.map.daytime ? new List { Color.Yellow } : new List { Color.Blue };
+
+ }
+
+ private void UpdateMana()
+ {
+ if (D2Json?.hero == null || D2Json.hero.mana_percent == -1)
+ return;
+
+ var manaPercent = D2Json.hero.mana_percent;
+ ManaRectangle.Colors = new List {Color.Blue};
+ ManaRectangle.Width = (int)Math.Floor(_topRow.BottomRight.Y / 100.00 * manaPercent) * Scale;
+ }
+
+ private void UpdateItems()
+ {
+ //throw new NotImplementedException();
}
private void UpdateAbilities()
{
- Console.WriteLine();
+ //Console.WriteLine();
//Update keys according to the abilities they take.
}
+
+ private void UpdateHealth()
+ {
+ if (D2Json?.hero == null || D2Json.hero.health_percent == -1)
+ return;
+
+ var healthPercent = D2Json.hero.health_percent;
+ if(healthPercent > 66)
+ HealthRectangle.Colors = new List { Color.Lime };
+ else if (healthPercent > 33)
+ HealthRectangle.Colors = new List {Color.Yellow};
+ else
+ HealthRectangle.Colors = new List {Color.Red};
+
+ HealthRectangle.Width = (int)Math.Floor(_topRow.BottomRight.Y / 100.00 * healthPercent) * Scale;
+
+ }
+
+
public override Bitmap GenerateBitmap()
{
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
@@ -105,7 +186,11 @@ namespace Artemis.Modules.Games.Dota2
using (var g = Graphics.FromImage(bitmap))
{
g.Clear(Color.Transparent);
- HealthRect.Draw(g);
+ EventRectangle.Draw(g);
+ HealthRectangle.Draw(g);
+ ManaRectangle.Draw(g);
+ DayCycleRectangle.Draw(g);
+
}
return bitmap;
}
diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2Settings.cs b/Artemis/Artemis/Modules/Games/Dota2/Dota2Settings.cs
index 971ac8243..a481522f9 100644
--- a/Artemis/Artemis/Modules/Games/Dota2/Dota2Settings.cs
+++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2Settings.cs
@@ -20,6 +20,10 @@ namespace Artemis.Modules.Games.Dota2
public string GameDirectory { get; set; }
public bool CanCastAbility { get; set; }
public bool ShowHealth { get; set; }
+ public bool ShowDayCycle { get; set; }
+ public bool CanCastItem { get; set; }
+ public bool ShowMana { get; set; }
+ public bool ShowDead { get; set; }
#endregion
@@ -29,24 +33,39 @@ namespace Artemis.Modules.Games.Dota2
CanCastAbility = Dota2.Default.CanCastAbility;
Enabled = Dota2.Default.Enabled;
GameDirectory = Dota2.Default.GameDirectory;
+ CanCastItem = Dota2.Default.CanCastItem;
+ ShowDayCycle = Dota2.Default.ShowDayCycle;
+ ShowMana = Dota2.Default.ShowMana;
+ ShowDead = Dota2.Default.ShowDead;
}
public override void Save()
{
+ Dota2.Default.ShowDayCycle = ShowDayCycle;
Dota2.Default.ShowHealth = ShowHealth;
Dota2.Default.CanCastAbility = CanCastAbility;
Dota2.Default.Enabled = Enabled;
Dota2.Default.GameDirectory = GameDirectory;
+ Dota2.Default.CanCastItem = CanCastItem;
+ Dota2.Default.ShowMana = ShowMana;
+ Dota2.Default.ShowDead = ShowDead;
Dota2.Default.Save();
}
public override void ToDefault()
{
- ShowHealth = true;
- CanCastAbility = true;
+
Enabled = false;
GameDirectory = string.Empty;
+
+ ShowHealth = true;
+ CanCastAbility = true;
+ ShowDayCycle = true;
+ CanCastItem = true;
+ ShowMana = true;
+ ShowDead = true;
+
}
}
}
diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2View.xaml b/Artemis/Artemis/Modules/Games/Dota2/Dota2View.xaml
index 5a90707c4..2c7f4f56c 100644
--- a/Artemis/Artemis/Modules/Games/Dota2/Dota2View.xaml
+++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2View.xaml
@@ -57,29 +57,68 @@
-
- Show abilities that can be cast.
+
+ Show abilities that can be cast.
-
-
+
+
+
+ Show items that can be cast.
+
+
+
-
- Show health on F-Keys.
+
+ Show health on F-Keys.
-
-
-
-
-
+
+
+
+ Show mana on the number keys.
+
+
+
+
+
+ Show day/night cycle.
+
+
+
+
+
+ Turn grey when dead.
+
+
+
+
+
+
+
+
+