Ejemplo n.º 1
0
        /// <summary>
        /// Gets the fish location data string for the given season
        /// </summary>
        /// <param name="season">The season</param>
        /// <returns />
        private string GetFishLocationDataForSeason(Seasons season, string defaultString)
        {
            // This location thing is just how the game did it... probably don't need fish locations
            // in the backwoods, but doing this just to be safe
            Locations location = (Location == Locations.Backwoods) ? Locations.Mountain : Location;

            if (!Globals.Config.RandomizeFish)
            {
                return(defaultString);
            }

            List <int> allFishIds = FishItem.Get().Select(x => x.Id).ToList();
            List <int> fishIds    = FishItem.Get(location, season).Select(x => x.Id).ToList();

            string[] stringParts = defaultString.Split(' ');
            int      fishIdIndex = 0;

            for (int i = 0; i < stringParts.Length; i += 2)
            {
                // Skips over algae, etc.
                if (allFishIds.Contains(int.Parse(stringParts[i])))
                {
                    stringParts[i] = fishIds[fishIdIndex].ToString();
                    fishIdIndex++;
                }
            }
            if (fishIdIndex != fishIds.Count)
            {
                Globals.ConsoleError($"Didn't assign all the fish to {Location.ToString()} in the {season.ToString()}! Assigned {fishIdIndex} out of {fishIds.Count}.");
            }

            return(string.Join(" ", stringParts));
        }
Ejemplo n.º 2
0
        private static List <string> CreateNameFromPieces(int numberOfNames, List <string> adjectives, List <string> prefixes, List <string> suffixes)
        {
            List <string> createdNames = new List <string>();
            string        newName      = "default name";

            for (int i = 0; i < numberOfNames; i++)
            {
                if (prefixes.Count > 0 && suffixes.Count > 0)
                {
                    newName = $"{Globals.RNGGetAndRemoveRandomValueFromList(prefixes)}{Globals.RNGGetAndRemoveRandomValueFromList(suffixes)}";
                    if (newName.StartsWith("Mc"))
                    {
                        newName = $"Mc{newName.Substring(2, 1).ToUpper()}{newName.Substring(3)}";
                    }

                    if (Globals.RNGGetNextBoolean(10) && adjectives.Count > 0)
                    {
                        newName = $"{Globals.RNGGetAndRemoveRandomValueFromList(adjectives)} {newName}";
                    }
                    createdNames.Add(newName);
                }
                else
                {
                    Globals.ConsoleError("Error generating new name: not enough prefixes/suffixes in lists");
                }
            }

            return(createdNames);
        }
        /// <summary>
        /// Gets a random file name that matches the weapon type at the given position
        /// Will remove the name found from the list
        /// </summary>
        /// <param name="position">The position</param>
        /// <returns>The selected file name</returns>
        protected override string GetRandomFileName(Point position)
        {
            string fileName = "";

            switch (GetWeaponTypeFromPosition(position))
            {
            case WeaponType.SlashingSword:
            case WeaponType.StabbingSword:
                fileName = Globals.RNGGetAndRemoveRandomValueFromList(SwordImages);
                break;

            case WeaponType.Dagger:
                fileName = Globals.RNGGetAndRemoveRandomValueFromList(DaggerImages);
                break;

            case WeaponType.ClubOrHammer:
                fileName = Globals.RNGGetAndRemoveRandomValueFromList(HammerAndClubImages);
                break;

            case WeaponType.Slingshot:
                // TODO:Use slingshot images when we actually randomize them
                break;

            default:
                Globals.ConsoleError($"No weapon type defined at image position: {position.X}, {position.Y}");
                break;
            }

            if (string.IsNullOrEmpty(fileName))
            {
                Globals.ConsoleWarn($"Using default image for weapon at image position - you may not have enough weapon images: {position.X}, {position.Y}");
                return(null);
            }
            return(fileName);
        }
        private static List <string> CreateDescriptionFromPieces(int numberOfDescriptions, List <string> descriptionBases, List <string> nouns, List <string> adjectives, List <string> names)
        {
            List <string> createdDescriptions = new List <string>();
            string        newDescription      = "default description";

            for (int i = 0; i < numberOfDescriptions; i++)
            {
                if (descriptionBases.Count > 0 && adjectives.Count > 1 && nouns.Count > 1 && names.Count > 0)
                {
                    newDescription = Globals.RNGGetAndRemoveRandomValueFromList(descriptionBases);
                    newDescription = newDescription.Replace("[noun]", Globals.RNGGetAndRemoveRandomValueFromList(nouns));
                    newDescription = newDescription.Replace("[noun2]", Globals.RNGGetAndRemoveRandomValueFromList(nouns));
                    newDescription = newDescription.Replace("[adjective]", Globals.RNGGetAndRemoveRandomValueFromList(adjectives));
                    newDescription = newDescription.Replace("[adjective2]", Globals.RNGGetAndRemoveRandomValueFromList(adjectives));
                    newDescription = newDescription.Replace("[name]", Globals.RNGGetAndRemoveRandomValueFromList(names));
                    createdDescriptions.Add(newDescription);
                }
                else
                {
                    Globals.ConsoleError("Error generating new description: not enough descriptions or string replacements in lists.");
                }
            }

            return(createdDescriptions);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Generates a random slingshot name
        /// </summary>
        /// <param name="slingshotId">The id of the slingshot weapon</param>
        /// <returns></returns>
        private string GenerateRandomSlingshotName(WeaponIndexes slingshotId)
        {
            string typeString = "";

            switch (slingshotId)
            {
            case WeaponIndexes.Slingshot:
                typeString = Globals.RNGGetAndRemoveRandomValueFromList(Tier1Slingshots);
                break;

            case WeaponIndexes.MasterSlingshot:
                typeString = Globals.RNGGetAndRemoveRandomValueFromList(Tier2Slingshots);
                break;

            case WeaponIndexes.GalaxySlingshot:
                typeString = Globals.RNGGetAndRemoveRandomValueFromList(Tier3Slingshots);
                break;

            default:
                Globals.ConsoleError($"Trying to generate slingshot name for invalid id: {slingshotId}");
                return("ERROR");
            }

            return($"{typeString} Slingshot");
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Generates a random name for the given weapon type
        /// </summary>
        /// <param name="type">The weapon type</param>
        /// <param name="slingshotTier">
        ///		The slingshot tier, from 0 - 2 = worst to best
        /// </param>
        /// <returns></returns>
        public string GenerateRandomWeaponName(WeaponType type, WeaponIndexes slingshotId = 0)
        {
            string typeString = "";

            switch (type)
            {
            case WeaponType.SlashingSword:
            case WeaponType.StabbingSword:
                typeString = Globals.RNGGetAndRemoveRandomValueFromList(Swords);
                break;

            case WeaponType.Dagger:
                typeString = Globals.RNGGetAndRemoveRandomValueFromList(Daggers);
                break;

            case WeaponType.ClubOrHammer:
                typeString = Globals.RNGGetAndRemoveRandomValueFromList(HammersAndClubs);
                break;

            case WeaponType.Slingshot:
                return(GenerateRandomSlingshotName(slingshotId));

            default:
                Globals.ConsoleError($"Trying to generate weapon name for invalid type: {type}");
                return("ERROR");
            }

            return(GenerateRandomNonSlingshotName(typeString));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Distribute the rest of the foragable list
        /// </summary>
        /// <param name="foragableList">The list of all foragables to choose from</param>
        private static void DistributeRemainingForagables(List <Item> foragableList)
        {
            bool keepLooping = true;

            while (keepLooping)
            {
                int season = Globals.RNG.Next(0, 4);
                switch (season)
                {
                case 0:
                    keepLooping = AddToList(foragableList, SpringForagables);
                    break;

                case 1:
                    keepLooping = AddToList(foragableList, SummerForagables);
                    break;

                case 2:
                    keepLooping = AddToList(foragableList, FallForagables);
                    break;

                case 3:
                    keepLooping = AddToList(foragableList, WinterForagables);
                    break;

                default:
                    Globals.ConsoleError("Should not have generated a value above 3 for a season check!");
                    keepLooping = false;
                    break;
                }
            }
        }
        /// <summary>
        /// The factory call for this bundle - creates one of the appropriate type
        /// If there's no bundle types left, will default to a random bundle
        /// Has a 10% chance of generating a random bundle, and a 10% chance of a random reward if not the Joja room
        /// </summary>
        /// <param name="room">The room the bundle is in</param>
        /// <param name="id">The id of the bundle</param>
        public static Bundle Create(CommunityCenterRooms room, int id)
        {
            Bundle createdBundle = null;

            switch (room)
            {
            case CommunityCenterRooms.CraftsRoom:
                createdBundle = new CraftingRoomBundle();
                break;

            case CommunityCenterRooms.Pantry:
                createdBundle = new PantryBundle();
                break;

            case CommunityCenterRooms.FishTank:
                createdBundle = new FishTankBundle();
                break;

            case CommunityCenterRooms.BoilerRoom:
                createdBundle = new BoilerRoomBundle();
                break;

            case CommunityCenterRooms.Vault:
                createdBundle = new VaultBundle();
                break;

            case CommunityCenterRooms.BulletinBoard:
                createdBundle = new BulletinBoardBundle();
                break;

            case CommunityCenterRooms.Joja:
                createdBundle = new JojaBundle();
                break;

            default:
                Globals.ConsoleError($"Cannot create bundle for room: {room.ToString()}");
                return(null);
            }

            createdBundle.Room = room;
            createdBundle.Id   = id;

            if (!createdBundle.TryGenerateRandomBundle())
            {
                createdBundle.Populate();
            }
            if (!createdBundle.TryGenerateRandomReward())
            {
                createdBundle.GenerateReward();
            }

            if (createdBundle.RequiredItems == null || createdBundle.RequiredItems.Count == 0)
            {
                createdBundle.GenerateRandomBundleFailsafe();
            }

            return(createdBundle);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Parse an integer field
        /// </summary>
        /// <param name="intString">The integer to parse</param>
        /// <param name="data">The data</param>
        /// <param name="fieldName">The name of the field to report back</param>
        /// <returns />
        private static int ParseIntField(string intString, string data, string fieldName)
        {
            if (!int.TryParse(intString, out int result))
            {
                Globals.ConsoleError($"Failed to parse monster field {fieldName} with input: {data}");
                return(0);
            }

            return(result);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Parse an double field
        /// </summary>
        /// <param name="boolString">The double to parse</param>
        /// <param name="data">The data</param>
        /// <param name="fieldName">The name of the field to report back</param>
        /// <returns />
        private static double ParseDoubleField(string doubleString, string data, string fieldName)
        {
            if (!double.TryParse(doubleString, out double result))
            {
                Globals.ConsoleError($"Failed to parse monster field {fieldName} with input: {data}");
                return(0);
            }

            return(result);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Not used normally - but when it is, used for the ObjectInformation string
        /// </summary>
        /// <returns />
        public override string ToString()
        {
            if (Id == (int)ObjectIndexes.Coffee)
            {
                return($"{Name}/150/1/Crafting/{Globals.GetTranslation("item-coffee-name", new { itemName = CoffeeIngredient })}/{Globals.GetTranslation("item-coffee-description")}/drink/0 0 0 0 0 0 0 0 0 1 0/120");
            }

            Globals.ConsoleError($"Called the ToString of unexpected item {Id}: {Name}");
            return("");
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Populates the given list with five foragables
        /// </summary>
        /// <param name="foragableList">The list of all foragables to choose from</param>
        /// <param name="listToPopulate">The list to populate</param>
        private static void AddMultipleToList(List <Item> foragableList, List <Item> listToPopulate, int numberToAdd)
        {
            if (foragableList.Count < numberToAdd)
            {
                Globals.ConsoleError($"Not enough foragables to initialize everything - trying to add {numberToAdd} from a list of {foragableList.Count}.");
                return;
            }

            for (int i = 0; i < numberToAdd; i++)
            {
                AddToList(foragableList, listToPopulate);
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Gets what a price for an item might be just based on its difficulty to obtain
        /// </summary>
        /// <param name="multiplier">The multiplier for the price - will add or subtract this as a percentage</param>
        /// <returns>The computed price</returns>
        public int GetPriceForObtainingDifficulty(double multiplier)
        {
            int basePrice = 0;

            switch (DifficultyToObtain)
            {
            case ObtainingDifficulties.NoRequirements:
                basePrice = 1000;
                break;

            case ObtainingDifficulties.SmallTimeRequirements:
                basePrice = 5000;
                break;

            case ObtainingDifficulties.MediumTimeRequirements:
                basePrice = 7500;
                break;

            case ObtainingDifficulties.LargeTimeRequirements:
                basePrice = 10000;
                break;

            case ObtainingDifficulties.UncommonItem:
                basePrice = 2500;
                break;

            case ObtainingDifficulties.RareItem:
                basePrice = 20000;
                break;

            case ObtainingDifficulties.EndgameItem:
                basePrice = 20000;
                break;

            case ObtainingDifficulties.NonCraftingItem:
                basePrice = 5000;
                break;

            default:
                Globals.ConsoleError($"Tried to get a base price for an item with an unrecognized ObtainingDifficulty: {Name}");
                return(100);
            }

            int   smallerBasePrice = basePrice / 10;           // Guarantees that the price will be an even number
            Range range            = new Range(
                (int)(smallerBasePrice - (smallerBasePrice * multiplier)),
                (int)(smallerBasePrice * (multiplier + 1))
                );

            return(range.GetRandomValue() * 10);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Gets the string for the Foragable type
        /// This will be 4 of any of the foragables of the appropriate season
        /// </summary>
        /// <returns />
        private string GetStringForForagables()
        {
            Seasons season = Seasons.Spring;

            switch (Id)
            {
            case (int)ObjectIndexes.SpringSeeds:
                season = Seasons.Spring;
                break;

            case (int)ObjectIndexes.SummerSeeds:
                season = Seasons.Summer;
                break;

            case (int)ObjectIndexes.FallSeeds:
                season = Seasons.Fall;
                break;

            case (int)ObjectIndexes.WinterSeeds:
                season = Seasons.Winter;
                break;

            default:
                Globals.ConsoleError("Generated string for Foragable type for a non-wild seed! Using 1 wood instead...");
                return($"{(int)ObjectIndexes.Wood} 1");
            }

            Dictionary <int, int> foragablesToUse = new Dictionary <int, int>();

            for (int i = 0; i < 4; i++)
            {
                int foragableId = Globals.RNGGetRandomValueFromList(ItemList.GetForagables(season)).Id;
                if (foragablesToUse.ContainsKey(foragableId))
                {
                    foragablesToUse[foragableId]++;
                }
                else
                {
                    foragablesToUse.Add(foragableId, 1);
                }
            }

            string craftingString = "";

            foreach (int id in foragablesToUse.Keys)
            {
                craftingString += $"{id} {foragablesToUse[id]} ";
            }

            return(craftingString.Trim());
        }
        public static TintColorInformation ParseString(string input)
        {
            TintColorInformation tintColorInformation = new TintColorInformation();

            string[] tintColorParts = input.Split(' ');
            if (bool.TryParse(tintColorParts[0], out bool value))
            {
                tintColorInformation.HasTint = value;
            }
            else
            {
                Globals.ConsoleError($"Tried to parse {tintColorParts[0]} into a boolean for tint color info while parsing: {input}");
                return(null);
            }

            if (tintColorInformation.HasTint)
            {
                string[] rgbColors = tintColorParts.Skip(1).ToArray();
                if (rgbColors.Length % 3 != 0)
                {
                    Globals.ConsoleError($"Invalid number of RGB colors - should be divisible by 3: {input}");
                    return(null);
                }

                for (int i = 0; i < rgbColors.Length; i += 3)
                {
                    if (!int.TryParse(rgbColors[i], out int redValue))
                    {
                        Globals.ConsoleError($"Tried to parse {rgbColors[i]} into a red value while parsing: {input}");
                        return(null);
                    }

                    if (!int.TryParse(rgbColors[i + 1], out int greenValue))
                    {
                        Globals.ConsoleError($"Tried to parse {rgbColors[i + 1]} into a red value while parsing: {input}");
                        return(null);
                    }

                    if (!int.TryParse(rgbColors[i + 2], out int blueValue))
                    {
                        Globals.ConsoleError($"Tried to parse {rgbColors[i + 2]} into a blue value while parsing: {input}");
                        return(null);
                    }

                    tintColorInformation.RGBInfo.Add(new RGBInformation(redValue, greenValue, blueValue));
                }
            }

            return(tintColorInformation);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Parse an boolean field
        /// </summary>
        /// <param name="boolString">The boolean to parse</param>
        /// <param name="data">The data</param>
        /// <param name="fieldName">The name of the field to report back</param>
        /// <returns />
        private static bool ParseBooleanField(string boolString, string data, string fieldName)
        {
            if (boolString == "true")
            {
                return(true);
            }

            else if (boolString == "false")
            {
                return(false);
            }

            Globals.ConsoleError($"Failed to parse monster field {fieldName} with input: {data}");
            return(false);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Generates a string consisting of the items required to craft this item
        /// This will NOT return the same value each time it's called!
        /// </summary>
        /// <returns>
        /// A string consisting of the following format:
        /// itemId numberOfItemsRequired (repeat this x times)
        /// </returns>
        private string GetItemsRequired()
        {
            string craftingString = "";

            switch (Category)
            {
            case CraftableCategories.EasyAndNeedMany:
                craftingString = GetStringForEasyAndNeedMany();
                break;

            case CraftableCategories.Easy:
                craftingString = GetStringForEasy();
                break;

            case CraftableCategories.ModerateAndNeedMany:
                craftingString = GetStringForModerateAndNeedMany();
                break;

            case CraftableCategories.Moderate:
                craftingString = GetStringForModerate();
                break;

            case CraftableCategories.DifficultAndNeedMany:
                craftingString = GetStringForDifficultAndNeedMany();
                break;

            case CraftableCategories.Difficult:
                craftingString = GetStringForDifficult();
                break;

            case CraftableCategories.Endgame:
                craftingString = GetStringForEndgame();
                break;

            case CraftableCategories.Foragables:
                craftingString = GetStringForForagables();
                break;

            default:
                Globals.ConsoleError($"Invalid category when generating recipe for {Name}!");
                craftingString = "18 9";                         // just a random value for now
                break;
            }

            PopulateLastRecipeGenerated(craftingString);
            return(craftingString);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Parses the given time string into a list of integers
        /// </summary>
        /// <param name="timeString">The time string</param>
        /// <returns />
        private static List <int> ParseTimes(string timeString)
        {
            string[]   timeStringParts = timeString.Split(' ');
            List <int> times           = new List <int>();

            foreach (string time in timeStringParts)
            {
                if (!int.TryParse(time, out int intTime))
                {
                    Globals.ConsoleError($"Could not convert time to integer in {timeString}");
                    return(null);
                }
                times.Add(intTime);
            }

            return(times);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Gets a list of randomly generated growth stages
        /// </summary>
        /// <param name="numberOfStages"></param>
        /// <returns>A list of integers, totaling up to a max of 12</returns>
        private static List <int> GetRandomGrowthStages(int numberOfStages)
        {
            if (numberOfStages <= 0)
            {
                Globals.ConsoleError("Tried to pass an invalid number of growth stages when randomizing crops.");
                return(new List <int>());
            }

            int        maxValuePerStage = 12 / numberOfStages;
            List <int> growthStages     = new List <int>();

            for (int i = 0; i < numberOfStages; i++)
            {
                growthStages.Add(Range.GetRandomValue(1, maxValuePerStage));
            }

            return(growthStages);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Builds the image and saves the result into randomizedImage.png
        /// </summary>
        public void BuildImage()
        {
            Bitmap finalImage = null;

            finalImage = new Bitmap(BaseFileFullPath);
            using (Graphics graphics = Graphics.FromImage(finalImage))
            {
                FilesToPullFrom = GetAllCustomImages();
                foreach (Point position in PositionsToOverlay)
                {
                    string randomFileName = GetRandomFileName(position);
                    if (string.IsNullOrWhiteSpace(randomFileName) || !ShouldSaveImage(position))
                    {
                        continue;
                    }

                    if (!File.Exists(randomFileName))
                    {
                        Globals.ConsoleError($"File {randomFileName} does not exist! Using default image instead.");
                        continue;
                    }

                    Bitmap bitmap = new Bitmap(randomFileName);
                    if (bitmap.Width != ImageWidthInPx || bitmap.Height != ImageHeightInPx)
                    {
                        bitmap = CropImage(bitmap, ImageWidthInPx, ImageHeightInPx);
                    }

                    int xOffset = position.X * OffsetWidthInPx;
                    int yOffset = position.Y * OffsetHeightInPx + InitialHeightOffetInPx;

                    graphics.FillRectangle(
                        new SolidBrush(Color.FromArgb(0, 0, 1)),
                        new Rectangle(xOffset, yOffset, ImageWidthInPx, ImageHeightInPx));
                    graphics.DrawImage(bitmap, new Rectangle(xOffset, yOffset, ImageWidthInPx, ImageHeightInPx));
                }

                finalImage.MakeTransparent(Color.FromArgb(0, 0, 1));
                if (ShouldSaveImage())
                {
                    finalImage.Save(OutputFileFullPath);
                }
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Gets all the fish that can be caught during the given weather type
        /// </summary>
        /// <param name="weather">The weather type</param>
        /// <param name="includeLegendaries">Include the legendary fish</param>
        /// <returns />
        public static List <Item> Get(Weather weather, bool includeLegendaries = false)
        {
            List <FishItem> allFish = GetListAsFishItem(includeLegendaries);

            switch (weather)
            {
            case Weather.Any:
                return(allFish.Cast <Item>().ToList());

            case Weather.Sunny:
                return(allFish.Where(x => x.IsSunFish).Cast <Item>().ToList());

            case Weather.Rainy:
                return(allFish.Where(x => x.IsRainFish).Cast <Item>().ToList());
            }

            Globals.ConsoleError($"Tried to get fish belonging to the non-existent weather: {weather.ToString()}");
            return(new List <Item>());
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Parses the xnb string into a Monster object
        /// </summary>
        /// <param name="data">The xnb string</param>
        /// <returns />
        public static Monster ParseMonster(string data)
        {
            string[] fields = data.Split('/');
            if (fields.Length != 15)
            {
                Globals.ConsoleError($"Incorrect number of fields when parsing monster with input: {data}");
                return(null);
            }

            int    hp       = ParseIntField(fields[(int)MonsterFields.HP], data, "HP");
            int    damage   = ParseIntField(fields[(int)MonsterFields.Damage], data, "Damage");
            int    minCoins = ParseIntField(fields[(int)MonsterFields.MinCoins], data, "Min Coins");
            int    maxCoins = ParseIntField(fields[(int)MonsterFields.MaxCoins], data, "Max Coins");
            bool   isGlider = ParseBooleanField(fields[(int)MonsterFields.IsGlider], data, "Is Glider");
            int    randomMovementDuration = ParseIntField(fields[(int)MonsterFields.RandomMovementDuration], data, "Random Movement Duration");
            string itemDrops         = fields[(int)MonsterFields.ItemDrops];
            int    resilience        = ParseIntField(fields[(int)MonsterFields.Resiliance], data, "Resilience");
            double jitteriness       = ParseDoubleField(fields[(int)MonsterFields.Jitteriness], data, "Jitteriness");
            int    movesTowardPlayer = ParseIntField(fields[(int)MonsterFields.MoveTowardPlayer], data, "Moves Toward Player");
            int    speed             = ParseIntField(fields[(int)MonsterFields.Speed], data, "Speed");
            double missChance        = ParseDoubleField(fields[(int)MonsterFields.MissChance], data, "Miss Chance");
            bool   isMinesMonster    = ParseBooleanField(fields[(int)MonsterFields.IsMinesMonster], data, "Is Mines Monster");
            int    experience        = ParseIntField(fields[(int)MonsterFields.Experience], data, "Experience");
            string name = fields[(int)MonsterFields.Name];

            return(new Monster(
                       hp,
                       damage,
                       minCoins,
                       maxCoins,
                       isGlider,
                       randomMovementDuration,
                       itemDrops,
                       resilience,
                       jitteriness,
                       movesTowardPlayer,
                       speed,
                       missChance,
                       isMinesMonster,
                       experience,
                       name
                       ));
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Creates the bundles for the room
        /// </summary>
        /// <param name="room">The room to create bundles for</param>
        private static void CreateBundlesForRoom(RoomInformation room)
        {
            if (room.StartingIndex > room.EndingIndex)
            {
                Globals.ConsoleError("Community center room information does not have correct indexes defined.");
                return;
            }

            List <Bundle> bundles = new List <Bundle>();

            for (int i = room.StartingIndex; i < room.EndingIndex + 1; i++)
            {
                if (i == 18)
                {
                    continue;
                }                                          // That's just how this is set up
                Bundle bundle = CreateBundleForRoom(room.Room, i);
                WriteToSpoilerLog(bundle, i);
            }
        }
        /// <summary>
        /// Gets the prefix used before the reward string
        /// </summary>
        /// <returns>R if a ring; BO if a BigCraftableObject; O otherwise</returns>
        private string GetRewardStringPrefix()
        {
            if (Reward?.Item == null)
            {
                Globals.ConsoleError($"No reward item defined for bundle: {Name}");
                return("O 388 1");
            }

            if (Reward.Item.IsRing)
            {
                return("R");
            }

            if (Reward.Item.Id <= -100)
            {
                return("BO");
            }

            return("O");
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Sets the diggable item info on the given data
        /// </summary>
        /// <param name="locationData">The location data</param>
        private static void SetExtraDiggableItemInfo(LocationData locationData)
        {
            ObtainingDifficulties difficulty = GetRandomItemDifficulty();
            double probability = 0;

            switch (difficulty)
            {
            case ObtainingDifficulties.NoRequirements:
                probability = (double)Range.GetRandomValue(30, 60) / 100;
                break;

            case ObtainingDifficulties.SmallTimeRequirements:
                probability = (double)Range.GetRandomValue(30, 40) / 100;
                break;

            case ObtainingDifficulties.MediumTimeRequirements:
                probability = (double)Range.GetRandomValue(20, 30) / 100;
                break;

            case ObtainingDifficulties.LargeTimeRequirements:
                probability = (double)Range.GetRandomValue(10, 20) / 100;
                break;

            case ObtainingDifficulties.UncommonItem:
                probability = (double)Range.GetRandomValue(5, 15) / 100;
                break;

            case ObtainingDifficulties.RareItem:
                probability = (double)Range.GetRandomValue(1, 5) / 100;
                break;

            default:
                Globals.ConsoleError($"Attempting to get a diggable item with invalid difficulty: {difficulty}");
                difficulty  = ObtainingDifficulties.NoRequirements;
                probability = (double)Range.GetRandomValue(30, 60) / 100;
                break;
            }

            locationData.ExtraDiggingItem       = ItemList.GetRandomItemAtDifficulty(difficulty);
            locationData.ExtraDiggingItemRarity = probability;
        }
        /// <summary>
        /// Gets the reward string for all the required items
        /// </summary>
        /// <returns>The reward string</returns>
        private string GetRewardStringForRequiredItems()
        {
            if (RequiredItems.Count == 0)
            {
                Globals.ConsoleError($"No items defined for bundle {Name}");
                return("");
            }

            if (Room == CommunityCenterRooms.Vault)
            {
                return(RequiredItems.First().GetStringForBundles(true));
            }

            string output = "";

            foreach (RequiredItem item in RequiredItems)
            {
                output += $"{item.GetStringForBundles(false)} ";
            }
            return(output.Trim());
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Gets all the fish that can be caught during the given season
        /// </summary>
        /// <param name="season">The season</param>
        /// <param name="includeLegendaries">Include the legendary fish</param>
        /// <returns />
        public static List <Item> Get(Seasons season, bool includeLegendaries = false)
        {
            List <FishItem> allFish = GetListAsFishItem(includeLegendaries);

            switch (season)
            {
            case Seasons.Spring:
                return(allFish.Where(x => x.IsSpringFish).Cast <Item>().ToList());

            case Seasons.Summer:
                return(allFish.Where(x => x.IsSummerFish).Cast <Item>().ToList());

            case Seasons.Fall:
                return(allFish.Where(x => x.IsFallFish).Cast <Item>().ToList());

            case Seasons.Winter:
                return(allFish.Where(x => x.IsWinterFish).Cast <Item>().ToList());
            }

            Globals.ConsoleError($"Tried to get fish belonging to the non-existent season: {season.ToString()}");
            return(new List <Item>());
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Parses an item drop string into a list of item drops
        /// </summary>
        /// <param name="itemDropString">The string to parse</param>
        /// <returns />
        public static List <ItemDrop> ParseString(string itemDropString)
        {
            List <ItemDrop> itemDrops = new List <ItemDrop>();

            string[] itemTokens = itemDropString.Split(' ');
            for (int i = 0; i + 1 < itemTokens.Length; i += 2)
            {
                if (!int.TryParse(itemTokens[i], out int itemId))
                {
                    Globals.ConsoleError($"Invalid token when parsing monster item drop in string: {itemDropString}");
                    itemId = (int)ObjectIndexes.Slime;
                }

                if (!double.TryParse(itemTokens[i + 1], out double probability))
                {
                    Globals.ConsoleError($"Invalid token when parsing monster item probability in string: {itemDropString}");
                    probability = 0.75;
                }

                itemDrops.Add(new ItemDrop(itemId, probability));
            }

            return(itemDrops);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Writes out the results for the given season and foragable location data
        /// </summary>
        /// <param name="season">The season to write the results for</param>
        /// <param name="locationData">The data to write the results for</param>
        private static void WriteResultsForSeason(Seasons season, LocationData locationData)
        {
            List <ForagableData> dataToWrite = null;

            switch (season)
            {
            case Seasons.Spring:
                dataToWrite = locationData.SpringForagables;
                break;

            case Seasons.Summer:
                dataToWrite = locationData.SummerForagables;
                break;

            case Seasons.Fall:
                dataToWrite = locationData.FallForagables;
                break;

            case Seasons.Winter:
                dataToWrite = locationData.WinterForagables;
                break;
            }

            if (dataToWrite == null)
            {
                Globals.ConsoleError($"Could not find the foragable list for {season.ToString()}");
                return;
            }

            Globals.SpoilerWrite("");
            Globals.SpoilerWrite(season.ToString());
            foreach (ForagableData foragableData in dataToWrite)
            {
                Globals.SpoilerWrite($"{foragableData.ItemId}: {ItemList.Items[foragableData.ItemId].Name} | {foragableData.ItemRarity}");
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Gets the fish location data string for all the seasons
        /// Note that the original behaviors for carps and catfish were changed here for ease
        /// of ensuring that all locations have all the fish they need
        /// </summary>
        /// <returns />
        private string GetFishLocationData()
        {
            Locations location = (Location == Locations.Backwoods) ? Locations.Mountain : Location;

            switch (location)
            {
            case Locations.Desert:
                string desertDefaultString = "153 -1 164 -1 165 -1";
                string desertSpringData    = GetFishLocationDataForSeason(Seasons.Spring, desertDefaultString);
                string desertSummerData    = GetFishLocationDataForSeason(Seasons.Summer, desertDefaultString);
                string desertFallData      = GetFishLocationDataForSeason(Seasons.Fall, desertDefaultString);
                string desertWinterData    = GetFishLocationDataForSeason(Seasons.Winter, desertDefaultString);
                return($"{desertSpringData}/{desertSummerData}/{desertFallData}/{desertWinterData}");

            case Locations.BusStop:
                return("-1/-1/-1/-1");

            case Locations.Forest:
                string forestSpringData = GetFishLocationDataForSeason(Seasons.Spring, "153 -1 145 0 143 0 137 1 132 0 706 0 702 0");
                string forestSummerData = GetFishLocationDataForSeason(Seasons.Summer, "153 -1 145 0 144 -1 138 0 132 0 706 0 704 0 702 0");
                string forestFallData   = GetFishLocationDataForSeason(Seasons.Fall, "143 0 153 -1 140 -1 139 0 137 1 132 0 706 0 702 0 699 0");
                string forestWinterData = GetFishLocationDataForSeason(Seasons.Winter, "699 0 143 0 153 -1 144 -1 141 -1 140 -1 132 0 707 0 702 0");
                return($"{forestSpringData}/{forestSummerData}/{forestFallData}/{forestWinterData}");

            case Locations.Town:
                string townSpringData = GetFishLocationDataForSeason(Seasons.Spring, "137 -1 132 -1 143 -1 145 -1 153 -1 706 -1");
                string townSummerData = GetFishLocationDataForSeason(Seasons.Summer, "138 -1 132 -1 144 -1 145 -1 153 -1 706 -1");
                string townFallData   = GetFishLocationDataForSeason(Seasons.Fall, "139 -1 137 -1 132 -1 140 -1 143 -1 153 -1 706 -1 699 -1");
                string townWinterData = GetFishLocationDataForSeason(Seasons.Winter, "132 -1 140 -1 141 -1 143 -1 144 -1 153 -1 707 -1 699 -1");
                return($"{townSpringData}/{townSummerData}/{townFallData}/{townWinterData}");

            case Locations.Mountain:
                string mountainSpringData = GetFishLocationDataForSeason(Seasons.Spring, "136 -1 142 -1 153 -1 702 -1 700 -1 163 -1");
                string mountainSummerData = GetFishLocationDataForSeason(Seasons.Summer, "136 -1 142 -1 153 -1 138 -1 702 -1 700 -1 698 -1");
                string mountainFallData   = GetFishLocationDataForSeason(Seasons.Fall, "136 -1 140 -1 142 -1 153 -1 702 -1 700 -1");
                string mountainWinterData = GetFishLocationDataForSeason(Seasons.Winter, "136 -1 140 -1 141 -1 153 -1 707 -1 702 -1 700 -1 698 -1");
                return($"{mountainSpringData}/{mountainSummerData}/{mountainFallData}/{mountainWinterData}");

            case Locations.Railroad:
                return($"-1/-1/-1/-1");

            case Locations.Beach:
                string beachSpringData = GetFishLocationDataForSeason(Seasons.Spring, "129 -1 131 -1 147 -1 148 -1 152 -1 708 -1");
                string beachSummerData = GetFishLocationDataForSeason(Seasons.Summer, "128 -1 130 -1 146 -1 149 -1 150 -1 152 -1 155 -1 708 -1 701 -1");
                string beachFallData   = GetFishLocationDataForSeason(Seasons.Fall, "129 -1 131 -1 148 -1 150 -1 152 -1 154 -1 155 -1 705 -1 701 -1");
                string beachWinterData = GetFishLocationDataForSeason(Seasons.Winter, "708 -1 130 -1 131 -1 146 -1 147 -1 150 -1 151 -1 152 -1 154 -1 705 -1");
                return($"{beachSpringData}/{beachSummerData}/{beachFallData}/{beachWinterData}");

            case Locations.Woods:
                string woodsDefaultString = "734 -1 142 -1 143 -1";
                string woodsSpringData    = GetFishLocationDataForSeason(Seasons.Spring, woodsDefaultString);
                string woodsSummerData    = GetFishLocationDataForSeason(Seasons.Summer, "734 -1 142 -1 157 -1");
                string woodsFallData      = GetFishLocationDataForSeason(Seasons.Fall, woodsDefaultString);
                string woodsWinterData    = GetFishLocationDataForSeason(Seasons.Winter, "734 -1 157 -1 143 -1");
                return($"{woodsSpringData}/{woodsSummerData}/{woodsFallData}/{woodsWinterData}");

            case Locations.UndergroundMine:
                string     fishString      = "153 -1 157 -1 ";
                List <int> undergroundFish = FishItem.Get(Locations.UndergroundMine)
                                             .Where(x => !new int[] { 158, 161, 162 }.Contains(x.Id))    // The three mines fish that are not ghost fish
                                             .Select(x => x.Id)
                                             .ToList();
                fishString += $"{string.Join(" -1 ", undergroundFish)} -1";
                return($"{fishString}/{fishString}/{fishString}/{fishString}");

            default:
                Globals.ConsoleError($"No location data found for {LocationName}!");
                return("-1/-1/-1/-1/-1");
            }
        }