private static string SignText(string strOverwrite)
        {
            if (strOverwrite.ToLower().Contains("[house]"))
            {
                intHouseNumber++;
            }
            Regex           reSquareBrackets = new Regex(@"(\[).*?(\])");
            MatchCollection mcSquareBrackets = reSquareBrackets.Matches(strOverwrite);

            // go backwards, because that way the indexes don't get messed up
            for (int intIndex = mcSquareBrackets.Count - 1; intIndex >= 0; intIndex--)
            {
                string strCurrentWord = strOverwrite.Substring(mcSquareBrackets[intIndex].Index + 1, mcSquareBrackets[intIndex].Length - 2);
                if (strCurrentWord.ToLower() == "house")
                {
                    strCurrentWord = "House " + intHouseNumber;
                }
                else if (File.Exists("Resources\\" + strCurrentWord + ".txt"))
                {
                    strCurrentWord = RandomHelper.RandomFileLine("Resources\\" + strCurrentWord + ".txt");
                }
                else
                {
                    strCurrentWord = "?" + strCurrentWord + "?";
                }
                strOverwrite = strOverwrite.Remove(mcSquareBrackets[intIndex].Index, mcSquareBrackets[intIndex].Length);
                strOverwrite = strOverwrite.Insert(mcSquareBrackets[intIndex].Index, strCurrentWord);
            }
            return(strOverwrite);
        }
Beispiel #2
0
        private static void MakeStreetSign(BlockManager bm, int x1, int z1, int x2, int z2)
        {
            x1 += _intBlockStart;
            z1 += _intBlockStart;
            x2 += _intBlockStart;
            z2 += _intBlockStart;
            bm.SetID(x1, 64, z1, BlockInfo.Fence.ID);
            bm.SetID(x1, 65, z1, BlockInfo.WoodPlank.ID);
            bm.SetID(x1, 66, z1, BlockInfo.Torch.ID);
            bm.SetID(x2, 64, z2, BlockInfo.Fence.ID);
            bm.SetID(x2, 65, z2, BlockInfo.WoodPlank.ID);
            bm.SetID(x2, 66, z2, BlockInfo.Torch.ID);
            if (z1 == z2)
            {
                x1--;
                x2++;
            }
            else
            {
                z1--;
                z2++;
            }
            string strStreetName, strStreetType;

            do
            {
                strStreetName = RandomHelper.RandomFileLine(Path.Combine("Resources", "Adjectives.txt"));
                strStreetType = RandomHelper.RandomFileLine(Path.Combine("Resources", "RoadTypes.txt"));
            } while (_lstStreetsUsed.Contains(strStreetName + " " + strStreetType));
            _lstStreetsUsed.Add(strStreetName + " " + strStreetType);
            BlockHelper.MakeSign(x1, 65, z1, "~" + strStreetName + "~" + strStreetType + "~", BlockInfo.WoodPlank.ID, 0);
            BlockHelper.MakeSign(x2, 65, z2, "~" + strStreetName + "~" + strStreetType + "~", BlockInfo.WoodPlank.ID, 0);
        }
Beispiel #3
0
        private static void MakeStreetSign(BlockManager bm, int x1, int z1, int x2, int z2)
        {
            x1 += intBlockStart;
            z1 += intBlockStart;
            x2 += intBlockStart;
            z2 += intBlockStart;
            bm.SetID(x1, 64, z1, (int)BlockType.WOOD_PLANK);
            bm.SetID(x1, 65, z1, (int)BlockType.TORCH);
            bm.SetID(x2, 64, z2, (int)BlockType.WOOD_PLANK);
            bm.SetID(x2, 65, z2, (int)BlockType.TORCH);
            if (z1 == z2)
            {
                x1--;
                x2++;
            }
            else
            {
                z1--;
                z2++;
            }
            string strStreetName, strStreetType;

            do
            {
                strStreetName = RandomHelper.RandomFileLine(Path.Combine("Resources", "CityAdj.txt"));
                strStreetType = RandomHelper.RandomFileLine(Path.Combine("Resources", "RoadTypes.txt"));
            } while (lstStreetsUsed.Contains(strStreetName + " " + strStreetType));
            lstStreetsUsed.Add(strStreetName + " " + strStreetType);
            BlockHelper.MakeSign(x1, 64, z1, "|" + strStreetName + "|" + strStreetType + "|", (int)BlockType.WOOD_PLANK);
            BlockHelper.MakeSign(x2, 64, z2, "|" + strStreetName + "|" + strStreetType + "|", (int)BlockType.WOOD_PLANK);
        }
Beispiel #4
0
        private void btnGenerateRandomSeedIdea_Click(object sender, EventArgs e)
        {
            RandomHelper.SetRandomSeed();
            switch (RandomHelper.Next(4))
            {
            case 0:
                txtWorldSeed.Text = "{" + RandomHelper.RandomString("Your name", "A friend's name",
                                                                    "Your pet's name", "Your shoe size", "Your lucky number") + "}";
                break;

            case 1:
                txtWorldSeed.Text = "{Your favourite " + RandomHelper.RandomString(
                    "food", "place", "activity", "Buffy character", "film", "book", "website", "game",
                    "mathematician", "tv show", "subject", "colour", "letter", "breed of hippo",
                    "celebrity", "c# hashtable key", "animal", "drink", "minecraft block", "potion",
                    "tv character", "colonel", "film character", "shade of green", "cluedo weapon",
                    "minecraft enemy", "capital", "ore", "keen commander", "dancing ghost") + "}";
                break;

            case 2:
                txtWorldSeed.Text = RandomHelper.RandomFileLine(Path.Combine("Resources", "Adjectives.txt")).ToLower().Trim();
                break;

            case 3:
                txtWorldSeed.Text = RandomHelper.RandomFileLine(Path.Combine("Resources", "Nouns.txt")).ToLower().Trim();
                break;

            default:
                txtWorldSeed.Text = "";
                break;
            }
        }
Beispiel #5
0
        private static string SignText(string strOverwrite)
        {
            switch (strOverwrite)
            {
            case "[house]":
                return("|House Number|" + ++intHouseNumber + "|");

            case "[bakery]":
                return(ConvertToSignText(RandomHelper.RandomFileLine("Resources\\Bakery.txt")));

            case "[tavern]":
                return("|The " + RandomHelper.RandomFileLine("Resources\\TavernStartingWords.txt") +
                       "|" + RandomHelper.RandomFileLine("Resources\\TavernEndingWords.txt") +
                       "|" + RandomHelper.RandomFileLine("Resources\\TavernTypes.txt"));

            case "[greenhouse]":
                return("|Greenhouse||");

            case "[warehouse]":
                return("|Warehouse||");

            case "[statue1]":
                return(ConvertToSignText(RandomHelper.RandomFileLine("Resources\\Statue1.txt")));

            case "[statue2]":
                return(ConvertToSignText(RandomHelper.RandomFileLine("Resources\\Statue2.txt")));

            case "[gravestone]":
                return(ConvertToSignText(RandomHelper.RandomFileLine("Resources\\Gravestone.txt")));

            case "[graveyard]":
                return("|Graveyard||");

            case "[crafthut]":
                return("|Crafting Hut||");

            case "[church]":
                return("The " + RandomHelper.RandomFileLine("Resources\\ChurchTypes.txt") +
                       "|of the " + RandomHelper.RandomFileLine("Resources\\ChurchStartingWords.txt") +
                       "|" + RandomHelper.RandomFileLine("Resources\\ChurchEndingWords.txt") +
                       "|");

            case "[brothel]":
                return("|" + RandomHelper.RandomFileLine("Resources\\BrothelStartingWords.txt") +
                       "|" + RandomHelper.RandomFileLine("Resources\\BrothelEndingWords.txt") +
                       "|" + RandomHelper.RandomFileLine("Resources\\BrothelTypes.txt"));

            case "[coffin]":
                return(ConvertToSignText(RandomHelper.RandomFileLine("Resources\\Gravestone.txt")));

            case "[library]":
                return(ConvertToSignText(RandomHelper.RandomFileLine("Resources\\Library.txt")));

            default:
                Debug.Fail("No handler for " + strOverwrite + " signs.");
                return("|||");
            }
        }
        private static string RandomSign()
        {
            string strSignText = "*|*|*|*";

            int intRand = rand.Next(9);

            while (intRand >= 4 && booSignUsed[intRand])
            {
                intRand = rand.Next(9);
            }
            ;
            booSignUsed[intRand] = true;

            switch (intRand)
            {
            case 0:
            case 1:
            case 2: strSignText = RandomHelper.RandomString("I will", "I can", "Will", "Can") + " " +
                                  RandomHelper.RandomString("trade", "swap", "sell") +
                                  "|" + RandomHelper.RandomString("gold", "iron", "dirt", "glass", "flowers", "cake") +
                                  "|for " + RandomHelper.RandomString("obsidian", "wood", "sand",
                                                                      "coal", "stone", "cookies") +
                                  "|- " + RandomHelper.RandomString("See", "Talk to") + " " +
                                  RandomHelper.RandomLetterUpper() + "." + RandomHelper.RandomLetterUpper() + ".";
                break;

            case 3: strSignText = RandomHelper.RandomString("Church", "Order") + " of the" +
                                  "|Holy " + RandomHelper.RandomFileLine("Resources\\ChurchStartingWords.txt") +
                                  "|are meeting" +
                                  "|this " + RandomHelper.RandomDay();
                break;

            case 4: strSignText = "Lost pet|creeper. Last|seen near the|mini crater";
                break;

            case 5: strSignText = "Israphel||Wanted dead|or alive";
                break;

            case 6: strSignText = "Lost|Jaffa Cakes.|Please return|to Honeydew";
                break;

            case 7: strSignText = "|Read note " + rand.Next(500, 999) + "||";
                break;

            case 8: strSignText = "Buy one|get one|free on|gravestones!";
                break;
            }
            return(strSignText);
        }
Beispiel #7
0
        public static string GenerateWorldName()
        {
            RandomHelper.SetRandomSeed();
            string strFolder = String.Empty;
            string strWorldName = String.Empty;
            string strType, strStart, strEnd;

            do
            {
                strType      = RandomHelper.RandomFileLine(Path.Combine("Resources", "WorldTypes.txt"));
                strStart     = RandomHelper.RandomFileLine(Path.Combine("Resources", "Adjectives.txt"));
                strEnd       = RandomHelper.RandomFileLine(Path.Combine("Resources", "Nouns.txt"));
                strWorldName = strType + " of " + strStart + strEnd;
                strFolder    = Utils.GetMinecraftSavesDirectory(strWorldName);
            } while (strStart.ToLower().Trim() == strEnd.ToLower().Trim() || Directory.Exists(strFolder) || (strStart + strEnd).Length > 14);
            return(strWorldName);
        }
Beispiel #8
0
 private void picMace_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         DateTime dtNow = new DateTime();
         dtNow = DateTime.Now;
         RandomHelper.SetSeed(dtNow.Millisecond);
         string strNames = String.Empty;
         for (int x = 0; x < 50; x++)
         {
             string strStart    = RandomHelper.RandomFileLine(Path.Combine("Resources", "Adjectives.txt"));
             string strEnd      = RandomHelper.RandomFileLine(Path.Combine("Resources", "Nouns.txt"));
             string strCityName = strStart + strEnd;
             strNames += strCityName + "\r\n";
         }
         MessageBox.Show(strNames);
     }
 }
Beispiel #9
0
        private void picMace_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                string strNames = "";
                for (int x = 0; x < 50; x++)
                {
                    strNames += "City of " + RandomHelper.RandomFileLine("Resources\\CityStartingWords.txt") +
                                RandomHelper.RandomFileLine("Resources\\CityEndingWords.txt") + "\r\n";
                }
                MessageBox.Show(strNames);
            }
            else
            {
#if DEBUG
                MessageBox.Show(SourceWorld.ConvertToSignText("[the writing is hidden behind vines]"));
#endif
            }
        }
Beispiel #10
0
 private static string SignText(string strOverwrite)
 {
     if (strOverwrite.ToLower().StartsWith("[nb]") ||
         strOverwrite.ToLower().StartsWith("[nb1]") ||
         strOverwrite.ToLower().StartsWith("[nb2]"))
     {
         return(NoticeBoard.GenerateNoticeboardSign(strOverwrite));
     }
     if (strOverwrite.ToLower().Contains("[house]"))
     {
         _intHouseNumber++;
         do
         {
             string strName = RandomHelper.RandomFileLine(Path.Combine("Resources", "CityNoun.txt")).Trim();
             strName      = strName.Substring(0, 1).ToUpper() + strName.Substring(1, strName.Length - 1);
             strOverwrite = RandomHelper.RandomFileLine(Path.Combine("Resources", "HouseTypes.txt")) + " of~" +
                            RandomHelper.RandomFileLine(Path.Combine("Resources", "Titles.txt")) +
                            " " + strName + "~- " + _intHouseNumber + " -";
         } while (!Utils.IsValidSign(strOverwrite));
     }
     else
     {
         Regex           reSquareBrackets = new Regex(@"(\[).*?(\])");
         MatchCollection mcSquareBrackets = reSquareBrackets.Matches(strOverwrite);
         for (int intIndex = mcSquareBrackets.Count - 1; intIndex >= 0; intIndex--)
         {
             string strCurrentWord = strOverwrite.Substring(mcSquareBrackets[intIndex].Index + 1,
                                                            mcSquareBrackets[intIndex].Length - 2);
             if (File.Exists(Path.Combine("Resources", strCurrentWord + ".txt")))
             {
                 strCurrentWord = RandomHelper.RandomFileLine(Path.Combine("Resources", strCurrentWord + ".txt"));
             }
             else
             {
                 strCurrentWord = "?" + strCurrentWord + "?";
                 Debug.Fail("Could not find a file for " + strCurrentWord);
             }
             strOverwrite = strOverwrite.Remove(mcSquareBrackets[intIndex].Index, mcSquareBrackets[intIndex].Length);
             strOverwrite = strOverwrite.Insert(mcSquareBrackets[intIndex].Index, strCurrentWord);
         }
     }
     return(strOverwrite);
 }
Beispiel #11
0
 private void picMace_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         DateTime dtNow = new DateTime();
         dtNow = DateTime.Now;
         RandomHelper.SetSeed(dtNow.Millisecond);
         string strNames = "";
         for (int x = 0; x < 50; x++)
         {
             string strStart    = RandomHelper.RandomFileLine("Resources\\CityAdj.txt");
             string strEnd      = RandomHelper.RandomFileLine("Resources\\CityNoun.txt");
             string strCityName = "City of " + strStart + strEnd;
             strNames += strCityName + "\r\n";
         }
         MessageBox.Show(strNames);
     }
     else
     {
         MessageBox.Show(Environment.TickCount.ToString());
         RandomHelper.SetSeed(Environment.TickCount);
     }
 }
Beispiel #12
0
        private static void MakeStreetSign(BlockManager bm, int x1, int z1, int x2, int z2)
        {
            x1 += intBlockStart;
            z1 += intBlockStart;
            x2 += intBlockStart;
            z2 += intBlockStart;
            bm.SetID(x1, 64, z1, (int)BlockType.WOOD_PLANK);
            bm.SetID(x2, 64, z2, (int)BlockType.WOOD_PLANK);
            if (z1 == z2)
            {
                x1--;
                x2++;
            }
            else
            {
                z1--;
                z2++;
            }
            string strStreetName = RandomHelper.RandomFileLine("Resources\\CityStartingWords.txt");
            string strStreetType = RandomHelper.RandomFileLine("Resources\\RoadTypes.txt");

            BlockHelper.MakeSign(x1, 64, z1, "|" + strStreetName + "|" + strStreetType + "|", (int)BlockType.WOOD_PLANK);
            BlockHelper.MakeSign(x2, 64, z2, "|" + strStreetName + "|" + strStreetType + "|", (int)BlockType.WOOD_PLANK);
        }
Beispiel #13
0
        private static string RandomSign()
        {
            string strSignText = "*|*|*|*";

            int intRand;

            do
            {
                intRand = RandomHelper.Next(booSignUsed.GetLength(0));
            } while (intRand >= 5 && booSignUsed[intRand]);
            booSignUsed[intRand] = true;

            do
            {
                switch (intRand)
                {
                case 0:
                case 1: strSignText = RandomHelper.RandomString("I will", "I can", "Will", "Can") + " " +
                                      RandomHelper.RandomString("trade", "swap", "sell") +
                                      " " + RandomHelper.RandomString("gold", "iron", "dirt", "glass", "flowers", "cake") +
                                      " for " + RandomHelper.RandomString("obsidian", "wood", "sand",
                                                                          "coal", "stone", "cookies") +
                                      "~- " + RandomHelper.RandomString("See", "Talk to") + " " +
                                      RandomHelper.RandomLetterUpper() + "." + RandomHelper.RandomLetterUpper() + ".";
                    break;

                case 2: strSignText = RandomHelper.RandomString("Church", "Order") + " of the" +
                                      " Holy " + RandomHelper.RandomFileLine(Path.Combine("Resources", "ChurchNoun.txt")) +
                                      " are meeting this " + RandomHelper.RandomDay();
                    break;

                case 3: strSignText = RandomHelper.RandomString("Mrs", "Miss") + " " +
                                      RandomHelper.RandomFileLine(Path.Combine("Resources", "CityAdj.txt")) + " has lost her " +
                                      RandomHelper.RandomString("cat", "dog", "glasses", "marbles") +
                                      RandomHelper.RandomString(". Reward offered", ". Please help");
                    break;

                case 4: strSignText = RandomHelper.RandomString("Armour", "Property", "House", "Weapons", "Gold", "Bodyguard", "Pet wolf", "Books", "Tools") +
                                      " for sale~- " + RandomHelper.RandomString("See", "Talk to") + " " +
                                      RandomHelper.RandomLetterUpper() + "." + RandomHelper.RandomLetterUpper() + ".";
                    break;

                case 5: strSignText = "Lost pet creeper. Last seen near the mini crater";
                    break;

                case 6: strSignText = "Israphel~~Wanted dead~or alive";
                    break;

                case 7: strSignText = "Lost Jaffa Cakes. Please return to Honeydew";
                    break;

                case 8: strSignText = "Read note " + RandomHelper.Next(500, 999);
                    break;

                case 9: strSignText = "Buy one get one free on gravestones!";
                    break;

                case 10: strSignText = "Archery practice this " + RandomHelper.RandomDay() + " afternoon";
                    break;

                case 11: strSignText = "Seen a crime? Tell the nearest city guard";
                    break;

                case 12: strSignText = "New city law: No minors can be miners";
                    break;
                }
            } while (!IsValidSign(strSignText));
            return(strSignText);
        }
        public static void Generate(frmMace frmLogForm, BetaWorld worldDest, BetaChunkManager cmDest, BlockManager bmDest, int x, int z)
        {
            #region create a city name
            string strStart, strEnd;
            do
            {
                strStart  = RandomHelper.RandomFileLine(Path.Combine("Resources", City.CityNamePrefixFilename));
                strEnd    = RandomHelper.RandomFileLine(Path.Combine("Resources", City.CityNameSuffixFilename));
                City.Name = "City of " + strStart + strEnd;
            } while (GenerateWorld.lstCityNames.Contains(City.Name) ||
                     strStart.ToLower().Trim() == strEnd.ToLower().Trim() ||
                     (strStart + strEnd).Length > 14);
            GenerateWorld.lstCityNames.Add(City.Name);
            #endregion

            #region determine block sizes
            City.CityLength *= 16; // chunk length
            City.FarmLength  = City.HasFarms ? 32 : 8;
            City.MapLength   = City.CityLength + (City.FarmLength * 2);
            #endregion

            #region setup classes
            BlockShapes.SetupClass(bmDest);
            BlockHelper.SetupClass(bmDest);
            NoticeBoard.SetupClass();
            if (!SourceWorld.SetupClass(worldDest))
            {
                return;
            }
            #endregion

            #region determine random options
#pragma warning disable
            switch (City.WallMaterialID)
            {
            case BlockType.WOOD_PLANK:
            case BlockType.WOOD:
            case BlockType.LEAVES:
            case BlockType.VINES:
            case BlockType.WOOL:
            case BlockType.BOOKSHELF:
                switch (City.OutsideLightType)
                {
                case "Fire":
                    frmLogForm.UpdateLog("Fixing fire-spreading combination", true, true);
                    City.OutsideLightType = "Torches";
                    break;
                }
                switch (City.MoatType)
                {
                case "Fire":
                case "Lava":
                    frmLogForm.UpdateLog("Fixing fire-spreading combination", true, true);
                    City.MoatType = "Water";
                    break;
                }
                break;
            }
#pragma warning restore
            #endregion

            #region make the city
            frmLogForm.UpdateLog("Creating the " + City.Name, false, false);
            frmLogForm.UpdateLog("City length in blocks: " + City.MapLength, true, true);
            frmLogForm.UpdateLog("City position in blocks: " + ((x + 30) * 16) + "," + ((z + 30) * 16), true, true);
            frmLogForm.UpdateLog("Theme: " + City.ThemeName, true, true);
            frmLogForm.UpdateLog("Creating underground terrain", true, false);
            Chunks.CreateInitialChunks(cmDest, frmLogForm);
            frmLogForm.UpdateProgress(0.35);

            Buildings.structPoint spMineshaftEntrance = new Buildings.structPoint();

            if (City.HasWalls)
            {
                frmLogForm.UpdateLog("Creating walls", true, false);
                Walls.MakeWalls(worldDest, frmLogForm);
            }
            frmLogForm.UpdateProgress(0.45);
            if (City.HasBuildings || City.HasPaths)
            {
                frmLogForm.UpdateLog("Creating paths", true, false);
                int[,] intArea = Paths.MakePaths(worldDest, bmDest);
                frmLogForm.UpdateProgress(0.50);
                if (City.HasBuildings)
                {
                    frmLogForm.UpdateLog("Creating buildings", true, false);
                    spMineshaftEntrance = Buildings.MakeInsideCity(bmDest, worldDest, intArea, frmLogForm);
                    frmLogForm.UpdateProgress(0.55);
                    if (City.HasMineshaft)
                    {
                        frmLogForm.UpdateLog("Creating mineshaft", true, false);
                        Mineshaft.MakeMineshaft(worldDest, bmDest, spMineshaftEntrance, frmLogForm);
                    }
                }
            }
            frmLogForm.UpdateProgress(0.60);

            if (City.HasMoat)
            {
                frmLogForm.UpdateLog("Creating moat", true, false);
                Moat.MakeMoat(frmLogForm);
            }
            frmLogForm.UpdateProgress(0.65);

            if (City.HasDrawbridges)
            {
                frmLogForm.UpdateLog("Creating drawbridges", true, false);
                Drawbridge.MakeDrawbridges(bmDest);
            }
            frmLogForm.UpdateProgress(0.70);

            if (City.HasGuardTowers)
            {
                frmLogForm.UpdateLog("Creating guard towers", true, false);
                GuardTowers.MakeGuardTowers(bmDest, frmLogForm);
            }
            frmLogForm.UpdateProgress(0.75);

            if (City.HasFarms)
            {
                frmLogForm.UpdateLog("Creating farms", true, false);
                Farms.MakeFarms(worldDest, bmDest, frmLogForm);
            }
            frmLogForm.UpdateProgress(0.80);

            if (!City.HasValuableBlocks)
            {
                frmLogForm.UpdateLog("Replacing valuable blocks", true, true);
                cmDest.Save();
                worldDest.Save();
                Chunks.ReplaceValuableBlocks(worldDest, bmDest);
            }
            frmLogForm.UpdateProgress(0.90);
            frmLogForm.UpdateLog("Creating rail data", true, false);
            Chunks.PositionRails(worldDest, bmDest);
            frmLogForm.UpdateProgress(0.95);
            frmLogForm.UpdateLog("Creating position data", true, false);

            Chunks.MoveChunks(worldDest, cmDest, x, z);
            frmLogForm.UpdateProgress(1);
            #endregion
        }
Beispiel #15
0
        private void ShowHelp(object sender, HelpEventArgs hlpevent)
        {
            string strHelp = String.Empty;

            switch (((Control)sender).Name)
            {
            case "btnAbout":
                strHelp = "You just clicked a question mark with a question mark. The world will now implode.";
                break;

            case "btnGenerateCity":
                strHelp = "This button will create a new world in your MineCraft saves directory, with a randomly generated city at the spawn point.\n\nMace doesn't interact with MineCraft directly, so you don't need MineCraft open.";
                break;

            case "picMace":
                strHelp = "Hiring all those graphics artists was definitely worth it.";
                break;
            }
            if (strHelp.Length == 0)
            {
                if (MessageBox.Show("Sorry, no help is available for this control :(\n\nWould you like to fire a random member of the Help Department?", "Help", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    Random randSeeds = new Random();
                    RandomHelper.SetSeed(randSeeds.Next());
                    MessageBox.Show("Thank you for submitting this request. We have now fired " + RandomHelper.RandomFileLine(Path.Combine("Resources", "HelpDepartment.txt")) + "\n\nYou monster.", "Requested granted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show(strHelp, "Help", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #16
0
        public void Generate(frmMace frmLogForm, string strUserCityName, bool booIncludeFarms, bool booIncludeMoat, bool booIncludeWalls,
                             bool booIncludeDrawbridges, bool booIncludeGuardTowers, bool booIncludeNoticeboard,
                             bool booIncludeBuildings, bool booIncludePaths,
                             string strCitySize, string strMoatType, string strCityEmblem, string strOutsideLights, string strFireBeacons,
                             string strCitySeed, string strWorldSeed)
        {
            #region Seed the random number generators
            int    intCitySeed, intWorldSeed;
            Random randSeeds = new Random();
            if (strCitySeed == "")
            {
                intCitySeed = randSeeds.Next();
                frmLogForm.UpdateLog("Random city seed: " + intCitySeed);
            }
            else
            {
                intCitySeed = JavaStringHashCode(strCitySeed);
                frmLogForm.UpdateLog("Random city seed: " + strCitySeed);
            }
            if (strWorldSeed == "")
            {
                intWorldSeed = randSeeds.Next();
                frmLogForm.UpdateLog("Random world seed: " + intWorldSeed);
            }
            else
            {
                intWorldSeed = JavaStringHashCode(strWorldSeed);
                frmLogForm.UpdateLog("Random world seed: " + strWorldSeed);
            }
            RandomHelper.SetSeed(intCitySeed);
            #endregion

            #region create minecraft world directory from a random unused city name
            string strFolder = "", strCityName = "";

            strUserCityName = SafeFilename(strUserCityName);
            if (strUserCityName.ToLower().Trim() == "")
            {
                strUserCityName = "Random";
            }

            if (strUserCityName.ToLower().Trim() != "random")
            {
                if (Directory.Exists(Environment.GetEnvironmentVariable("APPDATA") +
                                     @"\.minecraft\saves\" + strUserCityName + @"\"))
                {
                    if (MessageBox.Show("A world called \"" + strUserCityName + "\" already exists. " +
                                        "Would you like to use a random name instead?", "World already exists",
                                        MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
                    {
                        frmLogForm.UpdateLog("Cancelled, because a world with this name already exists.");
                        return;
                    }
                }
                else
                {
                    strCityName = strUserCityName;
                }
            }
            if (strCityName == "")
            {
                string strStart, strEnd;
                do
                {
                    strStart    = RandomHelper.RandomFileLine("Resources\\CityAdj.txt");
                    strEnd      = RandomHelper.RandomFileLine("Resources\\CityNoun.txt");
                    strCityName = "City of " + strStart + strEnd;
                    strFolder   = Environment.GetEnvironmentVariable("APPDATA") +
                                  @"\.minecraft\saves\" + strCityName + @"\";
                } while (strStart.ToLower().Trim() == strEnd.ToLower().Trim() || Directory.Exists(strFolder));
            }
            Directory.CreateDirectory(strFolder);
            #endregion

            RandomHelper.SetSeed(intCitySeed);

            #region get handles to world, chunk manager and block manager
            BetaWorld    worldDest = BetaWorld.Create(@strFolder);
            ChunkManager cmDest    = worldDest.GetChunkManager();
            BlockManager bmDest    = worldDest.GetBlockManager();
            bmDest.AutoLight = false;
            #endregion

            #region determine block sizes
            // first we set the city size by chunks
            int intCitySize = 12;
            switch (strCitySize)
            {
            case "Random":
                intCitySize = RandomHelper.Next(8, 16);
                break;

            case "Very small":
                intCitySize = 5;
                break;

            case "Small":
                intCitySize = 8;
                break;

            case "Medium":
                intCitySize = 12;
                break;

            case "Large":
                intCitySize = 16;
                break;

            case "Very large":
                intCitySize = 25;
                break;
            }
            // then we multiply by 16, because that's the x and z of a chunk
            intCitySize *= 16;
            int intFarmSize = booIncludeFarms ? 32 : 16;
            int intMapSize  = intCitySize + (intFarmSize * 2);
            #endregion

            #region setup classes
            BlockShapes.SetupClass(bmDest, intMapSize);
            BlockHelper.SetupClass(bmDest, intMapSize);
            SourceWorld.SetupClass(worldDest);
            #endregion

            if (strOutsideLights == "Random")
            {
                strOutsideLights = RandomHelper.RandomString("Fire", "Torches");
            }

            #region make the city
            frmLogForm.UpdateLog("Creating chunks");
            Chunks.MakeChunks(cmDest, 0, intMapSize / 16, frmLogForm);
            frmLogForm.UpdateProgress(35);

            if (booIncludeBuildings || booIncludePaths)
            {
                frmLogForm.UpdateLog("Creating paths");
                int[,] intArea = Paths.MakePaths(worldDest, bmDest, intFarmSize, intMapSize);
                frmLogForm.UpdateProgress(38);
                if (booIncludeBuildings)
                {
                    frmLogForm.UpdateLog("Creating buildings");
                    Buildings.MakeInsideCity(bmDest, worldDest, intArea, intFarmSize, intMapSize, booIncludePaths);
                }
            }
            frmLogForm.UpdateProgress(50);

            if (booIncludeWalls)
            {
                frmLogForm.UpdateLog("Creating walls");
                Walls.MakeWalls(worldDest, intFarmSize, intMapSize, strCityEmblem, strOutsideLights);
            }
            frmLogForm.UpdateProgress(51);

            if (booIncludeMoat)
            {
                frmLogForm.UpdateLog("Creating moat");
                Moat.MakeMoat(intFarmSize, intMapSize, strMoatType, booIncludeGuardTowers);
            }
            frmLogForm.UpdateProgress(52);

            if (booIncludeDrawbridges)
            {
                frmLogForm.UpdateLog("Creating drawbridges");
                Drawbridge.MakeDrawbridges(bmDest, intFarmSize, intMapSize, booIncludeMoat, booIncludeWalls);
            }
            frmLogForm.UpdateProgress(53);

            if (booIncludeGuardTowers)
            {
                frmLogForm.UpdateLog("Creating guard towers");
                GuardTowers.MakeGuardTowers(bmDest, intFarmSize, intMapSize, booIncludeWalls, strOutsideLights, strFireBeacons);
            }
            frmLogForm.UpdateProgress(54);

            if (booIncludeWalls && booIncludeNoticeboard)
            {
                frmLogForm.UpdateLog("Creating noticeboard");
                NoticeBoard.MakeNoticeBoard(bmDest, intFarmSize, intMapSize, intCitySeed, intWorldSeed);
            }
            frmLogForm.UpdateProgress(55);

            if (booIncludeFarms)
            {
                frmLogForm.UpdateLog("Creating farms");
                Farms.MakeFarms(worldDest, bmDest, intFarmSize, intMapSize);
            }
            frmLogForm.UpdateProgress(58);
            #endregion

            #region world settings
            // spawn in a guard tower
            //world.Level.SpawnX = intFarmSize + 5;
            //world.Level.SpawnZ = intFarmSize + 5;
            //world.Level.SpawnY = 74;
            // spawn looking at one of the city entrances
            worldDest.Level.SpawnX = intMapSize / 2;
            worldDest.Level.SpawnZ = intMapSize - (intFarmSize - 10);
            worldDest.Level.SpawnY = 64;
            // spawn in the middle of the city
            //worldDest.Level.SpawnX = intMapSize / 2;
            //worldDest.Level.SpawnZ = (intMapSize / 2) - 1;
            //worldDest.Level.SpawnY = 64;
            // spawn default
            //world.Level.SpawnX = 0;
            //world.Level.SpawnY = 65;
            //world.Level.SpawnZ = 0;
            if (strWorldSeed != "")
            {
                worldDest.Level.RandomSeed = intWorldSeed;
            }

            worldDest.Level.LevelName = strCityName;
            worldDest.Level.Time      = RandomHelper.Next(24000);

            if (RandomHelper.NextDouble() < 0.15)
            {
                worldDest.Level.IsRaining = true;
                // one-quarter to three-quarters of a day
                worldDest.Level.RainTime = RandomHelper.Next(6000, 18000);
                if (RandomHelper.NextDouble() < 0.25)
                {
                    worldDest.Level.IsThundering = true;
                    worldDest.Level.ThunderTime  = worldDest.Level.RainTime;
                }
            }
            #endregion

#if DEBUG
            MakeHelperChest(bmDest, worldDest.Level.SpawnX + 2, worldDest.Level.SpawnY, worldDest.Level.SpawnZ + 2);
#endif

            frmLogForm.UpdateLog("Resetting lighting");
            Chunks.ResetLighting(worldDest, cmDest, frmLogForm, (int)Math.Pow(intMapSize / 16, 2));

            worldDest.Save();

            frmLogForm.UpdateLog("\r\nCreated the " + strCityName + "!");
            frmLogForm.UpdateLog("It'll be at the end of your MineCraft world list.");
        }
Beispiel #17
0
        public void Generate(frmMace frmLogForm, bool booIncludeFarms, bool booIncludeMoat, bool booIncludeWalls,
                             bool booIncludeDrawbridges, bool booIncludeGuardTowers, bool booIncludeNoticeboard,
                             bool booIncludeBuildings, bool booIncludePaths,
                             string strCitySize, string strMoatType, string strCityEmblem, string strOutsideLights, string strFireBeacons)
        {
            #region create minecraft world directory from a random unused city name
            string strFolder = "", strCityName = "";
            do
            {
                strCityName = "City of " + RandomHelper.RandomFileLine("Resources\\CityStartingWords.txt")
                              + RandomHelper.RandomFileLine("Resources\\CityEndingWords.txt");
                strFolder = Environment.GetEnvironmentVariable("APPDATA") + @"\.minecraft\saves\" + strCityName + @"\";
            } while (Directory.Exists(strFolder));
            Directory.CreateDirectory(strFolder);
            #endregion

            #region get handles to world, chunk manager and block manager
            BetaWorld    worldDest = BetaWorld.Create(@strFolder);
            ChunkManager cmDest    = worldDest.GetChunkManager();
            BlockManager bmDest    = worldDest.GetBlockManager();
            bmDest.AutoLight = false;
            #endregion

            Random rand = new Random();

            #region determine block sizes
            // first we set the city size by chunks
            int intCitySize = 12;
            switch (strCitySize)
            {
            case "Random":
                intCitySize = rand.Next(8, 16);
                break;

            case "Very small":
                intCitySize = 5;
                break;

            case "Small":
                intCitySize = 8;
                break;

            case "Medium":
                intCitySize = 12;
                break;

            case "Large":
                intCitySize = 16;
                break;

            case "Very large":
                intCitySize = 25;
                break;
            }
            // then we multiply by 16, because that's the x and z of a chunk
            intCitySize *= 16;
            int intFarmSize = booIncludeFarms ? 32 : 16;
            int intMapSize  = intCitySize + (intFarmSize * 2);
            #endregion

            #region setup classes
            BlockShapes.SetupClass(bmDest, intMapSize);
            BlockHelper.SetupClass(bmDest, intMapSize);
            SourceWorld.SetupClass();
            #endregion

            if (strOutsideLights == "Random")
            {
                strOutsideLights = RandomHelper.RandomString("Fire", "Torches");
            }

            #region make the city
            frmLogForm.UpdateLog("Creating chunks");
            Chunks.MakeChunks(cmDest, 0, intMapSize / 16, frmLogForm);
            frmLogForm.UpdateProgress(35);

            // todo: test excluding paths/buildings
            if (booIncludeBuildings || booIncludePaths)
            {
                frmLogForm.UpdateLog("Creating paths");
                int[,] intArea = Paths.MakePaths(worldDest, bmDest, intFarmSize, intMapSize);
                frmLogForm.UpdateProgress(38);
                if (booIncludeBuildings)
                {
                    frmLogForm.UpdateLog("Creating buildings");
                    Buildings.MakeInsideCity(bmDest, worldDest, intArea, intFarmSize, intMapSize, booIncludePaths);
                }
            }
            frmLogForm.UpdateProgress(50);

            if (booIncludeWalls)
            {
                frmLogForm.UpdateLog("Creating walls");
                Walls.MakeWalls(worldDest, intFarmSize, intMapSize, strCityEmblem, strOutsideLights);
            }
            frmLogForm.UpdateProgress(51);

            if (booIncludeMoat)
            {
                frmLogForm.UpdateLog("Creating moat");
                Moat.MakeMoat(intFarmSize, intMapSize, strMoatType, booIncludeGuardTowers);
            }
            frmLogForm.UpdateProgress(52);

            if (booIncludeDrawbridges)
            {
                frmLogForm.UpdateLog("Creating drawbridges");
                Drawbridge.MakeDrawbridges(bmDest, intFarmSize, intMapSize, booIncludeMoat, booIncludeWalls);
            }
            frmLogForm.UpdateProgress(53);

            if (booIncludeGuardTowers)
            {
                frmLogForm.UpdateLog("Creating guard towers");
                GuardTowers.MakeGuardTowers(bmDest, intFarmSize, intMapSize, booIncludeWalls, strOutsideLights, strFireBeacons);
            }
            frmLogForm.UpdateProgress(54);

            if (booIncludeWalls && booIncludeNoticeboard)
            {
                frmLogForm.UpdateLog("Creating noticeboard");
                NoticeBoard.MakeNoticeBoard(bmDest, intFarmSize, intMapSize);
            }
            frmLogForm.UpdateProgress(55);

            if (booIncludeFarms)
            {
                frmLogForm.UpdateLog("Creating farms");
                Farms.MakeFarms(worldDest, bmDest, intFarmSize, intMapSize);
            }
            frmLogForm.UpdateProgress(58);
            #endregion

            #region world settings
            // spawn in a guard tower
            //world.Level.SpawnX = intFarmSize + 5;
            //world.Level.SpawnZ = intFarmSize + 5;
            //world.Level.SpawnY = 74;
            // spawn looking at one of the city entrances
            worldDest.Level.SpawnX = intMapSize / 2;
            worldDest.Level.SpawnZ = intMapSize - (intFarmSize - 10);
            worldDest.Level.SpawnY = 64;
            // spawn default
            //world.Level.SpawnX = 0;
            //world.Level.SpawnY = 65;
            //world.Level.SpawnZ = 0;

            worldDest.Level.LevelName = strCityName;
            worldDest.Level.Time      = rand.Next(24000);

            if (rand.NextDouble() < 0.15)
            {
                worldDest.Level.IsRaining = true;
                // one-quarter to three-quarters of a day
                worldDest.Level.RainTime = rand.Next(6000, 18000);
                if (rand.NextDouble() < 0.25)
                {
                    worldDest.Level.IsThundering = true;
                    worldDest.Level.ThunderTime  = worldDest.Level.RainTime;
                }
            }
            #endregion

#if DEBUG
            MakeHelperChest(bmDest, worldDest.Level.SpawnX + 2, worldDest.Level.SpawnY, worldDest.Level.SpawnZ + 2);
#endif

            frmLogForm.UpdateLog("Resetting lighting");
            Chunks.ResetLighting(worldDest, cmDest, frmLogForm, (int)Math.Pow(intMapSize / 16, 2));

            worldDest.Save();

            frmLogForm.UpdateLog("\r\nCreated the " + strCityName + "!");
            frmLogForm.UpdateLog("It'll be at the end of your MineCraft world list.");
        }
        public static void Generate(frmMace frmLogForm, string strUserCityName,
                                    bool booIncludeFarms, bool booIncludeMoat, bool booIncludeWalls,
                                    bool booIncludeDrawbridges, bool booIncludeGuardTowers, bool booIncludeBuildings,
                                    bool booIncludePaths, bool booIncludeMineshaft, bool booIncludeItemsInChests,
                                    bool booIncludeValuableBlocks, bool booIncludeGhostdancerSpawners,
                                    string strCitySize, string strMoatType, string strCityEmblem,
                                    string strOutsideLights, string strTowerAddition, string strWallMaterial,
                                    string strCitySeed, string strWorldSeed, bool booExportSchematic)
        {
            #region seed the random number generators
            int    intCitySeed, intWorldSeed;
            Random randSeeds = new Random();
            if (strCitySeed.Length == 0)
            {
                intCitySeed = randSeeds.Next();
                frmLogForm.UpdateLog("Random city seed: " + intCitySeed);
            }
            else
            {
                intCitySeed = JavaStringHashCode(strCitySeed);
                frmLogForm.UpdateLog("Random city seed: " + strCitySeed);
            }
            if (strWorldSeed.Length == 0)
            {
                intWorldSeed = randSeeds.Next();
                frmLogForm.UpdateLog("Random world seed: " + intWorldSeed);
            }
            else
            {
                intWorldSeed = JavaStringHashCode(strWorldSeed);
                frmLogForm.UpdateLog("Random world seed: " + strWorldSeed);
            }
            RandomHelper.SetSeed(intCitySeed);
            #endregion

            #region create minecraft world directory from a random unused city name
            string strFolder = String.Empty, strCityName = String.Empty;

            strUserCityName = SafeFilename(strUserCityName);
            if (strUserCityName.ToLower().Trim().Length == 0)
            {
                strUserCityName = "random";
            }

            if (strUserCityName.ToLower().Trim() != "random")
            {
                if (Directory.Exists(Utils.GetMinecraftSavesDirectory(strUserCityName)))
                {
                    if (MessageBox.Show("A world called \"" + strUserCityName + "\" already exists. " +
                                        "Would you like to use a random name instead?", "World already exists",
                                        MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
                    {
                        frmLogForm.UpdateLog("Cancelled, because a world with this name already exists.");
                        return;
                    }
                }
                else
                {
                    strCityName = strUserCityName;
                    strFolder   = Utils.GetMinecraftSavesDirectory(strCityName);
                }
            }
            if (strCityName.Length == 0)
            {
                string strStart, strEnd;
                do
                {
                    strStart    = RandomHelper.RandomFileLine(Path.Combine("Resources", "CityAdj.txt"));
                    strEnd      = RandomHelper.RandomFileLine(Path.Combine("Resources", "CityNoun.txt"));
                    strCityName = "City of " + strStart + strEnd;
                    strFolder   = Utils.GetMinecraftSavesDirectory(strCityName);
                } while (strStart.ToLower().Trim() == strEnd.ToLower().Trim() || Directory.Exists(strFolder) || (strStart + strEnd).Length > 14);
            }
            Directory.CreateDirectory(strFolder);
            RandomHelper.SetSeed(intCitySeed);
            #endregion

            #region get handles to world, chunk manager and block manager
            BetaWorld        worldDest = BetaWorld.Create(@strFolder);
            BetaChunkManager cmDest    = worldDest.GetChunkManager();
            BlockManager     bmDest    = worldDest.GetBlockManager();
            bmDest.AutoLight = false;
            #endregion

            #region determine block sizes
            // first we set the city size by chunks
            int intCitySize = 12;
            switch (strCitySize)
            {
            case "Random":
                intCitySize = RandomHelper.Next(8, 16);
                break;

            case "Very small":
                intCitySize = 5;
                break;

            case "Small":
                intCitySize = 8;
                break;

            case "Medium":
                intCitySize = 12;
                break;

            case "Large":
                intCitySize = 16;
                break;

            case "Very large":
                intCitySize = 25;
                break;

            default:
                Debug.Fail("Invalid switch result");
                break;
            }
            // then we multiply by 16, because that's the x and z of a chunk
            intCitySize *= 16;
            int intFarmLength = booIncludeFarms ? 32 : 8;
            int intMapLength  = intCitySize + (intFarmLength * 2);
            #endregion

            #region setup classes
            BlockShapes.SetupClass(bmDest, intMapLength);
            BlockHelper.SetupClass(bmDest, intMapLength);
            if (!SourceWorld.SetupClass(worldDest, booIncludeItemsInChests, booIncludeGhostdancerSpawners))
            {
                return;
            }
            NoticeBoard.SetupClass(intCitySeed, intWorldSeed);
            #endregion

            #region determine random options
            // ensure selected options take priority, but don't set things on fire
            if (strTowerAddition == "Random")
            {
                strTowerAddition = RandomHelper.RandomString("Fire beacon", "Flag");
            }
            if (strWallMaterial.StartsWith("Wood"))
            {
                if (strMoatType == "Lava" || strMoatType == "Fire" || strMoatType == "Random")
                {
                    strMoatType = RandomHelper.RandomString("Drop to Bedrock", "Cactus", "Water");
                }
                strOutsideLights = "Torches";
            }
            if (strWallMaterial == "Random")
            {
                if (strMoatType == "Lava" || strMoatType == "Fire" || strOutsideLights == "Fire")
                {
                    strWallMaterial = RandomHelper.RandomString("Brick", "Cobblestone", "Sandstone", "Stone");
                }
                else
                {
                    strWallMaterial = RandomHelper.RandomString("Brick", "Cobblestone", "Sandstone",
                                                                "Stone", "Wood Planks");
                    if (strWallMaterial.StartsWith("Wood"))
                    {
                        if (strMoatType == "Random")
                        {
                            strMoatType = RandomHelper.RandomString("Drop to Bedrock", "Cactus", "Water");
                        }
                        strOutsideLights = "Torches";
                    }
                }
            }
            if (strOutsideLights == "Random")
            {
                strOutsideLights = RandomHelper.RandomString("Fire", "Torches");
            }
            if (strMoatType == "Random")
            {
                int intRand = RandomHelper.Next(100);
                if (intRand >= 90)
                {
                    strMoatType = "Drop to Bedrock";
                }
                else if (intRand >= 80)
                {
                    strMoatType = "Cactus";
                }
                else if (intRand >= 50)
                {
                    strMoatType = "Lava";
                }
                else if (intRand >= 40)
                {
                    strMoatType = "Fire";
                }
                else
                {
                    strMoatType = "Water";
                }
            }

            int intWallMaterial = BlockType.STONE;
            switch (strWallMaterial)
            {
            case "Brick":
                intWallMaterial = BlockType.BRICK_BLOCK;
                break;

            case "Cobblestone":
                intWallMaterial = BlockType.COBBLESTONE;
                break;

            case "Sandstone":
                intWallMaterial = BlockType.SANDSTONE;
                break;

            case "Stone":
                intWallMaterial = BlockType.STONE;
                break;

            case "Wood Planks":
                intWallMaterial = BlockType.WOOD_PLANK;
                break;

            case "Wood Logs":
                intWallMaterial = BlockType.WOOD;
                break;

            case "Bedrock":
                intWallMaterial = BlockType.BEDROCK;
                break;

            case "Mossy Cobblestone":
                intWallMaterial = BlockType.MOSS_STONE;
                break;

            case "Netherrack":
                intWallMaterial = BlockType.NETHERRACK;
                break;

            case "Glass":
                intWallMaterial = BlockType.GLASS;
                break;

            case "Ice":
                intWallMaterial = BlockType.ICE;
                break;

            case "Snow":
                intWallMaterial = BlockType.SNOW_BLOCK;
                break;

            case "Glowstone":
                intWallMaterial = BlockType.GLOWSTONE_BLOCK;
                break;

            case "Dirt":
                intWallMaterial = BlockType.DIRT;
                break;

            case "Obsidian":
                intWallMaterial = BlockType.OBSIDIAN;
                break;

            case "Jack-o-Lantern":
                intWallMaterial = BlockType.JACK_O_LANTERN;
                break;

            case "Soul sand":
                intWallMaterial = BlockType.SOUL_SAND;
                break;

            case "Gold":
                intWallMaterial = BlockType.GOLD_BLOCK;
                break;

            case "Diamond":
                intWallMaterial = BlockType.DIAMOND_BLOCK;
                break;

            default:
                Debug.Fail("Invalid switch result");
                break;
            }
            #endregion

            #region make the city
            frmLogForm.UpdateLog("Creating underground terrain");
            Chunks.CreateInitialChunks(cmDest, intMapLength / 16, frmLogForm);
            frmLogForm.UpdateProgress(25);

            Buildings.structPoint spMineshaftEntrance = new Buildings.structPoint();

            if (booIncludeWalls)
            {
                frmLogForm.UpdateLog("Creating walls");
                Walls.MakeWalls(worldDest, intFarmLength, intMapLength, strCityEmblem, strOutsideLights, intWallMaterial);
            }
            frmLogForm.UpdateProgress(34);
            if (booIncludeBuildings || booIncludePaths)
            {
                frmLogForm.UpdateLog("Creating paths");
                int[,] intArea = Paths.MakePaths(worldDest, bmDest, intFarmLength, intMapLength, strCitySize,
                                                 booIncludeMineshaft);
                frmLogForm.UpdateProgress(36);
                if (booIncludeBuildings)
                {
                    frmLogForm.UpdateLog("Creating buildings");
                    spMineshaftEntrance = Buildings.MakeInsideCity(bmDest, worldDest, intArea, intFarmLength, intMapLength, booIncludePaths);
                    frmLogForm.UpdateProgress(45);
                    if (booIncludeMineshaft)
                    {
                        frmLogForm.UpdateLog("Creating mineshaft");
                        Mineshaft.MakeMineshaft(worldDest, bmDest, intFarmLength, intMapLength, spMineshaftEntrance);
                    }
                }
            }
            frmLogForm.UpdateProgress(51);

            if (booIncludeMoat)
            {
                frmLogForm.UpdateLog("Creating moat");
                Moat.MakeMoat(intFarmLength, intMapLength, strMoatType, booIncludeGuardTowers);
            }
            frmLogForm.UpdateProgress(52);

            if (booIncludeDrawbridges)
            {
                frmLogForm.UpdateLog("Creating drawbridges");
                Drawbridge.MakeDrawbridges(bmDest, intFarmLength, intMapLength, booIncludeMoat,
                                           booIncludeWalls, booIncludeItemsInChests, intWallMaterial, strMoatType, strCityName);
            }
            frmLogForm.UpdateProgress(53);

            if (booIncludeGuardTowers)
            {
                frmLogForm.UpdateLog("Creating guard towers");
                GuardTowers.MakeGuardTowers(bmDest, intFarmLength, intMapLength, booIncludeWalls,
                                            strOutsideLights, strTowerAddition, booIncludeItemsInChests, intWallMaterial);
            }
            frmLogForm.UpdateProgress(54);

            if (booIncludeFarms)
            {
                frmLogForm.UpdateLog("Creating farms");
                Farms.MakeFarms(worldDest, bmDest, intFarmLength, intMapLength);
            }
            frmLogForm.UpdateProgress(58);

            if (!booIncludeValuableBlocks)
            {
                cmDest.Save();
                worldDest.Save();
                Chunks.ReplaceValuableBlocks(worldDest, bmDest, intMapLength, intWallMaterial);
            }
            frmLogForm.UpdateProgress(60);
            Chunks.PositionRails(worldDest, bmDest, intMapLength);
            frmLogForm.UpdateProgress(62);
            #endregion

            #region world settings
            // spawn looking at one of the city entrances
            if (booIncludeFarms)
            {
                SpawnPoint spLevel = new SpawnPoint(7, 11, 13);
                worldDest.Level.Spawn = spLevel;
                worldDest.Level.Spawn = new SpawnPoint(intMapLength / 2, 64, intMapLength - (intFarmLength - 10));
            }
            else
            {
                worldDest.Level.Spawn = new SpawnPoint(intMapLength / 2, 64, intMapLength - (intFarmLength - 7));
            }
            // spawn in the middle of the city
//#if DEBUG
            //worldDest.Level.Spawn = new SpawnPoint(intMapLength / 2, 64, intMapLength / 2);
//#endif
            if (strWorldSeed.Length > 0)
            {
                worldDest.Level.RandomSeed = intWorldSeed;
            }

#if RELEASE
            worldDest.Level.Time = RandomHelper.Next(24000);

            if (RandomHelper.NextDouble() < 0.15)
            {
                worldDest.Level.IsRaining = true;
                // one-quarter to three-quarters of a day
                worldDest.Level.RainTime = RandomHelper.Next(6000, 18000);
                if (RandomHelper.NextDouble() < 0.25)
                {
                    worldDest.Level.IsThundering = true;
                    worldDest.Level.ThunderTime  = worldDest.Level.RainTime;
                }
            }
#endif
            #endregion

#if DEBUG
            MakeHelperChest(bmDest, worldDest.Level.Spawn.X + 2, worldDest.Level.Spawn.Y, worldDest.Level.Spawn.Z + 2);
#endif

            frmLogForm.UpdateLog("Creating lighting data");
            Chunks.ResetLighting(worldDest, cmDest, frmLogForm, (int)Math.Pow(intMapLength / 16, 2));

            worldDest.Level.LevelName = strCityName;
            worldDest.Save();

            if (booExportSchematic)
            {
                frmLogForm.UpdateLog("Creating schematic");
                AlphaBlockCollection abcExport = new AlphaBlockCollection(intMapLength, 128, intMapLength);
                for (int x = 0; x < intMapLength; x++)
                {
                    for (int z = 0; z < intMapLength; z++)
                    {
                        for (int y = 0; y < 128; y++)
                        {
                            abcExport.SetBlock(x, y, z, bmDest.GetBlock(x, y, z));
                        }
                    }
                }
                Schematic CitySchematic = new Schematic(intMapLength, 128, intMapLength);
                CitySchematic.Blocks = abcExport;
                CitySchematic.Export(Utils.GetMinecraftSavesDirectory(strCityName) + "\\" + strCityName + ".schematic");
            }

            frmLogForm.UpdateLog("\r\nCreated the " + strCityName + "!");
            frmLogForm.UpdateLog("It'll be at the end of your MineCraft world list.");
        }
        public void Generate(frmMace frmLogForm, string strUserCityName, bool booIncludeFarms, bool booIncludeMoat, bool booIncludeWalls,
                             bool booIncludeDrawbridges, bool booIncludeGuardTowers, bool booIncludeBuildings, bool booIncludePaths, bool booIncludeMineshaft,
                             bool booIncludeItemsInChests, bool booIncludeValuableBlocks,
                             string strCitySize, string strMoatType, string strCityEmblem, string strOutsideLights, string strTowerAddition, string strWallMaterial,
                             string strCitySeed, string strWorldSeed)
        {
            #region seed the random number generators
            int    intCitySeed, intWorldSeed;
            Random randSeeds = new Random();
            if (strCitySeed == "")
            {
                intCitySeed = randSeeds.Next();
                frmLogForm.UpdateLog("Random city seed: " + intCitySeed);
            }
            else
            {
                intCitySeed = JavaStringHashCode(strCitySeed);
                frmLogForm.UpdateLog("Random city seed: " + strCitySeed);
            }
            if (strWorldSeed == "")
            {
                intWorldSeed = randSeeds.Next();
                frmLogForm.UpdateLog("Random world seed: " + intWorldSeed);
            }
            else
            {
                intWorldSeed = JavaStringHashCode(strWorldSeed);
                frmLogForm.UpdateLog("Random world seed: " + strWorldSeed);
            }
            RandomHelper.SetSeed(intCitySeed);
            #endregion

            #region create minecraft world directory from a random unused city name
            string strFolder = "", strCityName = "";

            strUserCityName = SafeFilename(strUserCityName);
            if (strUserCityName.ToLower().Trim() == "")
            {
                strUserCityName = "Random";
            }

            if (strUserCityName.ToLower().Trim() != "random")
            {
                if (Directory.Exists(Utils.GetMinecraftSavesDir(strUserCityName)))
                {
                    if (MessageBox.Show("A world called \"" + strUserCityName + "\" already exists. " +
                                        "Would you like to use a random name instead?", "World already exists",
                                        MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
                    {
                        frmLogForm.UpdateLog("Cancelled, because a world with this name already exists.");
                        return;
                    }
                }
                else
                {
                    strCityName = strUserCityName;
                    strFolder   = Utils.GetMinecraftSavesDir(strCityName);
                }
            }
            if (strCityName == "")
            {
                string strStart, strEnd;
                do
                {
                    strStart    = RandomHelper.RandomFileLine(Path.Combine("Resources", "CityAdj.txt"));
                    strEnd      = RandomHelper.RandomFileLine(Path.Combine("Resources", "CityNoun.txt"));
                    strCityName = "City of " + strStart + strEnd;
                    strFolder   = Utils.GetMinecraftSavesDir(strCityName);
                } while (strStart.ToLower().Trim() == strEnd.ToLower().Trim() || Directory.Exists(strFolder));
            }
            Directory.CreateDirectory(strFolder);
            RandomHelper.SetSeed(intCitySeed);
            #endregion

            #region get handles to world, chunk manager and block manager
            BetaWorld    worldDest = BetaWorld.Create(@strFolder);
            ChunkManager cmDest    = worldDest.GetChunkManager();
            BlockManager bmDest    = worldDest.GetBlockManager();
            bmDest.AutoLight = false;
            #endregion

            #region determine block sizes
            // first we set the city size by chunks
            int intCitySize = 12;
            switch (strCitySize)
            {
            case "Random":
                intCitySize = RandomHelper.Next(8, 16);
                break;

            case "Very small":
                intCitySize = 5;
                break;

            case "Small":
                intCitySize = 8;
                break;

            case "Medium":
                intCitySize = 12;
                break;

            case "Large":
                intCitySize = 16;
                break;

            case "Very large":
                intCitySize = 25;
                break;
            }
            // then we multiply by 16, because that's the x and z of a chunk
            intCitySize *= 16;
            int intFarmSize = booIncludeFarms ? 32 : 16;
            int intMapSize  = intCitySize + (intFarmSize * 2);
            #endregion

            #region setup classes
            BlockShapes.SetupClass(bmDest, intMapSize);
            BlockHelper.SetupClass(bmDest, intMapSize);
            if (!SourceWorld.SetupClass(worldDest, booIncludeItemsInChests))
            {
                return;
            }
            NoticeBoard.SetupClass(intCitySeed, intWorldSeed);
            #endregion

            #region determine random options
            // ensure selected options take priority, but don't set things on fire
            if (strTowerAddition == "Random")
            {
                strTowerAddition = RandomHelper.RandomString("Fire beacon", "Flag");
            }
            if (strWallMaterial.StartsWith("Wood"))
            {
                if (strMoatType == "Lava" || strMoatType == "Random")
                {
                    strMoatType = RandomHelper.RandomString("Drop to Bedrock", "Cactus", "Water");
                }
                strOutsideLights = "Torches";
            }
            if (strWallMaterial == "Random")
            {
                if (strMoatType == "Lava" || strOutsideLights == "Fire")
                {
                    strWallMaterial = RandomHelper.RandomString("Brick", "Cobblestone", "Sandstone", "Stone");
                }
                else
                {
                    strWallMaterial = RandomHelper.RandomString("Brick", "Cobblestone", "Sandstone", "Stone", "Wood Planks");
                    if (strWallMaterial.StartsWith("Wood"))
                    {
                        if (strMoatType == "Random")
                        {
                            strMoatType = RandomHelper.RandomString("Drop to Bedrock", "Cactus", "Water");
                        }
                        strOutsideLights = "Torches";
                    }
                }
            }
            if (strOutsideLights == "Random")
            {
                strOutsideLights = RandomHelper.RandomString("Fire", "Torches");
            }
            if (strMoatType == "Random")
            {
                int intRand = RandomHelper.Next(100);
                if (intRand >= 90)
                {
                    strMoatType = "Drop to Bedrock";
                }
                else if (intRand >= 80)
                {
                    strMoatType = "Cactus";
                }
                else if (intRand >= 50)
                {
                    strMoatType = "Lava";
                }
                else
                {
                    strMoatType = "Water";
                }
            }

            int intWallMaterial = (int)BlockType.STONE;
            switch (strWallMaterial)
            {
            case "Brick":
                intWallMaterial = (int)BlockType.BRICK_BLOCK;
                break;

            case "Cobblestone":
                intWallMaterial = (int)BlockType.COBBLESTONE;
                break;

            case "Sandstone":
                intWallMaterial = (int)BlockType.SANDSTONE;
                break;

            case "Stone":
                intWallMaterial = (int)BlockType.STONE;
                break;

            case "Wood Planks":
                intWallMaterial = (int)BlockType.WOOD_PLANK;
                break;

            case "Wood Logs":
                intWallMaterial = (int)BlockType.WOOD;
                break;

            case "Bedrock":
                intWallMaterial = (int)BlockType.BEDROCK;
                break;

            case "Glass":
                intWallMaterial = (int)BlockType.GLASS;
                break;

            case "Dirt":
                intWallMaterial = (int)BlockType.DIRT;
                break;

            case "Obsidian":
                intWallMaterial = (int)BlockType.OBSIDIAN;
                break;
            }
            #endregion

            #region make the city
            frmLogForm.UpdateLog("Creating underground terrain");
            Chunks.MakeChunks(cmDest, intMapSize / 16, frmLogForm);
            frmLogForm.UpdateProgress(25);

            if (booIncludeBuildings || booIncludePaths)
            {
                frmLogForm.UpdateLog("Creating paths");
                int[,] intArea = Paths.MakePaths(worldDest, bmDest, intFarmSize, intMapSize);
                frmLogForm.UpdateProgress(34);
                if (booIncludeBuildings)
                {
                    frmLogForm.UpdateLog("Creating buildings");
                    Buildings.MakeInsideCity(bmDest, worldDest, intArea, intFarmSize, intMapSize, booIncludePaths);
                }
            }
            frmLogForm.UpdateProgress(43);

            if (booIncludeMineshaft)
            {
                frmLogForm.UpdateLog("Creating mineshaft");
                Mineshaft.MakeMineshaft(worldDest, bmDest, intFarmSize, intMapSize);
                frmLogForm.UpdateProgress(49);
            }

            if (booIncludeWalls)
            {
                frmLogForm.UpdateLog("Creating walls");
                Walls.MakeWalls(worldDest, intFarmSize, intMapSize, strCityEmblem, strOutsideLights, intWallMaterial);
            }
            frmLogForm.UpdateProgress(51);

            if (booIncludeMoat)
            {
                frmLogForm.UpdateLog("Creating moat");
                Moat.MakeMoat(intFarmSize, intMapSize, strMoatType, booIncludeGuardTowers);
            }
            frmLogForm.UpdateProgress(52);

            if (booIncludeDrawbridges)
            {
                frmLogForm.UpdateLog("Creating drawbridges");
                Drawbridge.MakeDrawbridges(bmDest, intFarmSize, intMapSize, booIncludeMoat, booIncludeWalls, booIncludeItemsInChests, intWallMaterial, strMoatType);
            }
            frmLogForm.UpdateProgress(53);

            if (booIncludeGuardTowers)
            {
                frmLogForm.UpdateLog("Creating guard towers");
                GuardTowers.MakeGuardTowers(bmDest, intFarmSize, intMapSize, booIncludeWalls, strOutsideLights, strTowerAddition, booIncludeItemsInChests, intWallMaterial);
            }
            frmLogForm.UpdateProgress(54);

            if (booIncludeFarms)
            {
                frmLogForm.UpdateLog("Creating farms");
                Farms.MakeFarms(worldDest, bmDest, intFarmSize, intMapSize);
            }
            frmLogForm.UpdateProgress(58);

            if (!booIncludeValuableBlocks)
            {
                cmDest.Save();
                worldDest.Save();
                Chunks.ReplaceValuableBlocks(worldDest, bmDest, intMapSize);
            }
            frmLogForm.UpdateProgress(62);
            #endregion

            #region world settings
            // spawn in a guard tower
            //worldDest.Level.SpawnX = intFarmSize + 5;
            //worldDest.Level.SpawnZ = intFarmSize + 5;
            //worldDest.Level.SpawnY = 82;
            // spawn looking at one of the city entrances
            worldDest.Level.SpawnX = intMapSize / 2;
            worldDest.Level.SpawnZ = intMapSize - (intFarmSize - 10);
            worldDest.Level.SpawnY = 64;
            // spawn in the middle of the city
            //worldDest.Level.SpawnX = intMapSize / 2;
            //worldDest.Level.SpawnZ = (intMapSize / 2) - 1;
            //worldDest.Level.SpawnY = 64;
            // spawn default
            //world.Level.SpawnX = 0;
            //world.Level.SpawnY = 65;
            //world.Level.SpawnZ = 0;
            if (strWorldSeed != "")
            {
                worldDest.Level.RandomSeed = intWorldSeed;
            }

            worldDest.Level.LevelName = strCityName;

#if RELEASE
            worldDest.Level.Time = RandomHelper.Next(24000);

            if (RandomHelper.NextDouble() < 0.15)
            {
                worldDest.Level.IsRaining = true;
                // one-quarter to three-quarters of a day
                worldDest.Level.RainTime = RandomHelper.Next(6000, 18000);
                if (RandomHelper.NextDouble() < 0.25)
                {
                    worldDest.Level.IsThundering = true;
                    worldDest.Level.ThunderTime  = worldDest.Level.RainTime;
                }
            }
#endif
            #endregion

#if DEBUG
            MakeHelperChest(bmDest, worldDest.Level.SpawnX + 2, worldDest.Level.SpawnY, worldDest.Level.SpawnZ + 2);
#endif

            frmLogForm.UpdateLog("Resetting lighting");
            Chunks.ResetLighting(worldDest, cmDest, frmLogForm, (int)Math.Pow(intMapSize / 16, 2));

            worldDest.Save();

            frmLogForm.UpdateLog("\r\nCreated the " + strCityName + "!");
            frmLogForm.UpdateLog("It'll be at the end of your MineCraft world list.");
        }
Beispiel #20
0
        public void Generate(frmMace frmLogForm, bool booIncludeFarms, bool booIncludeMoat, bool booIncludeWalls,
                             bool booIncludeDrawbridges, bool booIncludeGuardTowers, bool booIncludeNoticeboard,
                             bool booIncludeBuildings, bool booIncludeSewers, string strCitySize, string strMoatLiquid)
        {
            string strFolder, strCityName;

            do
            {
                strCityName = "City of " + RandomHelper.RandomFileLine("CityStartingWords.txt")
                              + RandomHelper.RandomFileLine("CityEndingWords.txt");
                strFolder = Environment.GetEnvironmentVariable("APPDATA") + @"\.minecraft\saves\" + strCityName + @"\";
            } while (Directory.Exists(strFolder));

            Directory.CreateDirectory(strFolder);
            BetaWorld world = BetaWorld.Create(@strFolder);

            int intFarmSize = 28;

            if (!booIncludeFarms)
            {
                intFarmSize = 2;
            }
            int    intPlotSize = 12;
            int    intPlots    = 15;
            Random rand        = new Random();

            switch (strCitySize)
            {
            case "Random":
                intPlots = rand.Next(10, 20);
                break;

            case "Very small":
                intPlots = 6;
                break;

            case "Small":
                intPlots = 10;
                break;

            case "Medium":
                intPlots = 15;
                break;

            case "Large":
                intPlots = 20;
                break;

            case "Very large":
                intPlots = 23;
                break;

            default:
                Debug.Assert(false);
                break;
            }
            int intMapSize = (intPlots * intPlotSize) + (intFarmSize * 2);

            ChunkManager cm = world.GetChunkManager();

            frmLogForm.UpdateLog("Creating chunks");
            Chunks.MakeChunks(cm, -1, 2 + (intMapSize / 16), frmLogForm);
            frmLogForm.UpdateProgress(34);

            BlockManager bm = world.GetBlockManager();

            bm.AutoLight = false;

            BlockShapes.SetupClass(bm, intMapSize);
            BlockHelper.SetupClass(bm, intMapSize);

            bool[,] booSewerEntrances;
            if (booIncludeSewers)
            {
                frmLogForm.UpdateLog("Creating sewers");
                booSewerEntrances = Sewers.MakeSewers(intFarmSize, intMapSize, intPlotSize);
            }
            else
            {
                booSewerEntrances = new bool[2 + ((intMapSize - ((intFarmSize + 16) * 2)) / intPlotSize),
                                             2 + ((intMapSize - ((intFarmSize + 16) * 2)) / intPlotSize)];
            }
            frmLogForm.UpdateProgress(35);
            if (booIncludeBuildings)
            {
                frmLogForm.UpdateLog("Creating plots");
                Plots.MakeBuildings(bm, booSewerEntrances, intFarmSize, intMapSize, intPlotSize);
            }
            frmLogForm.UpdateProgress(36);
            if (booIncludeWalls)
            {
                frmLogForm.UpdateLog("Creating walls");
                Walls.MakeWalls(intFarmSize, intMapSize);
            }
            frmLogForm.UpdateProgress(37);
            if (booIncludeMoat)
            {
                frmLogForm.UpdateLog("Creating moat");
                Moat.MakeMoat(intFarmSize, intMapSize, strMoatLiquid);
            }
            frmLogForm.UpdateProgress(38);
            if (booIncludeDrawbridges)
            {
                frmLogForm.UpdateLog("Creating drawbridges");
                Drawbridge.MakeDrawbridges(bm, intFarmSize, intMapSize, booIncludeMoat, booIncludeWalls);
            }
            frmLogForm.UpdateProgress(39);
            if (booIncludeGuardTowers)
            {
                frmLogForm.UpdateLog("Creating guard towers");
                GuardTowers.MakeGuardTowers(bm, intFarmSize, intMapSize, booIncludeWalls);
            }
            frmLogForm.UpdateProgress(40);
            if (booIncludeWalls && booIncludeNoticeboard)
            {
                frmLogForm.UpdateLog("Creating noticeboard");
                NoticeBoard.MakeNoticeBoard(bm, intFarmSize, intMapSize);
            }
            frmLogForm.UpdateProgress(41);
            if (booIncludeFarms)
            {
                frmLogForm.UpdateLog("Creating farms");
                Farms.MakeFarms(bm, intFarmSize, intMapSize);
            }
            frmLogForm.UpdateProgress(42);

            world.Level.LevelName = strCityName;
            // spawn in a guard tower
            //world.Level.SpawnX = intFarmSize + 5;
            //world.Level.SpawnZ = intFarmSize + 5;
            //world.Level.SpawnY = 74;
            // spawn looking at one of the city entrances
            world.Level.SpawnX = intMapSize / 2;
            world.Level.SpawnZ = intMapSize - 21;
            world.Level.SpawnY = 64;
            if (rand.NextDouble() < 0.1)
            {
                world.Level.IsRaining = true;
                if (rand.NextDouble() < 0.25)
                {
                    world.Level.IsThundering = true;
                }
            }

            //MakeHelperChest(bm, world.Level.SpawnX + 2, world.Level.SpawnY, world.Level.SpawnZ + 2);

            frmLogForm.UpdateLog("Resetting lighting");
            Chunks.ResetLighting(cm, frmLogForm, (int)Math.Pow(3 + (intMapSize / 16), 2));
            world.Save();

            frmLogForm.UpdateLog("\r\nCreated the " + strCityName + "!");
            frmLogForm.UpdateLog("It'll be at the end of your MineCraft world list.");
        }
Beispiel #21
0
        private void ShowHelp(object sender, HelpEventArgs hlpevent)
        {
            string strHelp = "";

            switch (((Control)sender).Name)
            {
            case "lblCitySize":
            case "cmbCitySize":
                strHelp = "Excluding the farms, each edge of the city is roughly:\n\nVery small - 80 blocks\nSmall - 128 blocks\nMedium - 192 blocks\nLarge - 256 blocks\nVery large - 400 blocks\n\nRandomly sized cities will be between 128 and 256 blocks on each edge.";
                break;

            case "lblMoatType":
            case "cmbMoatType":
                strHelp = "The moat is outside the city walls and goes all around the city. Choose a lava moat to increase your \"Oh &$£#!\" moments.";
                break;

            case "lblCityEmblem":
            case "cmbCityEmblem":
                strHelp = "City emblems appear on the outside walls, next to the four city entrances.";
                break;

            case "lblOutsideLights":
            case "cmbOutsideLights":
                strHelp = "This refers to the lights on the outside of the city walls.";
                break;

            case "lblTowerAddition":
            case "cmbTowerAddition":
                strHelp = "Fire beacons or flags give more character to the city and help you see the city from a distance.";
                break;

            case "lblWallMaterial":
            case "cmbWallMaterial":
                strHelp = "This refers to the walls that go all around the city. Selecting \"Random\" will choose a random normal material (brick, cobblestone, sandstone, stone, wood planks).";
                break;

            case "lblCityName":
            case "txtCityName":
                strHelp = "Use all your available intelligence, sarcasm and humour to come up with a city name. Alternatively, leave blank to let Mace generate a name for you. Mace won't overwrite worlds with the specified name.";
                break;

            case "lblCitySeed":
            case "txtCitySeed":
            case "lblWorldSeed":
            case "txtWorldSeed":
                strHelp = "This can be anything or nothing. For example:\n\nYour pet's name (Middy).\nYour favourite colour (Purple).\nYour favourite Buffy character (Willow).\nThe amount of blueberries you've eaten today (Seven and a half).\nThe name of your parole officer (Victor).\nHow many unicorns you've taught to fly (3).\nThe last person you vomitted all over (Mike).\nYour favourite piano tuner from Ukraine (Mikhaylyna).";
                break;

            case "chkIncludeFarms":
                strHelp = "Mace creates a variety of farms outside the city. The farms types are wheat, cactus, mushroom, sugarcane and orchards.";
                break;

            case "chkIncludeMoat":
                strHelp = "The moat is outside the city walls and goes all around the city.";
                break;

            case "chkIncludeDrawbridges":
                strHelp = "Unchecking this will make it rather tricky to enter the city!";
                break;

            case "chkIncludeGuardTowers":
                strHelp = "There's a guard tower at each corner of the city walls. They provide a high vantage point to see into and away from the city. They also make it easier to see the city from a distance.";
                break;

            case "chkIncludeWalls":
                strHelp = "Mace will generate four walls around the city. Unfortunately the fourth wall is frequently broken.";
                break;

            case "chkIncludeBuildings":
                strHelp = "Want to create your own buildings? Uncheck this!";
                break;

            case "chkIncludePaths":
                strHelp = "The city will have paths between the buildings. There's two main routes through the city, which have lights on either side.";
                break;

            case "chkIncludeMineshaft":
                strHelp = "The mineshaft is a large network of tunnels under the city, which spans multiple levels. It is full of resources and monsters.";
                break;

            case "chkValuableBlocks":
                strHelp = "Unchecking this will turn gold, iron, diamond, obsidian and lapis blocks into wool blocks. No sheep will be hurt during this process.";
                break;

            case "chkItemsInChests":
                strHelp = "Usually chests will contain appropriate or random items, to add more flavour to the city. Uncheck this if you'd like all chests to be empty.";
                break;

            case "txtLog":
                strHelp = "Information about the city generation will appear here.";
                break;

            case "btnAbout":
                strHelp = "You just clicked a question mark with a question mark. The world will now implode.";
                break;

            case "btnGenerateCity":
                strHelp = "This button will create a new world in your MineCraft saves directory, with a randomly generated city at the spawn point.\n\nMace doesn't interact with MineCraft directly, so you don't need MineCraft open.";
                break;

            case "picMace":
                strHelp = "Hiring all those graphics artists was definitely worth it.";
                break;
            }
            if (strHelp == "")
            {
                if (MessageBox.Show("Sorry, no help is available for this control :(\n\nWould you like to fire a random member of the Help Department?", "Help", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    Random randSeeds = new Random();
                    RandomHelper.SetSeed(randSeeds.Next());
                    MessageBox.Show("Thank you for submitting this request. We have now fired " + RandomHelper.RandomFileLine(Path.Combine("Resources", "HelpDepartment.txt")) + "\n\nYou monster.", "Requested granted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show(strHelp, "Help", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }