コード例 #1
0
        public static void setUpUserCropUtilityDictionary()
        {
            UserCropSeedUtilityDictionary.Clear();
            Dictionary <KeyValuePair <int, Crop>, float> tempDictionary = new Dictionary <KeyValuePair <int, Crop>, float>();

            foreach (var item in Game1.objectInformation)
            {
                StardewValley.Object test = new StardewValley.Object(item.Key, 1);
                if (test.getCategoryName() == "Seed")
                {
                    KeyValuePair <int, Crop> pair = StarAI.TaskCore.CropLogic.SeedLogic.getSeedCropPair(test.parentSheetIndex);


                    if (pair.Value == null)
                    {
                        continue;
                    }
                    //if (utilityValue <= 0) continue;
                    UserCropSeedUtilityDictionary.Add(test.parentSheetIndex, 0); //CHANGE THIS TO BE BASED ON THE MENU UTILITY
                    //numberOfInitializedUtilitySeedValues++;
                    ModCore.CoreMonitor.Log("Star AI: Utility Core: Calculating " + test.name + " for user utility picking with a value of: 0");
                }
            }
            ModCore.CoreMonitor.Log("UTIL COUNT:" + UserCropSeedUtilityDictionary.Count);
        }
コード例 #2
0
        public static void setUpCropUtilityDictionaryDaily()
        {
            CropSeedUtilityDictionary.Clear();
            Dictionary <int, float> tempDictionary     = new Dictionary <int, float>();
            int   numberOfInitializedUtilitySeedValues = 0;
            float totalValue = 0;

            foreach (var item in Game1.objectInformation)
            {
                StardewValley.Object test = new StardewValley.Object(item.Key, 1);
                if (test.getCategoryName() == "Seed")
                {
                    KeyValuePair <int, Crop> pair = StarAI.TaskCore.CropLogic.SeedLogic.getSeedCropPair(test.parentSheetIndex);
                    if (pair.Value == null)
                    {
                        continue;
                    }

                    float utilityValue = averageGoldPerDay(pair.Value, test);
                    if (!pair.Value.seasonsToGrowIn.Contains(Game1.currentSeason))
                    {
                        utilityValue = 0;
                    }
                    totalValue  += utilityValue;
                    utilityValue = (float)Math.Round(utilityValue, 2);
                    //if (utilityValue <= 0) continue;
                    tempDictionary.Add(test.parentSheetIndex, utilityValue); //CHANGE THIS TO BE BASED ON THE MENU UTILITY
                    numberOfInitializedUtilitySeedValues++;
                    //ModCore.CoreMonitor.Log("Star AI: Utility Core: Calculating " + test.name + " for utility picking with a value of: "+utilityValue.ToString());
                }
            }

            foreach (var c in tempDictionary)
            {
                KeyValuePair <int, float> hello = c;
                float afterValue = hello.Value / totalValue;
                CropSeedUtilityDictionary.Add(hello.Key, afterValue);
                StardewValley.Object test = new StardewValley.Object(c.Key, 1);
                ModCore.CoreMonitor.Log("Star AI: Utility Core: Calculating " + test.name + " for utility picking value of (" + hello.Value + " : " + (afterValue * 100).ToString() + "%)");
            }
            ModCore.CoreMonitor.Log("Star AI: Utility Core: Calculating " + numberOfInitializedUtilitySeedValues + " seeds for utility picking.");
            if (numberOfInitializedUtilitySeedValues == 0)
            {
                ModCore.CoreMonitor.Log("No seed values initialized. There must be no possible seeds I can grow for the rest of this season.", StardewModdingAPI.LogLevel.Alert);
            }
            recalculateAllUtilityValues();
        }
コード例 #3
0
        private static string GetSortValue(SObject Instance, SortingProperty Property)
        {
            switch (Property)
            {
            case SortingProperty.Name:
                return(Instance.DisplayName);

            case SortingProperty.Id:
                return(Instance.ParentSheetIndex.ToString("D4"));

            case SortingProperty.Category:
                return(string.Format("{0} {1}", Instance.getCategoryName(), Instance.getCategorySortValue().ToString("D3")));

            case SortingProperty.SingleValue:
                return(ItemBag.GetSingleItemPrice(Instance).ToString("D6"));

            default:
                throw new NotImplementedException(string.Format("Unimplemented {0} '{1}' in {2}.{3}", nameof(SortingProperty), Property, nameof(CommandHandler), nameof(GetSortValue)));
            }
        }
コード例 #4
0
        public static float[] Infos(int decorationRadius, Dictionary <string, float> ItemDataBase)
        {
            IModHelper Helper = ModEntry.instance.Helper;

            // Player position
            Vector2 posPlayerTile = new Vector2(Game1.player.getTileX(), Game1.player.getTileY());
            // Actual tile
            int actualTileIndex          = Game1.player.currentLocation.getTileIndexAt((int)posPlayerTile.X, (int)posPlayerTile.Y, "Back");
            int actualTileIndexBuildings = Game1.player.currentLocation.getTileIndexAt((int)posPlayerTile.X, (int)posPlayerTile.Y, "Buildings");


            // Check decoration around player
            float decorationMultiplier = 1;

            int virtualRadius;

            if (Game1.player.currentLocation.Name == "FarmHouse" ||
                Game1.player.currentLocation.Name == "Cabin")
            {
                virtualRadius = decorationRadius + 10;
            }
            else
            {
                virtualRadius = decorationRadius;
            }

            for (var y = posPlayerTile.Y - virtualRadius; y < posPlayerTile.Y + virtualRadius; y++)
            {
                for (var x = posPlayerTile.X - virtualRadius; x < posPlayerTile.X + virtualRadius; x++)
                {
                    StardewValley.Object obj = Game1.currentLocation.getObjectAtTile((int)x, (int)y) ?? null;

                    if (obj != null)
                    {
                        if (obj.getCategoryName() == "Furniture" || obj.getCategoryName() == "Decoration")
                        {
                            float itemValue;
                            if (ItemDataBase.TryGetValue(obj.Name, out itemValue))
                            {
                                decorationMultiplier += itemValue;
                            }
                        }
                    }
                }
            }


            // Check water around player
            float waterMultiplier = 1;
            float waterRadius     = 3;
            bool  foundWater      = false;

            for (var y = posPlayerTile.Y - waterRadius; y < posPlayerTile.Y + waterRadius; y++)
            {
                for (var x = posPlayerTile.X - waterRadius; x < posPlayerTile.X + waterRadius; x++)
                {
                    if (Game1.player.currentLocation.isWaterTile((int)x, (int)y))
                    {
                        waterMultiplier = 1.5f;
                        foundWater      = true;
                        break;
                    }
                }
            }
            if (foundWater)
            {
                waterNearby = true;
            }
            else
            {
                waterNearby = false;
            }

            // Reset paisage multiplier
            float paisageMultiplier = 1;


            // Check if player are below the pink tree in Town, Mountain and Forest
            if (Game1.player.currentLocation.Name == "Town" ||
                Game1.player.currentLocation.Name == "Mountain" ||
                Game1.player.currentLocation.Name == "Forest")
            {
                float pinkTreeRadius = 5;

                for (var y = posPlayerTile.Y - pinkTreeRadius; y < posPlayerTile.Y + pinkTreeRadius; y++)
                {
                    for (var x = posPlayerTile.X - pinkTreeRadius; x < posPlayerTile.X + pinkTreeRadius; x++)
                    {
                        int TileId = Game1.player.currentLocation.getTileIndexAt((int)x, (int)y, "Buildings");

                        if (TileId == 143 || TileId == 144 ||
                            TileId == 168 || TileId == 169)
                        {
                            paisageMultiplier = 3f;
                            Sound.PlaySound("wind");
                            calmPlaceLevel = 2;
                            return(new float[]
                            {
                                decorationMultiplier,
                                waterMultiplier,
                                paisageMultiplier
                            });
                        }
                        else
                        {
                            calmPlaceLevel = 0;
                        }
                    }
                }
            }


            // Town information check
            if (Game1.player.currentLocation.Name == "Town")
            {
                // Check if player are above a bridge in Town
                if (actualTileIndex == 909)
                {
                    paisageMultiplier = 2.25f;
                    calmPlaceLevel    = 1;
                }
                else
                {
                    calmPlaceLevel = 0;
                }
                // Check if player are above little bridges in Town
                if (actualTileIndex == 779 || actualTileIndex == 780 ||
                    actualTileIndex == 781 || actualTileIndex == 782)
                {
                    paisageMultiplier = 2.25f;
                    calmPlaceLevel    = 1;
                }
                else
                {
                    calmPlaceLevel = 0;
                }

                return(new float[]
                {
                    decorationMultiplier,
                    waterMultiplier,
                    paisageMultiplier
                });
            }


            // Mountain information check
            if (Game1.player.currentLocation.Name == "Mountain")
            {
                // Check if player are above little bridges in Mountain
                if (actualTileIndexBuildings == 779 || actualTileIndexBuildings == 780 ||
                    actualTileIndexBuildings == 781 || actualTileIndex == 782)
                {
                    paisageMultiplier = 2.25f;
                    calmPlaceLevel    = 1;
                }
                else
                {
                    calmPlaceLevel = 0;
                }
                if (actualTileIndexBuildings == 809 ||
                    actualTileIndexBuildings == 834 ||
                    actualTileIndexBuildings == 884)
                {
                    paisageMultiplier = 2.25f;
                    calmPlaceLevel    = 1;
                }
                else
                {
                    calmPlaceLevel = 0;
                }

                return(new float[]
                {
                    decorationMultiplier,
                    waterMultiplier,
                    paisageMultiplier
                });
            }


            // Beach information check
            if (Game1.player.currentLocation.Name == "Beach")
            {
                // Check if player are above a pier in Beach
                if (actualTileIndex == 419 || actualTileIndex == 420 ||
                    actualTileIndex == 421 || actualTileIndex == 470 ||
                    actualTileIndex == 471 || actualTileIndex == 487 ||
                    actualTileIndex == 488 || actualTileIndex == 489 ||
                    actualTileIndex == 504 || actualTileIndex == 505 ||
                    actualTileIndex == 506)
                {
                    paisageMultiplier = 2.25f;
                    calmPlaceLevel    = 1;
                }
                else
                {
                    calmPlaceLevel = 0;
                }

                return(new float[]
                {
                    decorationMultiplier,
                    waterMultiplier,
                    paisageMultiplier
                });
            }


            // Forest information check
            if (Game1.player.currentLocation.Name == "Forest")
            {
                // Check if player are below the pier in Forest
                if (actualTileIndex == 1637 || actualTileIndex == 1638 ||
                    actualTileIndex == 1639 || actualTileIndex == 1662 ||
                    actualTileIndex == 1663 || actualTileIndex == 1664 ||
                    actualTileIndex == 1687 || actualTileIndex == 1688 ||
                    actualTileIndex == 1689)
                {
                    paisageMultiplier = 2.25f;
                    calmPlaceLevel    = 1;
                }
                else
                {
                    calmPlaceLevel = 0;
                }

                // Check if player are below little bridges in Forest
                if (actualTileIndexBuildings == 809 || actualTileIndexBuildings == 859 ||
                    actualTileIndexBuildings == 860 || actualTileIndexBuildings == 885 ||
                    actualTileIndexBuildings == 910 || actualTileIndexBuildings == 884)
                {
                    paisageMultiplier = 2.25f;
                    calmPlaceLevel    = 1;
                }
                else
                {
                    calmPlaceLevel = 0;
                }

                return(new float[]
                {
                    decorationMultiplier,
                    waterMultiplier,
                    paisageMultiplier
                });
            }


            // Woods information check
            if (Game1.player.currentLocation.Name == "Woods")
            {
                // Add multiplier in woods
                paisageMultiplier = 1.5f;

                // Check if player are around the statue in Woods
                float borderRadius = 5;

                for (var y = posPlayerTile.Y - borderRadius; y < posPlayerTile.Y + borderRadius; y++)
                {
                    for (var x = posPlayerTile.X - borderRadius; x < posPlayerTile.X + borderRadius; x++)
                    {
                        int TileId = Game1.player.currentLocation.getTileIndexAt((int)x, (int)y, "Buildings");

                        if (TileId == 1140 || TileId == 1141)
                        {
                            paisageMultiplier = 3.5f;
                            Sound.PlaySound("wind");
                            calmPlaceLevel = 2;
                            return(new float[]
                            {
                                decorationMultiplier,
                                waterMultiplier,
                                paisageMultiplier
                            });
                        }
                        else
                        {
                            calmPlaceLevel = 0;
                        }
                    }
                }
            }


            // Desert information check
            if (Game1.player.currentLocation.Name == "Desert")
            {
                // Add multiplier in desert
                paisageMultiplier = 1.5f;
            }


            // Check if player are in the border of Island North
            if (Game1.player.currentLocation.Name == "IslandNorth")
            {
                float borderRadius = 5;

                for (var y = posPlayerTile.Y - borderRadius; y < posPlayerTile.Y + borderRadius; y++)
                {
                    for (var x = posPlayerTile.X - borderRadius; x < posPlayerTile.X + borderRadius; x++)
                    {
                        int TileId = Game1.player.currentLocation.getTileIndexAt((int)x, (int)y, "Buildings");

                        if (TileId == 832 || TileId == 833 ||
                            TileId == 834 || TileId == 835 ||
                            TileId == 864 || TileId == 869 ||
                            TileId == 896 || TileId == 900 ||
                            TileId == 901)
                        {
                            paisageMultiplier = 3f;
                            Sound.PlaySound("wind");
                            calmPlaceLevel = 2;
                            return(new float[]
                            {
                                decorationMultiplier,
                                waterMultiplier,
                                paisageMultiplier
                            });
                        }
                        else
                        {
                            calmPlaceLevel = 0;
                        }
                    }
                }
            }


            // Island East information check
            if (Game1.player.currentLocation.Name == "IslandEast")
            {
                // Add multiplier in island east
                paisageMultiplier = 1.5f;
                calmPlaceLevel    = 1;
                return(new float[]
                {
                    decorationMultiplier,
                    waterMultiplier,
                    paisageMultiplier
                });
            }

            // Saloon information check
            else if (Game1.player.currentLocation.Name == "Saloon")
            {
                // Add multiplier in saloon
                paisageMultiplier = 1.2f;
                calmPlaceLevel    = 1;
                return(new float[]
                {
                    decorationMultiplier,
                    waterMultiplier,
                    paisageMultiplier
                });
            }

            // Club information check
            else if (Game1.player.currentLocation.Name == "Club")
            {
                // Add multiplier in club
                paisageMultiplier = 1.2f;
                calmPlaceLevel    = 1;
                return(new float[]
                {
                    decorationMultiplier,
                    waterMultiplier,
                    paisageMultiplier
                });
            }

            // Island West Cave information check
            else if (Game1.player.currentLocation.Name == "IslandWestCave1")
            {
                // Add multiplier in Island West Cave
                paisageMultiplier = 1.5f;
                calmPlaceLevel    = 1;
                return(new float[]
                {
                    decorationMultiplier,
                    waterMultiplier,
                    paisageMultiplier
                });
            }

            // Island South East information check
            else if (Game1.player.currentLocation.Name == "IslandSouthEast")
            {
                // Add multiplier in Island South East
                paisageMultiplier = 1.5f;
                calmPlaceLevel    = 1;
                return(new float[]
                {
                    decorationMultiplier,
                    waterMultiplier,
                    paisageMultiplier
                });
            }

            // Island Shrine information check
            else if (Game1.player.currentLocation.Name == "IslandShrine")
            {
                // Add multiplier in Island Shrine
                paisageMultiplier = 1.5f;
                calmPlaceLevel    = 1;
                return(new float[]
                {
                    decorationMultiplier,
                    waterMultiplier,
                    paisageMultiplier
                });
            }

            // Island Farm Cave information check
            else if (Game1.player.currentLocation.Name == "IslandFarmCave")
            {
                // Add multiplier in Island Farm Cave
                paisageMultiplier = 1.5f;
                calmPlaceLevel    = 1;
                return(new float[]
                {
                    decorationMultiplier,
                    waterMultiplier,
                    paisageMultiplier
                });
            }

            else
            {
                calmPlaceLevel = 0;
            }

            if (Helper.ModRegistry.IsLoaded("FlashShifter.SVECode"))
            {
                // Check if player are in the Junimo Village
                if (Game1.player.currentLocation.Name == "LostWoods")
                {
                    float borderRadius = 5;

                    for (var y = posPlayerTile.Y - borderRadius; y < posPlayerTile.Y + borderRadius; y++)
                    {
                        for (var x = posPlayerTile.X - borderRadius; x < posPlayerTile.X + borderRadius; x++)
                        {
                            int TileId = Game1.player.currentLocation.getTileIndexAt((int)x, (int)y, "Buildings");

                            if (TileId == 591 || TileId == 592 ||
                                TileId == 593)
                            {
                                paisageMultiplier = 2.25f;
                                Sound.PlaySound("wind");
                                calmPlaceLevel = 2;
                                return(new float[]
                                {
                                    decorationMultiplier,
                                    waterMultiplier,
                                    paisageMultiplier
                                });
                            }
                            else
                            {
                                calmPlaceLevel = 0;
                            }
                        }
                    }
                }

                // ShearwaterBridge information check
                if (Game1.player.currentLocation.Name == "ShearwaterBridge")
                {
                    // Check if player are below the bridge in ShearwaterBridge
                    if (actualTileIndex == 598)
                    {
                        paisageMultiplier = 2;
                        calmPlaceLevel    = 2;
                    }
                    else
                    {
                        calmPlaceLevel = 0;
                    }
                    return(new float[]
                    {
                        decorationMultiplier,
                        waterMultiplier,
                        paisageMultiplier
                    });
                }

                // Summit information check
                if (Game1.player.currentLocation.Name == "Summit")
                {
                    // Add multiplier in Summit
                    paisageMultiplier = 2.5f;
                    calmPlaceLevel    = 2;
                }

                else
                {
                    calmPlaceLevel = 0;
                }
                return(new float[]
                {
                    decorationMultiplier,
                    waterMultiplier,
                    paisageMultiplier
                });
            }

            return(new float[]
            {
                decorationMultiplier,
                waterMultiplier,
                paisageMultiplier
            });
        }
コード例 #5
0
 public override string getCategoryName()
 {
     return(Item.getCategoryName());
 }
コード例 #6
0
        private static void RegisterGenerateModdedBagCommand()
        {
            string CommandName = "generate_modded_bag";
            string CommandHelp = string.Format("Creates a json file that defines a modded Item Bag for a particular mod.\n"
                                               + "Arguments: <BagName> <ModUniqueID> (This is the 'ModUniqueID' value of the mod's manifest.json that you want to generate the file for. All modded items belonging to this mod will be included in the generated modded bag)\n"
                                               + "If the BagName is multiple words, wrap it in double quotes."
                                               + "Example: {0} \"Artisan Valley Bag\" ppja.artisanvalleymachinegoods\n\n",
                                               CommandName);

            Helper.ConsoleCommands.Add(CommandName, CommandHelp, (string Name, string[] Args) =>
            {
                try
                {
                    if (!Helper.ModRegistry.IsLoaded(ItemBagsMod.JAUniqueId))
                    {
                        Monitor.Log("Unable to execute command: JsonAssets mod is not installed. Modded bags only support modded objects added through JsonAssets.", LogLevel.Alert);
                    }
                    else if (!Context.IsWorldReady)
                    {
                        Monitor.Log("Unable to execute command: JsonAssets has not finished loading modded items. You must load a save file before using this command.", LogLevel.Alert);
                    }
                    else if (Args.Length < 2)
                    {
                        Monitor.Log("Unable to execute command: Required arguments missing. You must specify a Bag Name and a ModUniqueID. All modded items from the given ModUniqueID will be included in the generated bag.", LogLevel.Alert);
                    }
                    else
                    {
                        string BagName     = Args[0];
                        string ModUniqueId = string.Join(" ", Args.Skip(1));
                        if (!Helper.ModRegistry.IsLoaded(ModUniqueId))
                        {
                            string Message = string.Format("Unable to execute command: ModUniqueID = '{0}' is not installed. "
                                                           + "Either install this mod first, or double check that you used the correct value for ModUniqueID. "
                                                           + "The ModUniqueID can be found in the mod's manifest.json file.", ModUniqueId);
                            Monitor.Log(Message, LogLevel.Alert);
                        }
                        else
                        {
                            IJsonAssetsAPI API = Helper.ModRegistry.GetApi <IJsonAssetsAPI>(ItemBagsMod.JAUniqueId);
                            if (API != null)
                            {
#if NEVER //DEBUG
                                //  Trying to figure out how to get seed ids belonging to a particular mod.
                                //  It seems like GetAllObjectsFromContentPack doesn't include the seeds, even though they are in GetAllObjectIds
                                string TestSeedName = "Adzuki Bean Seeds";
                                IDictionary <string, int> AllObjectIds = API.GetAllObjectIds();
                                List <string> AllObjectsInMod          = API.GetAllObjectsFromContentPack(ModUniqueId);
                                bool IsSeedFoundAnywhere = AllObjectIds != null && AllObjectIds.ContainsKey(TestSeedName);
                                bool IsSeedFoundInMod    = AllObjectsInMod != null && AllObjectsInMod.Contains(TestSeedName);
                                int SeedId = API.GetObjectId(TestSeedName);
#endif
                                List <ContainerSize> AllSizes = Enum.GetValues(typeof(ContainerSize)).Cast <ContainerSize>().ToList();

                                ModdedBag ModdedBag = new ModdedBag()
                                {
                                    IsEnabled      = true,
                                    ModUniqueId    = ModUniqueId,
                                    Guid           = ModdedBag.StringToGUID(ModUniqueId + BagName).ToString(),
                                    BagName        = BagName,
                                    BagDescription = string.Format("A bag for storing items belonging to {0} mod", ModUniqueId),
                                    IconTexture    = BagType.SourceTexture.SpringObjects,
                                    IconPosition   = new Rectangle(),
                                    Prices         = AllSizes.ToDictionary(x => x, x => BagTypeFactory.DefaultPrices[x]),
                                    Capacities     = AllSizes.ToDictionary(x => x, x => BagTypeFactory.DefaultCapacities[x]),
                                    Sellers        = AllSizes.ToDictionary(x => x, x => new List <BagShop>()
                                    {
                                        BagShop.Pierre
                                    }),
                                    MenuOptions = AllSizes.ToDictionary(x => x, x => new BagMenuOptions()
                                    {
                                        GroupedLayoutOptions = new BagMenuOptions.GroupedLayout()
                                        {
                                            GroupsPerRow = 5
                                        }
                                    }),
                                    Items = ModdedBag.GetModdedItems(ModUniqueId)
                                };

                                string OutputDirectory = Path.Combine(Helper.DirectoryPath, "assets", "Modded Bags");
                                string DesiredFilename = ModdedBag.ModUniqueId;
                                string CurrentFilename = DesiredFilename;
                                int CurrentIndex       = 0;
                                while (File.Exists(Path.Combine(OutputDirectory, CurrentFilename + ".json")))
                                {
                                    CurrentIndex++;
                                    CurrentFilename = string.Format("{0} ({1})", DesiredFilename, CurrentIndex);
                                }

                                string RelativePath = Path.Combine("assets", "Modded Bags", CurrentFilename + ".json");
                                Helper.Data.WriteJsonFile(RelativePath, ModdedBag);

                                Monitor.Log(string.Format("File exported to: {0}\nYou will need to re-launch the game for this file to be loaded.", Path.Combine(Helper.DirectoryPath, RelativePath)), LogLevel.Alert);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Monitor.Log(string.Format("ItemBags: Unhandled error while executing command: {0}", ex.Message), LogLevel.Error);
                }
            });

            CommandName = "generate_category_modded_bag";
            CommandHelp = string.Format("Creates a json file that defines a modded Item Bag for a particular category of items.\n"
                                        + "Arguments: <IncludeVanillaItems> <IncludeModdedItems> <SortingOrder> <BagName> <CategoryIdOrName>\n"
                                        + "IncludeVanillaItems: Possible values are 'true' or 'false' (without the quotes).\n\tIf true, the generated bag will be able to store vanilla (non-modded) items of the desired category(s).\n"
                                        + "IncludeModdedItems: Possible values are 'true' or 'false' (without the quotes).\n\tIf true, the generated bag will be able to store modded items of the desired category(s).\n"
                                        + "SortingOrder: A comma-separated list of what properties to sort the items by before exporting them.\n\tValid properties are {0}/{1}/{2}/{3}.\n\tYou can also choose {4} or {5} order for each property.\n\t"
                                        + "For example, '{6}-{7},{8}-{9}' would first sort by the {10} name in {11} order,\n\tand then sort by the item {12} in {13} order.\n"
                                        + "BagName: The name of the exported bag.\n\tIf the name is multiple words, enclose it in double quotes.\n"
                                        + "CategoryIdOrName: The name of the category, or its internal Id.\n\tMost categories can be found here: https://stardewcommunitywiki.com/Modding:Object_data#Categories \n\tYou can specify as many categories as you want.\n\tIf a category name is multiple words long, enclose it in double quotes.\n"
                                        + "Example: {14} true true \"Dairy Bag\" -5 -6\n\t"
                                        + "This would generate a bag that can store any items belonging to the Egg or Milk categories.\n\tNote that those categories are both named 'Animal Product', so to avoid amibiguity,\n\tthe category ids were used instead of the name.",
                                        SortingProperty.Name, SortingProperty.Id, SortingProperty.Category, SortingProperty.SingleValue,
                                        SortingOrder.Ascending, SortingOrder.Descending,
                                        SortingProperty.Category, SortingOrder.Ascending, SortingProperty.Id, SortingOrder.Descending, SortingProperty.Category, SortingOrder.Ascending, SortingProperty.Id, SortingOrder.Descending,
                                        CommandName);
            Helper.ConsoleCommands.Add(CommandName, CommandHelp, (string Name, string[] Args) =>
            {
                try
                {
                    if (!Context.IsWorldReady)
                    {
                        Monitor.Log("Unable to execute command: You must load a save file before using this command.", LogLevel.Alert);
                    }
                    else if (Args.Length < 5)
                    {
                        Monitor.Log(string.Format("Unable to execute command: Required arguments missing. Type 'help {0}' for more details on using this command.", CommandName), LogLevel.Alert);
                    }
                    else if (!bool.TryParse(Args[0], out bool IncludeVanillaItems))
                    {
                        Monitor.Log(string.Format("Unable to execute command: '{0}' is not a valid value for the IncludeVanillaItems parameter. Expected values are 'true' or 'false' (without the quotes)", Args[0]), LogLevel.Alert);
                    }
                    else if (!bool.TryParse(Args[1], out bool IncludeModdedItems))
                    {
                        Monitor.Log(string.Format("Unable to execute command: '{0}' is not a valid value for the IncludeModdedItems parameter. Expected values are 'true' or 'false' (without the quotes)", Args[1]), LogLevel.Alert);
                    }
                    else
                    {
                        string[] SortingArgs = Args[2].Split(',');
                        if (SortingArgs.Length == 0)
                        {
                            Monitor.Log(string.Format("Unable to execute command: '{0}' is not a valid value for the SortingOrder parameter. Type 'help {1}' for more details on using this command.", Args[2], CommandName), LogLevel.Alert);
                        }
                        else
                        {
                            bool IsOrderValid = true;
                            List <Persistence.KeyValuePair <SortingProperty, SortingOrder> > OrderBy = new List <Persistence.KeyValuePair <SortingProperty, SortingOrder> >();
                            foreach (string Value in SortingArgs)
                            {
                                string PropertyName;
                                string OrderName;
                                if (Value.Contains('-'))
                                {
                                    PropertyName = Value.Split('-')[0];
                                    OrderName    = Value.Split('-')[1];
                                }
                                else
                                {
                                    PropertyName = Value;
                                    OrderName    = SortingOrder.Ascending.ToString();
                                }

                                if (!Enum.TryParse(PropertyName, out SortingProperty Property))
                                {
                                    Monitor.Log(string.Format("Unable to execute command: '{0}' is not a valid sorting property. Expected values are: {1} {2} {3} {4}. " +
                                                              "Type 'help {5}' for more details on using this command.",
                                                              PropertyName, SortingProperty.Name, SortingProperty.Id, SortingProperty.Category, SortingProperty.SingleValue, CommandName), LogLevel.Alert);
                                    IsOrderValid = false;
                                    break;
                                }

                                if (!Enum.TryParse(OrderName, out SortingOrder Direction))
                                {
                                    Monitor.Log(string.Format("Unable to execute command: '{0}' is not a valid sorting direction. Expected values are: {1} or {2}. " +
                                                              "Type 'help {3}' for more details on using this command.",
                                                              OrderName, SortingOrder.Ascending, SortingOrder.Descending, CommandName), LogLevel.Alert);
                                    IsOrderValid = false;
                                    break;
                                }

                                OrderBy.Add(new Persistence.KeyValuePair <SortingProperty, SortingOrder>(Property, Direction));
                            }

                            if (IsOrderValid)
                            {
                                string BagName = Args[3];

                                HashSet <string> CategoryValues = new HashSet <string>(Args.Skip(4));

                                //  Get all modded item names
                                HashSet <string> ModdedItemNames = new HashSet <string>();
                                IJsonAssetsAPI API = Helper.ModRegistry.GetApi <IJsonAssetsAPI>(ItemBagsMod.JAUniqueId);
                                if (API != null)
                                {
                                    foreach (string ItemName in API.GetAllBigCraftableIds().Keys)
                                    {
                                        ModdedItemNames.Add(ItemName);
                                    }
                                    foreach (string ItemName in API.GetAllObjectIds().Keys)
                                    {
                                        ModdedItemNames.Add(ItemName);
                                    }
                                }

                                //  Get the items that match the desired conditions
                                List <SObject> TargetItems = new List <SObject>();
                                foreach (var KVP in Game1.objectInformation)
                                {
                                    int Id            = KVP.Key;
                                    SObject Instance  = new SObject(Id, 1);
                                    bool IsModdedItem = ModdedItemNames.Contains(Instance.DisplayName);

                                    if ((IsModdedItem && IncludeModdedItems) || (!IsModdedItem && IncludeVanillaItems))
                                    {
                                        if (CategoryValues.Contains(Instance.getCategoryName()) || CategoryValues.Contains(Instance.Category.ToString()))
                                        {
                                            TargetItems.Add(Instance);
                                        }
                                    }
                                }
                                foreach (var KVP in Game1.bigCraftablesInformation)
                                {
                                    int Id            = KVP.Key;
                                    SObject Instance  = new SObject(Vector2.Zero, Id, false);
                                    bool IsModdedItem = ModdedItemNames.Contains(Instance.DisplayName);

                                    if ((IsModdedItem && IncludeModdedItems) || (!IsModdedItem && IncludeVanillaItems))
                                    {
                                        if (CategoryValues.Contains(Instance.getCategoryName()) || CategoryValues.Contains(Instance.Category.ToString()))
                                        {
                                            TargetItems.Add(Instance);
                                        }
                                    }
                                }

                                List <string> Names = TargetItems.Select(x => x.DisplayName).ToList();

                                //  Sort the items
                                IOrderedEnumerable <SObject> SortedItems = ApplySorting(TargetItems, OrderBy[0].Key, OrderBy[0].Value);
                                Names = SortedItems.Select(x => x.DisplayName).ToList();
                                foreach (var KVP in OrderBy.Skip(1))
                                {
                                    SortedItems = ApplySorting(SortedItems, KVP.Key, KVP.Value);
                                    Names       = SortedItems.Select(x => x.DisplayName).ToList();
                                }

                                //  Generate the bag
                                List <ContainerSize> AllSizes = Enum.GetValues(typeof(ContainerSize)).Cast <ContainerSize>().ToList();
                                ModdedBag ModdedBag           = new ModdedBag()
                                {
                                    IsEnabled      = true,
                                    ModUniqueId    = ItemBagsMod.ModUniqueId,
                                    Guid           = ModdedBag.StringToGUID(ItemBagsMod.ModUniqueId + BagName).ToString(),
                                    BagName        = BagName,
                                    BagDescription = "A bag for storing items of specific category(s)",
                                    IconTexture    = BagType.SourceTexture.SpringObjects,
                                    IconPosition   = new Rectangle(),
                                    Prices         = AllSizes.ToDictionary(x => x, x => BagTypeFactory.DefaultPrices[x]),
                                    Capacities     = AllSizes.ToDictionary(x => x, x => BagTypeFactory.DefaultCapacities[x]),
                                    Sellers        = AllSizes.ToDictionary(x => x, x => new List <BagShop>()
                                    {
                                        BagShop.Pierre
                                    }),
                                    MenuOptions = AllSizes.ToDictionary(x => x, x => new BagMenuOptions()
                                    {
                                        GroupedLayoutOptions = new BagMenuOptions.GroupedLayout()
                                        {
                                            GroupsPerRow = 5
                                        },
                                        UngroupedLayoutOptions = new BagMenuOptions.UngroupedLayout()
                                        {
                                            Columns = 18
                                        }
                                    }),
                                    Items = SortedItems.Select(x => new ModdedItem(x, !ModdedItemNames.Contains(x.DisplayName))).ToList()
                                };

                                string OutputDirectory = Path.Combine(Helper.DirectoryPath, "assets", "Modded Bags");
                                string DesiredFilename = string.Format("Category-{0}", BagName);
                                string CurrentFilename = DesiredFilename;
                                int CurrentIndex       = 0;
                                while (File.Exists(Path.Combine(OutputDirectory, CurrentFilename + ".json")))
                                {
                                    CurrentIndex++;
                                    CurrentFilename = string.Format("{0} ({1})", DesiredFilename, CurrentIndex);
                                }

                                string RelativePath = Path.Combine("assets", "Modded Bags", CurrentFilename + ".json");
                                Helper.Data.WriteJsonFile(RelativePath, ModdedBag);

                                Monitor.Log(string.Format("File exported to: {0}\nYou will need to re-launch the game for this file to be loaded.", Path.Combine(Helper.DirectoryPath, RelativePath)), LogLevel.Alert);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Monitor.Log(string.Format("ItemBags: Unhandled error while executing command: {0}", ex.Message), LogLevel.Error);
                }
            });
        }
コード例 #7
0
        internal static void OnGameLaunched()
        {
            IModHelper Helper = ItemBagsMod.ModInstance.Helper;

#if NEVER //DEBUG
            try
            {
                //  Retrieve the item Ids of various new items added by update 1.5

                List <string> NewItemNames = new List <string>()
                {
                    "Bug Steak", "Banana Pudding", "Ginger", "Ginger Ale", "Ginger Beer", "Mango Sticky Rice", "Piña Colada", "Poi", "Taro Root", "Tropical Curry", "Squid Ink Ravioli",
                    "Deluxe Fertilizer", "Deluxe Retaining Soil", "Hyper Speed-Gro",
                    "Bone Fragment", "Fossilized Skull", "Fossilized Spine", "Fossilized Tail", "Fossilized Leg", "Fossilized Ribs", "Snake Skull", "Snake Vertebrae",
                    "Cinder Shard", "Dragon Tooth", "Tiger Slime Egg", "Fairy Dust", "Golden Walnut", "Magma Cap", "Monster Musk", "Mummified Bat", "Mummified Frog", "Ostrich Egg", "Qi Gem", "Qi Seasoning",
                    "Radioactive Ore", "Radioactive Bar", "Taro Tuber", "Mushroom Tree Seed", "Magic Bait",
                    "Stingray", "Lionfish", "Blue Discus", "Glacierfish Jr.", "Legend II", "Ms. Angler", "Radioactive Carp", "Son of Crimsonfish",
                    "Cookout Kit", "Coffee Maker", "Mahogany Seed", "Heavy Tapper", "Mango Sapling", "Mango", "Banana Sapling", "Banana",
                    "Farm Computer", "Mini-Shipping Bin", "Warp Totem: Island", "Bone Mill", "Mini-Obelisk", "Ostrich Incubator", "Geode Crusher", "Pineapple Seeds", "Pineapple",
                    "Dark Sign", "Deconstructor", "Hopper", "Solar Panel", "Fiber Seeds"
                };

                //Game1.objectInformation.GroupBy(x => x.Value).Select(x => x.First()).OrderBy(x => x.Value).ToDictionary(x => x.Value, x => x.Key);
                Dictionary <string, int> AllItems = new Dictionary <string, int>();
                foreach (var item in Game1.objectInformation)
                {
                    AllItems[item.Value.Split('/').First()] = item.Key;
                }
                foreach (var item in Game1.bigCraftablesInformation)
                {
                    AllItems[item.Value.Split('/').First()] = item.Key;
                }

                AllItems = AllItems.OrderBy(x => x.Key).ToDictionary(x => x.Key, x => x.Value);

                List <string> NotFound = new List <string>();

                List <string> Result = new List <string>();

                Dictionary <string, int> NewItems = new Dictionary <string, int>();
                foreach (string Name in NewItemNames.OrderBy(x => x))
                {
                    if (!AllItems.TryGetValue(Name, out int Id))
                    {
                        NotFound.Add(Name);
                    }
                    else
                    {
                        NewItems.Add(Name, Id);

                        Object Instance     = new Object(Id, 1);
                        bool   HasQualities = CategoriesWithQualities.Contains(Instance.Category);
                        bool   IsStackable  = Instance.maximumStackSize() > 1;
                        string Category     = Instance.getCategoryName();
                        if (string.IsNullOrEmpty(Category))
                        {
                            Category = Instance.Category.ToString();
                        }
                        Result.Add(string.Format("{0} ({1}, {2}, {3}) (Quality={4})", Name, Id, Category, ItemBag.GetSingleItemPrice(Instance), HasQualities.ToString()));
                    }
                }

                string NewItemInfo = string.Join("\n", Result);
            }
            catch (Exception) { }
#endif

            //  Load modded items from JsonAssets the moment it finishes registering items
            if (Helper.ModRegistry.IsLoaded(ItemBagsMod.JAUniqueId))
            {
                IJsonAssetsAPI API = Helper.ModRegistry.GetApi <IJsonAssetsAPI>(ItemBagsMod.JAUniqueId);
                if (API != null)
                {
                    API.IdsFixed += (sender, e) => { OnJsonAssetsIdsFixed(API, ItemBagsMod.BagConfig); };
                }
            }
        }
コード例 #8
0
        public CropUtilityMenu(int x, int y, int width, int height)
            : base(x, y, width, height, false)
        {
            List <ClickableTextureComponent> sideTabs1         = this.sideTabs;
            ClickableTextureComponent        textureComponent1 = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4 + CollectionsPage.widthToMoveActiveTab, this.yPositionOnScreen + Game1.tileSize * 2, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:Collections_Shipped"), Game1.mouseCursors, new Rectangle(640, 80, 16, 16), (float)Game1.pixelZoom, false);
            int num1 = 7001;

            textureComponent1.myID = num1;
            int num2 = 7002;

            textureComponent1.downNeighborID = num2;
            int num3 = 0;

            textureComponent1.rightNeighborID = num3;
            sideTabs1.Add(textureComponent1);
            this.collections.Add(0, new List <List <ClickableTextureComponent> >());
            List <ClickableTextureComponent> sideTabs2         = this.sideTabs;
            ClickableTextureComponent        textureComponent2 = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 3, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:Collections_Fish"), Game1.mouseCursors, new Rectangle(640, 64, 16, 16), (float)Game1.pixelZoom, false);
            int num4 = 7002;

            textureComponent2.myID = num4;
            int num5 = 7001;

            textureComponent2.upNeighborID = num5;
            int num6 = 7003;

            textureComponent2.downNeighborID = num6;
            int num7 = 0;

            textureComponent2.rightNeighborID = num7;
            sideTabs2.Add(textureComponent2);
            this.collections.Add(1, new List <List <ClickableTextureComponent> >());
            List <ClickableTextureComponent> sideTabs3         = this.sideTabs;
            ClickableTextureComponent        textureComponent3 = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 4, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:Collections_Artifacts"), Game1.mouseCursors, new Rectangle(656, 64, 16, 16), (float)Game1.pixelZoom, false);
            int num8 = 7003;

            textureComponent3.myID = num8;
            int num9 = 7002;

            textureComponent3.upNeighborID = num9;
            int num10 = 7004;

            textureComponent3.downNeighborID = num10;
            int num11 = 0;

            textureComponent3.rightNeighborID = num11;
            sideTabs3.Add(textureComponent3);
            this.collections.Add(2, new List <List <ClickableTextureComponent> >());
            List <ClickableTextureComponent> sideTabs4         = this.sideTabs;
            ClickableTextureComponent        textureComponent4 = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 5, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:Collections_Minerals"), Game1.mouseCursors, new Rectangle(672, 64, 16, 16), (float)Game1.pixelZoom, false);
            int num12 = 7004;

            textureComponent4.myID = num12;
            int num13 = 7003;

            textureComponent4.upNeighborID = num13;
            int num14 = 7005;

            textureComponent4.downNeighborID = num14;
            int num15 = 0;

            textureComponent4.rightNeighborID = num15;
            sideTabs4.Add(textureComponent4);
            this.collections.Add(3, new List <List <ClickableTextureComponent> >());
            List <ClickableTextureComponent> sideTabs5         = this.sideTabs;
            ClickableTextureComponent        textureComponent5 = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 6, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:Collections_Cooking"), Game1.mouseCursors, new Rectangle(688, 64, 16, 16), (float)Game1.pixelZoom, false);
            int num16 = 7005;

            textureComponent5.myID = num16;
            int num17 = 7004;

            textureComponent5.upNeighborID = num17;
            int num18 = 7006;

            textureComponent5.downNeighborID = num18;
            int num19 = 0;

            textureComponent5.rightNeighborID = num19;
            sideTabs5.Add(textureComponent5);
            this.collections.Add(4, new List <List <ClickableTextureComponent> >());
            List <ClickableTextureComponent> sideTabs6         = this.sideTabs;
            ClickableTextureComponent        textureComponent6 = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 7, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:Collections_Achievements"), Game1.mouseCursors, new Rectangle(656, 80, 16, 16), (float)Game1.pixelZoom, false);
            int num20 = 7006;

            textureComponent6.myID = num20;
            int num21 = 7005;

            textureComponent6.upNeighborID = num21;
            int num22 = 0;

            textureComponent6.rightNeighborID = num22;
            sideTabs6.Add(textureComponent6);
            this.collections.Add(5, new List <List <ClickableTextureComponent> >());
            CollectionsPage.widthToMoveActiveTab = Game1.tileSize / 8;
            ClickableTextureComponent textureComponent7 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 3 / 4, this.yPositionOnScreen + height - 20 * Game1.pixelZoom, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(352, 495, 12, 11), (float)Game1.pixelZoom, false);
            int num23 = 706;

            textureComponent7.myID = num23;
            int num24 = -7777;

            textureComponent7.rightNeighborID = num24;
            this.backButton = textureComponent7;
            ClickableTextureComponent textureComponent8 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + width - Game1.tileSize / 2 - 15 * Game1.pixelZoom, this.yPositionOnScreen + height - 20 * Game1.pixelZoom, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(365, 495, 12, 11), (float)Game1.pixelZoom, false);
            int num25 = 707;

            textureComponent8.myID = num25;
            int num26 = -7777;

            textureComponent8.leftNeighborID = num26;
            this.forwardButton = textureComponent8;
            int[] numArray = new int[this.sideTabs.Count];
            int   num27    = this.xPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearSideBorder;
            int   num28    = this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder - Game1.tileSize / 4;
            int   num29    = 10;

            foreach (KeyValuePair <int, string> keyValuePair in Game1.objectInformation)
            {
                string str        = keyValuePair.Value.Split('/')[3];
                bool   drawShadow = false;
                int    index;
                if (str.Contains("Arch"))
                {
                    index = 2;
                    if (Game1.player.archaeologyFound.ContainsKey(keyValuePair.Key))
                    {
                        drawShadow = true;
                    }
                }
                else if (str.Contains("Fish"))
                {
                    if (keyValuePair.Key < 167 || keyValuePair.Key >= 173)
                    {
                        index = 1;
                        if (Game1.player.fishCaught.ContainsKey(keyValuePair.Key))
                        {
                            drawShadow = true;
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
                else if (str.Contains("Mineral") || str.Substring(str.Length - 3).Equals("-2"))
                {
                    index = 3;
                    if (Game1.player.mineralsFound.ContainsKey(keyValuePair.Key))
                    {
                        drawShadow = true;
                    }
                }
                else if (str.Contains("Cooking") || str.Substring(str.Length - 3).Equals("-7"))
                {
                    index = 4;
                    if (Game1.player.recipesCooked.ContainsKey(keyValuePair.Key))
                    {
                        drawShadow = true;
                    }
                    if (keyValuePair.Key == 217 || keyValuePair.Key == 772 || keyValuePair.Key == 773)
                    {
                        continue;
                    }
                }
                else if (keyValuePair.Key > 0)
                {
                    index = 0;
                    StardewValley.Object obj = new StardewValley.Object(keyValuePair.Key, 1);
                    if (obj.getCategoryName() != "Seed")
                    {
                        continue;
                    }
                    drawShadow = true;
                }
                else
                {
                    continue;
                }
                int x1 = num27 + numArray[index] % num29 * (Game1.tileSize + 4);
                int y1 = num28 + numArray[index] / num29 * (Game1.tileSize + 4);
                if (y1 > this.yPositionOnScreen + height - 128)
                {
                    this.collections[index].Add(new List <ClickableTextureComponent>());
                    numArray[index] = 0;
                    x1 = num27;
                    y1 = num28;
                }
                if (this.collections[index].Count == 0)
                {
                    this.collections[index].Add(new List <ClickableTextureComponent>());
                }
                StardewValley.Object o = new StardewValley.Object(keyValuePair.Key, 1);
                if (o.getCategoryName() != "Seed")
                {
                    continue;
                }
                List <ClickableTextureComponent> textureComponentList = this.collections[index].Last <List <ClickableTextureComponent> >();
                float scale = Game1.pixelZoom * (1 + UtilityCore.SeedCropUtility.getUtilityScaleValue(o.parentSheetIndex));
                if (UtilityCore.SeedCropUtility.getUtilityScaleValue(o.parentSheetIndex) == 0)
                {
                    scale = 1.00f;
                }
                ClickableTextureComponent textureComponent9 = new ClickableTextureComponent(keyValuePair.Key.ToString() + " " + drawShadow.ToString(), new Rectangle(x1, y1, Game1.tileSize, Game1.tileSize), (string)null, "", Game1.objectSpriteSheet, Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, keyValuePair.Key, 16, 16), Game1.pixelZoom, drawShadow);
                textureComponent9.scale = scale;
                int count = this.collections[index].Last <List <ClickableTextureComponent> >().Count;
                textureComponent9.myID = count;
                int num30 = (this.collections[index].Last <List <ClickableTextureComponent> >().Count + 1) % num29 == 0 ? -1 : this.collections[index].Last <List <ClickableTextureComponent> >().Count + 1;
                textureComponent9.rightNeighborID = num30;
                int num31 = this.collections[index].Last <List <ClickableTextureComponent> >().Count % num29 == 0 ? 7001 : this.collections[index].Last <List <ClickableTextureComponent> >().Count - 1;
                textureComponent9.leftNeighborID = num31;
                int num32 = y1 + (Game1.tileSize + 4) > this.yPositionOnScreen + height - 128 ? -7777 : this.collections[index].Last <List <ClickableTextureComponent> >().Count + num29;
                textureComponent9.downNeighborID = num32;
                int num33 = this.collections[index].Last <List <ClickableTextureComponent> >().Count < num29 ? 12345 : this.collections[index].Last <List <ClickableTextureComponent> >().Count - num29;
                textureComponent9.upNeighborID = num33;
                int num34 = 1;
                textureComponent9.fullyImmutable = num34 != 0;
                textureComponentList.Add(textureComponent9);
                ++numArray[index];
            }
            if (this.collections[5].Count == 0)
            {
                this.collections[5].Add(new List <ClickableTextureComponent>());
            }
        }