Exemple #1
0
    def itemPicture(self) -> None:
        try:
            pictureUrl = self.soup.find_all(
                'div',
                class_='db-view__item__icon latest_patch__major__detail__item')
            try:
                for p in pictureUrl[0].contents:
                    if p == '\n':
                        continue

                    if p.attrs['class'][0] == 'latest_patch__major__icon':
                        continue

                    if p.attrs['class'][0] == "staining":
                        continue

                    elif p.attrs['class'][0] == 'db-view__item__icon__cover':
                        continue

                    elif p.attrs['width'] == '152':
                        continue

                    elif p.attrs['width'] == '128':
                        self.item.pictureUrl = p.attrs['src']
                        self.item.pictureWidth = int(p.attrs['width'])
                        self.item.pictureHeight = int(p.attrs['height'])
                    else:
                        print("new values found in pictureUrl")
            except Exception as e:
                print("Error parsing pictureUrl", e)
        except Exception as e:
            raise UnableToFindValue(
                "msg: Unable to find a 'div' with class 'db-view__item__icon latest_patch__major__detail__item'"
            )
Exemple #2
0
 def __getItemDesynthesizable__(self, itemInfo2: ResultSet) -> float:
     try:
         desynth: float = 0.0
         html = itemInfo2[0].contents[1].next_sibling.next_sibling
         key = html.contents[0]
         value = html.contents[1].contents[0]
         if key == 'Desynthesizable: ':
             if value == 'No':
                 return desynth
             else:
                 desynth = float(value)
         return desynth
     except:
         raise UnableToFindValue()
Exemple #3
0
    def __getItemProjectable__(self, itemInfo2: ResultSet) -> bool:
        try:
            projectable: bool = False
            html = itemInfo2[0].contents[1].next_sibling
            if html.contents[0] == 'Projectable: ':
                if html.contents[1].contents[0] == 'Yes':
                    projectable = True

            return projectable
        except:
            raise UnableToFindValue(
                "Unable to find 'Projectable: ' in the expected location.",
                f"key: {html.contents[0]}",
                f"value: {html.contents[1].contents[0]}")
Exemple #4
0
 def __getItemDyeable__(self, itemInfo2: ResultSet) -> bool:
     try:
         dyeable: bool = False
         html = itemInfo2[0].contents[
             1].next_sibling.next_sibling.next_sibling
         key = html.contents[0]
         value = html.contents[1].contents[0]
         if key == "Dyeable: ":
             if value == "Yes":
                 dyeable: bool = True
         return dyeable
     except Exception as e:
         raise UnableToFindValue(
             "Unable to find 'Dyeable: ' in the expected location.",
             f"key: {key}", f"value: {value}", f'raw: {e}')
Exemple #5
0
    def __getBonusAttr__(self, htmlResult: Tag):
        try:
            # Set default values
            self.item.stats = Stats()

            for b in htmlResult[1].contents[5].contents:
                if b == '\n':
                    pass
                elif b.contents[0].text == "Strength":
                    self.item.stats.strength = self.__cleanBonusAttr__(
                        b.contents[1])
                elif b.contents[0].text == "Vitality":
                    self.item.stats.vitality = self.__cleanBonusAttr__(
                        b.contents[1])
                elif b.contents[0].text == "Mind":
                    self.item.stats.mind = self.__cleanBonusAttr__(
                        b.contents[1])
                elif b.contents[0].text == "Intelligence":
                    self.item.stats.intelligence = self.__cleanBonusAttr__(
                        b.contents[1])
                elif b.contents[0].text == "Determination":
                    self.item.stats.determination = self.__cleanBonusAttr__(
                        b.contents[1])
                elif b.contents[0].text == "Skill Speed":
                    self.item.stats.skillSpeed = self.__cleanBonusAttr__(
                        b.contents[1])
                elif b.contents[0].text == "Spell Speed":
                    self.item.stats.spellSpeed = self.__cleanBonusAttr__(
                        b.contents[1])
                elif b.contents[0].text == "Dexterity":
                    self.item.stats.dexterity = self.__cleanBonusAttr__(
                        b.contents[1])
                elif b.contents[0].text == 'Critical Hit':
                    self.item.stats.criticalHit = self.__cleanBonusAttr__(
                        b.contents[1])
                elif b.contents[0].text == "Direct Hit Rate":
                    self.item.stats.directHitRate = self.__cleanBonusAttr__(
                        b.contents[1])
                elif b.contents[0].text == "Tenacity":
                    self.item.stats.tenacity = self.__cleanBonusAttr__(
                        b.contents[1])
                elif b.contents[0].text == "Piety":
                    self.item.stats.piety = self.__cleanBonusAttr__(
                        b.contents[1])
        except Exception as e:
            raise UnableToFindValue(
                "Failed to find BonusAttr, something is missing that is expected.",
                e)
Exemple #6
0
    def __getItemExtractable__(self, itemInfo2: ResultSet) -> bool:
        try:
            extractable: bool = False
            html = itemInfo2[0].contents[1]
            key = html.contents[0]
            value = html.contents[1].contents[0]
            if key == 'Extractable: ':
                if value == 'Yes':
                    extractable = True

            return extractable
        except:
            UnableToFindValue(
                "Unable to find 'Extractable: ' in the expected location.",
                f"key: {key}", f"value: {value}")
            pass
Exemple #7
0
    def __parseMateriaValues__(self, materiaCode: ResultSet):
        mslots: int = 0
        try:
            for m in materiaCode[0].contents:
                if m == '\n':
                    pass
                elif m.attrs['class'][1] == 'normal':
                    try:
                        mslots = mslots + 1
                    except:
                        mslots = 1

            self.item.materia.slots = mslots
        except Exception as e:
            raise UnableToFindValue(
                "HTML contained code for MateriaSlots but failed to parse.", e)