diff --git a/Artemis/Artemis/App.config b/Artemis/Artemis/App.config
index 6eb4fe3f8..1f453afa7 100644
--- a/Artemis/Artemis/App.config
+++ b/Artemis/Artemis/App.config
@@ -36,6 +36,24 @@
True
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ #FFFF0000
+
+
+ #FF0000FF
+
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..bcd46002b 100644
--- a/Artemis/Artemis/Modules/Games/Dota2/Dota2.Designer.cs
+++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2.Designer.cs
@@ -70,5 +70,77 @@ 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;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("#FFFF0000")]
+ public global::System.Windows.Media.Color MainColor {
+ get {
+ return ((global::System.Windows.Media.Color)(this["MainColor"]));
+ }
+ set {
+ this["MainColor"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("#FF0000FF")]
+ public global::System.Windows.Media.Color ManaColor {
+ get {
+ return ((global::System.Windows.Media.Color)(this["ManaColor"]));
+ }
+ set {
+ this["ManaColor"] = value;
+ }
+ }
}
}
diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings b/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings
index 7444214e6..064cc8115 100644
--- a/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings
+++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings
@@ -14,5 +14,23 @@
True
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ #FFFF0000
+
+
+ #FF0000FF
+
\ 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 1f4862088..bcb6f21e9 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;
@@ -13,6 +14,7 @@ using Artemis.Utilities.Keyboard;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Artemis.Modules.Games.Dota2;
+using Artemis.Utilities;
namespace Artemis.Modules.Games.Dota2
{
@@ -20,6 +22,7 @@ namespace Artemis.Modules.Games.Dota2
{
private KeyboardRegion _topRow;
+ private KeyboardRegion _keyPad;
public Dota2Model(MainManager mainManager, Dota2Settings settings) : base(mainManager)
{
Settings = settings;
@@ -35,8 +38,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 +55,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,32 +96,107 @@ namespace Artemis.Modules.Games.Dota2
if (D2Json == null)
return;
+ if (Settings.ShowDead && D2Json?.hero?.alive != null && !D2Json.hero.alive)
+ {
+ UpdateLifeStatus();
+ return;
+ }
+ UpdateMainColor();
if (Settings.CanCastAbility)
UpdateAbilities();
if (Settings.ShowHealth)
UpdateHealth();
+ if (Settings.ShowDayCycle)
+ UpdateDay();
+ if (Settings.ShowMana)
+ UpdateMana();
+ if (Settings.CanCastItem)
+ UpdateItems();
+
+
+
}
- private void UpdateHealth()
+ private void UpdateMainColor()
{
- 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};
+ var list = new List { ColorHelpers.ToDrawingColor(Settings.MainColor) };
+ EventRectangle.Colors = list;
+ DayCycleRectangle.Colors = list;
+ HealthRectangle.Colors = list;
+ ManaRectangle.Colors = list;
+ }
+
+ private void UpdateLifeStatus()
+ {
+ var list = new List { Color.LightGray };
+ EventRectangle.Colors = list;
+ DayCycleRectangle.Colors = list;
+ HealthRectangle.Colors = list;
+ ManaRectangle.Colors = list;
}
+ 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 { ColorHelpers.ToDrawingColor(Settings.ManaColor) };
+ 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);
@@ -96,7 +204,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..2332a99dd 100644
--- a/Artemis/Artemis/Modules/Games/Dota2/Dota2Settings.cs
+++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2Settings.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Windows.Media;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -20,33 +21,60 @@ 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; }
+ public Color MainColor { get; set; }
+ public Color ManaColor { get; set; }
#endregion
public override void Load()
{
+ MainColor = Dota2.Default.MainColor;
+ ManaColor = Dota2.Default.ManaColor;
ShowHealth = Dota2.Default.ShowHealth;
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.MainColor = MainColor;
+ Dota2.Default.ManaColor = ManaColor;
+ 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()
{
+
+ Enabled = true;
+ GameDirectory = string.Empty;
+
+ MainColor = Color.FromArgb(255,255,0,0);
+ ManaColor = Color.FromArgb(255,0,0,255);
ShowHealth = true;
CanCastAbility = true;
- Enabled = false;
- GameDirectory = string.Empty;
+ 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..5648d2de4 100644
--- a/Artemis/Artemis/Modules/Games/Dota2/Dota2View.xaml
+++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2View.xaml
@@ -5,8 +5,9 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:cal="http://www.caliburnproject.org"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
+ xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
- d:DesignHeight="424" d:DesignWidth="635">
+ d:DesignHeight="495" d:DesignWidth="635">
@@ -23,13 +24,15 @@
+
+
@@ -41,6 +44,8 @@
+
+
@@ -56,30 +61,89 @@
+
+
+ Main keyboard color
+
+
+
-
- Show abilities that can be cast.
+
+ Castable abilities
-
-
+
+
+
+ Castable items
+
+
+
-
- Show health on F-Keys.
+
+ Display health
-
-
-
-
-
+
+
+
+ Display mana
+
+
+
+
+
+ Mana color
+
+
+
+
+
+ Display day/night
+
+
+
+
+
+ Display gray when dead
+
+
+
+
+
+
+
+
+
diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2ViewModel.cs b/Artemis/Artemis/Modules/Games/Dota2/Dota2ViewModel.cs
index 73f1c9dde..4e6fad97a 100644
--- a/Artemis/Artemis/Modules/Games/Dota2/Dota2ViewModel.cs
+++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2ViewModel.cs
@@ -63,7 +63,7 @@ namespace Artemis.Modules.Games.Dota2
}
MainManager.DialogService.ShowErrorMessageBox("Please select a valid Dota 2 directory\n\n" +
- @"By default Dota 2 is in \SteamApps\common\Dota2");
+ @"By default Dota 2 is in \SteamApps\common\dota 2 beta");
((Dota2Settings)GameSettings).GameDirectory = string.Empty;
NotifyOfPropertyChange(() => GameSettings);