예제 #1
0
class DBBundles:
    """Bundle XAssets for the COD Tracker Database."""
    def Compile(self: Any) -> None:
        """Compile the Bundle XAssets for the COD Tracker Database."""

        dbBundles: List[Dict[str, Any]] = []
        bundles: List[Dict[str, Any]] = Utility.ReadFile(
            self, f"{self.eXAssets}/bundles.json")

        for bundle in bundles:
            if bundle.get("id") is None:
                continue
            elif bundle.get("name") is None:
                continue
            elif (b := bundle.get("billboard")) is None:
                continue
            elif (l := bundle.get("logo")) is None:
                continue

            self.dbImages.append(b)
            self.dbImages.append(l)

            if Utility.FileExists(self, f"{self.iImages}/{b}.png") is False:
                continue
            elif Utility.FileExists(self, f"{self.iImages}/{l}.png") is False:
                continue

            items: List[int] = []

            for item in bundle.get("items"):
                items.append(item.get("id"))

            bundle["items"] = items

            bundle.pop("altId")
            bundle.pop("hiddenItems")

            if bundle.get("description") is None:
                bundle.pop("description")
            if bundle.get("flavor") is None:
                bundle.pop("flavor")
            if bundle.get("feature") is None:
                bundle.pop("feature")
            if bundle.get("season") is None:
                bundle.pop("season")
            if bundle.get("name") == bundle.get("flavor"):
                bundle.pop("flavor")

            bundle["slug"] = Utility.Sluggify(self, bundle.get("name"))

            dbBundles.append(bundle)
            self.count += 1
예제 #2
0
파일: emporium.py 프로젝트: EthanC/Emporium
    def DiffStore(self: Any, store: Dict[str, Any]) -> bool:
        """
        Determine if the Modern Warfare and Warzone Store has updated
        since the last time the application was ran.
        """

        apiHash: str = store.get("hash")

        if Utility.FileExists(self, "latest.txt") is False:
            Utility.WriteFile(self, "latest.txt", apiHash)

            log.warning("No local Store hash found, created it")

            return False

        localHash: str = Utility.ReadFile(self, "latest.txt")

        if localHash == apiHash:
            log.info(
                "The Store has not updated, the local hash matches the API hash"
            )

            return False
        else:
            return True
예제 #3
0
    def Compile(self: Any) -> None:
        """Compile the Operator XAssets for the COD Tracker Database."""

        dbOperators: List[Dict[str, Any]] = []
        operators: List[Dict[str, Any]] = Utility.ReadFile(
            self, f"{self.eXAssets}/operators.json")
        skins: List[Dict[str, Any]] = Utility.ReadFile(
            self, f"{self.eXAssets}/operatorSkins.json")
        executions: List[Dict[str, Any]] = Utility.ReadFile(
            self, f"{self.eXAssets}/executions.json")
        quips: List[Dict[str, Any]] = Utility.ReadFile(
            self, f"{self.eXAssets}/operatorQuips.json")

        for operator in operators:
            if operator.get("id") is None:
                continue
            elif operator.get("name") is None:
                continue
            elif (i := operator.get("image")) is None:
                continue

            self.dbImages.append(i)

            if Utility.FileExists(self, f"{self.iImages}/{i}.png") is False:
                continue

            operator.pop("altId")
            operator.pop("type")
            operator.pop("rarity")
            operator.pop("branchIcon")
            operator.pop("thumbprint")
            operator.pop("launchOperator")
            operator.pop("video")
            operator.pop("hidden")
            operator.pop("billets")

            if operator.get("season") is None:
                operator.pop("season")
            if operator.get("description") is None:
                operator.pop("description")

            operator["skins"] = []
            operator["executions"] = []
            operator["quips"] = []
            operator["slug"] = Utility.Sluggify(self, operator.get("name"))

            for skin in Utility.SortList(self, skins, "name", key2="rarity"):
                if (skinId := skin.get("id")) is None:
                    continue
                elif skin.get("name") is None:
                    continue
예제 #4
0
class DBWeapons:
    """Weapon XAssets for the COD Tracker Database."""
    def Compile(self: Any) -> None:
        """Compile the Weapon XAssets for the COD Tracker Database."""

        dbWeapons: List[Dict[str, Any]] = []
        weapons: List[Dict[str, Any]] = Utility.ReadFile(
            self, f"{self.eXAssets}/weapons.json")

        for weapon in weapons:
            if weapon.get("id") is None:
                continue
            if weapon.get("name") is None:
                continue
            if (i := weapon.get("image")) is None:
                continue
            if (ico := weapon.get("icon")) is None:
                continue

            self.dbImages.append(i)
            self.dbImages.append(ico)

            if Utility.FileExists(self, f"{self.iImages}/{i}.png") is False:
                continue
            elif Utility.FileExists(self,
                                    f"{self.iImages}/{ico}.png") is False:
                continue

            variants: List[int] = []

            for variant in Utility.SortList(self,
                                            weapon.get("variants"),
                                            "name",
                                            key2="rarity"):
                if variant.get("id") is None:
                    continue
                elif variant.get("name") is None:
                    continue
                elif variant.get("image") is None:
                    continue

                variants.append(variant.get("id"))

            weapon["variants"] = variants

            attachments: List[int] = []

            for attachment in weapon.get("attachments"):
                if attachment.get("id") is None:
                    continue
                elif attachment.get("name") is None:
                    continue
                elif (i := attachment.get("image")) is None:
                    continue

                self.dbImages.append(i)

                if Utility.FileExists(self,
                                      f"{self.iImages}/{i}.png") is False:
                    continue

                attachment.pop("altId")
                attachment.pop("unlock")

                if attachment.get("description") is None:
                    attachment.pop("description")

                attachments.append(attachment)
예제 #5
0
    def Compile(self: Any) -> None:
        """Compile the Loot XAssets for the COD Tracker Database."""

        dbLoot: List[Dict[str, Any]] = []
        loot: List[str] = [
            "accessories",
            "battlePassItems",
            "callingCards",
            "camos",
            "charms",
            "consumables",
            "emblems",
            "executions",
            "features",
            "gestures",
            "missionItems",
            "operatorQuips",
            "operatorSkins",
            "specialItems",
            "sprays",
            "stickers",
            "vehicleCamos",
            "vehicleHorns",
            "vehicleTracks",
        ]

        for file in loot:
            items: List[Dict[str, Any]] = Utility.ReadFile(
                self, f"{self.eXAssets}/{file}.json")

            for item in items:
                if item.get("id") is None:
                    continue
                elif item.get("name") is None:
                    continue
                elif (i := item.get("image")) is None:
                    continue

                self.dbImages.append(i)

                if Utility.FileExists(self,
                                      f"{self.iImages}/{i}.png") is False:
                    continue

                item.pop("altId", None)
                item.pop("hidden", None)
                item.pop("category", None)
                item.pop("operatorAltId", None)
                item.pop("pet", None)
                item.pop("video", None)
                item.pop("unlock", None)

                if item.get("description") is None:
                    item.pop("description", None)
                if item.get("flavor") is None:
                    item.pop("flavor", None)
                if item.get("season") is None:
                    item.pop("season", None)
                if item.get("attribute") is None:
                    item.pop("attribute", None)

                if (iType := item.get("type")) == "Calling Card":
                    item["animated"] = Utility.AnimateSprite(
                        self, i, [(512, 128), (512, 136), (960, 240)])
                elif iType == "Emblem":
                    item["animated"] = Utility.AnimateSprite(
                        self, i, [(256, 256)])
예제 #6
0
        weapons: List[Dict[str, Any]] = Utility.ReadFile(
            self, f"{self.eXAssets}/weapons.json")

        for weapon in weapons:
            for variant in weapon.get("variants"):
                if variant.get("id") is None:
                    continue
                elif variant.get("name") is None:
                    continue
                elif (i := variant.get("image")) is None:
                    continue

                self.dbImages.append(i)

                if Utility.FileExists(self,
                                      f"{self.iImages}/{i}.png") is False:
                    continue

                variant.pop("altId")

                if variant.get("flavor") is None:
                    variant.pop("flavor")
                if variant.get("season") is None:
                    variant.pop("season")
                if variant.get("tracers") is None:
                    variant.pop("tracers")
                if variant.get("dismemberment") is None:
                    variant.pop("dismemberment")

                variant["class"] = weapon.get("class")
                variant["baseId"] = weapon.get("id")