How to use the osrsbox.items_api.item_equipment.ItemEquipment function in osrsbox

To help you get started, we’ve selected a few osrsbox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github osrsbox / osrsbox-db / osrsbox / items_api / item_properties.py View on Github external
equipable_by_player: bool
    equipable_weapon: bool
    cost: int
    lowalch: int
    highalch: int
    weight: Optional[float]
    buy_limit: Optional[int]
    quest_item: bool
    release_date: Optional[str]
    duplicate: bool
    examine: Optional[str]
    icon: str
    wiki_name: Optional[str]
    wiki_url: Optional[str]
    wiki_exchange: Optional[str]
    equipment: Optional[ItemEquipment] = None
    weapon: Optional[ItemWeapon] = None

    @classmethod
    def from_json(cls, json_dict: Dict) -> 'ItemProperties':
        """Construct ItemProperties object from dictionary/JSON."""
        # Convert the dictionary under the 'equipment' key into ItemEquipment.
        if json_dict.get("equipable_by_player"):
            equipment = json_dict.pop("equipment")
            json_dict["equipment"] = ItemEquipment(**equipment)

        # Convert the dictionary under the 'weapon' key into ItemWeapon.
        if json_dict.get("weapon"):
            weapon = json_dict.pop("weapon")
            json_dict["weapon"] = ItemWeapon(**weapon)

        return cls(**json_dict)
github osrsbox / osrsbox-db / osrsbox / items_api / item_properties.py View on Github external
def from_json(cls, json_dict: Dict) -> 'ItemProperties':
        """Construct ItemProperties object from dictionary/JSON."""
        # Convert the dictionary under the 'equipment' key into ItemEquipment.
        if json_dict.get("equipable_by_player"):
            equipment = json_dict.pop("equipment")
            json_dict["equipment"] = ItemEquipment(**equipment)

        # Convert the dictionary under the 'weapon' key into ItemWeapon.
        if json_dict.get("weapon"):
            weapon = json_dict.pop("weapon")
            json_dict["weapon"] = ItemWeapon(**weapon)

        return cls(**json_dict)