using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 KarmaFix
{
[BepInPlugin("Chrigi.KarmaForBeingAnnoyingMod", "Karma For Being Annoying Mod", "1.1.1")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Log;
internal static ConfigEntry<bool> AnnoyingItemSetting;
internal static ConfigEntry<bool> RemoteSetting;
internal static ConfigEntry<float> ProbabilitySetting;
internal static ConfigEntry<float> ProbabilityRemoteSetting;
internal static ConfigEntry<float> ProbabilityAirhornSetting;
internal static ConfigEntry<float> ProbabilityClownhornSetting;
internal static ConfigEntry<float> ProbabilityCashRegisterSetting;
internal static ConfigEntry<float> ProbabilityHairDryerSetting;
internal static ConfigEntry<float> DelaySetting;
internal static ConfigEntry<float> KillRangeSetting;
internal static ConfigEntry<float> DamageRangeSetting;
private void Awake()
{
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
Log = ((BaseUnityPlugin)this).Logger;
AnnoyingItemSetting = ((BaseUnityPlugin)this).Config.Bind<bool>("KarmaForBeingAnnoying Settings", "ON OFF switch", true, "Enable/disable the mod");
RemoteSetting = ((BaseUnityPlugin)this).Config.Bind<bool>("KarmaForBeingAnnoying Settings", "UseOnRemote", true, "Whether the Remote triggers the mod");
ProbabilitySetting = ((BaseUnityPlugin)this).Config.Bind<float>("Probability Settings", "General Probability", 0.1f, "Default explosion chance (0.0-1.0)");
ProbabilityRemoteSetting = ((BaseUnityPlugin)this).Config.Bind<float>("Probability Settings", "Remote Probability", 0.1f, "Explosion chance for Remote");
ProbabilityAirhornSetting = ((BaseUnityPlugin)this).Config.Bind<float>("Probability Settings", "Airhorn Probability", 0.1f, "Explosion chance for Airhorn");
ProbabilityClownhornSetting = ((BaseUnityPlugin)this).Config.Bind<float>("Probability Settings", "Clownhorn Probability", 0.1f, "Explosion chance for Clownhorn");
ProbabilityCashRegisterSetting = ((BaseUnityPlugin)this).Config.Bind<float>("Probability Settings", "Cashregister Probability", 0.05f, "Explosion chance for Cash Register");
ProbabilityHairDryerSetting = ((BaseUnityPlugin)this).Config.Bind<float>("Probability Settings", "Hairdryer Probability", 0.05f, "Explosion chance for Hairdryer");
DelaySetting = ((BaseUnityPlugin)this).Config.Bind<float>("Delay Settings", "General Delay", 0.5f, "Seconds before the explosion fires");
KillRangeSetting = ((BaseUnityPlugin)this).Config.Bind<float>("Kill Range Settings", "General Kill Range", 10f, "Instant-kill radius");
DamageRangeSetting = ((BaseUnityPlugin)this).Config.Bind<float>("Damage Range Settings", "General Damage Range", 1f, "Damage (non-lethal) radius");
new Harmony("Chrigi.KarmaForBeingAnnoyingMod").PatchAll();
Log.LogInfo((object)"________________");
Log.LogInfo((object)"Karma is a bitch!");
}
}
[HarmonyPatch]
internal static class NoisemakerPropPatch
{
[CompilerGenerated]
private sealed class <DelayedExplosion>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public float delay;
public Vector3 position;
public bool effect;
public float killRange;
public float damageRange;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DelayedExplosion>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
Plugin.Log.LogInfo((object)"C'ya");
<>2__current = (object)new WaitForSeconds(delay);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
Landmine.SpawnExplosion(position, effect, killRange, damageRange, 50, 0f, (GameObject)null, false);
Plugin.Log.LogInfo((object)"Boom");
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[HarmonyPatch(typeof(NoisemakerProp), "ItemActivate")]
[HarmonyPostfix]
private static void NoiseMakerPropItemActivatePatch(ref PlayerControllerB ___playerHeldBy, ref NoisemakerProp __instance)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
Plugin.Log.LogInfo((object)("NoiseMakerPropItemActivatePacth ACTIVATED BRUHHHHH: " + ((Object)__instance).name));
NetworkBehaviour val = (NetworkBehaviour)___playerHeldBy;
if ((Plugin.AnnoyingItemSetting.Value && val.IsOwner && ___playerHeldBy.isPlayerControlled && (!val.IsServer || ___playerHeldBy.isHostPlayerObject)) || ___playerHeldBy.isTestingPlayer)
{
float value = Plugin.ProbabilitySetting.Value;
switch (((Object)__instance).name.Replace("(Clone)", "").ToLower())
{
case "airhorn":
value = Plugin.ProbabilityAirhornSetting.Value;
break;
case "clownhorn":
value = Plugin.ProbabilityClownhornSetting.Value;
break;
case "cashregisteritem":
value = Plugin.ProbabilityCashRegisterSetting.Value;
break;
case "hairdryer":
value = Plugin.ProbabilityHairDryerSetting.Value;
break;
}
if (Random.value < value)
{
((MonoBehaviour)__instance).StartCoroutine(DelayedExplosion(((Component)val).transform.position, effect: true, Plugin.KillRangeSetting.Value, Plugin.DamageRangeSetting.Value, Plugin.DelaySetting.Value));
Plugin.Log.LogInfo((object)"Karma");
}
}
}
[IteratorStateMachine(typeof(<DelayedExplosion>d__1))]
private static IEnumerator DelayedExplosion(Vector3 position, bool effect, float killRange, float damageRange, float delay)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DelayedExplosion>d__1(0)
{
position = position,
effect = effect,
killRange = killRange,
damageRange = damageRange,
delay = delay
};
}
}
[HarmonyPatch]
internal static class RemotePropPatch
{
[CompilerGenerated]
private sealed class <DelayedExplosion>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public float delay;
public Vector3 position;
public bool effect;
public float killRange;
public float damageRange;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DelayedExplosion>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
Plugin.Log.LogInfo((object)"C'ya");
<>2__current = (object)new WaitForSeconds(delay);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
Landmine.SpawnExplosion(position, effect, killRange, damageRange, 50, 0f, (GameObject)null, false);
Plugin.Log.LogInfo((object)"Boom");
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[HarmonyPatch(typeof(RemoteProp), "ItemActivate")]
[HarmonyPostfix]
private static void RemotePropItemActivatePatch(ref PlayerControllerB ___playerHeldBy, ref RemoteProp __instance)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
if (Plugin.RemoteSetting.Value)
{
NetworkBehaviour val = (NetworkBehaviour)___playerHeldBy;
if (((val.IsOwner && ___playerHeldBy.isPlayerControlled && (!val.IsServer || ___playerHeldBy.isHostPlayerObject)) || ___playerHeldBy.isTestingPlayer) && Random.value < Plugin.ProbabilityRemoteSetting.Value)
{
((MonoBehaviour)__instance).StartCoroutine(DelayedExplosion(((Component)val).transform.position, effect: true, Plugin.KillRangeSetting.Value, Plugin.DamageRangeSetting.Value, Plugin.DelaySetting.Value));
Plugin.Log.LogInfo((object)"Karma");
}
}
}
[IteratorStateMachine(typeof(<DelayedExplosion>d__1))]
private static IEnumerator DelayedExplosion(Vector3 position, bool effect, float killRange, float damageRange, float delay)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DelayedExplosion>d__1(0)
{
position = position,
effect = effect,
killRange = killRange,
damageRange = damageRange,
delay = delay
};
}
}
}