Decompiled source of SkyheimRussianTranslation v1.0.0

SkyheimRus.dll

Decompiled 6 months ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using UnityEngine.UI;
using skyheim;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("SkyheimRus")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SkyheimRus")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1fb8c4f1-4af8-407a-b44e-91b47998a28d")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace SkyheimRus
{
	[BepInPlugin("skyheim_rus", "SkyheimRus", "0.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("valheim.exe")]
	public class SkyheimRus : BaseUnityPlugin
	{
		private const string modGUID = "skyheim_rus";

		private const string modName = "SkyheimRus";

		private const string modVersion = "0.0.2";

		private readonly Harmony harmony = new Harmony("skyheim_rus");

		public static bool m_piece_changed;

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"skyheimRus is started");
			harmony.PatchAll();
		}
	}
}
namespace SkyheimRus.Patches
{
	[HarmonyPatch(typeof(CraftingStation))]
	internal class CraftingStation_Patches
	{
		[HarmonyPostfix]
		[HarmonyPatch("GetHoverText")]
		public static void PostfixGetHoverText(CraftingStation_Patches __instance, ref string ___m_name, ref string __result)
		{
			if (___m_name.Contains("Rune") && ___m_name.Contains("Altar"))
			{
				string text = "Рунный Алтарь";
				__result = Localization.instance.Localize(text + "\n[<color=yellow><b>$KEY_Use</b></color>] $piece_use ");
			}
		}
	}
	[HarmonyPatch(typeof(ObjectDB))]
	internal class ObjectDB_Patches
	{
		[HarmonyPostfix]
		[HarmonyPatch("UpdateItemHashes")]
		public static void PostfixUpdateItemHashes(ObjectDB __instance)
		{
			foreach (GameObject item in __instance.m_items)
			{
				ItemDrop component = item.GetComponent<ItemDrop>();
				if ((Object)(object)component != (Object)null && ((Object)component).name.Contains("rune_"))
				{
					if (((Object)component).name.Contains("barkskin"))
					{
						component.m_itemData.m_shared.m_name = "Руна Дубовой кожи";
						component.m_itemData.m_shared.m_description = "Жертвует выносливостью, чтобы увеличить броню до максимума. Максимальное повышения качества. Навык природы увеличивает продолжительность.";
					}
					else if (((Object)component).name.Contains("blink"))
					{
						component.m_itemData.m_shared.m_name = "Руна Мерцания";
						component.m_itemData.m_shared.m_description = "Телепортирует вас вперед. \nРастояние: 15 (+5 на уровень)";
					}
					else if (((Object)component).name.Contains("chain_lightning"))
					{
						component.m_itemData.m_shared.m_name = "Руна Цепной молнии";
						component.m_itemData.m_shared.m_description = "Разряд молнии поражает 5 целей. \nРастояние: 15";
					}
					else if (((Object)component).name.Contains("firebolt"))
					{
						component.m_itemData.m_shared.m_name = "Руна Огненного шара";
						component.m_itemData.m_shared.m_description = "Сжигает ваших врагов до смерти.";
					}
					else if (((Object)component).name.Contains("force"))
					{
						component.m_itemData.m_shared.m_name = "Руна Силы";
						component.m_itemData.m_shared.m_description = "Воспользуйтесь мощью стены щитов.";
					}
					else if (((Object)component).name.Contains("frostbolt"))
					{
						component.m_itemData.m_shared.m_name = "Руна Ледяного шара";
						component.m_itemData.m_shared.m_description = "Замедляет цель при попадании.";
					}
					else if (((Object)component).name.Contains("frostnova"))
					{
						component.m_itemData.m_shared.m_name = "Руна Фростновы";
						component.m_itemData.m_shared.m_description = "Замораживает врагов вокруг вас.";
					}
					else if (((Object)component).name.Contains("glacial_spike"))
					{
						component.m_itemData.m_shared.m_name = "Руна Ледяного шипа";
						component.m_itemData.m_shared.m_description = "Пронзительный ледяной шип.";
					}
					else if (((Object)component).name.Contains("goodberry"))
					{
						component.m_itemData.m_shared.m_name = "Руна Доброягоды";
						component.m_itemData.m_shared.m_description = "Вызывает ягаду которую вы можете съесть";
					}
					else if (((Object)component).name.Contains("heal"))
					{
						component.m_itemData.m_shared.m_name = "Руна Лечения";
						component.m_itemData.m_shared.m_description = "Применяет эффект \"Исцеление с течением времени\" ко всем союзникам в радиусе 10 ярдов от игрока. Качество руны увеличивает количество исцелений, а навык Природы увеличивает продолжительность.";
					}
					else if (((Object)component).name.Contains("immolate"))
					{
						component.m_itemData.m_shared.m_name = "Руна Выжигания";
						component.m_itemData.m_shared.m_description = "Вызывайте пылающую ауру, сжигающую врагов вокруг вас.";
					}
					else if (((Object)component).name.Contains("invigorate"))
					{
						component.m_itemData.m_shared.m_name = "Руна Бодрости";
						component.m_itemData.m_shared.m_description = "Мгновенно восстанавливает выносливость и со временем увеличивает ее.";
					}
					else if (((Object)component).name.Contains("light"))
					{
						component.m_itemData.m_shared.m_name = "Руна Света";
						component.m_itemData.m_shared.m_description = "Призывает шар света который будет следовать за тобой в течении 5 минут.";
					}
					else if (((Object)component).name.Contains("recall"))
					{
						component.m_itemData.m_shared.m_name = "Руна Возвращения";
						component.m_itemData.m_shared.m_description = "Призови валькирий вернуть тебя домой.";
					}
					else if (((Object)component).name.Contains("travel"))
					{
						component.m_itemData.m_shared.m_name = "Руна Путешествия";
						component.m_itemData.m_shared.m_description = "Увеличивает скорость передвижения и истощает ману при удержании.";
					}
					else if (((Object)component).name.Contains("warmth"))
					{
						component.m_itemData.m_shared.m_name = "Руна Тепла";
						component.m_itemData.m_shared.m_description = "Увеличивает восстановление здоровья и выносливости и делает вас устойчивым к холоду.";
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(Container))]
	internal class Container_Patches
	{
		[HarmonyPrefix]
		[HarmonyPatch("GetHoverText")]
		private static bool PrefixGetHoverText(Container __instance, ref string ___m_name)
		{
			if (___m_name.Contains("Runic") && ___m_name.Contains("Chest"))
			{
				Debug.Log((object)("HoverText: " + ___m_name));
				___m_name = "Рунический Сундук";
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PieceTable))]
	internal class PieceTable_Patches
	{
		[HarmonyPrefix]
		[HarmonyPatch("GetSelectedPiece")]
		public static bool PrefixAwake(PieceTable __instance)
		{
			if (!SkyheimRus.m_piece_changed)
			{
				foreach (GameObject piece in __instance.m_pieces)
				{
					Piece component = piece.GetComponent<Piece>();
					if ((Object)(object)component != (Object)null && ((Object)component).name.Contains("piece_rune_altar"))
					{
						Debug.Log((object)("Piece: " + ((Object)component).name));
						component.m_name = "Рунный Алтарь";
						SkyheimRus.m_piece_changed = true;
						break;
					}
				}
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(SkyheimAltarPanel))]
	internal class SkyheimAltarPanel_Patches
	{
		[HarmonyPostfix]
		[HarmonyPatch("UpdateGui")]
		private static void PostfixUpdateGui(SkyheimAltarPanel __instance, ref Text ____timeText)
		{
			string text = ____timeText.text;
			if (text.Contains("Close"))
			{
				____timeText.text = "Закройте сундук, чтобы начать";
			}
			else if (text.Contains("Needs"))
			{
				____timeText.text = "Нужно больше осколков Эйтра";
			}
			else if (text.Contains("Place"))
			{
				____timeText.text = "Положите подходящую броню для наполнения";
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetTimeRemaining")]
		private static void PostfixSetTimeRemaining(SkyheimAltarPanel __instance, ref Text ____timeText)
		{
			string text = ____timeText.text;
			int startIndex = text.IndexOf(':');
			string text2 = "Оставшееся время";
			string text3 = text.Substring(startIndex);
			____timeText.text = text2 + text3;
		}
	}
	[HarmonyPatch(typeof(SkyheimArmorRecipe))]
	internal class SkyheimArmorRecipe_Patches
	{
		[HarmonyPostfix]
		[HarmonyPatch("GetImbueTooltip")]
		private static void PostfixGetImbueTooltip(SkyheimArmorRecipe __instance, ref string __result)
		{
			string text = $"Нужно осколков Эйтра: <color=orange>{__instance.EitrShardsRequired}</color>\nМаксимум Эйтра: <color=orange>+{__instance.EitrModifier}</color>";
			if (__instance.EitrRegenModifier != 0f)
			{
				text += $"\nМодификатор регенерации Эйтра: <color=orange>+{__instance.EitrRegenModifier * 100f}%</color>";
			}
			if (__instance.ArmorModifier != 0f)
			{
				text += $"\nМодификатор брони: <color=orange>-{__instance.ArmorModifier * 100f}%</color>";
			}
			string timeString = StatusEffect.GetTimeString(__instance.CraftingTime, true, true);
			__result = text + "\nВремя создания: <color=orange>" + timeString + "</color>";
		}
	}
	[HarmonyPatch(typeof(SkyheimArmor))]
	internal class SkyheimArmor_Patches
	{
		[HarmonyPostfix]
		[HarmonyPatch("ItemDrop_GetTooltip_Postfix")]
		public static void PostfixItemDropGetTooltipPostfix(SkyheimArmor __instance, object[] __args)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			string text = (string)__args[1];
			ItemData val = (ItemData)__args[0];
			string text2 = CommonUtils.Get<string>((IDictionary)val.m_customData, "sh_mod_eitr", (string)null);
			if (text2 != null)
			{
				string text3 = "\n\nПропитано Эйтром\nМаксимум Эйтра: <color=orange>+" + text2 + "</color>";
				float num = CommonUtils.Get<float>((IDictionary)val.m_customData, "sh_mod_eitr_regen", 0f);
				if (num > 0f)
				{
					text3 += $"\nРегенерация Эйтра: <color=orange>+{(int)(num * 100f)}%</color>";
				}
				float num2 = CommonUtils.Get<float>((IDictionary)val.m_customData, "sh_mod_armor", 0f);
				if (num2 > 0f)
				{
					text3 += $"\nБроня: <color=orange>-{(int)(num2 * 100f)}%</color>";
				}
				text += text3;
				__args[1] = text;
			}
		}
	}
}