From c8ec7a1bfc31a1c5dd26d7f00021a53f2b4d2e11 Mon Sep 17 00:00:00 2001 From: Logan Saso Date: Tue, 15 Mar 2016 23:29:27 -0700 Subject: [PATCH] Changed Death to Events (Death included) --- Artemis/Artemis/App.config | 2 +- .../Modules/Games/Dota2/Dota2.Designer.cs | 6 +-- .../Modules/Games/Dota2/Dota2.settings | 2 +- .../Artemis/Modules/Games/Dota2/Dota2Model.cs | 51 ++++++++++++++----- .../Modules/Games/Dota2/Dota2Settings.cs | 8 +-- .../Modules/Games/Dota2/Dota2View.xaml | 4 +- 6 files changed, 48 insertions(+), 25 deletions(-) diff --git a/Artemis/Artemis/App.config b/Artemis/Artemis/App.config index c2fb1013a..41ce7e0b7 100644 --- a/Artemis/Artemis/App.config +++ b/Artemis/Artemis/App.config @@ -48,7 +48,7 @@ True - + True diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2.Designer.cs b/Artemis/Artemis/Modules/Games/Dota2/Dota2.Designer.cs index ae346373b..e098aeae3 100644 --- a/Artemis/Artemis/Modules/Games/Dota2/Dota2.Designer.cs +++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2.Designer.cs @@ -98,12 +98,12 @@ namespace Artemis.Modules.Games.Dota2 { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool ShowDead { + public bool ShowEvents { get { - return ((bool)(this["ShowDead"])); + return ((bool)(this["ShowEvents"])); } set { - this["ShowDead"] = value; + this["ShowEvents"] = value; } } diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings b/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings index 473a385a3..89ff15102 100644 --- a/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings +++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2.settings @@ -20,7 +20,7 @@ True - + True diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs b/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs index d8f3cdeb1..fb7d07885 100644 --- a/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs +++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2Model.cs @@ -72,7 +72,7 @@ namespace Artemis.Modules.Games.Dota2 DayCycleRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard , _keyPad.TopLeft.X*Scale - , _keyPad.BottomRight.Y*Scale + , _keyPad.TopLeft.Y* Scale , new List() , LinearGradientMode.Horizontal) { @@ -91,7 +91,8 @@ namespace Artemis.Modules.Games.Dota2 #region Long Switch Statement for Keys switch (Settings.KeyboardLayout) { - case "0": //default + case "0": + case "Default": //default case "4": //Heroes of newearth case "3": //League of Legends for (int i = 0; i < AbilityKeysRectangles.Length; i++) @@ -167,20 +168,20 @@ namespace Artemis.Modules.Games.Dota2 public override void Update() { - if (D2Json == null) + if (D2Json?.map == null) return; - if (Settings.ShowDead && D2Json?.hero?.alive != null && !D2Json.hero.alive) - { - UpdateLifeStatus(); - return; - } + UpdateMainColor(); + if (Settings.ShowEvents) + UpdateEvents(); + if (Settings.ShowDayCycle) + UpdateDay(); + if (!D2Json.hero.alive) + return; if (Settings.CanCastAbility) UpdateAbilities(); if (Settings.ShowHealth) UpdateHealth(); - if (Settings.ShowDayCycle) - UpdateDay(); if (Settings.ShowMana) UpdateMana(); @@ -193,15 +194,34 @@ namespace Artemis.Modules.Games.Dota2 DayCycleRectangle.Colors = list; HealthRectangle.Colors = list; ManaRectangle.Colors = list; + foreach (var key in AbilityKeysRectangles) + key.Colors = list; } - private void UpdateLifeStatus() + private void UpdateEvents() { - var list = new List {Color.LightGray}; + List list = null; + if (!D2Json.hero.alive) + list = new List { Color.LightGray }; + else if (D2Json.hero.disarmed) + list = new List { Color.Yellow }; + else if (D2Json.hero.hexed) + list = new List { Color.Yellow }; + else if (D2Json.hero.silenced) + list = new List { Color.Yellow }; + else if (D2Json.hero.stunned) + list = new List { Color.Yellow }; + else if (D2Json.hero.magicimmune) + list = new List { Color.Lime }; + if(list == null) + return; + EventRectangle.Colors = list; DayCycleRectangle.Colors = list; HealthRectangle.Colors = list; ManaRectangle.Colors = list; + foreach (var item in AbilityKeysRectangles) + item.Colors = list; } private void UpdateDay() @@ -276,9 +296,12 @@ namespace Artemis.Modules.Games.Dota2 EventRectangle.Draw(g); HealthRectangle.Draw(g); ManaRectangle.Draw(g); + foreach (var item in AbilityKeysRectangles) + { + item.Draw(g); + } DayCycleRectangle.Draw(g); - foreach (var key in AbilityKeysRectangles) - key.Draw(g); + } return bitmap; } diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2Settings.cs b/Artemis/Artemis/Modules/Games/Dota2/Dota2Settings.cs index 2f4990db7..5e14b138f 100644 --- a/Artemis/Artemis/Modules/Games/Dota2/Dota2Settings.cs +++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2Settings.cs @@ -23,7 +23,7 @@ namespace Artemis.Modules.Games.Dota2 public bool ShowHealth { get; set; } public bool ShowDayCycle { get; set; } public bool ShowMana { get; set; } - public bool ShowDead { get; set; } + public bool ShowEvents { get; set; } public Color MainColor { get; set; } public Color ManaColor { get; set; } public string KeyboardLayout { get; set; } @@ -43,7 +43,7 @@ namespace Artemis.Modules.Games.Dota2 GameDirectory = Dota2.Default.GameDirectory; ShowDayCycle = Dota2.Default.ShowDayCycle; ShowMana = Dota2.Default.ShowMana; - ShowDead = Dota2.Default.ShowDead; + ShowEvents = Dota2.Default.ShowEvents; AbilityReadyColor = Dota2.Default.AbilityReadyColor; AbilityCooldownColor = Dota2.Default.AbilityCooldownColor; } @@ -59,7 +59,7 @@ namespace Artemis.Modules.Games.Dota2 Dota2.Default.Enabled = Enabled; Dota2.Default.GameDirectory = GameDirectory; Dota2.Default.ShowMana = ShowMana; - Dota2.Default.ShowDead = ShowDead; + Dota2.Default.ShowEvents = ShowEvents; Dota2.Default.AbilityCooldownColor = AbilityCooldownColor; Dota2.Default.AbilityReadyColor = AbilityReadyColor; @@ -81,7 +81,7 @@ namespace Artemis.Modules.Games.Dota2 CanCastAbility = true; ShowDayCycle = true; ShowMana = true; - ShowDead = true; + ShowEvents = true; } } diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2View.xaml b/Artemis/Artemis/Modules/Games/Dota2/Dota2View.xaml index 6ed3e5e9d..39d4758a4 100644 --- a/Artemis/Artemis/Modules/Games/Dota2/Dota2View.xaml +++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2View.xaml @@ -151,9 +151,9 @@ - Display gray when dead + Show events on the keyboard -