mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Fixed saving settings. Colors Health Rectangle
This commit is contained in:
parent
dcd88331f6
commit
40ea9fd6cc
@ -297,6 +297,7 @@
|
|||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
<DependentUpon>Dota2.settings</DependentUpon>
|
<DependentUpon>Dota2.settings</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Modules\Games\Dota2\Dota2DataModel.cs" />
|
||||||
<Compile Include="Modules\Games\Dota2\Dota2Model.cs" />
|
<Compile Include="Modules\Games\Dota2\Dota2Model.cs" />
|
||||||
<Compile Include="Modules\Games\Dota2\Dota2Settings.cs" />
|
<Compile Include="Modules\Games\Dota2\Dota2Settings.cs" />
|
||||||
<Compile Include="Modules\Games\RocketLeague\RocketLeague.Designer.cs">
|
<Compile Include="Modules\Games\RocketLeague\RocketLeague.Designer.cs">
|
||||||
|
|||||||
227
Artemis/Artemis/Modules/Games/Dota2/Dota2DataModel.cs
Normal file
227
Artemis/Artemis/Modules/Games/Dota2/Dota2DataModel.cs
Normal file
@ -0,0 +1,227 @@
|
|||||||
|
namespace Artemis.Modules.Games.Dota2
|
||||||
|
{
|
||||||
|
class Dota2DataModel
|
||||||
|
{
|
||||||
|
public class Rootobject
|
||||||
|
{
|
||||||
|
public Provider provider { get; set; }
|
||||||
|
public Map map { get; set; }
|
||||||
|
public Player player { get; set; }
|
||||||
|
public Hero hero { get; set; }
|
||||||
|
public Abilities abilities { get; set; }
|
||||||
|
public Items items { get; set; }
|
||||||
|
public Previously previously { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Provider
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
public int appid { get; set; }
|
||||||
|
public int version { get; set; }
|
||||||
|
public int timestamp { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Map
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
public long matchid { get; set; }
|
||||||
|
public int game_time { get; set; }
|
||||||
|
public int clock_time { get; set; }
|
||||||
|
public bool daytime { get; set; }
|
||||||
|
public bool nightstalker_night { get; set; }
|
||||||
|
public string game_state { get; set; }
|
||||||
|
public string win_team { get; set; }
|
||||||
|
public string customgamename { get; set; }
|
||||||
|
public int ward_purchase_cooldown { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Player
|
||||||
|
{
|
||||||
|
public string steamid { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
public string activity { get; set; }
|
||||||
|
public int kills { get; set; }
|
||||||
|
public int deaths { get; set; }
|
||||||
|
public int assists { get; set; }
|
||||||
|
public int last_hits { get; set; }
|
||||||
|
public int denies { get; set; }
|
||||||
|
public int kill_streak { get; set; }
|
||||||
|
public string team_name { get; set; }
|
||||||
|
public int gold { get; set; }
|
||||||
|
public int gold_reliable { get; set; }
|
||||||
|
public int gold_unreliable { get; set; }
|
||||||
|
public int gpm { get; set; }
|
||||||
|
public int xpm { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Hero
|
||||||
|
{
|
||||||
|
public int id { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
public int level { get; set; }
|
||||||
|
public bool alive { get; set; }
|
||||||
|
public int respawn_seconds { get; set; }
|
||||||
|
public int buyback_cost { get; set; }
|
||||||
|
public int buyback_cooldown { get; set; }
|
||||||
|
public int health { get; set; }
|
||||||
|
public int max_health { get; set; }
|
||||||
|
public int health_percent { get; set; }
|
||||||
|
public int mana { get; set; }
|
||||||
|
public int max_mana { get; set; }
|
||||||
|
public int mana_percent { get; set; }
|
||||||
|
public bool silenced { get; set; }
|
||||||
|
public bool stunned { get; set; }
|
||||||
|
public bool disarmed { get; set; }
|
||||||
|
public bool magicimmune { get; set; }
|
||||||
|
public bool hexed { get; set; }
|
||||||
|
public bool muted { get; set; }
|
||||||
|
public bool _break { get; set; }
|
||||||
|
public bool has_debuff { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Abilities
|
||||||
|
{
|
||||||
|
public Ability0 ability0 { get; set; }
|
||||||
|
public Ability1 ability1 { get; set; }
|
||||||
|
public Ability2 ability2 { get; set; }
|
||||||
|
public Ability3 ability3 { get; set; }
|
||||||
|
public Attributes attributes { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Ability0
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
public int level { get; set; }
|
||||||
|
public bool can_cast { get; set; }
|
||||||
|
public bool passive { get; set; }
|
||||||
|
public bool ability_active { get; set; }
|
||||||
|
public int cooldown { get; set; }
|
||||||
|
public bool ultimate { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Ability1
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
public int level { get; set; }
|
||||||
|
public bool can_cast { get; set; }
|
||||||
|
public bool passive { get; set; }
|
||||||
|
public bool ability_active { get; set; }
|
||||||
|
public int cooldown { get; set; }
|
||||||
|
public bool ultimate { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Ability2
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
public int level { get; set; }
|
||||||
|
public bool can_cast { get; set; }
|
||||||
|
public bool passive { get; set; }
|
||||||
|
public bool ability_active { get; set; }
|
||||||
|
public int cooldown { get; set; }
|
||||||
|
public bool ultimate { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Ability3
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
public int level { get; set; }
|
||||||
|
public bool can_cast { get; set; }
|
||||||
|
public bool passive { get; set; }
|
||||||
|
public bool ability_active { get; set; }
|
||||||
|
public int cooldown { get; set; }
|
||||||
|
public bool ultimate { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Attributes
|
||||||
|
{
|
||||||
|
public int level { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Items
|
||||||
|
{
|
||||||
|
public Slot0 slot0 { get; set; }
|
||||||
|
public Slot1 slot1 { get; set; }
|
||||||
|
public Slot2 slot2 { get; set; }
|
||||||
|
public Slot3 slot3 { get; set; }
|
||||||
|
public Slot4 slot4 { get; set; }
|
||||||
|
public Slot5 slot5 { get; set; }
|
||||||
|
public Stash0 stash0 { get; set; }
|
||||||
|
public Stash1 stash1 { get; set; }
|
||||||
|
public Stash2 stash2 { get; set; }
|
||||||
|
public Stash3 stash3 { get; set; }
|
||||||
|
public Stash4 stash4 { get; set; }
|
||||||
|
public Stash5 stash5 { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Slot0
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Slot1
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Slot2
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Slot3
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Slot4
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Slot5
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Stash0
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Stash1
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Stash2
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Stash3
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Stash4
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Stash5
|
||||||
|
{
|
||||||
|
public string name { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Previously
|
||||||
|
{
|
||||||
|
public Player1 player { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Player1
|
||||||
|
{
|
||||||
|
public int gold { get; set; }
|
||||||
|
public int gold_unreliable { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -12,6 +12,7 @@ using Artemis.Utilities.GameState;
|
|||||||
using Artemis.Utilities.Keyboard;
|
using Artemis.Utilities.Keyboard;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Artemis.Modules.Games.Dota2;
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.Dota2
|
namespace Artemis.Modules.Games.Dota2
|
||||||
{
|
{
|
||||||
@ -32,7 +33,7 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
#region Variables
|
#region Variables
|
||||||
|
|
||||||
public Dota2Settings Settings { get; set; }
|
public Dota2Settings Settings { get; set; }
|
||||||
public JObject D2Json { get; set; }
|
public Dota2DataModel.Rootobject D2Json { get; set; }
|
||||||
public int Scale { get; set; }
|
public int Scale { get; set; }
|
||||||
public KeyboardRectangle HealthRect { get; set; }
|
public KeyboardRectangle HealthRect { get; set; }
|
||||||
|
|
||||||
@ -70,10 +71,10 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
|
|
||||||
private void UpdateHealth()
|
private void UpdateHealth()
|
||||||
{
|
{
|
||||||
var health = D2Json["hero"]["health_percent"];
|
var health = D2Json.hero.health_percent;
|
||||||
if((int)health > 66)
|
if(health > 66)
|
||||||
HealthRect.Colors = new List<Color> { Color.Lime };
|
HealthRect.Colors = new List<Color> { Color.Lime };
|
||||||
else if ((int) health > 33)
|
else if (health > 33)
|
||||||
HealthRect.Colors = new List<Color> {Color.Yellow};
|
HealthRect.Colors = new List<Color> {Color.Yellow};
|
||||||
else
|
else
|
||||||
HealthRect.Colors = new List<Color> {Color.Red};
|
HealthRect.Colors = new List<Color> {Color.Red};
|
||||||
@ -82,6 +83,9 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
|
|
||||||
private void UpdateAbilities()
|
private void UpdateAbilities()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Console.WriteLine();
|
||||||
|
|
||||||
//Update keys according to the abilities they take.
|
//Update keys according to the abilities they take.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +112,7 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Parse the JSON
|
// Parse the JSON
|
||||||
D2Json = JsonConvert.DeserializeObject<JObject>(jsonString);
|
D2Json = JsonConvert.DeserializeObject<Dota2DataModel.Rootobject>(jsonString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,8 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
Dota2.Default.CanCastAbility = CanCastAbility;
|
Dota2.Default.CanCastAbility = CanCastAbility;
|
||||||
Dota2.Default.Enabled = Enabled;
|
Dota2.Default.Enabled = Enabled;
|
||||||
Dota2.Default.GameDirectory = GameDirectory;
|
Dota2.Default.GameDirectory = GameDirectory;
|
||||||
|
|
||||||
|
Dota2.Default.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ToDefault()
|
public override void ToDefault()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user