using System;
using System.Collections.Generic;
using System.Diagnostics;
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 HarmonyLib;
using InputAPI;
using Microsoft.CodeAnalysis;
using Push.Input;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("novinity.Push")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c91a712ec2bd42d03ee5ac032eb8ee36f55162d7")]
[assembly: AssemblyProduct("novinity.Push")]
[assembly: AssemblyTitle("novinity.Push")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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.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;
}
}
[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 Push
{
internal class ModConfig
{
public readonly ConfigEntry<float> pushForce;
public readonly ConfigEntry<bool> canPushMonsters;
public readonly ConfigEntry<bool> canPushPlayers;
public ModConfig(ConfigFile cfg)
{
cfg.SaveOnConfigSet = false;
pushForce = cfg.Bind<float>("General", "PushForce", 5f, "How hard you push things");
canPushMonsters = cfg.Bind<bool>("General", "CanPushMonsters", false, "Can you push monsters?");
canPushPlayers = cfg.Bind<bool>("General", "CanPushPlayers", true, "Can you push players?");
ClearOrphanedEntries(cfg);
cfg.Save();
cfg.SaveOnConfigSet = true;
}
private static void ClearOrphanedEntries(ConfigFile cfg)
{
PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries");
Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(cfg);
dictionary.Clear();
}
}
[ContentWarningPlugin("novinity.Push", "1.0.0", true)]
[BepInPlugin("novinity.Push", "novinity.Push", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
internal PushInput pushInput = new PushInput();
public static Plugin Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
internal static Harmony? Harmony { get; set; }
internal static ModConfig BoundConfig { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
BoundConfig = new ModConfig(((BaseUnityPlugin)this).Config);
((BaseCWInput)pushInput).Enable();
Patch();
Logger.LogInfo((object)"novinity.Push v1.0.0 has loaded!");
}
internal static void Patch()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
if (Harmony == null)
{
Harmony = new Harmony("novinity.Push");
}
Logger.LogDebug((object)"Patching...");
Harmony.PatchAll();
Logger.LogDebug((object)"Finished patching!");
}
internal static void Unpatch()
{
Logger.LogDebug((object)"Unpatching...");
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
Logger.LogDebug((object)"Finished unpatching!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "novinity.Push";
public const string PLUGIN_NAME = "novinity.Push";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace Push.Input
{
[ContentWarningSetting]
internal class PushInput : BaseCWInput, IExposedSetting
{
protected override KeyCode GetDefaultKey()
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return (KeyCode)101;
}
public string GetDisplayName()
{
return "Push";
}
public SettingCategory GetSettingCategory()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (SettingCategory)4;
}
protected override void OnHeld(Player player)
{
}
protected override void OnKeyDown(Player player)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: 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)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
Transform headPos = player.refs.headPos;
RaycastHit val = default(RaycastHit);
if (!Physics.Raycast(headPos.position + headPos.forward * 0.3f, headPos.forward, ref val, 7f))
{
return;
}
Player component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<Player>();
if ((Object)(object)component == (Object)null)
{
Transform parent = ((RaycastHit)(ref val)).transform.parent;
while ((Object)(object)parent != (Object)null && (Object)(object)((Component)parent).GetComponent<Player>() == (Object)null)
{
parent = parent.parent;
}
if ((Object)(object)parent == (Object)null)
{
return;
}
component = ((Component)parent).GetComponent<Player>();
Plugin.Logger.LogDebug((object)component);
if ((Object)(object)component == (Object)(object)player)
{
return;
}
Plugin.Logger.LogDebug((object)"not my player");
}
if (Plugin.BoundConfig.canPushMonsters.Value || !component.ai)
{
Plugin.Logger.LogDebug((object)"cAN PUSH MONSTER");
if (Plugin.BoundConfig.canPushPlayers.Value || component.ai)
{
Plugin.Logger.LogDebug((object)"CanPush");
Player obj = component;
Vector3 val2 = component.refs.headPos.position - player.refs.headPos.position;
obj.CallTakeDamageAndAddForceAndFall(0f, ((Vector3)(ref val2)).normalized * Plugin.BoundConfig.pushForce.Value, 3f);
}
}
}
protected override void OnKeyUp(Player player)
{
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}