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 = RNG.RandomFileLine(Path.Combine("Resources", "Adjectives.txt")); strStreetType = RNG.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); }
private void btnGenerateRandomSeedIdea_Click(object sender, EventArgs e) { RNG.SetRandomSeed(); switch (RNG.Next(4)) { case 0: txtWorldSeed.Text = "{" + RNG.RandomItem("Your name", "A friend's name", "Your pet's name", "Your shoe size", "Your lucky number") + "}"; break; case 1: txtWorldSeed.Text = "{Your favourite " + RNG.RandomItem( "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 = RNG.RandomFileLine(Path.Combine("Resources", "Adjectives.txt")).ToLower().Trim(); break; case 3: txtWorldSeed.Text = RNG.RandomFileLine(Path.Combine("Resources", "Nouns.txt")).ToLower().Trim(); break; default: txtWorldSeed.Text = ""; break; } }
private void picMace_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { MessageBox.Show(BlockInfo.Stone.ID.ToString()); Debug.WriteLine((int)FenceGateState.OPEN); Debug.WriteLine((int)DoorState.SWUNG); DateTime dtNow = new DateTime(); dtNow = DateTime.Now; RNG.SetSeed(dtNow.Millisecond); string[] strFlagFiles = Directory.GetFiles("Resources", "Flag_*.txt"); string strFlag = RNG.RandomItemFromArray(strFlagFiles); string[] strFlagLines = File.ReadAllLines(strFlag); MessageBox.Show(String.Join(" ", strFlagLines)); string strNames = String.Empty; for (int x = 0; x < 50; x++) { string strStart = RNG.RandomFileLine(Path.Combine("Resources", "Adjectives.txt")); string strEnd = RNG.RandomFileLine(Path.Combine("Resources", "Nouns.txt")); string strCityName = strStart + strEnd; strNames += strCityName + "\r\n"; } MessageBox.Show(strNames); } }
private void ShowExampleCityNames(object sender, EventArgs e) { if (cmbCityStartingWord.SelectedIndex >= 0 && cmbCityEndingWord.SelectedIndex >= 0) { string strNames = String.Empty; for (int x = 0; x < 50; x++) { string strStart = RNG.RandomFileLine(Path.Combine("Resources", cmbCityStartingWord.Text.Replace(' ', '_') + ".txt")); string strEnd = RNG.RandomFileLine(Path.Combine("Resources", cmbCityEndingWord.Text.Replace(' ', '_') + ".txt")); string strCityName = strStart + strEnd; strNames += txtCityPrefix.Text + strCityName + "\r\n"; } txtExampleCityNames.Text = "Example city names:\r\n\r\n" + strNames.Substring(0, strNames.Length - 2); } }
public static string GenerateWorldName() { RNG.SetRandomSeed(); string strFolder = String.Empty; string strWorldName = String.Empty; string strType, strStart, strEnd; do { strType = RNG.RandomFileLine(Path.Combine("Resources", "WorldTypes.txt")); strStart = RNG.RandomFileLine(Path.Combine("Resources", "Adjectives.txt")); strEnd = RNG.RandomFileLine(Path.Combine("Resources", "Nouns.txt")); strWorldName = strType + " of " + strStart + strEnd; strFolder = strWorldName.ToMinecraftSaveDirectory(); } while (strStart.ToLower().Trim() == strEnd.ToLower().Trim() || Directory.Exists(strFolder) || (strStart + strEnd).Length > 14); return(strWorldName); }
private void CreateSplash() { DateTime dtNow = DateTime.Now; if (dtNow.Day == 24 && dtNow.Month == 12) { lblSplash.Text = "Merry Christmas Eve!"; } else if (dtNow.Day == 25 && dtNow.Month == 12) { lblSplash.Text = "Merry Christmas!"; } else if (dtNow.Day == 1 && dtNow.Month == 1) { lblSplash.Text = "Happy New Year!"; } else if (dtNow.Day == 19 && dtNow.Month == 12) { lblSplash.Text = "Happy Birthday Polly!"; } else if (dtNow.Day == 20 && dtNow.Month == 12) { lblSplash.Text = "Happy Birthday Rayven!"; } else if (dtNow.Day == 29 && dtNow.Month == 7) { lblSplash.Text = "Happy Birthday Robson!"; } else if (dtNow.Day == 2 && dtNow.Month == 6) { lblSplash.Text = "Happy Birthday Mace!"; } else { lblSplash.Text = RNG.RandomFileLine(Path.Combine("Resources", "Splash.txt")); } }
private static string RandomSign() { string strSignText = "*~*~*~*"; int intRand; do { intRand = RNG.Next(intAmountOfSignTypes); } while (intRand >= 5 && _booSignUsed[intRand]); _booSignUsed[intRand] = true; do { switch (intRand) { case 0: case 1: strSignText = String.Format("{0} {1} {2} for {3}~-{4} {5}.{6}.", RNG.RandomItem("I will", "I can", "Will", "Can", "Can you"), RNG.RandomItem("trade", "swap", "sell"), RNG.RandomItem("gold", "iron", "dirt", "tools", "glass", "flowers", "cake", "mushrooms"), RNG.RandomItem("obsidian", "wood", "sand", "bricks", "coal", "stone", "cookies", "diamonds"), RNG.RandomItem("See", "Talk to"), RNG.RandomLetter().ToString().ToUpper(), RNG.RandomLetter().ToString().ToUpper()); break; case 2: strSignText = String.Format("{0} of the holy {1} are meeting this {2}", RNG.RandomItem("Church", "Order"), RNG.RandomFileLine(Path.Combine("Resources", "ChurchNoun.txt")), RNG.RandomDay()); break; case 3: strSignText = String.Format("{0} {1} has lost her {2}. {3}", RNG.RandomItem("Mrs", "Miss"), RNG.RandomFileLine(Path.Combine("Resources", "Adjectives.txt")), RNG.RandomItem("cat", "dog", "glasses", "marbles", "knitting"), RNG.RandomItem("Reward offered", "Please help")); break; case 4: strSignText = String.Format("{0} for sale~-{1} {2}.{3}.", RNG.RandomItem("Armour", "Property", "House", "Weapons", "Gold", "Bodyguard", "Pet wolf", "Books", "Tools"), RNG.RandomItem("See", "Talk to"), RNG.RandomLetter().ToString().ToUpper(), RNG.RandomLetter().ToString().ToUpper()); 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 " + RNG.Next(500, 999); break; case 9: strSignText = "Buy one get one free on gravestones!"; break; case 10: strSignText = "Archery practice this " + RNG.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; case 13: strSignText = "Council meeting this " + RNG.RandomDay(); break; case 14: strSignText = "Numbers for lovers:~" + RNG.RandomItem("220 284", "1184 1210", "2620 2924", "5020 5564", "6232 6368"); break; default: Debug.Fail("Invalid switch result"); break; } } while (!strSignText.IsValidSign()); return(strSignText); }
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(); RNG.SetSeed(randSeeds.Next()); MessageBox.Show("Thank you for submitting this request. We have now fired " + RNG.RandomFileLine(Path.Combine("Resources", "HelpDepartment.txt")) + "\n\nYou monster.", "Requested granted", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show(strHelp, "Help", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public static void Generate(frmMace frmLogForm, BetaWorld worldDest, BetaChunkManager cmDest, BlockManager bmDest, int x, int z, bool booExportSchematics, string strUndergroundOres) { #region create a city name string strStart, strEnd; do { strStart = RNG.RandomFileLine(Path.Combine("Resources", City.CityNamePrefixFilename)); strEnd = RNG.RandomFileLine(Path.Combine("Resources", City.CityNameSuffixFilename)); City.Name = City.CityNamePrefix + 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; City.FarmLength *= 16; City.EdgeLength = 8; City.MapLength = City.CityLength + (City.EdgeLength * 2); #endregion #region setup classes BlockShapes.SetupClass(bmDest); BlockHelper.SetupClass(bmDest); NoticeBoard.SetupClass(); if (!SourceWorld.SetupClass(worldDest)) { return; } #endregion #region determine random options 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; } switch (City.PathType.ToLower().Trim()) { case "stone_raised": City.PathBlockID = BlockInfo.DoubleSlab.ID; City.PathBlockData = 0; City.PathAlternativeBlockID = BlockInfo.Slab.ID; City.PathAlternativeBlockData = 0; City.PathExtends = 2; break; case "sandstone_raised": City.PathBlockID = BlockInfo.Sandstone.ID; City.PathBlockData = 0; City.PathAlternativeBlockID = BlockInfo.Slab.ID; City.PathAlternativeBlockData = 1; City.PathExtends = 2; break; case "woodplanks_raised": City.PathBlockID = BlockInfo.WoodPlank.ID; City.PathBlockData = 0; City.PathAlternativeBlockID = BlockInfo.Slab.ID; City.PathAlternativeBlockData = 2; City.PathExtends = 2; break; case "cobblestone_raised": City.PathBlockID = BlockInfo.Cobblestone.ID; City.PathBlockData = 0; City.PathAlternativeBlockID = BlockInfo.Slab.ID; City.PathAlternativeBlockData = 3; City.PathExtends = 2; break; case "brick_raised": City.PathBlockID = BlockInfo.BrickBlock.ID; City.PathBlockData = 0; City.PathAlternativeBlockID = BlockInfo.Slab.ID; City.PathAlternativeBlockData = 4; City.PathExtends = 2; break; case "stonebrick_raised": City.PathBlockID = BlockInfo.StoneBrick.ID; City.PathBlockData = 0; City.PathAlternativeBlockID = BlockInfo.Slab.ID; City.PathAlternativeBlockData = 5; City.PathExtends = 2; break; case "stonebrick": City.PathBlockID = BlockInfo.StoneBrick.ID; City.PathBlockData = 0; City.PathAlternativeBlockID = 0; City.PathAlternativeBlockData = 0; City.PathExtends = 1; break; case "sandstone": City.PathBlockID = BlockInfo.Sandstone.ID; City.PathBlockData = 0; City.PathAlternativeBlockID = 0; City.PathAlternativeBlockData = 0; City.PathExtends = 1; break; case "stone": City.PathBlockID = BlockInfo.Stone.ID; City.PathBlockData = 0; City.PathAlternativeBlockID = 0; City.PathAlternativeBlockData = 0; City.PathExtends = 1; break; case "wood": City.PathBlockID = BlockInfo.Wood.ID; City.PathBlockData = RNG.Next(0, 2); City.PathAlternativeBlockID = 0; City.PathAlternativeBlockData = 0; City.PathExtends = 1; break; } #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("Edge length in blocks: " + City.EdgeLength, true, true); frmLogForm.UpdateLog("Farm length in blocks: " + City.FarmLength, true, true); frmLogForm.UpdateLog("City position in blocks: " + ((x + Chunks.CITY_RELOCATION_CHUNKS) * 16) + "," + ((z + Chunks.CITY_RELOCATION_CHUNKS) * 16), true, true); frmLogForm.UpdateLog("Theme: " + City.ThemeName, true, true); frmLogForm.UpdateLog("Creating underground terrain", true, false); Chunks.CreateInitialChunks(cmDest, frmLogForm, strUndergroundOres); frmLogForm.UpdateProgress(0.21); Buildings.structPoint spMineshaftEntrance = new Buildings.structPoint(); if (City.HasWalls) { frmLogForm.UpdateLog("Creating walls", true, false); Walls.MakeWalls(worldDest, frmLogForm); } frmLogForm.UpdateProgress(0.24); if (City.HasDrawbridges) { frmLogForm.UpdateLog("Creating entrances", true, false); Entrances.MakeEntrances(bmDest); } frmLogForm.UpdateProgress(0.27); if (City.HasMoat) { frmLogForm.UpdateLog("Creating moat", true, false); Moat.MakeMoat(frmLogForm, bmDest); } frmLogForm.UpdateProgress(0.30); if (City.HasBuildings || City.HasPaths) { frmLogForm.UpdateLog("Creating paths", true, false); frmLogForm.UpdateLog("Path type: " + City.PathType, true, true); int[,] intArea = Paths.MakePaths(worldDest, bmDest); frmLogForm.UpdateProgress(0.33); if (City.HasBuildings) { frmLogForm.UpdateLog("Creating buildings", true, false); spMineshaftEntrance = Buildings.MakeInsideCity(bmDest, worldDest, intArea, frmLogForm); frmLogForm.UpdateProgress(0.36); if (City.HasMineshaft) { frmLogForm.UpdateLog("Creating mineshaft", true, false); Mineshaft.MakeMineshaft(worldDest, bmDest, spMineshaftEntrance, frmLogForm); } } } frmLogForm.UpdateProgress(0.39); if (City.HasGuardTowers) { frmLogForm.UpdateLog("Creating guard towers", true, false); GuardTowers.MakeGuardTowers(bmDest, frmLogForm); } frmLogForm.UpdateProgress(0.42); if (City.HasFarms) { frmLogForm.UpdateLog("Creating farms", true, false); Farms2.MakeFarms(worldDest, bmDest); } frmLogForm.UpdateProgress(0.45); if (City.HasFlowers) { frmLogForm.UpdateLog("Creating flowers", true, false); Flowers.MakeFlowers(worldDest, bmDest); } frmLogForm.UpdateProgress(0.46); if (!City.HasValuableBlocks) { frmLogForm.UpdateLog("Replacing valuable blocks", true, true); cmDest.Save(); worldDest.Save(); Chunks.ReplaceValuableBlocks(worldDest, bmDest); } frmLogForm.UpdateProgress(0.48); frmLogForm.UpdateLog("Creating rail data", true, false); Chunks.PositionRails(worldDest, bmDest); frmLogForm.UpdateProgress(0.50); frmLogForm.UpdateLog("Creating lighting data", true, false); Chunks.ResetLighting(worldDest, cmDest, frmLogForm); frmLogForm.UpdateProgress(0.95); #endregion #region export schematic if (booExportSchematics) { frmLogForm.UpdateLog("Creating schematic in world folder", true, false); AlphaBlockCollection abcExport = new AlphaBlockCollection(City.MapLength, 128, City.MapLength + City.FarmLength); for (int xBlock = 0; xBlock < City.MapLength; xBlock++) { for (int zBlock = -City.FarmLength; zBlock < City.MapLength; zBlock++) { for (int y = 0; y < 128; y++) { abcExport.SetBlock(xBlock, y, City.FarmLength + zBlock, bmDest.GetBlock(xBlock, y, zBlock)); } } } Schematic CitySchematic = new Schematic(City.MapLength, 128, City.MapLength + City.FarmLength); CitySchematic.Blocks = abcExport; CitySchematic.Export(worldDest.Path + "\\" + City.Name + ".schematic"); } #endregion #region positioning frmLogForm.UpdateLog("Creating position data", true, false); Chunks.MoveChunks(worldDest, cmDest, x, z); frmLogForm.UpdateProgress(1); #endregion }