예제 #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
    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
예제 #3
0
class DBLoot:
    """Loot XAssets for the COD Tracker Database."""
    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)])

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

                dbLoot.append(item)
                self.count += 1
예제 #4
0
                    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")
                variant["slug"] = Utility.Sluggify(self, variant.get("name"))

                dbLoot.append(variant)
                self.count += 1

        Utility.WriteFile(
            self,
            f"{self.eDatabase}/loot.json",
            Utility.SortList(self, dbLoot, "name", key2="rarity"),
            compress=True,
        )
        Utility.WriteFile(
            self,
            f"{self.eDatabase}/_loot.json",
            Utility.SortList(self, dbLoot, "name", key2="rarity"),
        )