using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EZDamage;
using EZLightning;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SithCompany.Patches;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SithCompany")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ea47e63a4453a20ff915148d8b4382a7fda5d23b")]
[assembly: AssemblyProduct("SithCompany")]
[assembly: AssemblyTitle("SithCompany")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace SithCompany
{
[BepInPlugin("com.jacobot5.SithCompany", "SithCompany", "1.0.1")]
public class SithCompanyMod : BaseUnityPlugin
{
public const string modGUID = "com.jacobot5.SithCompany";
public const string modName = "SithCompany";
public const string modVersion = "1.0.1";
private readonly Harmony harmony = new Harmony("com.jacobot5.SithCompany");
public static ConfigEntry<float> configLightningVolume;
public static ConfigEntry<float> configLightningDamageRadius;
public static ConfigEntry<float> configLightningLength;
public static SithCompanyMod Instance;
public static ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("com.jacobot5.SithCompany");
mls.LogInfo((object)"SithCompany has awoken.");
configLightningVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Lightning.Thunder", "Volume", 1f, "How loud thunder should be. Default is 1; ranges from 0-1");
configLightningDamageRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Lightning.Damage", "Radius", 3f, "How close players/enemies must be to a lighting bolt to be killed by it");
configLightningLength = ((BaseUnityPlugin)this).Config.Bind<float>("Lightning.Length", "Length", 10f, "How long lightning bolt should be");
harmony.PatchAll(typeof(SithCompanyMod));
harmony.PatchAll(typeof(PlayerControllerBPatch));
harmony.PatchAll(typeof(KickIfModNotInstalled));
}
}
}
namespace SithCompany.Patches
{
[HarmonyPatch(typeof(NetworkManager))]
internal static class KickIfModNotInstalled
{
private static readonly string MOD_GUID = "com.jacobot5.SithCompany";
[HarmonyPostfix]
[HarmonyPatch("SetSingleton")]
private static void RegisterPrefab()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(MOD_GUID + " Prefab");
((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x3D);
Object.DontDestroyOnLoad((Object)(object)val);
NetworkObject obj = val.AddComponent<NetworkObject>();
typeof(NetworkObject).GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(obj, GetHash(MOD_GUID));
NetworkManager.Singleton.PrefabHandler.AddNetworkPrefab(val);
static uint GetHash(string value)
{
return value?.Aggregate(17u, (uint current, char c) => (current * 31) ^ c) ?? 0;
}
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerBPatch
{
[HarmonyPatch("PerformEmote")]
[HarmonyPostfix]
private static void LightningStrikePatch(PlayerControllerB __instance, int emoteID)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: 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_0029: Expected O, but got Unknown
//IL_0070: 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_0085: 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)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
if (emoteID == 2 && !(__instance.sprintMeter < 0.6f))
{
GameObject val = new GameObject("SithCompany_ThunderAudioSource");
val.SetActive(true);
Object.DontDestroyOnLoad((Object)val);
AudioSource obj = val.AddComponent<AudioSource>();
obj.spatialBlend = 0f;
obj.minDistance = 5f;
obj.maxDistance = 200f;
obj.rolloffMode = (AudioRolloffMode)0;
obj.playOnAwake = false;
obj.loop = false;
((Behaviour)obj).enabled = true;
Vector3 val2 = ((Component)__instance).transform.position + ((Component)__instance).transform.forward * 1f + Vector3.up * 2f;
Vector3 val3 = ((Component)__instance.gameplayCamera).transform.position + ((Component)__instance.gameplayCamera).transform.forward * SithCompanyMod.configLightningLength.Value;
API.KillEverything(val3, SithCompanyMod.configLightningDamageRadius.Value, (CauseOfDeath)11);
API.Strike(val3, val2, 1f, 0.5f, 0.5f, 0, -1f, 0.6f, 1.2f, 0, 1);
__instance.sprintMeter = Mathf.Clamp(__instance.sprintMeter - 0.6f, 0f, 1f);
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}