From b862b20ab1d8d59085137b90d022cd8a111b36d1 Mon Sep 17 00:00:00 2001 From: lsawin Date: Sat, 9 Sep 2023 14:45:27 +0200 Subject: [PATCH] dynamicitem now has a proper data structure --- ESI.NET/Logic/DogmaLogic.cs | 12 ++-- ESI.NET/Models/Dogma/Attribute.cs | 35 ++--------- ESI.NET/Models/Dogma/AttributeInfo.cs | 34 ++++++++++ ESI.NET/Models/Dogma/DynamicItem.cs | 2 +- ESI.NET/Models/Dogma/Effect.cs | 88 +------------------------- ESI.NET/Models/Dogma/EffectInfo.cs | 89 +++++++++++++++++++++++++++ 6 files changed, 137 insertions(+), 123 deletions(-) create mode 100644 ESI.NET/Models/Dogma/AttributeInfo.cs create mode 100644 ESI.NET/Models/Dogma/EffectInfo.cs diff --git a/ESI.NET/Logic/DogmaLogic.cs b/ESI.NET/Logic/DogmaLogic.cs index 71f7869..2a22be9 100644 --- a/ESI.NET/Logic/DogmaLogic.cs +++ b/ESI.NET/Logic/DogmaLogic.cs @@ -25,8 +25,8 @@ public async Task> Attributes() /// /// /// - public async Task> Attribute(int attribute_id) - => await Execute(_client, _config, RequestSecurity.Public, HttpMethod.Get, "/dogma/attributes/{attribute_id}/", + public async Task> Attribute(int attribute_id) + => await Execute(_client, _config, RequestSecurity.Public, HttpMethod.Get, "/dogma/attributes/{attribute_id}/", replacements: new Dictionary() { { "attribute_id", attribute_id.ToString() } @@ -44,8 +44,8 @@ public async Task> Effects() /// /// /// - public async Task> Effect(int effect_id) - => await Execute(_client, _config, RequestSecurity.Public, HttpMethod.Get, "/dogma/effects/{effect_id}/", + public async Task> Effect(int effect_id) + => await Execute(_client, _config, RequestSecurity.Public, HttpMethod.Get, "/dogma/effects/{effect_id}/", replacements: new Dictionary() { { "effect_id", effect_id.ToString() } @@ -57,8 +57,8 @@ public async Task> Effect(int effect_id) /// /// /// - public async Task> DynamicItem(int type_id, long item_id) - => await Execute(_client, _config, RequestSecurity.Public, HttpMethod.Get, "/dogma/dynamic/items/{type_id}/{item_id}/", + public async Task> DynamicItem(int type_id, long item_id) + => await Execute(_client, _config, RequestSecurity.Public, HttpMethod.Get, "/dogma/dynamic/items/{type_id}/{item_id}/", replacements: new Dictionary() { { "type_id", type_id.ToString() }, diff --git a/ESI.NET/Models/Dogma/Attribute.cs b/ESI.NET/Models/Dogma/Attribute.cs index 0bd1c1e..d052c8c 100644 --- a/ESI.NET/Models/Dogma/Attribute.cs +++ b/ESI.NET/Models/Dogma/Attribute.cs @@ -1,42 +1,15 @@ using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; namespace ESI.NET.Models.Dogma { public class Attribute { - [JsonProperty("attribute_id")] + [JsonProperty("attribute_id", Required = Required.Always)] public int AttributeId { get; set; } - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("description")] - public string Description { get; set; } - - [JsonProperty("icon_id")] - public int IconId { get; set; } - - [JsonProperty("default_value")] - public double DefaultValue { get; set; } - - [JsonProperty("published")] - public bool Published { get; set; } - - [JsonProperty("display_name")] - public string DisplayName { get; set; } - - [JsonProperty("unit_id")] - public int UnitId { get; set; } - - [JsonProperty("stackable")] - public bool Stackable { get; set; } - - [JsonProperty("high_is_good")] - public bool HighIsGood { get; set; } - - /// - /// Only populated when used in DynamicItem; all other properties except AttributeId will be empty - /// [JsonProperty("value")] public decimal Value { get; set; } } diff --git a/ESI.NET/Models/Dogma/AttributeInfo.cs b/ESI.NET/Models/Dogma/AttributeInfo.cs new file mode 100644 index 0000000..32bc05f --- /dev/null +++ b/ESI.NET/Models/Dogma/AttributeInfo.cs @@ -0,0 +1,34 @@ +using Newtonsoft.Json; + +namespace ESI.NET.Models.Dogma +{ + public class AttributeInfo : Attribute + { + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("description")] + public string Description { get; set; } + + [JsonProperty("icon_id")] + public int IconId { get; set; } + + [JsonProperty("default_value")] + public double DefaultValue { get; set; } + + [JsonProperty("published")] + public bool Published { get; set; } + + [JsonProperty("display_name")] + public string DisplayName { get; set; } + + [JsonProperty("unit_id")] + public int UnitId { get; set; } + + [JsonProperty("stackable")] + public bool Stackable { get; set; } + + [JsonProperty("high_is_good")] + public bool HighIsGood { get; set; } + } +} diff --git a/ESI.NET/Models/Dogma/DynamicItem.cs b/ESI.NET/Models/Dogma/DynamicItem.cs index a800105..2a0b893 100644 --- a/ESI.NET/Models/Dogma/DynamicItem.cs +++ b/ESI.NET/Models/Dogma/DynamicItem.cs @@ -3,7 +3,7 @@ namespace ESI.NET.Models.Dogma { - class DynamicItem + public class DynamicItem { [JsonProperty("created_by")] public int CreatedBy { get; set; } diff --git a/ESI.NET/Models/Dogma/Effect.cs b/ESI.NET/Models/Dogma/Effect.cs index b141c62..6ecaf1e 100644 --- a/ESI.NET/Models/Dogma/Effect.cs +++ b/ESI.NET/Models/Dogma/Effect.cs @@ -1,98 +1,16 @@ using Newtonsoft.Json; +using System; using System.Collections.Generic; +using System.Text; namespace ESI.NET.Models.Dogma { public class Effect { - [JsonProperty("effect_id")] + [JsonProperty("effect_id", Required = Required.Always)] public int EffectId { get; set; } - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("display_name")] - public string DisplayName { get; set; } - - [JsonProperty("description")] - public string Description { get; set; } - - [JsonProperty("icon_id")] - public int IconId { get; set; } - - [JsonProperty("effect_category")] - public int EffectCategory { get; set; } - - [JsonProperty("pre_expression")] - public int PreExpression { get; set; } - - [JsonProperty("post_expression")] - public int PostExpression { get; set; } - - [JsonProperty("is_offensive")] - public bool IsOffensive { get; set; } - - [JsonProperty("is_assistance")] - public bool IsAssistance { get; set; } - - [JsonProperty("disallow_auto_repeat")] - public bool DisallowAutoRepeat { get; set; } - - [JsonProperty("published")] - public bool Published { get; set; } - - [JsonProperty("is_warp_safe")] - public bool IsWarpSafe { get; set; } - - [JsonProperty("range_chance")] - public bool RangeChance { get; set; } - - [JsonProperty("electronic_chance")] - public bool ElectronicChance { get; set; } - - [JsonProperty("duration_attribute_id")] - public int DurationAttributeId { get; set; } - - [JsonProperty("tracking_speed_attribute_id")] - public int TrackingSpeedAttributeId { get; set; } - - [JsonProperty("discharge_attribute_id")] - public int DischargeAttributeId { get; set; } - - [JsonProperty("range_attribute_id")] - public int RangeAttributeId { get; set; } - - [JsonProperty("falloff_attribute_id")] - public int FalloffAttributeId { get; set; } - - [JsonProperty("modifiers")] - public List Modifiers { get; set; } = new List(); - - /// - /// Only populated when used in DynamicItem; all other properties except EffectId will be empty - /// [JsonProperty("is_default")] public bool IsDefault { get; set; } } - - public class Modifier - { - [JsonProperty("func")] - public string Func { get; set; } - - [JsonProperty("domain")] - public string Domain { get; set; } - - [JsonProperty("modified_attribute_id")] - public int ModifiedAttributeId { get; set; } - - [JsonProperty("modifying_attribute_id")] - public int ModifyingAttributeId { get; set; } - - [JsonProperty("effect_id")] - public int EffectId { get; set; } - - [JsonProperty("operator")] - public int Operator { get; set; } - } } diff --git a/ESI.NET/Models/Dogma/EffectInfo.cs b/ESI.NET/Models/Dogma/EffectInfo.cs new file mode 100644 index 0000000..f6a28a9 --- /dev/null +++ b/ESI.NET/Models/Dogma/EffectInfo.cs @@ -0,0 +1,89 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace ESI.NET.Models.Dogma +{ + public class EffectInfo : Effect + { + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("display_name")] + public string DisplayName { get; set; } + + [JsonProperty("description")] + public string Description { get; set; } + + [JsonProperty("icon_id")] + public int IconId { get; set; } + + [JsonProperty("effect_category")] + public int EffectCategory { get; set; } + + [JsonProperty("pre_expression")] + public int PreExpression { get; set; } + + [JsonProperty("post_expression")] + public int PostExpression { get; set; } + + [JsonProperty("is_offensive")] + public bool IsOffensive { get; set; } + + [JsonProperty("is_assistance")] + public bool IsAssistance { get; set; } + + [JsonProperty("disallow_auto_repeat")] + public bool DisallowAutoRepeat { get; set; } + + [JsonProperty("published")] + public bool Published { get; set; } + + [JsonProperty("is_warp_safe")] + public bool IsWarpSafe { get; set; } + + [JsonProperty("range_chance")] + public bool RangeChance { get; set; } + + [JsonProperty("electronic_chance")] + public bool ElectronicChance { get; set; } + + [JsonProperty("duration_attribute_id")] + public int DurationAttributeId { get; set; } + + [JsonProperty("tracking_speed_attribute_id")] + public int TrackingSpeedAttributeId { get; set; } + + [JsonProperty("discharge_attribute_id")] + public int DischargeAttributeId { get; set; } + + [JsonProperty("range_attribute_id")] + public int RangeAttributeId { get; set; } + + [JsonProperty("falloff_attribute_id")] + public int FalloffAttributeId { get; set; } + + [JsonProperty("modifiers")] + public List Modifiers { get; set; } = new List(); + } + + public class Modifier + { + [JsonProperty("func")] + public string Func { get; set; } + + [JsonProperty("domain")] + public string Domain { get; set; } + + [JsonProperty("modified_attribute_id")] + public int ModifiedAttributeId { get; set; } + + [JsonProperty("modifying_attribute_id")] + public int ModifyingAttributeId { get; set; } + + [JsonProperty("effect_id")] + public int EffectId { get; set; } + + [JsonProperty("operator")] + public int Operator { get; set; } + } +}