diff --git a/GW2SDK/Features/Items/ICombatEquipment.cs b/GW2SDK/Features/Items/ICombatEquipment.cs new file mode 100644 index 000000000..356274df0 --- /dev/null +++ b/GW2SDK/Features/Items/ICombatEquipment.cs @@ -0,0 +1,26 @@ +using GuildWars2.Hero; + +namespace GuildWars2.Items; + +/// The interface for items that can be equipped to increase the player's combat attributes. +public interface ICombatEquipment +{ + /// The Attribute Adjustment factor. To calculate the final item stats of the item, multiply this value with an + /// attribute's multiplier, then add the result to the attribute's base value. + /// The formula is: attribute_adjustment * multiplier + value. + double AttributeAdjustment { get; } + + /// The ID of the item's attribute combination, used for items with fixed stats. This property is not used for + /// items with selectable stats. + int? AttributeCombinationId { get; } + + /// The IDs of the attribute combinations that can be chosen for the item. This property is only used for items + /// with selectable stats. + IReadOnlyList StatChoices { get; } + + /// The effective stats of the item. + IDictionary, int> Attributes { get; } + + /// The effect which is applied to the player when the item is equipped. + Buff? Buff { get; } +} diff --git a/GW2SDK/Features/Items/IInfusable.cs b/GW2SDK/Features/Items/IInfusable.cs new file mode 100644 index 000000000..5621b8719 --- /dev/null +++ b/GW2SDK/Features/Items/IInfusable.cs @@ -0,0 +1,10 @@ +namespace GuildWars2.Items; + + +/// The interface for items that can be infused (or attuned) to add one extra infusion slot. +public interface IInfusable +{ + /// If the current item is used in the Mystic Forge to infuse (or attune) equipment, this collection contains the IDs + /// of the infused (or attuned) items. Each item in the collection represents a different recipe. + IReadOnlyCollection UpgradesInto { get; } +} diff --git a/GW2SDK/Features/Items/IInfused.cs b/GW2SDK/Features/Items/IInfused.cs new file mode 100644 index 000000000..442b59c1b --- /dev/null +++ b/GW2SDK/Features/Items/IInfused.cs @@ -0,0 +1,8 @@ +namespace GuildWars2.Items; + +/// The interface for items with an extra infusion slot. +public interface IInfused +{ + /// If the current item is upgraded, this collection contains the IDs of possible source items. + IReadOnlyCollection UpgradesFrom { get; } +} diff --git a/GW2SDK/Features/Items/IUpgradable.cs b/GW2SDK/Features/Items/IUpgradable.cs new file mode 100644 index 000000000..dec7513bf --- /dev/null +++ b/GW2SDK/Features/Items/IUpgradable.cs @@ -0,0 +1,14 @@ +namespace GuildWars2.Items; + +/// The interface for items with upgrade or infusion slots. +public interface IUpgradable +{ + /// The ID of the upgrade component in the upgrade slot, if any. + int? SuffixItemId { get; } + + /// The ID of the upgrade component in the second upgrade slot (two-handed weapons only), if any. + int? SecondarySuffixItemId { get; } + + /// The infusion slots of the item (only available on ascended and legendary items). + IReadOnlyList InfusionSlots { get; } +} diff --git a/GW2SDK/Features/Items/Models/Armors/Armor.cs b/GW2SDK/Features/Items/Models/Armors/Armor.cs index e46718ec8..bffcf6c2f 100644 --- a/GW2SDK/Features/Items/Models/Armors/Armor.cs +++ b/GW2SDK/Features/Items/Models/Armors/Armor.cs @@ -8,7 +8,7 @@ namespace GuildWars2.Items; [PublicAPI] [Inheritable] [JsonConverter(typeof(ArmorJsonConverter))] -public record Armor : Item +public record Armor : Item, ICombatEquipment, IUpgradable { /// The default skin ID for the armor. This skin can be unlocked in the wardrobe by binding the item. public required int DefaultSkinId { get; init; } @@ -41,6 +41,8 @@ public record Armor : Item /// The ID of the upgrade component in the upgrade slot, if any. public required int? SuffixItemId { get; init; } + int? IUpgradable.SecondarySuffixItemId => null; + /// The IDs of the attribute combinations that can be chosen for the item. This property is only used for items /// with selectable stats. public required IReadOnlyList StatChoices { get; init; } diff --git a/GW2SDK/Features/Items/Models/Backs/Backpack.cs b/GW2SDK/Features/Items/Models/Backs/Backpack.cs index 5e3f35584..313bbcaa1 100644 --- a/GW2SDK/Features/Items/Models/Backs/Backpack.cs +++ b/GW2SDK/Features/Items/Models/Backs/Backpack.cs @@ -6,7 +6,7 @@ namespace GuildWars2.Items; /// Information about a back item. [PublicAPI] [JsonConverter(typeof(BackpackJsonConverter))] -public sealed record Backpack : Item +public sealed record Backpack : Item, ICombatEquipment, IUpgradable, IInfused, IInfusable { /// The default skin ID for the back item. This skin can be unlocked in the wardrobe by binding the item. public required int DefaultSkinId { get; init; } @@ -32,12 +32,14 @@ public sealed record Backpack : Item /// The ID of the upgrade component in the upgrade slot, if any. public required int? SuffixItemId { get; init; } + int? IUpgradable.SecondarySuffixItemId => null; + /// The IDs of the attribute combinations that can be chosen for the item. This property is only used for items /// with selectable stats. public required IReadOnlyList StatChoices { get; init; } - /// If the current back item can be infused, this collection contains the IDs of the infused variations of the - /// back item. Each item in the collection represents a possible upgrade path. + /// If the current back item can be infused in the Mystic Forge, this collection contains the IDs of the infused variations of the + /// back item. Each item in the collection represents a different recipe. public required IReadOnlyCollection UpgradesInto { get; init; } /// If the current back item is infused, this collection contains the IDs of possible source items. diff --git a/GW2SDK/Features/Items/Models/CraftingMaterials/CraftingMaterial.cs b/GW2SDK/Features/Items/Models/CraftingMaterials/CraftingMaterial.cs index 3d79f9afc..dcfabe14e 100644 --- a/GW2SDK/Features/Items/Models/CraftingMaterials/CraftingMaterial.cs +++ b/GW2SDK/Features/Items/Models/CraftingMaterials/CraftingMaterial.cs @@ -5,10 +5,10 @@ namespace GuildWars2.Items; /// Information about a crafting material. [PublicAPI] [JsonConverter(typeof(CraftingMaterialJsonConverter))] -public sealed record CraftingMaterial : Item +public sealed record CraftingMaterial : Item, IInfusable { - /// If the current material is used in a Mystic Forge recipe to infuse equipment, this collection contains the IDs - /// of the infused items. Each item in the collection represents a possible upgrade path. + /// If the current crafting material is used in the Mystic Forge to infuse or attune equipment, this collection contains the IDs + /// of the infused (or attuned) items. Each item in the collection represents a different recipe. public required IReadOnlyCollection UpgradesInto { get; init; } /// diff --git a/GW2SDK/Features/Items/Models/Trinkets/Ring.cs b/GW2SDK/Features/Items/Models/Trinkets/Ring.cs index b27fd0649..f62a14452 100644 --- a/GW2SDK/Features/Items/Models/Trinkets/Ring.cs +++ b/GW2SDK/Features/Items/Models/Trinkets/Ring.cs @@ -5,10 +5,10 @@ namespace GuildWars2.Items; /// Information about a ring. [PublicAPI] [JsonConverter(typeof(RingJsonConverter))] -public sealed record Ring : Trinket +public sealed record Ring : Trinket, IInfused, IInfusable { - /// If the current ring can be infused or attuned, this collection contains the IDs of the infused/attuned - /// variations of the ring. Each item in the collection represents a possible upgrade path. + /// If the current ring can be infused or attuned in the Mystic Forge, this collection contains the IDs of the infused (or attuned) + /// variations of the ring. Each item in the collection represents a different recipe. public required IReadOnlyCollection UpgradesInto { get; init; } /// If the current ring is infused or attuned, this collection contains the IDs of possible source items. diff --git a/GW2SDK/Features/Items/Models/Trinkets/Trinket.cs b/GW2SDK/Features/Items/Models/Trinkets/Trinket.cs index b4405e077..b3acef299 100644 --- a/GW2SDK/Features/Items/Models/Trinkets/Trinket.cs +++ b/GW2SDK/Features/Items/Models/Trinkets/Trinket.cs @@ -8,7 +8,7 @@ namespace GuildWars2.Items; [PublicAPI] [Inheritable] [JsonConverter(typeof(TrinketJsonConverter))] -public record Trinket : Item +public record Trinket : Item, ICombatEquipment, IUpgradable { /// The infusion slots of the trinket (only available on ascended and legendary items). public required IReadOnlyList InfusionSlots { get; init; } @@ -31,6 +31,8 @@ public record Trinket : Item /// The ID of the upgrade component in the upgrade slot, if any. public required int? SuffixItemId { get; init; } + int? IUpgradable.SecondarySuffixItemId => null; + /// The IDs of the attribute combinations that can be chosen for the item. This property is only used for items /// with selectable stats. public required IReadOnlyList StatChoices { get; init; } diff --git a/GW2SDK/Features/Items/Models/UpgradeComponents/UpgradeComponent.cs b/GW2SDK/Features/Items/Models/UpgradeComponents/UpgradeComponent.cs index 6c4c9280a..7252f9dca 100644 --- a/GW2SDK/Features/Items/Models/UpgradeComponents/UpgradeComponent.cs +++ b/GW2SDK/Features/Items/Models/UpgradeComponents/UpgradeComponent.cs @@ -7,7 +7,7 @@ namespace GuildWars2.Items; [PublicAPI] [Inheritable] [JsonConverter(typeof(UpgradeComponentJsonConverter))] -public record UpgradeComponent : Item +public record UpgradeComponent : Item, ICombatEquipment { /// Flags that indicate which types of items are compatible with the upgrade. public required UpgradeComponentFlags UpgradeComponentFlags { get; init; } @@ -24,6 +24,8 @@ public record UpgradeComponent : Item /// items with selectable stats. public required int? AttributeCombinationId { get; init; } + IReadOnlyList ICombatEquipment.StatChoices { get; } = Empty.ListOfInt32; + /// The effective stats of the item. public required IDictionary, int> Attributes { get; init; } diff --git a/GW2SDK/Features/Items/Models/Weapons/Weapon.cs b/GW2SDK/Features/Items/Models/Weapons/Weapon.cs index 038a97c8e..deb7487b6 100644 --- a/GW2SDK/Features/Items/Models/Weapons/Weapon.cs +++ b/GW2SDK/Features/Items/Models/Weapons/Weapon.cs @@ -8,7 +8,7 @@ namespace GuildWars2.Items; [PublicAPI] [Inheritable] [JsonConverter(typeof(WeaponJsonConverter))] -public record Weapon : Item +public record Weapon : Item, ICombatEquipment, IUpgradable { /// The default skin ID for the weapon. This skin can be unlocked in the wardrobe by binding the item. public required int DefaultSkinId { get; init; } @@ -29,7 +29,7 @@ public record Weapon : Item /// attribute, which reduces incoming strike damage. public required int Defense { get; init; } - /// The infusion slots of the armor (only available on ascended and legendary items). + /// The infusion slots of the weapon (only available on ascended and legendary items). public required IReadOnlyList InfusionSlots { get; init; } /// The Attribute Adjustment factor. To calculate the final item stats of the item, multiply this value with an