Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ReBallista v1.0.413
ReBallista.dll
Decompiled 2 days agousing System; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ReBallista")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+386aee85c96197fd0a4a3031799c457837f3648d")] [assembly: AssemblyProduct("ReBallista")] [assembly: AssemblyTitle("ReBallista")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SmartBallista { [BepInPlugin("com.skarif.reballista", "Better Ballista AI", "1.0.0")] public class SmartBallistaPlugin : BaseUnityPlugin { private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony val = new Harmony("com.skarif.reballista"); val.PatchAll(); } public static Vector3 CalculateTargetPoint(Character target) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) Vector3 centerPoint = target.GetCenterPoint(); float y = ((Component)target).transform.position.y; float num = centerPoint.y - y; if (num < 0.55f) { centerPoint.y = y + num * 0.65f; } return centerPoint; } } [HarmonyPatch(typeof(Turret), "Awake")] public static class Turret_Awake_Patch { public static void Postfix(Turret __instance) { __instance.m_turnRate = 45f; __instance.m_lookAcceleration = 8f; __instance.m_lookDeacceleration = 8f; __instance.m_lookMinDegreesDelta = 0.01f; __instance.m_shootWhenAimDiff = 0.999f; __instance.m_targetPlayers = false; __instance.m_targetTamed = false; } } [HarmonyPatch(typeof(Turret), "UpdateTurretRotation")] public static class Turret_UpdateTurretRotation_Patch { public static bool Prefix(Turret __instance) { //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) if (__instance.IsCoolingDown()) { return false; } float fixedDeltaTime = Time.fixedDeltaTime; Character value = Traverse.Create((object)__instance).Field("m_target").GetValue<Character>(); bool flag = (Object)(object)value != (Object)null && !value.IsDead() && __instance.HasAmmo(); Vector3 val3; Quaternion rotation; if (flag) { ItemData value2 = Traverse.Create((object)__instance).Field("m_lastAmmo").GetValue<ItemData>(); if (value2 == null) { value2 = Traverse.Create((object)__instance).Method("GetAmmoItem", Array.Empty<object>()).GetValue<ItemData>(); Traverse.Create((object)__instance).Field("m_lastAmmo").SetValue((object)value2); } if (value2 == null) { return true; } float num = value2.m_shared.m_attack.m_projectileVel; if (num <= 0.1f) { num = 50f; } Vector3 val = SmartBallistaPlugin.CalculateTargetPoint(value); Vector3 position = __instance.m_turretBody.transform.position; float num2 = Vector3.Distance(val, position); float num3 = Mathf.Clamp(num2 / num, 0f, 0.35f); Vector3 val2 = value.GetVelocity() * num3 * __instance.m_predictionModifier; val3 = val + val2 - position; } else if (!__instance.HasAmmo()) { val3 = ((Component)__instance).transform.forward + new Vector3(0f, -0.3f, 0f); } else { float value3 = Traverse.Create((object)__instance).Field("m_scan").GetValue<float>(); value3 += fixedDeltaTime; if (value3 > __instance.m_noTargetScanRate * 2f) { value3 = 0f; } Traverse.Create((object)__instance).Field("m_scan").SetValue((object)value3); rotation = ((Component)__instance).transform.rotation; val3 = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y + ((value3 - __instance.m_noTargetScanRate > 0f) ? 1f : (-1f)) * __instance.m_horizontalAngle, 0f) * Vector3.forward; } ((Vector3)(ref val3)).Normalize(); Quaternion val4 = Quaternion.LookRotation(val3, Vector3.up); Vector3 eulerAngles = ((Quaternion)(ref val4)).eulerAngles; rotation = ((Component)__instance).transform.rotation; float y = ((Quaternion)(ref rotation)).eulerAngles.y; eulerAngles.y -= y; if (__instance.m_horizontalAngle >= 0f) { float num4 = eulerAngles.y; if (num4 > 180f) { num4 -= 360f; } else if (num4 < -180f) { num4 += 360f; } if (num4 > __instance.m_horizontalAngle) { ((Vector3)(ref eulerAngles))..ctor(eulerAngles.x, __instance.m_horizontalAngle + y, eulerAngles.z); ((Quaternion)(ref val4)).eulerAngles = eulerAngles; } else if (num4 < 0f - __instance.m_horizontalAngle) { ((Vector3)(ref eulerAngles))..ctor(eulerAngles.x, 0f - __instance.m_horizontalAngle + y, eulerAngles.z); ((Quaternion)(ref val4)).eulerAngles = eulerAngles; } } Quaternion value4 = Traverse.Create((object)__instance).Field("m_lastRotation").GetValue<Quaternion>(); Quaternion val5 = Utils.RotateTorwardsSmooth(__instance.m_turretBody.transform.rotation, val4, value4, __instance.m_turnRate * fixedDeltaTime, __instance.m_lookAcceleration, __instance.m_lookDeacceleration, __instance.m_lookMinDegreesDelta); Traverse.Create((object)__instance).Field("m_lastRotation").SetValue((object)__instance.m_turretBody.transform.rotation); Quaternion value5 = Traverse.Create((object)__instance).Field("m_baseBodyRotation").GetValue<Quaternion>(); Quaternion value6 = Traverse.Create((object)__instance).Field("m_baseNeckRotation").GetValue<Quaternion>(); __instance.m_turretBody.transform.rotation = value5 * val5; Transform transform = __instance.m_turretNeck.transform; rotation = __instance.m_turretBody.transform.rotation; float y2 = ((Quaternion)(ref rotation)).eulerAngles.y; rotation = __instance.m_turretBody.transform.rotation; transform.rotation = value6 * Quaternion.Euler(0f, y2, ((Quaternion)(ref rotation)).eulerAngles.z); float num5 = (flag ? Quaternion.Dot(val5, val4) : (-1f)); Traverse.Create((object)__instance).Field("m_aimDiffToTarget").SetValue((object)num5); return false; } } [HarmonyPatch(typeof(Turret), "ShootProjectile")] public static class Turret_ShootProjectile_Patch { private static float s_origAccuracy; public static void Prefix(Turret __instance) { ItemData value = Traverse.Create((object)__instance).Field("m_lastAmmo").GetValue<ItemData>(); if (value == null) { value = Traverse.Create((object)__instance).Method("GetAmmoItem", Array.Empty<object>()).GetValue<ItemData>(); } if (value != null) { s_origAccuracy = value.m_shared.m_attack.m_projectileAccuracy; value.m_shared.m_attack.m_projectileAccuracy = 0f; } } public static void Postfix(Turret __instance) { ItemData value = Traverse.Create((object)__instance).Field("m_lastAmmo").GetValue<ItemData>(); if (value != null) { value.m_shared.m_attack.m_projectileAccuracy = s_origAccuracy; } GameObject value2 = Traverse.Create((object)__instance).Field("m_lastProjectile").GetValue<GameObject>(); Character value3 = Traverse.Create((object)__instance).Field("m_target").GetValue<Character>(); if ((Object)(object)value2 != (Object)null && (Object)(object)value3 != (Object)null) { SmartBoltTracker smartBoltTracker = value2.AddComponent<SmartBoltTracker>(); smartBoltTracker.Init(value3); } } } public class SmartBoltTracker : MonoBehaviour { private static readonly FieldInfo VelField = typeof(Projectile).GetField("m_vel", BindingFlags.Instance | BindingFlags.NonPublic); private Character m_target; private Projectile m_projectile; private const float TurnSpeedDeg = 65f; public void Init(Character target) { m_target = target; m_projectile = ((Component)this).GetComponent<Projectile>(); } private void FixedUpdate() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_target == (Object)null || m_target.IsDead() || (Object)(object)m_projectile == (Object)null || VelField == null) { return; } Vector3 val = (Vector3)VelField.GetValue(m_projectile); float magnitude = ((Vector3)(ref val)).magnitude; if (!(magnitude < 1f)) { Vector3 val2 = SmartBallistaPlugin.CalculateTargetPoint(m_target); Vector3 val3 = val2 - ((Component)this).transform.position; float magnitude2 = ((Vector3)(ref val3)).magnitude; if (magnitude2 > 0.4f && magnitude2 < 25f) { Vector3 normalized = ((Vector3)(ref val3)).normalized; Vector3 val4 = Vector3.RotateTowards(val, normalized * magnitude, MathF.PI * 13f / 36f * Time.fixedDeltaTime, 0f); VelField.SetValue(m_projectile, val4); ((Component)this).transform.rotation = Quaternion.LookRotation(val4); } } } } [HarmonyPatch] public static class BallistaWelcomeMessage { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__8_1; public static UnityAction <>9__8_2; internal void <ShowWelcomePanel>b__8_1() { Application.OpenURL("https://discord.com/users/1084209564653727804"); } internal void <ShowWelcomePanel>b__8_2() { Application.OpenURL("https://steamcommunity.com/id/Skarif_W/"); } } private static bool _shown; private const string PREFS_KEY = "SmartBallista_HideWelcome"; private static Sprite _discordSprite; private static Sprite _steamSprite; private static void LoadExternalLogos() { if ((Object)(object)_discordSprite == (Object)null) { _discordSprite = LoadEmbeddedIcon("discord-logo.ico") ?? LoadEmbeddedIcon("discord-logo.png"); } if ((Object)(object)_steamSprite == (Object)null) { _steamSprite = LoadEmbeddedIcon("steam-logo.ico") ?? LoadEmbeddedIcon("steam-logo.png"); } } private static Sprite LoadEmbeddedIcon(string fileName) { //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = executingAssembly.GetManifestResourceNames().FirstOrDefault((string r) => r.EndsWith(fileName, StringComparison.OrdinalIgnoreCase)); byte[] array = null; if (!string.IsNullOrEmpty(text)) { using Stream stream = executingAssembly.GetManifestResourceStream(text); if (stream != null) { array = new byte[stream.Length]; stream.Read(array, 0, array.Length); } } if (array == null) { string directoryName = Path.GetDirectoryName(executingAssembly.Location); string[] array2 = new string[4] { Path.Combine(directoryName, "logos", fileName), Path.Combine(directoryName, fileName), Path.Combine(Paths.PluginPath, "logos", fileName), Path.Combine(Paths.PluginPath, fileName) }; for (int num = 0; num < array2.Length; num++) { if (File.Exists(array2[num])) { array = File.ReadAllBytes(array2[num]); break; } } } if (array != null && array.Length != 0) { byte[] data = ExtractIconImagePayload(array); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); ((Texture)val).filterMode = (FilterMode)1; if (TryLoadTexture(val, data)) { return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } } } catch { } return null; } private static bool TryLoadTexture(Texture2D tex, byte[] data) { if ((Object)(object)tex == (Object)null || data == null || data.Length == 0) { return false; } try { Type type = Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule") ?? Type.GetType("UnityEngine.ImageConversion, UnityEngine"); if (type != null) { MethodInfo method = type.GetMethod("LoadImage", BindingFlags.Static | BindingFlags.Public, null, new Type[2] { typeof(Texture2D), typeof(byte[]) }, null); if (method != null) { return (bool)method.Invoke(null, new object[2] { tex, data }); } } MethodInfo method2 = typeof(Texture2D).GetMethod("LoadImage", BindingFlags.Instance | BindingFlags.Public, null, new Type[1] { typeof(byte[]) }, null); if (method2 != null) { return (bool)method2.Invoke(tex, new object[1] { data }); } } catch { } return false; } private static byte[] ExtractIconImagePayload(byte[] icoBytes) { if (icoBytes == null || icoBytes.Length < 22) { return icoBytes; } if (icoBytes[0] == 137 && icoBytes[1] == 80 && icoBytes[2] == 78 && icoBytes[3] == 71) { return icoBytes; } try { int num = BitConverter.ToUInt16(icoBytes, 4); if (num == 0) { return icoBytes; } int num2 = 0; int num3 = -1; for (int i = 0; i < num; i++) { int num4 = 6 + i * 16; int num5 = icoBytes[num4]; int num6 = icoBytes[num4 + 1]; if (num5 == 0) { num5 = 256; } if (num6 == 0) { num6 = 256; } int num7 = num5 * num6; if (num7 > num3) { num3 = num7; num2 = i; } } int num8 = 6 + num2 * 16; int num9 = BitConverter.ToInt32(icoBytes, num8 + 8); int num10 = BitConverter.ToInt32(icoBytes, num8 + 12); if (num10 + num9 <= icoBytes.Length) { byte[] array = new byte[num9]; Buffer.BlockCopy(icoBytes, num10, array, 0, num9); if (array.Length > 8 && array[0] == 137 && array[1] == 80 && array[2] == 78 && array[3] == 71) { return array; } if (array.Length > 40 && BitConverter.ToInt32(array, 0) == 40) { byte[] array2 = new byte[14 + array.Length]; array2[0] = 66; array2[1] = 77; Buffer.BlockCopy(BitConverter.GetBytes(array2.Length), 0, array2, 2, 4); Buffer.BlockCopy(BitConverter.GetBytes(54), 0, array2, 10, 4); Buffer.BlockCopy(array, 0, array2, 14, array.Length); return array2; } return array; } } catch { } return icoBytes; } [HarmonyPatch(typeof(FejdStartup), "Start")] [HarmonyPostfix] public static void ShowWelcomePanel() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Expected O, but got Unknown //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Expected O, but got Unknown //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Expected O, but got Unknown //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Expected O, but got Unknown //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05e9: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_0610: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Expected O, but got Unknown //IL_06a4: Unknown result type (might be due to invalid IL or missing references) //IL_06ea: Unknown result type (might be due to invalid IL or missing references) //IL_06f4: Expected O, but got Unknown //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_0718: Unknown result type (might be due to invalid IL or missing references) //IL_0727: Unknown result type (might be due to invalid IL or missing references) //IL_072c: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Unknown result type (might be due to invalid IL or missing references) //IL_075c: Unknown result type (might be due to invalid IL or missing references) //IL_0774: Unknown result type (might be due to invalid IL or missing references) //IL_0783: Unknown result type (might be due to invalid IL or missing references) //IL_0792: Unknown result type (might be due to invalid IL or missing references) //IL_07a1: Unknown result type (might be due to invalid IL or missing references) //IL_07c2: Unknown result type (might be due to invalid IL or missing references) //IL_0822: Unknown result type (might be due to invalid IL or missing references) //IL_083a: Unknown result type (might be due to invalid IL or missing references) //IL_0849: Unknown result type (might be due to invalid IL or missing references) //IL_0858: Unknown result type (might be due to invalid IL or missing references) //IL_085d: Unknown result type (might be due to invalid IL or missing references) //IL_087e: Unknown result type (might be due to invalid IL or missing references) //IL_07f1: Unknown result type (might be due to invalid IL or missing references) //IL_07f6: Unknown result type (might be due to invalid IL or missing references) //IL_07fc: Expected O, but got Unknown //IL_08de: Unknown result type (might be due to invalid IL or missing references) //IL_08f6: Unknown result type (might be due to invalid IL or missing references) //IL_0905: Unknown result type (might be due to invalid IL or missing references) //IL_0914: Unknown result type (might be due to invalid IL or missing references) //IL_0923: Unknown result type (might be due to invalid IL or missing references) //IL_08ad: Unknown result type (might be due to invalid IL or missing references) //IL_08b2: Unknown result type (might be due to invalid IL or missing references) //IL_08b8: Expected O, but got Unknown //IL_0950: Unknown result type (might be due to invalid IL or missing references) //IL_0973: Unknown result type (might be due to invalid IL or missing references) //IL_097d: Expected O, but got Unknown if (_shown || PlayerPrefs.GetInt("SmartBallista_HideWelcome", 0) == 1) { return; } _shown = true; LoadExternalLogos(); GameObject canvasGO = new GameObject("WelcomeCanvas_SmartBallista"); canvasGO.layer = 5; Canvas val = canvasGO.AddComponent<Canvas>(); val.renderMode = (RenderMode)0; val.sortingOrder = 9999; canvasGO.AddComponent<CanvasScaler>(); canvasGO.AddComponent<GraphicRaycaster>(); Object.DontDestroyOnLoad((Object)(object)canvasGO); GameObject val2 = MakeRect("Background", canvasGO.transform, new Color(0.06f, 0.06f, 0.07f, 0.98f)); SetRect(val2, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(640f, 420f), Vector2.zero); Outline val3 = val2.AddComponent<Outline>(); ((Shadow)val3).effectColor = new Color(0.25f, 0.25f, 0.25f, 1f); ((Shadow)val3).effectDistance = new Vector2(2f, -2f); string text = "ReBallista"; Text val4 = MakeText("Header", val2.transform, text, 24, new Color(1f, 0.72f, 0.15f), (FontStyle)1); SetRect(((Component)val4).gameObject, new Vector2(0f, 0.85f), new Vector2(1f, 1f), Vector2.zero, new Vector2(0f, -10f)); GameObject val5 = MakeRect("ContentBox", val2.transform, new Color(0f, 0f, 0f, 0.45f)); SetRect(val5, new Vector2(0.05f, 0.28f), new Vector2(0.95f, 0.83f), Vector2.zero, Vector2.zero); Outline val6 = val5.AddComponent<Outline>(); ((Shadow)val6).effectColor = new Color(1f, 1f, 1f, 0.05f); ((Shadow)val6).effectDistance = new Vector2(1f, -1f); bool flag = PlayerPrefs.GetString("language", "English").Equals("Russian", StringComparison.OrdinalIgnoreCase); string text2 = (flag ? "Переделанный <color=#55AAFF>ИИ</color> баллисты: <color=#FF4444>сверхточные</color> выстрелы и полезный <color=#55FF88>друг</color>." : "Redesigned Ballista <color=#55AAFF>AI</color>: <color=#FF4444>Super-accurate</color> shots and a helpful <color=#55FF88>friend</color>."); GameObject val7 = new GameObject("BodyText"); val7.layer = 5; val7.transform.SetParent(val5.transform, false); Text val8 = val7.AddComponent<Text>(); val8.text = text2; val8.font = GetValheimFont(); val8.fontSize = 18; ((Graphic)val8).color = new Color(0.92f, 0.92f, 0.92f, 1f); val8.lineSpacing = 1.35f; val8.supportRichText = true; val8.alignment = (TextAnchor)4; val8.horizontalOverflow = (HorizontalWrapMode)0; val8.verticalOverflow = (VerticalWrapMode)1; RectTransform component = val7.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = new Vector2(-40f, -40f); component.anchoredPosition = Vector2.zero; bool dontShow = false; GameObject val9 = new GameObject("CheckRow"); val9.layer = 5; val9.transform.SetParent(val2.transform, false); RectTransform val10 = val9.AddComponent<RectTransform>(); val10.anchorMin = new Vector2(0.5f, 0.2f); val10.anchorMax = new Vector2(0.5f, 0.2f); val10.pivot = new Vector2(0.5f, 0.5f); val10.anchoredPosition = Vector2.zero; HorizontalLayoutGroup val11 = val9.AddComponent<HorizontalLayoutGroup>(); ((LayoutGroup)val11).childAlignment = (TextAnchor)4; ((HorizontalOrVerticalLayoutGroup)val11).childControlWidth = false; ((HorizontalOrVerticalLayoutGroup)val11).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)val11).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)val11).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val11).spacing = 10f; ContentSizeFitter val12 = val9.AddComponent<ContentSizeFitter>(); val12.horizontalFit = (FitMode)2; val12.verticalFit = (FitMode)2; GameObject val13 = new GameObject("Box"); val13.layer = 5; val13.transform.SetParent(val9.transform, false); Image boxImg = val13.AddComponent<Image>(); ((Graphic)boxImg).color = new Color(0.18f, 0.18f, 0.2f, 1f); RectTransform component2 = val13.GetComponent<RectTransform>(); component2.sizeDelta = new Vector2(20f, 20f); LayoutElement val14 = val13.AddComponent<LayoutElement>(); val14.minWidth = 20f; val14.preferredWidth = 20f; val14.minHeight = 20f; val14.preferredHeight = 20f; val14.flexibleWidth = 0f; Outline val15 = val13.AddComponent<Outline>(); ((Shadow)val15).effectColor = new Color(0.45f, 0.45f, 0.45f, 0.8f); ((Shadow)val15).effectDistance = new Vector2(1f, -1f); GameObject tickGO = new GameObject("Tick"); tickGO.layer = 5; tickGO.transform.SetParent(val13.transform, false); Text val16 = tickGO.AddComponent<Text>(); val16.text = "✓"; val16.font = GetValheimFont(); val16.fontSize = 15; ((Graphic)val16).color = Color.white; val16.fontStyle = (FontStyle)1; val16.alignment = (TextAnchor)4; RectTransform component3 = tickGO.GetComponent<RectTransform>(); component3.anchorMin = Vector2.zero; component3.anchorMax = Vector2.one; component3.sizeDelta = Vector2.zero; component3.anchoredPosition = Vector2.zero; tickGO.SetActive(false); string text3 = (flag ? "Больше не показывать" : "Don't show this again"); GameObject val17 = new GameObject("Label"); val17.layer = 5; val17.transform.SetParent(val9.transform, false); Text val18 = val17.AddComponent<Text>(); val18.text = text3; val18.font = GetValheimFont(); val18.fontSize = 15; ((Graphic)val18).color = new Color(0.85f, 0.85f, 0.85f, 1f); val18.alignment = (TextAnchor)3; ContentSizeFitter val19 = val17.AddComponent<ContentSizeFitter>(); val19.horizontalFit = (FitMode)2; val19.verticalFit = (FitMode)2; Button val20 = val9.AddComponent<Button>(); ((UnityEvent)val20.onClick).AddListener((UnityAction)delegate { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) dontShow = !dontShow; tickGO.SetActive(dontShow); ((Graphic)boxImg).color = (dontShow ? new Color(0.18f, 0.55f, 0.95f, 1f) : new Color(0.18f, 0.18f, 0.2f, 1f)); }); GameObject val21 = MakeRect("BottomBar", val2.transform, Color.clear); SetRect(val21, new Vector2(0.05f, 0.05f), new Vector2(0.95f, 0.15f), Vector2.zero, Vector2.zero); GameObject val22 = MakeRect("DiscordBtn", val21.transform, new Color(0.345f, 0.396f, 0.949f, 1f)); SetRect(val22, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(180f, 44f), new Vector2(90f, 0f)); CreateSocialButtonContent(val22.transform, _discordSprite, new Vector2(29f, 29f)); Button val23 = val22.AddComponent<Button>(); ButtonClickedEvent onClick = val23.onClick; object obj = <>c.<>9__8_1; if (obj == null) { UnityAction val24 = delegate { Application.OpenURL("https://discord.com/users/1084209564653727804"); }; <>c.<>9__8_1 = val24; obj = (object)val24; } ((UnityEvent)onClick).AddListener((UnityAction)obj); GameObject val25 = MakeRect("SteamBtn", val21.transform, new Color(0.12f, 0.22f, 0.36f, 1f)); SetRect(val25, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(180f, 44f), Vector2.zero); CreateSocialButtonContent(val25.transform, _steamSprite, new Vector2(24f, 24f)); Button val26 = val25.AddComponent<Button>(); ButtonClickedEvent onClick2 = val26.onClick; object obj2 = <>c.<>9__8_2; if (obj2 == null) { UnityAction val27 = delegate { Application.OpenURL("https://steamcommunity.com/id/Skarif_W/"); }; <>c.<>9__8_2 = val27; obj2 = (object)val27; } ((UnityEvent)onClick2).AddListener((UnityAction)obj2); GameObject val28 = MakeRect("CloseBtn", val21.transform, new Color(0.75f, 0.2f, 0.2f, 1f)); SetRect(val28, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(180f, 44f), new Vector2(-90f, 0f)); string text4 = (flag ? "ЗАКРЫТЬ" : "CLOSE"); MakeText("CloseTxt", val28.transform, text4, 15, Color.white, (FontStyle)1); Button val29 = val28.AddComponent<Button>(); ((UnityEvent)val29.onClick).AddListener((UnityAction)delegate { if (dontShow) { PlayerPrefs.SetInt("SmartBallista_HideWelcome", 1); PlayerPrefs.Save(); } Object.Destroy((Object)(object)canvasGO); }); } private static void CreateSocialButtonContent(Transform parent, Sprite iconSprite, Vector2 iconSize) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)iconSprite == (Object)null)) { GameObject val = MakeRect("Content", parent, Color.clear); SetRect(val, Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero); GameObject val2 = MakeRect("Icon", val.transform, Color.white); Image component = val2.GetComponent<Image>(); component.sprite = iconSprite; component.preserveAspect = true; SetRect(val2, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), iconSize, Vector2.zero); } } public static GameObject MakeRect(string name, Transform parent, Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.layer = 5; val.transform.SetParent(parent, false); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = color; return val; } public static Text MakeText(string name, Transform parent, string text, int size, Color color, FontStyle style = (FontStyle)0) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.layer = 5; val.transform.SetParent(parent, false); Text val2 = val.AddComponent<Text>(); val2.text = text; val2.font = GetValheimFont(); val2.fontSize = size; ((Graphic)val2).color = color; val2.fontStyle = style; val2.alignment = (TextAnchor)4; RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; component.anchoredPosition = Vector2.zero; return val2; } public static void SetRect(GameObject go, Vector2 anchorMin, Vector2 anchorMax, Vector2 sizeDelta, Vector2 anchoredPos) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) RectTransform component = go.GetComponent<RectTransform>(); component.anchorMin = anchorMin; component.anchorMax = anchorMax; component.sizeDelta = sizeDelta; component.anchoredPosition = anchoredPos; } public static Font GetValheimFont() { Font[] array = Object.FindObjectsByType<Font>((FindObjectsSortMode)0); Font[] array2 = array; foreach (Font val in array2) { if ((Object)(object)val != (Object)null && ((Object)val).name.Contains("Averia")) { return val; } } return Resources.GetBuiltinResource<Font>("Arial.ttf"); } } }