Exemple #1
0
            private static void PreviewGear(GearSelectionController __instance, IndexPath index)
            {
                GearInfo gearAtIndex1 = GearDatabase.Instance.GetGearAtIndex(index);

                if (gearAtIndex1 == (GearInfo)null)
                {
                    return;
                }
                List <GearInfo> toBeCachedGear = new List <GearInfo>();

                for (int steps = -__instance.preloadedItemsPerSide; steps <= __instance.preloadedItemsPerSide; ++steps)
                {
                    GearInfo gearAtIndex2 = GearDatabase.Instance.GetGearAtIndex(index.Horizontal(steps));
                    if (gearAtIndex2 != (GearInfo)null)
                    {
                        toBeCachedGear.Add(gearAtIndex2);
                    }
                }

                if (gearAtIndex1 is CustomGearFolderInfo)
                {
                    __instance.previewCustomizer.PreviewItem(null, toBeCachedGear);
                }
                else
                {
                    __instance.previewCustomizer.PreviewItem(gearAtIndex1, toBeCachedGear);
                }
            }
Exemple #2
0
    public void ChangeGear()
    {
        int currentIndex = gears.IndexOf(currentGear);

        if (Input.GetKeyDown(KeyCode.Q) && currentIndex != 0)
        {
            currentGear = gears[currentIndex - 1];
        }
        if (Input.GetKeyDown(KeyCode.E) && currentIndex != gears.Count - 1)
        {
            currentGear = gears[currentIndex + 1];
        }

        //gearText.text = "Gear: " + (gears.IndexOf(currentGear) + 1).ToString();
    }
Exemple #3
0
 //ini gear
 public virtual void initialization(string nameI, Stats statsI, Ranking rk, TroopType tt, Faction factionI, Experience expI)
 {
     gearInfo    = TroopDataBase.troopDataBase.getGearInfo(faction, troopType, ranking);
     name        = nameI;
     stats       = statsI;
     ranking     = rk;
     troopType   = tt;
     faction     = factionI;
     exp         = expI;
     battleValue = getBattleValue();
     inBattle    = false;
     renamed     = false;
     stamina     = getStaminaMax();
     health      = getHealthMax();
 }
Exemple #4
0
    //[SerializeField]
    //private Text speedText;

    //[SerializeField]
    //private Text gearText;

    // Start is called before the first frame update
    void Start()
    {
        rb = this.GetComponent <Rigidbody>();

        visualWheelOffset = axleInfos[0].LeftWheel.transform.GetChild(0).eulerAngles;

        currentGear = gears[0];
        //speedText.text = "Speed: 0";
        //gearText.text = "Gear: 1";

        for (int i = 0; i < axleInfos.Length; i++)
        {
            AxleInfo axle = axleInfos[i];

            axle.RightWheel.ConfigureVehicleSubsteps(20, 12, 16);
            axle.LeftWheel.ConfigureVehicleSubsteps(20, 12, 16);
        }
    }
Exemple #5
0
 public MultiplayerRemoteTexture(GearInfo gInfo, bool custom, StreamWriter sw)
 {
     this.info        = gInfo;
     this.isCustom    = custom;
     this.debugWriter = sw;
 }
Exemple #6
0
            static void Postfix(GearSelectionController __instance, IndexPath index, ref MVCListItemView itemView)
            {
                __instance.normalColor = Main.Settings.EnableDarkMode ? UserInterfaceHelper.DarkModeText.normalColor : UserInterfaceHelper.DefaultText.normalColor;

                if (index[1] < 0)
                {
                    return;
                }

                itemView.Label.richText = true;

                var officialGear = Traverse.Create(GearDatabase.Instance).Field("gearListSource").GetValue <GearInfo[][][]>();

                // return out if it's not one of the tabs XLMenuMod is aware of.
                if (index[1] < 0 || index[1] > (officialGear[index[0]].Length * 2) - 1)
                {
                    return;
                }

                bool isCustom = index[1] >= Enum.GetValues(typeof(GearCategory)).Length;

                if (SpriteHelper.MenuIcons != null)
                {
                    itemView.Label.spriteAsset = SpriteHelper.MenuIcons;
                }

                if (index.depth >= 3)
                {
                    GearInfo gearAtIndex = GearDatabase.Instance.GetGearAtIndex(index, out bool _);

                    if (gearAtIndex == null)
                    {
                        itemView.SetText("NOT FOUND", false);
                        Traverse.Create(GearSelectionController.Instance).Method("SetIsEquippedIndicators", itemView, false).GetValue();
                    }
                    else
                    {
                        // To ensure the items have the proper font and weight.
                        itemView.Label.font      = FontDatabase.bookOblique;
                        itemView.Label.fontStyle = FontStyles.Normal;

                        if (gearAtIndex.name.StartsWith("\\"))
                        {
                            if (isCustom || CategoryHelper.IsTypeOf(index, GearCategory.Hair))
                            {
                                var newText = "<space=18px><sprite name=\"folder_outline\" tint=1>";

                                if (gearAtIndex is CustomGearFolderInfo folder)
                                {
                                    if (folder.CustomSprite != null)
                                    {
                                        itemView.Label.spriteAsset = folder.CustomSprite;
                                        newText = "<space=18px><sprite=0 tint=1>";
                                    }
                                }

                                if (gearAtIndex.name.Equals("\\mod.io"))
                                {
                                    itemView.Label.spriteAsset = SpriteHelper.BrandIcons;
                                    newText = "<space=18px><sprite name=\"mod.io\" tint=1>";
                                }

                                itemView.SetText(gearAtIndex.name.Replace("\\", newText), true);
                            }
                            else
                            {
                                itemView.SetBrandSprite(gearAtIndex);
                            }
                        }
                        else if (gearAtIndex.name.Equals("..\\"))
                        {
                            itemView.SetText(gearAtIndex.name.Replace("..\\", "<space=18px><sprite name=\"folder\" tint=1>Go Back"), true);
                        }
                        else
                        {
                            itemView.SetText(gearAtIndex.name, true);
                        }

                        Traverse.Create(__instance).Method("SetIsEquippedIndicators", itemView, __instance.previewCustomizer.HasEquipped(gearAtIndex)).GetValue();
                    }
                }
            }
 public override bool EqualPaths(GearInfo other)
 {
     throw new System.NotImplementedException();
 }
    public override GearInfo getGearInfo()
    {
        GearInfo result = new GearInfo(1, 1, 1, 1, 1, 1, 1, 1, 1);

        if (skillTree != null)
        {
            if (troopType == TroopType.mainCharType)
            {
                if (skillTree.getPerk("M1_HELMET1").own)
                {
                    result.visionRating += 2;
                    result.armorRating  += 2;
                    if (skillTree.getPerk("M1_HELMET2").own)
                    {
                        result.visionRating += 2;
                        result.armorRating  += 2;
                        if (skillTree.getPerk("M1_HELMET3").own)
                        {
                            result.visionRating += 2;
                            result.armorRating  += 2;
                            if (skillTree.getPerk("M1_HELMET4A").own)
                            {
                                result.visionRating += 3;
                            }
                            else if (skillTree.getPerk("M1_HELMET4B").own)
                            {
                                result.armorRating += 3;
                            }
                        }
                    }
                }
                if (skillTree.getPerk("M1_ARMOR1").own)
                {
                    result.armorRating   += 2;
                    result.blockRating   += 2;
                    result.evasionRating += 2;
                    if (skillTree.getPerk("M1_ARMOR2").own)
                    {
                        result.armorRating   += 2;
                        result.blockRating   += 2;
                        result.evasionRating += 2;
                        if (skillTree.getPerk("M1_ARMOR3").own)
                        {
                            result.armorRating   += 2;
                            result.blockRating   += 2;
                            result.evasionRating += 2;
                            if (skillTree.getPerk("M1_ARMOR4A").own)
                            {
                                result.armorRating += 3;
                            }
                            else if (skillTree.getPerk("M1_ARMOR4B").own)
                            {
                                result.blockRating += 3;
                            }
                            else if (skillTree.getPerk("M1_ARMOR4C").own)
                            {
                                result.evasionRating += 3;
                            }
                        }
                    }
                }
                if (skillTree.getPerk("M1_CLOTHES1").own)
                {
                    result.stealthRating  += 2;
                    result.mobilityRating += 2;
                    result.evasionRating  += 2;
                    result.visionRating   += 2;
                    if (skillTree.getPerk("M1_CLOTHES2").own)
                    {
                        result.stealthRating  += 2;
                        result.mobilityRating += 2;
                        result.evasionRating  += 2;
                        result.visionRating   += 2;
                        if (skillTree.getPerk("M1_CLOTHES3").own)
                        {
                            result.stealthRating  += 2;
                            result.mobilityRating += 2;
                            result.evasionRating  += 2;
                            result.visionRating   += 2;
                            if (skillTree.getPerk("M1_CLOTHES4A").own)
                            {
                                result.stealthRating += 3;
                            }
                            else if (skillTree.getPerk("M1_CLOTHES4B").own)
                            {
                                result.mobilityRating += 3;
                            }
                            else if (skillTree.getPerk("M1_CLOTHES4C").own)
                            {
                                result.evasionRating += 3;
                            }
                            else if (skillTree.getPerk("M1_CLOTHES4D").own)
                            {
                                result.visionRating += 3;
                            }
                        }
                    }
                }
                if (skillTree.getPerk("M1_SWORD1").own)
                {
                    result.meleeDmgRating += 4;
                    result.blockRating    += 2;
                    if (skillTree.getPerk("M1_SWORD2").own)
                    {
                        result.meleeDmgRating += 4;
                        result.blockRating    += 2;
                        if (skillTree.getPerk("M1_SWORD3").own)
                        {
                            result.meleeDmgRating += 4;
                            result.blockRating    += 2;
                            if (skillTree.getPerk("M1_SWORD4A").own)
                            {
                                result.meleeDmgRating += 7;
                            }
                            else if (skillTree.getPerk("M1_SWORD4B").own)
                            {
                                result.blockRating += 3;
                            }
                            else if (skillTree.getPerk("M1_SWORD4C").own)
                            {
                                //reduce stamina cost
                            }
                        }
                    }
                }
                if (skillTree.getPerk("M1_PISTOL1").own)
                {
                    result.rangedDmgRating += 4;
                    result.accuracyRating  += 4;
                    if (skillTree.getPerk("M1_PISTOL2").own)
                    {
                        result.rangedDmgRating += 4;
                        result.accuracyRating  += 4;
                        if (skillTree.getPerk("M1_PISTOL3").own)
                        {
                            result.rangedDmgRating += 4;
                            result.accuracyRating  += 4;
                            if (skillTree.getPerk("M1_PISTOL4A").own)
                            {
                                result.rangedDmgRating += 7;
                            }
                            else if (skillTree.getPerk("M1_PISTOL4B").own)
                            {
                                result.accuracyRating += 7;
                            }
                        }
                    }
                }
                if (skillTree.getPerk("M1_BOOTS1").own)
                {
                    result.mobilityRating += 2;
                    result.stealthRating  += 2;
                    if (skillTree.getPerk("M1_BOOTS2").own)
                    {
                        result.mobilityRating += 2;
                        result.stealthRating  += 2;
                        if (skillTree.getPerk("M1_BOOTS3").own)
                        {
                            result.mobilityRating += 2;
                            result.stealthRating  += 2;
                            if (skillTree.getPerk("M1_BOOTS4A").own)
                            {
                                result.mobilityRating += 3;
                            }
                            else if (skillTree.getPerk("M1_BOOTS4B").own)
                            {
                                result.stealthRating += 3;
                            }
                        }
                    }
                }
            }
            if (troopType == TroopType.crossbowman)
            {
                skillTree = Player.mainCharacter.skillTree;
                if (skillTree.getPerk("M2_HELMET1").own)
                {
                    result.visionRating += 2;
                    result.armorRating  += 2;
                    if (skillTree.getPerk("M2_HELMET2").own)
                    {
                        result.visionRating += 2;
                        result.armorRating  += 2;
                        if (skillTree.getPerk("M2_HELMET3").own)
                        {
                            result.visionRating += 2;
                            result.armorRating  += 2;
                            if (skillTree.getPerk("M2_HELMET4A").own)
                            {
                                result.visionRating += 3;
                            }
                            else if (skillTree.getPerk("M2_HELMET4B").own)
                            {
                                result.armorRating += 3;
                            }
                        }
                    }
                }
                if (skillTree.getPerk("M2_ARMOR1").own)
                {
                    result.armorRating   += 2;
                    result.blockRating   += 2;
                    result.evasionRating += 2;
                    if (skillTree.getPerk("M2_ARMOR2").own)
                    {
                        result.armorRating   += 2;
                        result.blockRating   += 2;
                        result.evasionRating += 2;
                        if (skillTree.getPerk("M2_ARMOR3").own)
                        {
                            result.armorRating   += 2;
                            result.blockRating   += 2;
                            result.evasionRating += 2;
                            if (skillTree.getPerk("M2_ARMOR4A").own)
                            {
                                result.armorRating += 3;
                            }
                            else if (skillTree.getPerk("M2_ARMOR4B").own)
                            {
                                result.blockRating += 3;
                            }
                            else if (skillTree.getPerk("M2_ARMOR4C").own)
                            {
                                result.evasionRating += 3;
                            }
                        }
                    }
                }
                if (skillTree.getPerk("M2_CLOTHES1").own)
                {
                    result.stealthRating  += 2;
                    result.mobilityRating += 2;
                    result.evasionRating  += 2;
                    result.visionRating   += 2;
                    if (skillTree.getPerk("M2_CLOTHES2").own)
                    {
                        result.stealthRating  += 2;
                        result.mobilityRating += 2;
                        result.evasionRating  += 2;
                        result.visionRating   += 2;
                        if (skillTree.getPerk("M2_CLOTHES3").own)
                        {
                            result.stealthRating  += 2;
                            result.mobilityRating += 2;
                            result.evasionRating  += 2;
                            result.visionRating   += 2;
                            if (skillTree.getPerk("M2_CLOTHES4A").own)
                            {
                                result.stealthRating += 3;
                            }
                            else if (skillTree.getPerk("M2_CLOTHES4B").own)
                            {
                                result.mobilityRating += 3;
                            }
                            else if (skillTree.getPerk("M2_CLOTHES4C").own)
                            {
                                result.evasionRating += 3;
                            }
                            else if (skillTree.getPerk("M2_CLOTHES4D").own)
                            {
                                result.visionRating += 3;
                            }
                        }
                    }
                }
                if (skillTree.getPerk("M2_DAGGER1").own)
                {
                    result.meleeDmgRating += 4;
                    result.blockRating    += 2;
                    if (skillTree.getPerk("M2_DAGGER2").own)
                    {
                        result.meleeDmgRating += 4;
                        result.blockRating    += 2;
                        if (skillTree.getPerk("M2_DAGGER3").own)
                        {
                            result.meleeDmgRating += 4;
                            result.blockRating    += 2;
                            if (skillTree.getPerk("M2_DAGGER4A").own)
                            {
                                result.meleeDmgRating += 7;
                            }
                            else if (skillTree.getPerk("M2_DAGGER4B").own)
                            {
                                result.blockRating += 3;
                            }
                            else if (skillTree.getPerk("M2_DAGGER4C").own)
                            {
                                //reduce stamina cost
                            }
                        }
                    }
                }
                if (skillTree.getPerk("M2_CROSSBOW1").own)
                {
                    result.rangedDmgRating += 4;
                    result.accuracyRating  += 4;
                    if (skillTree.getPerk("M2_CROSSBOW2").own)
                    {
                        result.rangedDmgRating += 4;
                        result.accuracyRating  += 4;
                        if (skillTree.getPerk("M2_CROSSBOW3").own)
                        {
                            result.rangedDmgRating += 4;
                            result.accuracyRating  += 4;
                            if (skillTree.getPerk("M2_CROSSBOW4A").own)
                            {
                                result.rangedDmgRating += 7;
                            }
                            else if (skillTree.getPerk("M2_CROSSBOW4B").own)
                            {
                                result.accuracyRating += 7;
                            }
                        }
                    }
                }
                if (skillTree.getPerk("M2_BOOTS1").own)
                {
                    result.mobilityRating += 2;
                    result.stealthRating  += 2;
                    if (skillTree.getPerk("M2_BOOTS2").own)
                    {
                        result.mobilityRating += 2;
                        result.stealthRating  += 2;
                        if (skillTree.getPerk("M2_SWORD3").own)
                        {
                            result.mobilityRating += 2;
                            result.stealthRating  += 2;
                            if (skillTree.getPerk("M2_SWORD4A").own)
                            {
                                result.mobilityRating += 3;
                            }
                            else if (skillTree.getPerk("M2_SWORD4B").own)
                            {
                                result.stealthRating += 3;
                            }
                        }
                    }
                }
            }
        }

        return(result);
    }
Exemple #9
0
        public override void LoadNestedItems(object[] objectsToLoad = null)
        {
            var gearToLoad = (GearInfo[])objectsToLoad;

            if (gearToLoad == null)
            {
                return;
            }

            if (LastLoaded != null && LastLoaded == gearToLoad)
            {
                return;
            }

            LastLoaded = gearToLoad;
            NestedItems.Clear();

            CustomFolderInfo modIoFolder = null;

            foreach (var gear in gearToLoad)
            {
                GearInfo      newGear       = null;
                TextureChange textureChange = null;

                if (gear is GearInfoSingleMaterial singleMaterialGear)
                {
                    textureChange = singleMaterialGear?.textureChanges?.FirstOrDefault();
                    newGear       = singleMaterialGear;
                }
                else if (gear is CharacterBodyInfo characterBodyInfo)
                {
                    var materialChange = characterBodyInfo.materialChanges.FirstOrDefault();
                    textureChange = materialChange?.textureChanges?.FirstOrDefault();
                    newGear       = characterBodyInfo;
                }

                if (textureChange == null || string.IsNullOrEmpty(textureChange.texturePath))
                {
                    continue;
                }

                var isGearFolder = textureChange.texturePath.IsSubPathOf(SaveManager.Instance.CustomGearDir);
                var isModIo      = textureChange.texturePath.IsSubPathOf(PluginSettings.INSTALLATION_DIRECTORY);

                CustomFolderInfo parent = null;
                if (isModIo)
                {
                    AddFolder <CustomGearFolderInfo>("mod.io", null, NestedItems, ref parent);
                    modIoFolder = NestedItems.FirstOrDefault(x => x.GetName() == "\\mod.io" && x.GetPath() == null) as CustomFolderInfo;

                    var mod = InstalledGearMods.FirstOrDefault(x => textureChange.texturePath.IsSubPathOf(x.Key));

                    AddFolder <CustomGearFolderInfo>(mod.Value, null, modIoFolder.Children, ref parent);
                    AddItem(newGear, parent.Children, ref modIoFolder);

                    continue;
                }

                if (!isGearFolder && !isModIo)
                {
                    continue;
                }

                string textureSubPath = string.Empty;
                string folderPath     = string.Empty;

                if (isGearFolder)
                {
                    textureSubPath = textureChange.texturePath.Replace(SaveManager.Instance.CustomGearDir + '\\', string.Empty);
                    folderPath     = SaveManager.Instance.CustomGearDir;
                }
                else if (isModIo)
                {
                    textureSubPath = textureChange.texturePath.Replace(PluginSettings.INSTALLATION_DIRECTORY + '\\', string.Empty);
                    folderPath     = PluginSettings.INSTALLATION_DIRECTORY;
                }

                if (string.IsNullOrEmpty(textureSubPath) || string.IsNullOrEmpty(folderPath))
                {
                    continue;
                }

                var folders = textureSubPath.Split('\\').ToList();
                if (!folders.Any())
                {
                    continue;
                }

                parent = null;
                if (folders.Count == 1 || IsImage(folders.First()))
                {
                    // This gear item is at the root.
                    AddItem(newGear, NestedItems, ref parent);
                    continue;
                }

                parent = null;

                foreach (var folder in folders)
                {
                    if (IsImage(folder))
                    {
                        AddItem(newGear, parent == null ? NestedItems : parent.Children, ref parent);
                    }
                    else
                    {
                        folderPath = Path.Combine(folderPath, folder);
                        AddFolder <CustomGearFolderInfo>(folder, folderPath, parent == null ? NestedItems : parent.Children, ref parent);
                    }
                }
            }

            NestedItems = SortList(NestedItems);
        }
Exemple #10
0
            static void Postfix(GearDatabase __instance, IndexPath index, GearInfo[][][] ___gearListSource, ref GearInfo __result)
            {
                if (index.depth < 3)
                {
                    return;
                }

                // return out if it's not one of the tabs XLMenuMod is aware of.
                if (index[1] < 0 || index[1] > (___gearListSource[index[0]].Length * 2) - 1)
                {
                    return;
                }

                List <ICustomInfo> sourceList = null;

                if (CustomGearManager.Instance.CurrentFolder.HasChildren())
                {
                    sourceList = CustomGearManager.Instance.CurrentFolder.Children;
                }
                else
                {
                    if (index[1] < Enum.GetValues(typeof(GearCategory)).Length&& !CategoryHelper.IsTypeOf(index, GearCategory.SkinTone))
                    {
                        sourceList = CustomGearManager.Instance.NestedOfficialItems;
                    }
                    else if (index[1] >= Enum.GetValues(typeof(GearCategory)).Length)
                    {
                        sourceList = CustomGearManager.Instance.NestedItems;
                    }
                }

                if (sourceList == null)
                {
                    return;
                }

                if (index.LastIndex < 0 || index.LastIndex >= sourceList.Count)
                {
                    return;
                }

                var customInfo = sourceList.ElementAt(index.LastIndex);

                if (customInfo.GetParentObject() is CustomBoardGearInfo customBoardGearInfo)
                {
                    __result = customBoardGearInfo;
                }
                else if (customInfo.GetParentObject() is CustomCharacterGearInfo customCharacterGearInfo)
                {
                    __result = customCharacterGearInfo;
                }
                else if (customInfo.GetParentObject() is CustomCharacterBodyInfo customCharacterBodyInfo)
                {
                    __result = customCharacterBodyInfo;
                }
                else if (customInfo.GetParentObject() is CustomGearFolderInfo customGearFolderInfo)
                {
                    __result = customGearFolderInfo;
                }
            }