# generated by update to not change manually
import dataclasses as dt
import typing as t
from bungieapi.json import to_json
[docs]@dt.dataclass(frozen=True)
class DestinyItemTierTypeDefinition:
"""Defines the tier type of an item.
Mostly this provides human readable properties for types like
Common, Rare, etc... It also provides some base data for infusion
that could be useful.
"""
display_properties: t.Optional["DestinyDisplayPropertiesDefinition"] = None
hash: t.Optional[
int
] = None # The unique identifier for this entity. Guaranteed to be unique for the type of entity, but not globally. When entities refer to each other in Destiny content, it is this hash that they are referring to.
index: t.Optional[
int
] = None # The index of the entity as it was found in the investment tables.
infusion_process: t.Optional[
"DestinyItemTierTypeInfusionBlock"
] = None # If this tier defines infusion properties, they will be contained here.
redacted: t.Optional[
bool
] = None # If this is true, then there is an entity with this identifier/type combination, but BNet is not yet allowed to show it. Sorry!
[docs] def to_json(self) -> t.Mapping[str, t.Any]:
return {
"displayProperties": to_json(self.display_properties),
"infusionProcess": to_json(self.infusion_process),
"hash": to_json(self.hash),
"index": to_json(self.index),
"redacted": to_json(self.redacted),
}
[docs]@dt.dataclass(frozen=True)
class DestinyItemTierTypeInfusionBlock:
base_quality_transfer_ratio: t.Optional[
float
] = None # The default portion of quality that will transfer from the infuser to the infusee item. (InfuserQuality - InfuseeQuality) * baseQualityTransferRatio = base quality transferred.
minimum_quality_increment: t.Optional[
int
] = None # As long as InfuserQuality > InfuseeQuality, the amount of quality bestowed is guaranteed to be at least this value, even if the transferRatio would dictate that it should be less. The total amount of quality that ends up in the Infusee cannot exceed the Infuser's quality however (for instance, if you infuse a 300 item with a 301 item and the minimum quality increment is 10, the infused item will not end up with 310 quality)
[docs] def to_json(self) -> t.Mapping[str, t.Any]:
return {
"baseQualityTransferRatio": to_json(self.base_quality_transfer_ratio),
"minimumQualityIncrement": to_json(self.minimum_quality_increment),
}
[docs]@dt.dataclass(frozen=True)
class DestinyDerivedItemCategoryDefinition:
"""A shortcut for the fact that some items have a "Preview Vendor" - See DestinyInventoryItemDefinition.preview.previewVendorHash - that is intended to be used to show what items you can get as a result of acquiring or using this item.
A common example of this in Destiny 1 was Eververse "Boxes," which could have many possible items. This "Preview Vendor" is not a vendor you can actually see in the game, but it defines categories and sale items for all of the possible items you could get from the Box so that the game can show them to you. We summarize that info here so that you don't have to do that Vendor lookup and aggregation manually."""
category_description: t.Optional[
str
] = None # The localized string for the category title. This will be something describing the items you can get as a group, or your likelihood/the quantity you'll get.
items: t.Optional[
t.Sequence["DestinyDerivedItemDefinition"]
] = None # This is the list of all of the items for this category and the basic properties we'll know about them.
[docs] def to_json(self) -> t.Mapping[str, t.Any]:
return {
"categoryDescription": to_json(self.category_description),
"items": to_json(self.items),
}
[docs]@dt.dataclass(frozen=True)
class DestinyDerivedItemDefinition:
"""This is a reference to, and summary data for, a specific item that you
can get as a result of Using or Acquiring some other Item (For example,
this could be summary information for an Emote that you can get by opening
an an Eververse Box) See DestinyDerivedItemCategoryDefinition for more
information."""
icon_path: t.Optional[str] = None # An icon for the item.
item_description: t.Optional[str] = None # A brief description of the item.
item_detail: t.Optional[
str
] = None # Additional details about the derived item, in addition to the description.
item_hash: t.Optional[
int
] = None # The hash for the DestinyInventoryItemDefinition of this derived item, if there is one. Sometimes we are given this information as a manual override, in which case there won't be an actual DestinyInventoryItemDefinition for what we display, but you can still show the strings from this object itself.
item_name: t.Optional[str] = None # The name of the derived item.
vendor_item_index: t.Optional[
int
] = None # If the item was derived from a "Preview Vendor", this will be an index into the DestinyVendorDefinition's itemList property. Otherwise, -1.
[docs] def to_json(self) -> t.Mapping[str, t.Any]:
return {
"itemHash": to_json(self.item_hash),
"itemName": to_json(self.item_name),
"itemDetail": to_json(self.item_detail),
"itemDescription": to_json(self.item_description),
"iconPath": to_json(self.icon_path),
"vendorItemIndex": to_json(self.vendor_item_index),
}
[docs]@dt.dataclass(frozen=True)
class DestinyItemPlugDefinition:
"""If an item is a Plug, its DestinyInventoryItemDefinition.plug property
will be populated with an instance of one of these bad boys.
This gives information about when it can be inserted, what the
plug's category is (and thus whether it is compatible with a
socket... see DestinySocketTypeDefinition for information about Plug
Categories and socket compatibility), whether it is enabled and
other Plug info.
"""
alternate_plug_style: t.Optional[
"PlugUiStyles"
] = None # The alternate plug of the plug: only applies when the item is in states that only the server can know about and control, unfortunately. See AlternateUiPlugLabel for the related label info.
alternate_ui_plug_label: t.Optional[
str
] = None # If the plug meets certain state requirements, it may have an alternative label applied to it. This is the alternative label that will be applied in such a situation.
enabled_material_requirement_hash: t.Optional[
int
] = None # It's not enough for the plug to be inserted. It has to be enabled as well. For it to be enabled, it may require materials. This is the hash identifier for the DestinyMaterialRequirementSetDefinition for those requirements, if there is one.
enabled_rules: t.Optional[
t.Sequence["DestinyPlugRuleDefinition"]
] = None # The rules around whether the plug, once inserted, is enabled and providing its benefits. The live data DestinyItemPlugComponent.enableFailIndexes will be an index into this array, so you can pull out the failure strings appropriate for the user.
energy_capacity: t.Optional[
"DestinyEnergyCapacityEntry"
] = None # IF not null, this plug provides Energy capacity to the item in which it is socketed. In Armor 2.0 for example, is implemented in a similar way to Masterworks, where visually it's a single area of the UI being clicked on to "Upgrade" to higher energy levels, but it's actually socketing new plugs.
energy_cost: t.Optional[
"DestinyEnergyCostEntry"
] = None # IF not null, this plug has an energy cost. This contains the details of that cost.
insertion_material_requirement_hash: t.Optional[
int
] = None # If inserting this plug requires materials, this is the hash identifier for looking up the DestinyMaterialRequirementSetDefinition for those requirements.
insertion_rules: t.Optional[
t.Sequence["DestinyPlugRuleDefinition"]
] = None # The rules around when this plug can be inserted into a socket, aside from the socket's individual restrictions. The live data DestinyItemPlugComponent.insertFailIndexes will be an index into this array, so you can pull out the failure strings appropriate for the user.
is_dummy_plug: t.Optional[
bool
] = None # If TRUE, this plug is used for UI display purposes only, and doesn't have any interesting effects of its own.
on_action_recreate_self: t.Optional[
bool
] = None # If you successfully socket the item, this will determine whether or not you get "refunded" on the plug.
parent_item_override: t.Optional[
"DestinyParentItemOverride"
] = None # Do you ever get the feeling that a system has become so overburdened by edge cases that it probably should have become some other system entirely? So do I! In totally unrelated news, Plugs can now override properties of their parent items. This is some of the relevant definition data for those overrides. If this is populated, it will have the override data to be applied when this plug is applied to an item.
plug_availability: t.Optional[
"PlugAvailabilityMode"
] = None # Indicates the rules about when this plug can be used. See the PlugAvailabilityMode enumeration for more information!
plug_category_hash: t.Optional[
int
] = None # The hash for the plugCategoryIdentifier. You can use this instead if you wish: I put both in the definition for debugging purposes.
plug_category_identifier: t.Optional[
str
] = None # The string identifier for the plug's category. Use the socket's DestinySocketTypeDefinition.plugWhitelist to determine whether this plug can be inserted into the socket.
plug_style: t.Optional["PlugUiStyles"] = None
preview_item_override_hash: t.Optional[
int
] = None # In the game, if you're inspecting a plug item directly, this will be the item shown with the plug attached. Look up the DestinyInventoryItemDefinition for this hash for the item.
ui_plug_label: t.Optional[
str
] = None # Plugs can have arbitrary, UI-defined identifiers that the UI designers use to determine the style applied to plugs. Unfortunately, we have neither a definitive list of these labels nor advance warning of when new labels might be applied or how that relates to how they get rendered. If you want to, you can refer to known labels to change your own styles: but know that new ones can be created arbitrarily, and we have no way of associating the labels with any specific UI style guidance... you'll have to piece that together on your end. Or do what we do, and just show plugs more generically, without specialized styles.
[docs] def to_json(self) -> t.Mapping[str, t.Any]:
return {
"insertionRules": to_json(self.insertion_rules),
"plugCategoryIdentifier": to_json(self.plug_category_identifier),
"plugCategoryHash": to_json(self.plug_category_hash),
"onActionRecreateSelf": to_json(self.on_action_recreate_self),
"insertionMaterialRequirementHash": to_json(
self.insertion_material_requirement_hash
),
"previewItemOverrideHash": to_json(self.preview_item_override_hash),
"enabledMaterialRequirementHash": to_json(
self.enabled_material_requirement_hash
),
"enabledRules": to_json(self.enabled_rules),
"uiPlugLabel": to_json(self.ui_plug_label),
"plugStyle": to_json(self.plug_style),
"plugAvailability": to_json(self.plug_availability),
"alternateUiPlugLabel": to_json(self.alternate_ui_plug_label),
"alternatePlugStyle": to_json(self.alternate_plug_style),
"isDummyPlug": to_json(self.is_dummy_plug),
"parentItemOverride": to_json(self.parent_item_override),
"energyCapacity": to_json(self.energy_capacity),
"energyCost": to_json(self.energy_cost),
}
[docs]@dt.dataclass(frozen=True)
class DestinyPlugRuleDefinition:
"""Dictates a rule around whether the plug is enabled or insertable.
In practice, the live Destiny data will refer to these entries by
index. You can then look up that index in the appropriate property
(enabledRules or insertionRules) to get the localized string for the
failure message if it failed.
"""
failure_message: t.Optional[
str
] = None # The localized string to show if this rule fails.
[docs] def to_json(self) -> t.Mapping[str, t.Any]:
return {
"failureMessage": to_json(self.failure_message),
}
[docs]@dt.dataclass(frozen=True)
class DestinyParentItemOverride:
additional_equip_requirements_display_strings: t.Optional[t.Sequence[str]] = None
pip_icon: t.Optional[str] = None
[docs] def to_json(self) -> t.Mapping[str, t.Any]:
return {
"additionalEquipRequirementsDisplayStrings": to_json(
self.additional_equip_requirements_display_strings
),
"pipIcon": to_json(self.pip_icon),
}
[docs]@dt.dataclass(frozen=True)
class DestinyEnergyCapacityEntry:
"""Items can have Energy Capacity, and plugs can provide that capacity such
as on a piece of Armor in Armor 2.0.
This is how much "Energy" can be spent on activating plugs for this
item.
"""
capacity_value: t.Optional[
int
] = None # How much energy capacity this plug provides.
energy_type: t.Optional[
"DestinyEnergyType"
] = None # The Energy Type for this energy capacity, in enum form for easy use.
energy_type_hash: t.Optional[
int
] = None # Energy provided by a plug is always of a specific type - this is the hash identifier for the energy type for which it provides Capacity.
[docs] def to_json(self) -> t.Mapping[str, t.Any]:
return {
"capacityValue": to_json(self.capacity_value),
"energyTypeHash": to_json(self.energy_type_hash),
"energyType": to_json(self.energy_type),
}
[docs]@dt.dataclass(frozen=True)
class DestinyEnergyCostEntry:
"""Some plugs cost Energy, which is a stat on the item that can be
increased by other plugs (that, at least in Armor 2.0, have a "masterworks-
like" mechanic for upgrading).
If a plug has costs, the details of that cost are defined here.
"""
energy_cost: t.Optional[int] = None # The Energy cost for inserting this plug.
energy_type: t.Optional[
"DestinyEnergyType"
] = None # The type of energy that this plug costs, in enum form.
energy_type_hash: t.Optional[
int
] = None # The type of energy that this plug costs, as a reference to the DestinyEnergyTypeDefinition of the energy type.
[docs] def to_json(self) -> t.Mapping[str, t.Any]:
return {
"energyCost": to_json(self.energy_cost),
"energyTypeHash": to_json(self.energy_type_hash),
"energyType": to_json(self.energy_type),
}
from bungieapi.generated.components.schemas.destiny import (
DestinyEnergyType,
) # noqa: E402
from bungieapi.generated.components.schemas.destiny import (
PlugAvailabilityMode,
) # noqa: E402
from bungieapi.generated.components.schemas.destiny import PlugUiStyles # noqa: E402
# imported at the end to do not case circular imports for type annotations
from bungieapi.generated.components.schemas.destiny.definitions.common import (
DestinyDisplayPropertiesDefinition,
) # noqa: E402