private static string MiscProgressionData_ToString(On.PlayerProgression.MiscProgressionData.orig_ToString orig, PlayerProgression.MiscProgressionData self) { string text = "Custom Regions: MiscProgdata ["; for (int i = 0; i < self.discoveredShelters.Length; i++) { if (self.discoveredShelters[i] != null && self.discoveredShelters[i].Count > 0) { text = text + "SHELTERLIST<mpdB>" + self.owner.regionNames[i] + "<mpdB>"; for (int j = 0; j < self.discoveredShelters[i].Count; j++) { text = text + self.discoveredShelters[i][j] + ((j >= self.discoveredShelters[i].Count - 1) ? string.Empty : "<mpdC>"); } text += "<mpdA>"; } } CustomWorldMod.Log(text + "] "); return(orig(self)); }
private static void MiscProgressionData_SaveDiscoveredShelter(On.PlayerProgression.MiscProgressionData.orig_SaveDiscoveredShelter orig, PlayerProgression.MiscProgressionData self, string roomName) { CustomWorldMod.Log($"Custom Regions: Save Discovered Shelter [{roomName}]. "); string debug = "Custom Regions: RegionNames { "; int num = -1; for (int i = 0; i < self.owner.regionNames.Length; i++) { debug += self.owner.regionNames[i] + " , "; if (self.owner.regionNames[i] == roomName.Substring(0, 2)) { num = i; break; } } if (num == -1) { debug += "\n ERROR! region not found"; } // CustomWorldMod.Log(debug); if (self.discoveredShelters[num] == null) { self.discoveredShelters[num] = new List <string>(); } for (int j = 0; j < self.discoveredShelters[num].Count; j++) { if (self.discoveredShelters[num][j] == roomName) { CustomWorldMod.Log("Custom Regions: Save shelter ERROR, already saved"); } } orig(self, roomName); string debug2 = "Custom Regions: Discovered Shelters { "; for (int i = 0; i < self.discoveredShelters.Length; i++) { if (self.discoveredShelters[i] != null) { for (int x = 0; x < self.discoveredShelters[i].Count; x++) { if (self.discoveredShelters[i][x] != null) { debug += self.discoveredShelters[i][x] + " , "; } } } } CustomWorldMod.Log("} " + debug2); }
private static void MiscProgressionData_FromString(On.PlayerProgression.MiscProgressionData.orig_FromString orig, PlayerProgression.MiscProgressionData self, string s) { /* * string debug2 = "Custom Regions: MISC PROGRESION FROM STRING - RegionNames { "; * for (int i = 0; i < self.owner.regionNames.Length; i++) * { * debug2 += self.owner.regionNames[i] + " , "; * } * CustomWorldMod.CustomWorldLog(debug2); */ CustomWorldMod.Log($"MISC PROGRESSION FROM STRING - RegionNames[{string.Join(", ", self.owner.regionNames)}]"); Dictionary <string, int> dictionaryTemp = new Dictionary <string, int>(7); string[] array = Regex.Split(s, "<mpdA>"); string debug = "Custom Regions: Loaded shelters from string: [ "; for (int i = 0; i < array.Length; i++) { string[] array2 = Regex.Split(array[i], "<mpdB>"); string text = array2[0]; if (text != null) { if (dictionaryTemp == null) { Dictionary <string, int> dictionary = new Dictionary <string, int>(7) { { "SHELTERLIST", 0 }, { "MENUREGION", 1 }, { "LEVELTOKENS", 2 }, { "SANDBOXTOKENS", 3 }, { "INTEGERS", 4 }, { "PLAYEDARENAS", 5 }, { "REDSFLOWER", 6 } }; dictionaryTemp = dictionary; } int num; if (dictionaryTemp.TryGetValue(text, out num)) { switch (num) { case 0: { int num2 = -1; for (int j = 0; j < self.owner.regionNames.Length; j++) { if (self.owner.regionNames[j] == array2[1]) { num2 = j; break; } } if (num2 > -1) { // self.discoveredShelters[num2] = new List<string>(); string[] array3 = Regex.Split(array2[2], "<mpdC>"); for (int k = 0; k < array3.Length; k++) { if (array3[k].Length > 0) { // self.discoveredShelters[num2].Add(array3[k]); //shelters.Add(array3[k]); for (int h = 0; h < array3[k].Length; h++) { debug += array3[h] + " "; } } } } //myStringOutput = String.Join(",", array2[2].Select(p => p.ToString()).ToArray()); break; } } } } /*for (int a = 0; a < array2.Length; a++) * { * for (int b = 0; b < array2[a].Length; b++) * { * debug += array2[a][b] + " "; * } * }*/ } debug += " ]"; CustomWorldMod.Log(debug); orig(self, s); string debug2 = "Custom Regions: Discovered Shelters { "; for (int i = 0; i < self.discoveredShelters.Length; i++) { if (self.discoveredShelters[i] != null) { for (int x = 0; x < self.discoveredShelters[i].Count; x++) { if (self.discoveredShelters[i][x] != null) { debug += self.discoveredShelters[i][x] + " , "; } } } } CustomWorldMod.Log(debug2 + "} "); }