Exemplo n.º 1
0
class MatchHistory(BaseMatchDetail):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.items = []
        self.loadout = []
        for i in range(1, 5):
            obj = InGameItem(kwargs.get('ActiveId{}'.format(i)),
                             kwargs.get('Active_{}'.format(i)),
                             kwargs.get('ActiveLevel{}'.format(i)))
            self.items.append(obj)
        for i in range(1, 7):
            obj = InGameItem(kwargs.get('ItemId{}'.format(i)),
                             kwargs.get('Item_{}'.format(i)),
                             kwargs.get('ItemLevel{}'.format(i)))
            self.loadout.append(obj)
        self.assists = kwargs.get('Assists')
        try:
            self.godId = Champions(kwargs.get('ChampionId')) if kwargs.get(
                'ChampionId') else Gods(kwargs.get('GodId'))
            self.godName = self.godId.getName()
        except ValueError:
            self.godId = kwargs.get('ChampionId', kwargs.get(
                'GodId', 0)) if kwargs else 0
            self.godName = kwargs.get('Champion', kwargs.get(
                'God', None)) if kwargs else None
        self.creeps = kwargs.get('Creeps', 0) if kwargs else 0
        self.damage = kwargs.get('Damage', 0) if kwargs else 0
        self.credits = kwargs.get('Gold', 0) if kwargs else 0  #creditsEarned
        self.kills = kwargs.get('Kills', 0) if kwargs else 0
        self.level = kwargs.get('Level', 0) if kwargs else 0
        self.queueId = kwargs.get('Match_Queue_Id', 0) if kwargs else 0
        self.matchTime = kwargs.get('Match_Time', 0) if kwargs else 0
        self.queue = kwargs.get('Queue', None) if kwargs else None
Exemplo n.º 2
0
class ChampionSkin(Skin):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        try:
            self.godId = Champions(kwargs.get('champion_id'))
            self.godName = self.godId.getName()
        except ValueError:
            self.godId = kwargs.get('champion_id', 0) if kwargs else 0
            self.godName = kwargs.get('champion_name',
                                      None) if kwargs else None
Exemplo n.º 3
0
class Champion(BaseCharacter):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        try:
            self.godId = Champions(kwargs.get('id'))
            self.godName = self.godId.getName()
        except ValueError:
            self.godId = kwargs.get('id', 0) if kwargs else 0
            self.godName = kwargs.get('Name', None) if kwargs else None
        for i in range(0, 5):
            obj = ChampionAbility(**kwargs.get('Ability_' + str(i + 1), None))
            self.abilitys.append(obj)
        self.onFreeWeeklyRotation = str(kwargs.get('OnFreeWeeklyRotation', None)).lower() == 'y' if kwargs else False
        self.godCardURL = kwargs.get('ChampionCard_URL', None) if kwargs else None
        self.godIconURL = kwargs.get('ChampionIcon_URL', None) if kwargs else None
Exemplo n.º 4
0
class LiveMatch(MatchBase, PlayerMixin):
    def __init__(self, **kwargs):
        MatchBase.__init__(self, **kwargs)
        PlayerMixin.__init__(self, **kwargs)
        self.accountLevel = kwargs.get("Account_Level", 0) if kwargs else 0
        self.masteryLevel = kwargs.get("Mastery_Level", 0) if kwargs else 0
        self.mapName = kwargs.get("mapGame", None) if kwargs else None
        self.playerCreated = kwargs.get("playerCreated",
                                        None) if kwargs else None
        self.playerRegion = kwargs.get("playerRegion",
                                       None) if kwargs else None
        if self.playerCreated:
            self.playerCreated = datetime.strptime(self.playerCreated,
                                                   "%m/%d/%Y %I:%M:%S %p")
        try:
            self.tier = Tier(kwargs.get("Tier"))
        except ValueError:
            self.tier = kwargs.get("Tier", 0) if kwargs else 0
        self.tierLosses = kwargs.get("tierLosses", 0) if kwargs else 0
        self.tierWins = kwargs.get("tierWins", 0) if kwargs else 0
        try:
            self.godId = Champions(kwargs.get("ChampionId")) if kwargs.get(
                "ChampionId") else Gods(kwargs.get("GodId"))
            self.godName = self.godId.getName()
        except ValueError:
            self.godId = kwargs.get("ChampionId", kwargs.get(
                "GodId", 0)) if kwargs else 0
            self.godName = kwargs.get("ChampionName",
                                      kwargs.get("GodName",
                                                 None)) if kwargs else None
        try:
            self.queue = QueuePaladins(kwargs.get("Queue")) if kwargs.get(
                "ChampionId") else QueueSmite(kwargs.get("Queue"))
        except ValueError:
            self.queue = kwargs.get("Queue", 0) if kwargs else 0

    def getMapName(self, _clear=False):
        return self.mapName.replace("LIVE ", '').replace(
            "Practice ", '').replace(" (Onslaught)", '').replace(
                " (Onslaught) ", ''
            ).replace(" (TDM)", '').replace(" (TDM) ", '').replace(
                "Ranked ", ''
            ) if self.mapName and _clear else self.mapName  #.replace("'", '')

    @property
    def region(self):
        return str(self.playerRegion)[:2] if self.playerRegion and len(
            str(self.playerRegion)) >= 2 else self.playerRegion
Exemplo n.º 5
0
class Loadout(APIResponse):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        try:
            self.godId = Champions(kwargs.get('ChampionId'))
            self.godName = self.godId.getName()
        except ValueError:
            self.godId = kwargs.get('ChampionId', 0) if kwargs else 0
            self.godName = kwargs.get('ChampionName', None) if kwargs else None
        self.deckId = kwargs.get('DeckId', 0) if kwargs else 0
        self.deckName = kwargs.get('DeckName', None) if kwargs else None
        self.playerId = kwargs.get('playerId', 0) if kwargs else 0
        self.playerName = kwargs.get('playerName', None) if kwargs else None
        self.cards = [
            LoadoutItem(**_) for _ in (kwargs.get('LoadoutItems', None) or [])
        ]
Exemplo n.º 6
0
class ChampionCard(APIResponse):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.activeFlagActivationSchedule = str(
            kwargs.get('active_flag_activation_schedule',
                       None)).lower() == 'y' if kwargs else False
        self.activeFlagLti = str(kwargs.get(
            'active_flag_lti', None)).lower() == 'y' if kwargs else False
        self.cardDescription = kwargs.get('card_description',
                                          None) if kwargs else None
        self.cardId1 = kwargs.get('card_id1', 0) if kwargs else 0
        self.cardId2 = kwargs.get('card_id2', 0) if kwargs else 0
        self.cardName = kwargs.get('card_name', None) if kwargs else None
        self.cardNameEnglish = kwargs.get('card_name_english',
                                          None) if kwargs else None
        self.godCardURL = kwargs.get('championCard_URL',
                                     None) if kwargs else None
        self.godIconURL = kwargs.get('championIcon_URL',
                                     None) if kwargs else None
        try:
            self.godId = Champions(kwargs.get('champion_id'))
            self.godName = self.godId.getName()
        except ValueError:
            self.godId = kwargs.get('champion_id', 0) if kwargs else 0
            self.godName = kwargs.get('champion_name',
                                      None) if kwargs else None
        self.exclusive = str(kwargs.get(
            'exclusive', None)).lower() == 'y' if kwargs else False
        self.rank = kwargs.get('rank', 0) if kwargs else 0
        self.rarity = kwargs.get('rarity', None) if kwargs else None
        self.rechargeSeconds = kwargs.get('recharge_seconds',
                                          0) if kwargs else 0

    def getIconURL(self):
        return 'https://web2.hirez.com/paladins/champion-icons/{}.jpg'.format(
            self.godName.lower().replace(' ', '-'))

    def getCardURL(self):
        return 'https://web2.hirez.com/paladins/champion-cards/{}.jpg'.format(
            self.cardNameEnglish.lower().replace(' ', '-'))
Exemplo n.º 7
0
class QueueStats(APIResponse, KDA, PlayerMixin, Winratio):
    def __init__(self, **kwargs):
        APIResponse.__init__(self, **kwargs)  #super().__init__(**kwargs)
        KDA.__init__(self, **kwargs)
        PlayerMixin.__init__(self, **kwargs)
        Winratio.__init__(self, **kwargs)
        try:
            self.godId = Champions(kwargs.get('ChampionId')) if kwargs.get(
                'ChampionId') else Gods(kwargs.get('GodId'))
            self.godName = self.godId.getName()
        except ValueError:
            self.godId = kwargs.get('GodId', kwargs.get('ChampionId',
                                                        0)) if kwargs else 0
            self.godName = kwargs.get('God', kwargs.get('Champion', None))
        self.gold = kwargs.get('Gold', 0) if kwargs else 0
        self.lastPlayed = kwargs.get('LastPlayed', None) if kwargs else None
        if self.lastPlayed:
            self.lastPlayed = datetime.strptime(self.lastPlayed,
                                                '%m/%d/%Y %I:%M:%S %p')
        self.matches = kwargs.get('Matches', 0) if kwargs else 0
        self.minutes = kwargs.get('Minutes', 0) if kwargs else 0
        self.queue = kwargs.get('Queue', None) if kwargs else None