Skip to content

Instantly share code, notes, and snippets.

@derofim
Created April 27, 2017 22:08
Show Gist options
  • Select an option

  • Save derofim/02e3749fa5dc1c7150bb699b84ebde0c to your computer and use it in GitHub Desktop.

Select an option

Save derofim/02e3749fa5dc1c7150bb699b84ebde0c to your computer and use it in GitHub Desktop.
Rain World
@derofim

derofim commented Apr 27, 2017

Copy link
Copy Markdown
Author

projection1
rnd_proj
str_proj

@derofim

derofim commented Apr 27, 2017

Copy link
Copy Markdown
Author

iterators
unq - triple landscape

@derofim

derofim commented Apr 27, 2017

Copy link
Copy Markdown
Author
protected void LoadEventsFromFile(int fileName, bool oneRandomLine, int randomSeed)
{
	string path = string.Concat(new object[]
	{
		this.interfaceOwner.rainWorld.inGameTranslator.SpecificTextFolderDirectory(),
		Path.DirectorySeparatorChar,
		fileName,
		".txt"
	});
	if (!File.Exists(path))
	{
		return;
	}
	string text = File.ReadAllText(path, Encoding.UTF8);
	if (text[0] == '0')
	{
		Conversation.EncryptAllDialogue();
	}
	else
	{
		text = Custom.xorEncrypt(text, (int)(52 + fileName + this.interfaceOwner.rainWorld.inGameTranslator.currentLanguage * (InGameTranslator.LanguageID)6));
	}
	string[] array = Regex.Split(text, Environment.NewLine);
	try
	{
		if (Regex.Split(array[0], "-")[1] == fileName.ToString())
		{
			if (oneRandomLine)
			{
				List<Conversation.TextEvent> list = new List<Conversation.TextEvent>();
				for (int i = 1; i < array.Length; i++)
				{
					string[] array2 = Regex.Split(array[i], " : ");
					if (array2.Length == 3)
					{
						list.Add(new Conversation.TextEvent(this, int.Parse(array2[0]), array2[2], int.Parse(array2[1])));
					}
					else if (array2.Length == 1 && array2[0].Length > 0)
					{
						list.Add(new Conversation.TextEvent(this, 0, array2[0], 0));
					}
				}
				if (list.Count > 0)
				{
					int seed = UnityEngine.Random.seed;
					UnityEngine.Random.seed = randomSeed;
					Conversation.TextEvent item = list[UnityEngine.Random.Range(0, list.Count)];
					UnityEngine.Random.seed = seed;
					this.events.Add(item);
				}
			}
			else
			{
				for (int j = 1; j < array.Length; j++)
				{
					string[] array3 = Regex.Split(array[j], " : ");
					if (array3.Length == 3)
					{
						this.events.Add(new Conversation.TextEvent(this, int.Parse(array3[0]), array3[2], int.Parse(array3[1])));
					}
					else if (array3.Length == 1 && array3[0].Length > 0)
					{
						this.events.Add(new Conversation.TextEvent(this, 0, array3[0], 0));
					}
				}
			}
		}
	}
	catch
	{
		Debug.Log("TEXT ERROR");
		this.events.Add(new Conversation.TextEvent(this, 0, "TEXT ERROR", 100));
	}
}

@derofim

derofim commented Apr 27, 2017

Copy link
Copy Markdown
Author

Conversations:

		MoonFirstPostMarkConversation,
		MoonSecondPostMarkConversation,
		MoonRecieveSwarmer,
		Moon_Pearl_Misc,
		Moon_Pearl_Misc2,
		Moon_Pebbles_Pearl,
		Moon_Pearl_CC,
		Moon_Pearl_SI_west,
		Moon_Pearl_SI_top,
		Moon_Pearl_LF_west,
		Moon_Pearl_LF_bottom,
		Moon_Pearl_HI,
		Moon_Pearl_SH,
		Moon_Pearl_DS,
		Moon_Pearl_SB_filtration,
		Moon_Pearl_GW,
		Moon_Pearl_SL_bridge,
		Moon_Pearl_SL_moon,
		Moon_Misc_Item,
		Moon_Pearl_SU,
		Moon_Pearl_SB_ravine,
		Moon_Pearl_UW,
		Ghost_CC,
		Ghost_SI,
		Ghost_LF,
		Ghost_SH,
		Ghost_UW,
		Ghost_SB```

@derofim

derofim commented Apr 28, 2017

Copy link
Copy Markdown
Author
public static bool ControlCheckSum(RainWorld.BuildType buildType)
{
	if (buildType == RainWorld.BuildType.Development)
	{
		return true;
	}
	string text = WorldChecksumController.WorldCheckSum();
	string text2 = File.ReadAllText(string.Concat(new object[]
	{
		Custom.RootFolderDirectory(),
		"World",
		Path.DirectorySeparatorChar,
		"checksum.txt"
	}));
	if (text2 == "Cre4teN3wSum")
	{
		File.WriteAllText(string.Concat(new object[]
		{
			Custom.RootFolderDirectory(),
			"World",
			Path.DirectorySeparatorChar,
			"checksum.txt"
		}), text);
		Debug.Log("SETTING NEW WORLD CHECKSUM");
		return true;
	}
	return text == text2;
}

@derofim

derofim commented Apr 28, 2017

Copy link
Copy Markdown
Author
private static string WorldCheckSum()
{
	string text = string.Empty;
	text += WorldChecksumController.ReadText("default alignments.txt");
	text += WorldChecksumController.ReadText("Gates" + Path.DirectorySeparatorChar + "locks.txt");
	string[] array = File.ReadAllLines(string.Concat(new object[]
	{
		Custom.RootFolderDirectory(),
		"World",
		Path.DirectorySeparatorChar,
		"Regions",
		Path.DirectorySeparatorChar,
		"regions.txt"
	}));
	for (int i = 0; i < array.Length; i++)
	{
		text += WorldChecksumController.ReadText(string.Concat(new object[]
		{
			"Regions",
			Path.DirectorySeparatorChar,
			array[i],
			Path.DirectorySeparatorChar,
			"Properties.txt"
		}));
		text += WorldChecksumController.ReadText(string.Concat(new object[]
		{
			"Regions",
			Path.DirectorySeparatorChar,
			array[i],
			Path.DirectorySeparatorChar,
			"world_",
			array[i],
			".txt"
		}));
	}
	return Custom.Md5Sum(text);
}```

@derofim

derofim commented Apr 28, 2017

Copy link
Copy Markdown
Author
protected string[] GetProgLines()
{
	if (File.Exists(this.saveFilePath))
	{
		string text = File.ReadAllText(this.saveFilePath);
		string b = text.Substring(0, 32);
		text = text.Substring(32, text.Length - 32);
		if (Custom.Md5Sum(text) == b)
		{
			Debug.Log("Checksum CORRECT!");
		}
		else
		{
			Debug.Log("Checksum WRONG!");
			this.gameTinkeredWith = true;
		}
		return Regex.Split(text, "<progDivA>");
	}
	return new string[0];
}

@derofim

derofim commented Apr 28, 2017

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment