예제 #1
0
    def LoadLocalize(self: Any) -> Dict[str, Optional[str]]:
        """Load and filter the localized string entries for Modern Warfare."""

        localize: dict = Utility.ReadFile(self,
                                          f"{self.iXAssets}/localize.json")
        placeholders: List[str] = Utility.ReadFile(
            self, "ModernWarfare/placeholders.json")

        for key in localize:
            value: Optional[str] = localize.get(key)

            if value is None:
                continue
            elif value == "":
                localize[key] = None
                continue

            for placeholder in placeholders:
                if value.lower().startswith(placeholder.lower()):
                    localize[key] = None
                elif value.lower().endswith(placeholder.lower()):
                    localize[key] = None

            if (value := localize.get(key)) is not None:
                localize[key] = Utility.StripColorCodes(self, value)
예제 #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
파일: 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
예제 #4
0
    def LoadConfiguration(self: Any) -> Dict[str, Any]:
        """Load the configurable values from config.json"""

        config: Optional[Dict[str, Any]] = Utility.ReadFile(self, "config.json")

        if config is not None:
            return dict(config)
예제 #5
0
    def Compile(self: Any) -> None:
        """Compile the Battle Pass XAssets for the COD Tracker Database."""

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

        for battlePass in passes:
            if battlePass.get("name") is None:
                continue

            items: List[Dict[str, Any]] = []

            for item in battlePass.get("items"):
                item.pop("type")
                item.pop("billboard")

                items.append(item)

            dbPasses.append(battlePass)
            self.count += 1

        Utility.WriteFile(
            self,
            f"{self.eDatabase}/battlePasses.json",
            dbPasses,
            compress=True,
        )
        Utility.WriteFile(self, f"{self.eDatabase}/_battlePasses.json",
                          dbPasses)
예제 #6
0
파일: emporium.py 프로젝트: EthanC/Emporium
    def LoadConfiguration(self: Any) -> Optional[Dict[str, Any]]:
        """Load the configurable values from config.json"""

        config: Optional[Dict[str,
                              Any]] = Utility.ReadFile(self, "config.json")

        if config is not None:
            log.info("Loaded configuration")

            return config
예제 #7
0
    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
예제 #8
0
    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
예제 #9
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)])
예제 #10
0
                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

        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