Skip to content

Commit d0ce3ed

Browse files
authored
Choose which games are in the randomizer pool
1 parent b5acae7 commit d0ce3ed

37 files changed

+3932
-362
lines changed

Form1.Designer.cs

Lines changed: 223 additions & 127 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Form1.cs

Lines changed: 38 additions & 233 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77
using System.IO;
88
using System.Text;
99
using System.Security.Cryptography;
10+
using select;
11+
using randomize;
1012
namespace HaloRuns
1113
{
1214
public partial class Form1 : Form
1315
{
1416
public Form1()
1517
{
1618
InitializeComponent();
17-
19+
1820
//sets the path you save your file to to the path in path.txt
1921
PathLabel.Text = path;
2022
//centers the path text shown in the settings tab
@@ -46,18 +48,16 @@ public Form1()
4648
//this array is used for the mombasa streets insertion points
4749
bool[] hasInsert = new bool[65];
4850
//and this is the number that tells which insertion point to add
49-
int[] instert = new int[65];
51+
int[] insert = new int[65];
5052

5153
//reads the path from the file "path.txt"
5254
string path = File.ReadAllText("resources/path.txt");
5355

5456
//arrays used to track which missions will be added top the file in the randomizer
5557
//this one is used to keep track of missions in the randomizer
5658
string[] curMissions = new string[0];
57-
//this one is used to make sure the same level isnt used twice
58-
string[] usedMissions = new string[0];
5959
//this one checks for insertion points
60-
int[] curInstert = new int[0];
60+
int[] curInsert = new int[0];
6161

6262
//bools for which type of randomization is applied to the difficulty
6363
bool fullRand;
@@ -67,78 +67,7 @@ public Form1()
6767
bool finding = true;
6868

6969
//the map names of ever mission in the game
70-
string[] Names = new string[65] {
71-
//ce
72-
"Map id ='_map_id_halo1_pillar_of_autumn'",
73-
"Map id ='_map_id_halo1_halo'",
74-
"Map id ='_map_id_halo1_truth_and_reconciliation'",
75-
"Map id ='_map_id_halo1_silent_cartographer'",
76-
"Map id ='_map_id_halo1_assault_on_the_control_room'",
77-
"Map id ='_map_id_halo1_343_guilty_spark'",
78-
"Map id ='_map_id_halo1_the_library'",
79-
"Map id ='_map_id_halo1_two_betrayals'",
80-
"Map id ='_map_id_halo1_keyes'",
81-
"Map id ='_map_id_halo1_the_maw'",
82-
//h2
83-
"Map id ='_map_id_halo2_the_armory'",
84-
"Map id ='_map_id_halo2_cairo_station'",
85-
"Map id ='_map_id_halo2_outskirts'",
86-
"Map id ='_map_id_halo2_metropolis'",
87-
"Map id ='_map_id_halo2_the_arbiter'",
88-
"Map id ='_map_id_halo2_the_oracle'",
89-
"Map id ='_map_id_halo2_delta_halo'",
90-
"Map id ='_map_id_halo2_regret'",
91-
"Map id ='_map_id_halo2_sacred_icon'",
92-
"Map id ='_map_id_halo2_quarantine_zone'",
93-
"Map id ='_map_id_halo2_gravemind'",
94-
"Map id ='_map_id_halo2_uprising'",
95-
"Map id ='_map_id_halo2_high_charity'",
96-
"Map id ='_map_id_halo2_the_great_journey'",
97-
//h3
98-
"Map id ='_map_id_halo3_sierra_117'",
99-
"Map id ='_map_id_halo3_crows_nest'",
100-
"Map id ='_map_id_halo3_tsavo_highway'",
101-
"Map id ='_map_id_halo3_the_storm'",
102-
"Map id ='_map_id_halo3_floodgate'",
103-
"Map id ='_map_id_halo3_the_ark'",
104-
"Map id ='_map_id_halo3_the_covenant'",
105-
"Map id ='_map_id_halo3_cortana'",
106-
"Map id ='_map_id_halo3_halo'",
107-
//odst
108-
"Map id='_map_id_halo3odst_mombasa_streets'",
109-
"Map id='_map_id_halo3odst_tayari_plaza'",
110-
"Map id='_map_id_halo3odst_mombasa_streets'",
111-
"Map id='_map_id_halo3odst_uplift_reserve'",
112-
"Map id='_map_id_halo3odst_mombasa_streets'",
113-
"Map id='_map_id_halo3odst_kizingo_boulevard'",
114-
"Map id='_map_id_halo3odst_mombasa_streets'",
115-
"Map id='_map_id_halo3odst_oni_alpha_site'",
116-
"Map id='_map_id_halo3odst_mombasa_streets'",
117-
"Map id='_map_id_halo3odst_nmpd_hq'",
118-
"Map id='_map_id_halo3odst_mombasa_streets'",
119-
"Map id='_map_id_halo3odst_kikowani_station'",
120-
"Map id='_map_id_halo3odst_mombasa_streets'",
121-
"Map id='_map_id_halo3odst_data_hive'",
122-
"Map id='_map_id_halo3odst_coastal_highway'",
123-
// reach
124-
"Map id ='_map_id_haloreach_winter_contingency'",
125-
"Map id='_map_id_haloreach_oni_sword_base'",
126-
"Map id='_map_id_haloreach_nightfall'",
127-
"Map id='_map_id_haloreach_tip_of_the_spear'",
128-
"Map id='_map_id_haloreach_long_night_of_solace'",
129-
"Map id='_map_id_haloreach_exodus'",
130-
"Map id='_map_id_haloreach_new_alexandria'",
131-
"Map id='_map_id_haloreach_the_package'",
132-
"Map id='_map_id_haloreach_the_pillar_of_autumn'",
133-
"Map id='_map_id_halo4_dawn'",
134-
"Map id='_map_id_halo4_requiem'",
135-
"Map id='_map_id_halo4_forerunner'",
136-
"Map id='_map_id_halo4_infinity'",
137-
"Map id='_map_id_halo4_reclaimer'",
138-
"Map id='_map_id_halo4_shutdown'",
139-
"Map id='_map_id_halo4_composer'",
140-
"Map id='_map_id_halo4_midnight'"
141-
};
70+
string[] Names = new string[0];
14271

14372
#region levelChecks
14473
//these change the state of the bools in "missions" whenever you mess with the corresponding checkbox
@@ -474,77 +403,43 @@ private void Midnight_CheckedChanged(object sender, EventArgs e)
474403
}
475404
#endregion
476405

477-
private void reset()
406+
//checks for seeing what games will be active in the randomizer
407+
bool[] activeGames = new bool[6];
408+
private void CE_CheckedChanged(object sender, EventArgs e)
478409
{
479-
//sets the output back to the default whenever a button is pressed. if you dont do this if you make the file twice it will paste in the text twice.
480-
output = $@"<?xml version=""1.0"" encoding=""utf-8""?>
481-
<!--Please increment version number inside the MissionPlaylists tag if the list is updated. The game uses version number to ensure coop players have same data and also save games will be based on this (The version inside XML tag is not used.)-->
482-
<MissionPlaylists version=""4"">
483-
<Halo1 />
484-
<Halo2 />
485-
<Halo3 />
486-
<Halo3ODST />
487-
<HaloReach />
488-
<Halo4 />
489-
<CrossTitle>
490-
<Playlist id=""hydraulic"" name=""Randomizer Playlist"" desc=""H4sIAAAAAAAAAzNkqGHIYKhkSGEoYkhkKGXIYchkSAaKGQCxIZSGsEGkH5ilx2DEYApmYUIDukIAM+Jwa74AAAA="" image=""CT_Setlist_Preview_01"" highestDiffID=""_campaign_difficulty_level_easy"" hasRallyPoints=""false"">
491-
<MapList>
492-
";
410+
activeGames[0] = !activeGames[0];
411+
}
493412

494-
//resizes arrays and deletes the elements in them for the randomizer
495-
Array.Clear(curMissions, 0, curMissions.Length);
496-
Array.Resize(ref curMissions, 0);
413+
private void H2_CheckedChanged(object sender, EventArgs e)
414+
{
415+
activeGames[1] = !activeGames[1];
416+
}
497417

498-
Array.Clear(usedMissions, 0, usedMissions.Length);
499-
Array.Resize(ref usedMissions, 0);
418+
private void H3_CheckedChanged(object sender, EventArgs e)
419+
{
420+
activeGames[2] = !activeGames[2];
421+
}
500422

501-
Array.Clear(curInstert, 0, curInstert.Length);
502-
Array.Resize(ref curInstert, 0);
423+
private void ODST_CheckedChanged(object sender, EventArgs e)
424+
{
425+
activeGames[3] = !activeGames[3];
426+
}
503427

504-
//sets the mombasa streets levels insertion points
505-
hasInsert[35] = true; instert[35] = 1;
506-
hasInsert[37] = true; instert[37] = 2;
507-
hasInsert[39] = true; instert[39] = 3;
508-
hasInsert[41] = true; instert[41] = 4;
509-
hasInsert[43] = true; instert[43] = 5;
510-
hasInsert[45] = true; instert[45] = 6;
428+
private void Reach_CheckedChanged(object sender, EventArgs e)
429+
{
430+
activeGames[4] = !activeGames[4];
431+
}
511432

433+
private void H4_CheckedChanged(object sender, EventArgs e)
434+
{
435+
activeGames[5] = !activeGames[5];
512436
}
513437

514438
private void Make_Click(object sender, EventArgs e)
515439
{
516-
reset();
517-
518-
//this loop goes through every bool in "Missions" and if it is true adds the value from "Names" to "Output"
519-
//there is also code to check for insertion points and if it has them tags it at the end of the string were adding
520-
for (int i = 0; i < 65; i++)
521-
{
522-
if (Missions[i] == true && hasInsert[i] == true)
523-
{
524-
output = output + ("<" + Names[i] + " diffID='" + difficulty + "' insertionpoint='" + instert[i] + "' />");
525-
}
526-
else
527-
{
528-
if (Missions[i] == true)
529-
{
530-
output = output + ("<" + Names[i] + " diffID='" + difficulty + "' />");
531-
}
532-
}
533-
}
534-
535-
//adds the code the close out the file to "Output"
536-
output = output +
537-
$@"</MapList>
538-
</Playlist>
539-
</CrossTitle>
540-
<Extras>
541-
<!-- Status: 0 = greyed out, 1 = visible, 2 = hidden, 3 = invalid -->
542-
<Halo5Beta status=""0"" />
543-
</Extras>
544-
</MissionPlaylists>";
545-
546-
//writes the data in output to the path youve selected
547-
File.WriteAllText(path, output);
440+
Select selectCode = new Select();
441+
selectCode.reset(ref Names, ref insert);
442+
selectCode.create(Missions, insert, Names, difficulty, output, path);
548443
}
549444

550445
private void restore_Click(object sender, EventArgs e)
@@ -582,101 +477,11 @@ private void Legendary_CheckedChanged(object sender, EventArgs e)
582477

583478
private void Randomize_Click(object sender, EventArgs e)
584479
{
585-
reset();
586-
587-
//generates a random number with the seed you put between the range of 0 and 64
588-
int Seed = int.Parse(seed.Text);
589-
Random num = new Random(Seed);
590-
int numIndex = num.Next(0, 64);
591-
592-
//generates a random number for the difficulty
593-
Random diff = new Random(Seed);
594-
int diffIndex = diff.Next(0, 2);
595-
596-
//loops as many times as the number entered into the "number of levels" field in the randomize tab
597-
for (int i = 0; i < int.Parse(numLevels.Text); i++)
598-
{
599-
finding = true;
600-
//makes the length of "curMissions" = to the number of levels entered
601-
Array.Resize(ref curMissions, int.Parse(numLevels.Text));
602-
603-
//this is where the finding variable comes into play
604-
//its a bool that remains true if the program selects a level thats already been used
605-
//once it finds a new level it sets to false ending the loop and starting the next iteration of the for loop
606-
while (finding)
607-
{
608-
//pick a random number
609-
numIndex = num.Next(0, 64);
610-
611-
//check if the level has been used already
612-
if (!Array.Exists(curMissions, element => element == Names[numIndex]))
613-
{
614-
//if it hasnt stop the while loop and add the mission name to an array
615-
finding = false;
616-
curMissions[i] = Names[numIndex];
617-
if (hasInsert[numIndex] == true)
618-
{
619-
curInstert[i] = instert[numIndex];
620-
}
621-
}
622-
}
623-
}
624-
625-
//if the selected option was "random per playlist" it uses the random number generated earlier to determine the difficulty
626-
if (semiRand)
627-
{
628-
if (diffIndex == 0)
629-
{
630-
difficulty = "_campaign_difficulty_level_impossible";
631-
}
632-
else
633-
{
634-
difficulty = "_campaign_difficulty_level_easy";
635-
}
636-
}
637-
638-
for (int i = 0; i < curMissions.Length; i++)
639-
{
640-
//this one uses the same variable as the semirand but changes the value to be random for every mission
641-
if (fullRand)
642-
{
643-
diffIndex = diff.Next(0, 2);
644-
if (diffIndex == 0)
645-
{
646-
difficulty = "_campaign_difficulty_level_impossible";
647-
}
648-
else
649-
{
650-
difficulty = "_campaign_difficulty_level_easy";
651-
}
652-
}
653-
654-
//checks for the mombasa streets insertion points
655-
if (curInstert[i] != 0)
656-
{
657-
//if the level has insertion points it will add them to the end
658-
output = output + ("<" + curMissions[i] + " diffID='" + difficulty + "' insertionpoint='" + instert[i] + "' />");
659-
}
660-
else
661-
{
662-
//if not it will add the standard mission code
663-
output = output + ("<" + curMissions[i] + " diffID='" + difficulty + "' />");
664-
}
665-
}
666-
667-
//adds the code the close out the file to "Output"
668-
output = output +
669-
$@"</MapList>
670-
</Playlist>
671-
</CrossTitle>
672-
<Extras>
673-
<!-- Status: 0 = greyed out, 1 = visible, 2 = hidden, 3 = invalid -->
674-
<Halo5Beta status=""0"" />
675-
</Extras>
676-
</MissionPlaylists>";
677-
678-
//writes the data in output to the path youve selected
679-
File.WriteAllText(path, output);
480+
Randomize randCode = new Randomize();
481+
randCode.reset(ref Names, activeGames, ref insert, ref curMissions, ref curInsert);
482+
randCode.choose(ref Names, ref curMissions, insert, ref curInsert, seed, numLevels);
483+
randCode.difficulty(semiRand, difficulty, seed);
484+
randCode.create(curMissions, difficulty, fullRand, curInsert, output, seed, path);
680485
}
681486

682487
private void ChangePath_Click(object sender, EventArgs e)
18 KB
Binary file not shown.
0 Bytes
Binary file not shown.
7.6 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<body>
4+
<h1>Help</h1>
5+
<p>Select the root folder of your mcc installation("Halo The Master Chief Collection")</p>
6+
</body>
7+
</html>

0 commit comments

Comments
 (0)