Decompiled source of WFRusNoTranslate v1.0.1

GDWeave/mods/WFRusNoTranslate/WFRus.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.Json.Serialization;
using GDWeave;
using GDWeave.Godot;
using GDWeave.Godot.Variants;
using GDWeave.Modding;
using Serilog;
using WFRus.modifies;
using WFRus.modifies.globals;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyCompany("WFRus")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]
[assembly: AssemblyProduct("WFRus")]
[assembly: AssemblyTitle("WFRus")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace WFRus
{
	public class Config
	{
		[JsonInclude]
		public string mainmenuLogoPath = Directory.GetCurrentDirectory() + "/GDWeave/mods/WFRus/mainmenuLogo.png";

		[JsonInclude]
		public string splashLamePath = Directory.GetCurrentDirectory() + "/GDWeave/mods/WFRus/splashLame.png";

		[JsonInclude]
		public string splashGodotPath = Directory.GetCurrentDirectory() + "/GDWeave/mods/WFRus/splashGodot.png";
	}
	public static class Helpers
	{
		public static IEnumerable<Token> SetFont(string node, uint indents = 0u)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Expected O, but got Unknown
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Expected O, but got Unknown
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Expected O, but got Unknown
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Expected O, but got Unknown
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Expected O, but got Unknown
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Expected O, but got Unknown
			IEnumerable<Token> source = Array.Empty<Token>();
			source = source.Append(new Token((TokenType)87, (uint?)null));
			source = source.Append((Token)new IdentifierToken(node));
			source = source.Append(new Token((TokenType)84, (uint?)null));
			source = source.Append((Token)new IdentifierToken("get"));
			source = source.Append(new Token((TokenType)80, (uint?)null));
			source = source.Append((Token)new ConstantToken((Variant)new StringVariant("custom_fonts/font")));
			source = source.Append(new Token((TokenType)81, (uint?)null));
			source = source.Append(new Token((TokenType)84, (uint?)null));
			source = source.Append((Token)new IdentifierToken("set"));
			source = source.Append(new Token((TokenType)80, (uint?)null));
			source = source.Append((Token)new ConstantToken((Variant)new StringVariant("font_data")));
			source = source.Append(new Token((TokenType)82, (uint?)null));
			source = source.Append(new Token((TokenType)5, (uint?)76u));
			source = source.Append(new Token((TokenType)80, (uint?)null));
			source = source.Append((Token)new ConstantToken((Variant)new StringVariant("res://mods/WFRus/Cyrillic/accidCyr.ttf")));
			source = source.Append(new Token((TokenType)81, (uint?)null));
			source = source.Append(new Token((TokenType)81, (uint?)null));
			return source.Append(new Token((TokenType)89, (uint?)indents));
		}

		public static IEnumerable<Token> SetText(string node, string param, string str, uint indents = 0u)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			IEnumerable<Token> source = Array.Empty<Token>();
			source = source.Append(new Token((TokenType)87, (uint?)null));
			source = source.Append((Token)new IdentifierToken(node));
			source = source.Append(new Token((TokenType)84, (uint?)null));
			source = source.Append((Token)new IdentifierToken(param));
			source = source.Append(new Token((TokenType)23, (uint?)null));
			source = source.Append((Token)new ConstantToken((Variant)new StringVariant(str)));
			return source.Append(new Token((TokenType)89, (uint?)indents));
		}

		public static IEnumerable<Token> LoadExtImage(string node, string path)
		{
			IEnumerable<Token> first = Array.Empty<Token>();
			first = first.Concat(ScriptTokenizer.Tokenize("var img" + node + " = Image.new()", 1u));
			first = first.Concat(ScriptTokenizer.Tokenize($"var result{node} = img{node}.load(\"{path}\")", 1u));
			first = first.Concat(ScriptTokenizer.Tokenize("if result" + node + " == OK:", 1u));
			first = first.Concat(ScriptTokenizer.Tokenize("var texture" + node + " = ImageTexture.new()", 2u));
			first = first.Concat(ScriptTokenizer.Tokenize($"texture{node}.create_from_image(img{node})", 2u));
			first = first.Concat(ScriptTokenizer.Tokenize("texture" + node + ".flags = 0", 2u));
			return first.Concat(ScriptTokenizer.Tokenize("$" + node + ".texture = texture" + node, 2u));
		}
	}
	public class WFRusMod : IMod, IDisposable
	{
		public Config Config;

		public ILogger Logger;

		public WFRusMod(IModInterface modInterface)
		{
			Config = modInterface.ReadConfig<Config>();
			Logger = modInterface.Logger;
			modInterface.RegisterScriptMod((IScriptMod)(object)new Voice());
			modInterface.RegisterScriptMod((IScriptMod)(object)new PlayerVoice());
			modInterface.RegisterScriptMod((IScriptMod)(object)new MainMenu(this));
			modInterface.RegisterScriptMod((IScriptMod)(object)new SpeechBubble());
			Logger.Information("[WFRusCS] C# Mod initialized!");
		}

		public void Dispose()
		{
		}
	}
}
namespace WFRus.modifies
{
	public class LevelBubble : IScriptMod
	{
		public bool ShouldRun(string path)
		{
			return path == "res://Scenes/Entities/Player/SpeechBubble/level_bubble.gdc";
		}

		public IEnumerable<Token> Modify(string path, IEnumerable<Token> tokens)
		{
			MultiTokenWaiter waiter = new MultiTokenWaiter(new Func<Token, bool>[2]
			{
				delegate(Token t)
				{
					IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val != null && val.Name == "time";
				},
				(Token t) => (int)t.Type == 89
			}, false, true);
			foreach (Token token in tokens)
			{
				if (waiter.Check(token))
				{
					IEnumerable<Token> tkns = Array.Empty<Token>();
					tkns = tkns.Concat(ScriptTokenizer.Tokenize("func _ready():", 0u));
					tkns = tkns.Concat(ScriptTokenizer.Tokenize("\t$RichTextLabel.visible_characters = 20", 1u));
					tkns = tkns.Concat(ScriptTokenizer.Tokenize("\t$RichTextLabel.bbcode_text = \"[center][wave amp=80.0 freq=5.0 connected=1]НОВЫЙ УРОВЕНЬ!\" ", 1u));
					foreach (Token item in tkns)
					{
						yield return item;
					}
				}
				else
				{
					yield return token;
				}
			}
		}
	}
	public class MainMenu(WFRusMod mod) : IScriptMod
	{
		public bool ShouldRun(string path)
		{
			return path == "res://Scenes/Menus/Main Menu/main_menu.gdc";
		}

		public IEnumerable<Token> Modify(string path, IEnumerable<Token> tokens)
		{
			MultiTokenWaiter waiter = new MultiTokenWaiter(new Func<Token, bool>[2]
			{
				delegate(Token t)
				{
					IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val != null && val.Name == "_ready";
				},
				(Token t) => (int)t.Type == 89
			}, false, true);
			foreach (Token token in tokens)
			{
				if (waiter.Check(token))
				{
					yield return token;
					IEnumerable<Token> tkns = Array.Empty<Token>();
					mod.Logger.Information("Trying to load mainmenu logo from " + mod.Config.mainmenuLogoPath);
					tkns = tkns.Concat(ScriptTokenizer.Tokenize("TextPrint(\"[WFRusCS>GD] Injected into main_menu.gd!\")", 1u));
					tkns = tkns.Concat(ScriptTokenizer.Tokenize("if PlayerData.player_options.altfont == 0:", 1u));
					tkns = tkns.Concat(ScriptTokenizer.Tokenize("ResourceLoad(\"res://Assets/Themes/main.tres\").default_font = ResourceLoad(\"res://mods/WFRus/Cyrillic/cyrillic.tres\")", 2u));
					foreach (Token item in tkns)
					{
						yield return item;
					}
					yield return new Token((TokenType)89, (uint?)1u);
				}
				else
				{
					yield return token;
				}
			}
		}
	}
	public class OptionsMenu : IScriptMod
	{
		public bool ShouldRun(string path)
		{
			return path == "res://Scenes/Singletons/OptionsMenu/options_menu.gdc";
		}

		public IEnumerable<Token> Modify(string path, IEnumerable<Token> tokens)
		{
			MultiTokenWaiter waiter = new MultiTokenWaiter(new Func<Token, bool>[5]
			{
				delegate(Token t)
				{
					IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val != null && val.Name == "_update_options";
				},
				delegate(Token t)
				{
					IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val != null && val.Name == "altfont";
				},
				delegate(Token t)
				{
					IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val != null && val.Name == "default_font";
				},
				(Token t) => (int)t.Type == 23,
				(Token t) => (int)t.Type == 63
			}, false, true);
			TokenWaiter waiter2 = new TokenWaiter((Func<Token, bool>)((Token t) => false), false);
			List<Token>.Enumerator enmr = tokens.ToList().GetEnumerator();
			bool hasNext = enmr.MoveNext();
			while (hasNext)
			{
				Token token = enmr.Current;
				hasNext = enmr.MoveNext();
				if (waiter.Check(token))
				{
					Console.WriteLine("[WFRusCS] Injecting options menu (preload -> load)");
					Console.WriteLine(tokens.ToList().IndexOf(token));
					yield return new Token((TokenType)5, (uint?)76u);
					waiter2 = new TokenWaiter((Func<Token, bool>)((Token t) => t is ConstantToken), false);
				}
				else if (waiter2.Check(token))
				{
					Console.WriteLine("[WFRusCS] Injecting options menu (main_font.tres -> cyrillic.tres)");
					Console.WriteLine(tokens.ToList().IndexOf(token));
					yield return (Token)new ConstantToken((Variant)new StringVariant("res://mods/WFRus/Cyrillic/cyrillic.tres"));
					waiter2 = new TokenWaiter((Func<Token, bool>)((Token t) => false), false);
				}
				else
				{
					yield return token;
				}
			}
		}
	}
	public class PlayerVoice : IScriptMod
	{
		public bool ShouldRun(string path)
		{
			return path == "res://Scenes/Entities/Player/player.gdc";
		}

		public IEnumerable<Token> Modify(string path, IEnumerable<Token> tokens)
		{
			MultiTokenWaiter waiter = new MultiTokenWaiter(new Func<Token, bool>[3]
			{
				delegate(Token t)
				{
					IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val != null && val.Name == "_sync_talk";
				},
				delegate(Token t)
				{
					IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val != null && val.Name == "blacklist";
				},
				(Token t) => (int)t.Type == 77
			}, false, true);
			foreach (Token token in tokens)
			{
				if (waiter.Check(token))
				{
					List<string> ruChars = (from c in "абвгдеёжзийклмнопрстуфхцчшщьыэюя".ToList()
						select c.ToString()).ToList();
					foreach (string ch in ruChars)
					{
						yield return new Token((TokenType)82, (uint?)null);
						yield return (Token)new ConstantToken((Variant)new StringVariant(ch));
					}
					yield return token;
				}
				else
				{
					yield return token;
				}
			}
		}
	}
	public class SpeechBubble : IScriptMod
	{
		public bool ShouldRun(string path)
		{
			return path == "res://Scenes/Entities/Player/SpeechBubble/speech_bubble.gdc";
		}

		public IEnumerable<Token> Modify(string path, IEnumerable<Token> tokens)
		{
			MultiTokenWaiter waiter = new MultiTokenWaiter(new Func<Token, bool>[2]
			{
				delegate(Token t)
				{
					IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val != null && val.Name == "_ready";
				},
				(Token t) => (int)t.Type == 89
			}, false, true);
			foreach (Token token in tokens)
			{
				if (waiter.Check(token))
				{
					yield return token;
					IEnumerable<Token> tkns = Helpers.SetFont("RichTextLabel");
					foreach (Token item in tkns)
					{
						yield return item;
					}
					yield return new Token((TokenType)89, (uint?)1u);
				}
				else
				{
					yield return token;
				}
			}
		}
	}
	public class SplashScreen(WFRusMod mod) : IScriptMod
	{
		public bool ShouldRun(string path)
		{
			return path == "res://Scenes/Menus/Splash/splash.gdc";
		}

		public IEnumerable<Token> Modify(string path, IEnumerable<Token> tokens)
		{
			MultiTokenWaiter waiter = new MultiTokenWaiter(new Func<Token, bool>[2]
			{
				delegate(Token t)
				{
					IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val != null && val.Name == "_ready";
				},
				(Token t) => (int)t.Type == 89
			}, false, true);
			foreach (Token token in tokens)
			{
				if (waiter.Check(token))
				{
					yield return new Token((TokenType)89, (uint?)1u);
					IEnumerable<Token> tkns = Array.Empty<Token>();
					tkns = tkns.Concat(Helpers.LoadExtImage("lame", mod.Config.splashLamePath));
					tkns = tkns.Concat(Helpers.LoadExtImage("god", mod.Config.splashGodotPath));
					foreach (Token item in tkns)
					{
						yield return item;
					}
					yield return new Token((TokenType)89, (uint?)1u);
				}
				else
				{
					yield return token;
				}
			}
		}
	}
}
namespace WFRus.modifies.globals
{
	public class GlobalsAddMaps : IScriptMod
	{
		public bool ShouldRun(string path)
		{
			return path == "res://Scenes/Singletons/globals.gdc";
		}

		public IEnumerable<Token> Modify(string path, IEnumerable<Token> tokens)
		{
			MultiTokenWaiter waiter = new MultiTokenWaiter(new Func<Token, bool>[2]
			{
				delegate(Token t)
				{
					IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val != null && val.Name == "loot_tables";
				},
				(Token t) => (int)t.Type == 89
			}, false, true);
			foreach (Token token in tokens)
			{
				if (waiter.Check(token))
				{
					yield return token;
					IEnumerable<Token> tkns = Array.Empty<Token>();
					Dictionary<string, string> titleNameDict = new Dictionary<string, string>
					{
						["Scout"] = "Скаут",
						["Second Class Scout"] = "Второклассный скаут",
						["First Class Scout"] = "Первоклассный скаут",
						["Star Scout"] = "Звёздный скаут",
						["Life Scout"] = "Скаут по жизни",
						["Eagle Scout"] = "Старший скаут",
						["Survival Expert"] = "Эксперт по выживанию",
						["Pack Leader"] = "Лидер стаи",
						["Headmaster"] = "Директор",
						["Tenderfoot"] = "Новичок",
						["Voyager"] = "Путешественник",
						["Ace"] = "Ас",
						["Admiral"] = "Адмирал",
						["Ancient"] = "Древний",
						["Bi"] = "Би",
						["Bipedal Animal Drawer"] = "Двуногая тумбочка-животное",
						["cadaver dog"] = "собака-кадавр",
						["NiceCandy"] = "NiceCandy",
						["Catfisher"] = "Ловец сомов",
						["Cozy"] = "Комфортный",
						["Creature"] = "Существо",
						["Critter"] = "Тварь",
						["Cryptid"] = "Криптоид",
						["Dude"] = "Чувак",
						["Elite"] = "Элита",
						[":3"] = ":3",
						["Fish-Pilled"] = "Рыбинист",
						["Freaky"] = "Фрик",
						["Gay"] = "Гей",
						["The Title Only For People Who Caught The Super Duper Rare Golden Bass"] = "Звание только для тех, кто поймал супер пупер редкого золотого окуня",
						["The Title Only For People Who Caught The Super Duper Rare Golden Ray"] = "Звание только для тех, кто поймал супер пупер редкого золотого ската",
						["Goober"] = "Дурашка",
						["Good Boy"] = "Хороший мальчик",
						["Good Girl"] = "Хорошая девочка",
						["77 | 3328 FISSILE"] = "77 | 3328 FISSILE",
						["Igloo or Hot Dog"] = "Иглу или хот-дог",
						["Normal and Regular"] = "Нормальный и обычный",
						["Is Cool"] = "Очень крутой",
						["King"] = "Король",
						["Kitten"] = "Котик",
						["Koi Boy"] = "Кой-бой",
						["fake lamedev"] = "фейк lamedev",
						["lamedev"] = "lamedev",
						["Lesbian"] = "Лесбиянка",
						["Little Lad"] = "Микрочел",
						["Majestic"] = "Царь во дворца",
						["Musky"] = "Мускусный",
						["Night Crawler"] = "Стрингер",
						["nitrous oxide"] = "закусь азотом",
						["Non-Binary"] = "Небинарный",
						["Pan"] = "Кастрюля",
						["Pretty"] = "Милый",
						["Problematic"] = "Проблемный",
						["Pup"] = "Щенок",
						["Puppy"] = "Пёсик",
						["Queer"] = "Квир",
						["Shark Bait"] = "Наживка для акул",
						["shithead"] = "ублюдок",
						["Silly Guy"] = "Дурачок",
						["Soggy Doggy"] = "До нитки",
						["Special"] = "Особый",
						["Webfishing Special Forces"] = "Спецотряд интернет-рыбалки",
						["Stinker Dinker"] = "Вонючка",
						["\"straight\""] = "\"натурал\"",
						["Strongest Warrior"] = "Сильнейший воин",
						["Stupid Idiot Baby"] = "Тупой ребёнок-идиот",
						["Trans"] = "Транс",
						["Yapper"] = "Болтун",
						["ZedDog"] = "ZedDog"
					};
					tkns = tkns.Concat(assignDictionary("titlenamedict", titleNameDict));
					tkns = tkns.Append(new Token((TokenType)89, (uint?)null));
					Dictionary<string, string> titleDescDict = new Dictionary<string, string>
					{
						["Welcome to Camp!"] = "Добро пожаловать в лагерь!",
						["Getting the ropes!"] = "Уже понимаешь, как всё завязано!",
						["Making a name for yourself!"] = "Зарабатываешь репутацию!",
						["Shining!"] = "Блестишь!",
						["Climbing the ladder!"] = "Взбираешься по лестнице!",
						["The best of the best!"] = "Лучший из лучших!",
						["You know it all!"] = "Всё знаешь!",
						["Lead by example!"] = "Веди примером!",
						["Keeping everyone else in line!"] = "Держишь всех в строю!",
						["Getting around!"] = "Бегаешь туда-сюда!",
						["Top of the world."] = "Вершина мира.",
						["Ace!"] = "Ас!",
						["admirable"] = "восхитительно",
						["Eons old!"] = "Стар, как мир!",
						["Bi!"] = "Би!",
						["RAHHHH"] = "РАХХХХ",
						["worlds smartest mutt"] = "умнейшая дворняга",
						["the nicests candy"] = "the nicests candy",
						["kinda like a cat but if it was fishing"] = "типа ловец снов но ловец сомов",
						["Nice and warm!"] = "Уютно и тепло.",
						["Raaaahh!"] = "Раааахх!",
						["just scampering around, you"] = "тупо слоняешься без дела, ты",
						["Mysterious!"] = "Загадочно!",
						["Duuuuude..."] = "Чуваааак...",
						["Intense!"] = "Мощно!",
						[":3"] = ":3",
						["based and fish-pilled"] = "базированный рыбинист",
						["what if webfishing was freaky"] = "вот бы была иге по интернет рыбалке",
						["Gay!"] = "Гей!",
						["Woah!"] = "Воу!",
						["Goob!"] = "Гуп!",
						["Who'sa good boy!"] = "Кто хороший мальчик!",
						["Who'sa good girl!"] = "Кто хорошая девочка!",
						["Hazardous..."] = "Радиокартивно...",
						["wad of meat"] = "пачка мяса",
						["we know, zach."] = "мы в курсе, зак.",
						["The coolest."] = "Крутейший.",
						["Royalty!"] = "Царственно!",
						["Mew!"] = "Мяу!",
						["koiboi"] = "коибои",
						["due to a bug, this exists now."] = "произошёл какой-то баг, и появилось это звание",
						["if youre not west and you see this. you're evil."] = "если вы не уэст и видите это. вы злодей.",
						["Lesbian!"] = "Лесбиянка!",
						["Lil guy!"] = "Мини-челик!",
						["Graceful!"] = "Грациозно!",
						["Smelly!"] = "Вонь какая!",
						["Wormy!"] = "Джилленхол?",
						["very funny"] = "очень смешно",
						["Non-Binary!"] = "Небинарный!",
						["Pan!"] = "Кастрюля!",
						["The prettiest!"] = "Милейше!",
						["Yikes, dude."] = "Мда, чел.",
						["Yeah."] = "Ага.",
						["Pup!"] = "Щенок!",
						["How peculiar."] = "Как интересно.",
						["Shark Bait!"] = "Наживка для акул!",
						["Pronounced, Shitheed."] = "Кто, интересно, выберет такое звание?",
						["just a silly lil guy,,,"] = "всего лишь маленький дурашка",
						["Sloppy!"] = "Подскользнёшься!",
						["Very special :)"] = "Очень особый :)",
						["The W.S.F."] = "С.И.Р.",
						["The stinkiest!"] = "Максимальный вонючка!",
						["mhm"] = "угу",
						["The mightiest!"] = "Величайший!",
						["we get it box."] = "это же для друзей разраба, да?",
						["Trans!"] = "Транс!",
						["Yap yap yap!"] = "Бла бла бла!",
						["zeddy doggy"] = "zeddy doggy"
					};
					tkns = tkns.Concat(assignDictionary("titledescdict", titleDescDict));
					tkns = tkns.Append(new Token((TokenType)89, (uint?)null));
					foreach (Token item in tkns)
					{
						yield return item;
					}
				}
				else
				{
					yield return token;
				}
			}
		}

		private IEnumerable<Token> assignDictionary(string identifier, Dictionary<string, string> dict)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			IEnumerable<Token> source = Array.Empty<Token>();
			source = source.Append(new Token((TokenType)59, (uint?)null));
			source = source.Append((Token)new IdentifierToken(identifier));
			source = source.Append(new Token((TokenType)23, (uint?)null));
			source = source.Append(new Token((TokenType)78, (uint?)null));
			source = source.Concat(parseDictionary(dict));
			return source.Append(new Token((TokenType)79, (uint?)null));
		}

		private IEnumerable<Token> parseDictionary(Dictionary<string, string> dict)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			IEnumerable<Token> enumerable = Array.Empty<Token>();
			Dictionary<string, string>.Enumerator enumerator = dict.GetEnumerator();
			bool flag = enumerator.MoveNext();
			while (flag)
			{
				enumerator.Current.Deconstruct(out var key, out var value);
				string text = key;
				string text2 = value;
				flag = enumerator.MoveNext();
				enumerable = enumerable.Append((Token)new ConstantToken((Variant)new StringVariant(text)));
				enumerable = enumerable.Append(new Token((TokenType)86, (uint?)null));
				enumerable = enumerable.Append((Token)new ConstantToken((Variant)new StringVariant(text2)));
				if (flag)
				{
					enumerable = enumerable.Append(new Token((TokenType)82, (uint?)null));
				}
			}
			return enumerable;
		}
	}
	public class GlobalsUseMaps : IScriptMod
	{
		public bool ShouldRun(string path)
		{
			return path == "res://Scenes/Singletons/globals.gdc";
		}

		public IEnumerable<Token> Modify(string path, IEnumerable<Token> tokens)
		{
			MultiTokenWaiter waiter = new MultiTokenWaiter(new Func<Token, bool>[4]
			{
				delegate(Token t)
				{
					IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val != null && val.Name == "_add_resource";
				},
				delegate(Token t)
				{
					IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val != null && val.Name == "new";
				},
				delegate(Token t)
				{
					//IL_0004: Unknown result type (might be due to invalid IL or missing references)
					//IL_000a: Invalid comparison between Unknown and I4
					int result;
					if (t != null && (int)t.Type == 5)
					{
						uint? associatedData = t.AssociatedData;
						if (associatedData.HasValue)
						{
							result = ((associatedData == 76) ? 1 : 0);
							goto IL_002a;
						}
					}
					result = 0;
					goto IL_002a;
					IL_002a:
					return (byte)result != 0;
				},
				(Token t) => (int)t.Type == 89
			}, false, true);
			foreach (Token token in tokens)
			{
				if (waiter.Check(token))
				{
					IEnumerable<Token> tkns = Array.Empty<Token>();
					tkns = tkns.Concat(ScriptTokenizer.Tokenize("if file_name.rfind(\"title_\") != -1:", 1u));
					tkns = tkns.Concat(ScriptTokenizer.Tokenize("if new[\"file\"].title in titlenamedict:", 2u));
					tkns = tkns.Concat(ScriptTokenizer.Tokenize("var titlename = titlenamedict[new[\"file\"].title]", 3u));
					tkns = tkns.Concat(ScriptTokenizer.Tokenize("new[\"file\"].title = titlename", 3u));
					tkns = tkns.Concat(ScriptTokenizer.Tokenize("new[\"file\"].name = \"Звание «\" + titlename + \"»\" ", 3u));
					tkns = tkns.Concat(ScriptTokenizer.Tokenize("new[\"file\"].desc = titledescdict[new[\"file\"].desc]", 3u));
					tkns = tkns.Concat(ScriptTokenizer.Tokenize("elif new[\"file\"].name == \"No Title\":", 2u));
					tkns = tkns.Concat(ScriptTokenizer.Tokenize("new[\"file\"].name = \"Нет звания\" ", 3u));
					tkns = tkns.Concat(ScriptTokenizer.Tokenize("new[\"file\"].desc = \"Без звания!\" ", 3u));
					foreach (Token item in tkns)
					{
						yield return item;
					}
					yield return new Token((TokenType)89, (uint?)1u);
				}
				else
				{
					yield return token;
				}
			}
		}
	}
	public class Voice : IScriptMod
	{
		public bool ShouldRun(string path)
		{
			return path == "res://Scenes/Singletons/globals.gdc";
		}

		public IEnumerable<Token> Modify(string path, IEnumerable<Token> tokens)
		{
			MultiTokenWaiter waiter = new MultiTokenWaiter(new Func<Token, bool>[5]
			{
				delegate(Token t)
				{
					IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val != null && val.Name == "_generate_voice_bank";
				},
				delegate(Token t)
				{
					IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val != null && val.Name == "voice_bank";
				},
				delegate(Token t)
				{
					IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
					return val != null && val.Name == "path";
				},
				(Token t) => (int)t.Type == 23,
				(Token t) => t is ConstantToken
			}, false, true);
			foreach (Token token in tokens)
			{
				if (waiter.Check(token))
				{
					yield return (Token)new ConstantToken((Variant)new StringVariant("res://mods/WFRus/RuVoice/"));
				}
				else
				{
					yield return token;
				}
			}
		}
	}
}