예제 #1
0
    def Attachments(self: Any,
                    weapons: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
        """Compile the loot/iw8_*_*_attachment_ids.csv XAssets."""

        files: List[str] = Utility.GetMatchingFiles(self,
                                                    f"{self.iXAssets}/loot/",
                                                    "csv", None,
                                                    "_attachment_ids")

        for weapon in weapons:
            if (wAltId := weapon.get("altId")) is None:
                continue

            for file in files:
                filePartial: str = file.split("\\")[-1].split(".")[0]

                if filePartial.startswith(wAltId + "_") is False:
                    continue

                table: List[Dict[str, Any]] = Utility.ReadCSV(
                    self, file, AttachmentIDs)

                if table is None:
                    continue

                for attachment in weapon.get("attachments"):
                    for entry in table:
                        if entry.get("ref") is None:
                            continue
                        elif attachment.get("id") != entry.get("index"):
                            continue

                        attachment["altId"] = entry.get("ref")
예제 #2
0
    def Variants(self: Any, weapons: List[Dict[str,
                                               Any]]) -> List[Dict[str, Any]]:
        """Compile the mp/gunsmith/*_*_variants.csv XAssets."""

        files: List[str] = Utility.GetMatchingFiles(
            self, f"{self.iXAssets}/mp/gunsmith/", "csv", None, "_variants")

        for weapon in weapons:
            if (altId := weapon.get("altId")) is None:
                continue

            for file in files:
                refPartial: str = altId.replace("iw8_", "") + "_"
                filePartial: str = file.split("\\")[-1].split(".")[0]

                if filePartial.startswith(refPartial) is False:
                    continue

                table: List[Dict[str, Any]] = Utility.ReadCSV(
                    self, file, WeaponVariants)

                if table is None:
                    continue

                for entry in table:
                    if entry.get("variantID") == 0:
                        weapon["image"] = entry.get("image")

                    for variant in weapon.get("variants", []):
                        if variant.get("altId") != entry.get("ref"):
                            continue

                        flavor: str = variant.get("altId").replace(
                            "iw8_", "").replace("variant_", "")

                        variant["name"] = self.localize.get(entry.get("name"))
                        variant["flavor"] = self.localize.get(
                            f"WEAPON_FLAVOR/{flavor.upper()}_FLAVOR")
                        variant["tracers"] = self.ModernWarfare.GetAttribute(
                            entry.get("tracerColor"))
                        variant[
                            "dismemberment"] = self.ModernWarfare.GetAttribute(
                                entry.get("dismembermentEnabled"))
                        variant["image"] = entry.get("image")
예제 #3
0
    def Progression(self, weapons: List[Dict[str,
                                             Any]]) -> List[Dict[str, Any]]:
        """Compile the mp/gunsmith/*_*_progression.csv XAssets."""

        files: List[str] = Utility.GetMatchingFiles(
            self, f"{self.iXAssets}/mp/gunsmith/", "csv", None, "_progression")

        for weapon in weapons:
            if (wAltId := weapon.get("altId")) is None:
                continue

            for file in files:
                refPartial: str = wAltId.replace("iw8_", "") + "_"
                filePartial: str = file.split("\\")[-1].split(".")[0]

                if filePartial.startswith(refPartial) is False:
                    continue

                table: List[Dict[str, Any]] = Utility.ReadCSV(
                    self, file, WeaponProgression)

                if table is None:
                    continue

                for entry in table:
                    if entry.get("lootID") is None:
                        continue
                    elif entry.get("level") < 0:
                        continue

                    weapon["attachments"].append({
                        "id": entry.get("lootID"),
                        "altId": None,
                        "name": None,
                        "description": None,
                        "type": None,
                        "unlock": entry.get("level"),
                        "image": None,
                        "background": "ui_loot_bg_generic",
                        "attributes": [],
                        "statBars": [],
                    })