Skip to content

Commit

Permalink
Merge pull request #48 from leonhard-s/bugfix/47-faction-image_path-m…
Browse files Browse the repository at this point in the history
…issing

Bugfix/47 faction image path missing
  • Loading branch information
leonhard-s authored May 5, 2021
2 parents 3d6cbb3 + 89b4f56 commit e240179
Show file tree
Hide file tree
Showing 13 changed files with 209 additions and 23 deletions.
4 changes: 1 addition & 3 deletions auraxium/models/_achievement.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
"""Data classes for :mod:`auraxium.ps2._achievement`."""

from .base import ImageData
from .base import ImageData, RESTPayload
from ..types import LocaleData

from .base import RESTPayload

__all__ = [
'AchievementData'
]
Expand Down
4 changes: 1 addition & 3 deletions auraxium/models/_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

from typing import Optional

from .base import ImageData
from .base import ImageData, RESTPayload
from ..types import LocaleData

from .base import RESTPayload

__all__ = [
'DirectiveData',
'DirectiveTierData',
Expand Down
4 changes: 1 addition & 3 deletions auraxium/models/_faction.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
"""Data classes for :mod:`auraxium.ps2._faction`."""

from .base import ImageData
from .base import ImageData, RESTPayload
from ..types import LocaleData

from .base import RESTPayload

__all__ = [
'FactionData'
]
Expand Down
4 changes: 1 addition & 3 deletions auraxium/models/_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

from typing import Optional

from .base import ImageData
from .base import ImageData, RESTPayload
from ..types import LocaleData

from .base import RESTPayload

__all__ = [
'ItemCategoryData',
'ItemData',
Expand Down
4 changes: 1 addition & 3 deletions auraxium/models/_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

from typing import Optional

from .base import ImageData
from .base import ImageData, RESTPayload
from ..types import LocaleData

from .base import RESTPayload

__all__ = [
'SkillData',
'SkillCategoryData',
Expand Down
4 changes: 1 addition & 3 deletions auraxium/models/_vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

from typing import Optional

from .base import ImageData
from .base import ImageData, RESTPayload
from ..types import LocaleData

from .base import RESTPayload

__all__ = [
'VehicleAttachmentData',
'VehicleData'
Expand Down
4 changes: 1 addition & 3 deletions auraxium/models/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Shared base classes for API data model implementations."""

import abc
import dataclasses
import datetime
from typing import Optional, TypeVar

Expand Down Expand Up @@ -93,8 +92,7 @@ def fallback_hook(id_: int) -> CensusData:
"""


@dataclasses.dataclass(frozen=True)
class ImageData:
class ImageData(pydantic.BaseModel):
"""Mixin dataclass for types supporting image access.
.. attribute:: image_id
Expand Down
20 changes: 19 additions & 1 deletion auraxium/ps2/_achievement.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Achievements include weapon medals and service ribbons.
"""

from typing import List
from typing import List, Optional

from ..base import ImageMixin, Named
from ..census import Query
Expand Down Expand Up @@ -83,6 +83,21 @@ class Achievement(Named, ImageMixin, cache_size=50, cache_ttu=60.0):
:type: auraxium.types.LocaleData
The localised description of achievement.
.. attribute:: image_id
:type: int | None
The image ID of the default image.
.. attribute:: image_set_id
:type: int | None
The corresponding image set.
.. attribute:: image_path
:type: str | None
The base path to the image with the default :attr:`image_id`.
"""

collection = 'achievement'
Expand All @@ -98,6 +113,9 @@ class Achievement(Named, ImageMixin, cache_size=50, cache_ttu=60.0):
reward_id: int
repeatable: bool
description: LocaleData
image_id: Optional[int]
image_set_id: Optional[int]
image_path: Optional[str]

async def objectives(self) -> List[Objective]:
"""Return any objectives in the given objective group."""
Expand Down
56 changes: 55 additions & 1 deletion auraxium/ps2/_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
]


class DirectiveTreeCategory(Named, ImageMixin, cache_size=10, cache_ttu=300.0):
class DirectiveTreeCategory(Named, cache_size=10, cache_ttu=300.0):
"""A category of directive.
In-game, this is represented by the side bar to the left, e.g.
Expand Down Expand Up @@ -91,6 +91,21 @@ class DirectiveTree(Named, ImageMixin, cache_size=30, cache_ttu=60.0):
:type: auraxium.types.LocaleData
The localised name of the directive tree.
.. attribute:: image_id
:type: int | None
The image ID of the default image.
.. attribute:: image_set_id
:type: int | None
The corresponding image set.
.. attribute:: image_path
:type: str | None
The base path to the image with the default :attr:`image_id`.
"""

collection = 'directive_tree'
Expand All @@ -103,6 +118,9 @@ class DirectiveTree(Named, ImageMixin, cache_size=30, cache_ttu=60.0):
directive_tree_category_id: int
description: Optional[LocaleData]
name: LocaleData
image_id: Optional[int]
image_set_id: Optional[int]
image_path: Optional[str]

def category(self) -> InstanceProxy[DirectiveTreeCategory]:
"""Return the category of the directive tree.
Expand Down Expand Up @@ -186,6 +204,21 @@ class DirectiveTier(Named, ImageMixin, cache_size=30, cache_ttu=60.0):
:type: auraxium.types.LocaleData
The localised name of the directive tier.
.. attribute:: image_id
:type: int | None
The image ID of the default image.
.. attribute:: image_set_id
:type: int | None
The corresponding image set.
.. attribute:: image_path
:type: str | None
The base path to the image with the default :attr:`image_id`.
"""

collection = 'directive_tier'
Expand All @@ -200,6 +233,9 @@ class DirectiveTier(Named, ImageMixin, cache_size=30, cache_ttu=60.0):
reward_set_id: Optional[int]
directive_points: int
completion_count: int
image_id: Optional[int]
image_set_id: Optional[int]
image_path: Optional[str]

def directives(self) -> SequenceProxy['Directive']:
"""Return the list of directives in this tier.
Expand Down Expand Up @@ -282,6 +318,21 @@ class Directive(Named, ImageMixin, cache_size=30, cache_ttu=60.0):
:type: auraxium.types.LocaleData
The localised description of the directive.
.. attribute:: image_id
:type: int | None
The image ID of the default image.
.. attribute:: image_set_id
:type: int | None
The corresponding image set.
.. attribute:: image_path
:type: str | None
The base path to the image with the default :attr:`image_id`.
"""

collection = 'directive'
Expand All @@ -297,6 +348,9 @@ class Directive(Named, ImageMixin, cache_size=30, cache_ttu=60.0):
objective_set_id: int
qualify_requirement_id: Optional[int]
description: Optional[LocaleData]
image_id: Optional[int]
image_set_id: Optional[int]
image_path: Optional[str]

def objectives(self) -> SequenceProxy[Objective]:
"""Return the objectives for this directive.
Expand Down
20 changes: 20 additions & 0 deletions auraxium/ps2/_faction.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Object definition for the faction type."""

from typing import Optional

from ..base import ImageMixin, Named
from ..models import FactionData
from ..types import LocaleData
Expand Down Expand Up @@ -37,6 +39,21 @@ class Faction(Named, ImageMixin, cache_size=10):
:type: bool
Whether this faction is playable.
.. attribute:: image_id
:type: int | None
The image ID of the default image.
.. attribute:: image_set_id
:type: int | None
The corresponding image set.
.. attribute:: image_path
:type: str | None
The base path to the image with the default :attr:`image_id`.
"""

collection = 'faction'
Expand All @@ -49,6 +66,9 @@ class Faction(Named, ImageMixin, cache_size=10):
code_tag: str
name: LocaleData
user_selectable: bool
image_id: Optional[int]
image_set_id: Optional[int]
image_path: Optional[str]

def __repr__(self) -> str:
"""Return the unique string representation of the faction.
Expand Down
18 changes: 18 additions & 0 deletions auraxium/ps2/_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,21 @@ class Item(Named, ImageMixin, cache_size=128, cache_ttu=3600.0):
are used whenever nothing is selected. Examples include the
default iron sights, or the regular ammo type for weapon
supporting non-standard ammo types.
.. attribute:: image_id
:type: int | None
The image ID of the default image.
.. attribute:: image_set_id
:type: int | None
The corresponding image set.
.. attribute:: image_path
:type: str | None
The base path to the image with the default :attr:`image_id`.
"""

collection = 'item'
Expand All @@ -189,6 +204,9 @@ class Item(Named, ImageMixin, cache_size=128, cache_ttu=3600.0):
name: LocaleData
skill_set_id: Optional[int]
is_default_attachment: bool
image_id: Optional[int]
image_set_id: Optional[int]
image_path: Optional[str]

def attachments(self) -> SequenceProxy['Item']:
"""Return the attachment options for this item.
Expand Down
Loading

0 comments on commit e240179

Please sign in to comment.