using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Agents;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using ChainedPuzzles;
using GameData;
using Gear;
using HarmonyLib;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("RaidCore")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RaidCore")]
[assembly: AssemblyTitle("RaidCore")]
[assembly: AssemblyVersion("1.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.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 RaidCore
{
internal static class Logger
{
private static readonly ManualLogSource _Logger;
static Logger()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
_Logger = new ManualLogSource("cactus.RaidCore");
Logger.Sources.Add((ILogSource)(object)_Logger);
}
private static string Format(object msg)
{
return msg.ToString();
}
public static void Info(BepInExInfoLogInterpolatedStringHandler handler)
{
_Logger.LogInfo(handler);
}
public static void Info(string str)
{
_Logger.LogMessage((object)str);
}
public static void Info(object data)
{
_Logger.LogMessage((object)Format(data));
}
public static void Debug(BepInExDebugLogInterpolatedStringHandler handler)
{
_Logger.LogDebug(handler);
}
public static void Debug(string str)
{
_Logger.LogDebug((object)str);
}
public static void Debug(object data)
{
_Logger.LogDebug((object)Format(data));
}
public static void Error(BepInExErrorLogInterpolatedStringHandler handler)
{
_Logger.LogError(handler);
}
public static void Error(string str)
{
_Logger.LogError((object)str);
}
public static void Error(object data)
{
_Logger.LogError((object)Format(data));
}
public static void Fatal(BepInExFatalLogInterpolatedStringHandler handler)
{
_Logger.LogFatal(handler);
}
public static void Fatal(string str)
{
_Logger.LogFatal((object)str);
}
public static void Fatal(object data)
{
_Logger.LogFatal((object)Format(data));
}
public static void Warn(BepInExWarningLogInterpolatedStringHandler handler)
{
_Logger.LogWarning(handler);
}
public static void Warn(string str)
{
_Logger.LogWarning((object)str);
}
public static void Warn(object data)
{
_Logger.LogWarning((object)Format(data));
}
[Conditional("DEBUG")]
public static void DebugOnly(object data)
{
_Logger.LogDebug((object)Format(data));
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "RaidCore";
public const string PLUGIN_NAME = "RaidCore";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace RaidCore.Patches
{
[HarmonyPatch]
internal class RaidCore_Patches
{
private static bool ThirdWeaponEquipped;
private static bool weaponAimed;
[HarmonyPatch(typeof(BulletWeaponArchetype), "OnWield")]
[HarmonyPostfix]
internal static void ThirdWeaponSlotWield(BulletWeaponArchetype __instance)
{
if (((GameDataBlockBase<ArchetypeDataBlock>)(object)__instance.m_archetypeData).persistentID == 202 && ((Agent)__instance.m_owner).IsLocallyOwned)
{
ThirdWeaponEquipped = true;
}
}
[HarmonyPatch(typeof(BulletWeaponArchetype), "OnUnWield")]
[HarmonyPostfix]
internal static void ThirdWeaponSlotUnwield(BulletWeaponArchetype __instance)
{
if (((GameDataBlockBase<ArchetypeDataBlock>)(object)__instance.m_archetypeData).persistentID == 202 && ((Agent)__instance.m_owner).IsLocallyOwned)
{
ThirdWeaponEquipped = false;
}
}
[HarmonyPatch(typeof(PlayerStamina))]
[HarmonyPatch("get_MoveSpeedModifier")]
[HarmonyPostfix]
private static void Postfix(ref float __result, PlayerStamina __instance)
{
if (ThirdWeaponEquipped && ((Agent)__instance.m_owner).IsLocallyOwned)
{
__result = 0f;
}
}
[HarmonyPatch(typeof(PLOC_Base), "UpdateHorizontalVelocityOnGround")]
[HarmonyPostfix]
internal static void Movement__Postfix(PLOC_Base __instance)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
if (weaponAimed && ((Agent)__instance.m_owner).IsLocallyOwned)
{
__instance.m_owner.Locomotion.HorizontalVelocity = __instance.GetHorizontalVelocityFromInput(0f);
}
}
[HarmonyPatch(typeof(PLOC_Downed), "CommonEnter")]
[HarmonyPostfix]
internal static void PlayerDownCheck__Postfix(PLOC_Downed __instance)
{
//IL_003b: 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)
if (SNet.IsMaster)
{
ushort num = default(ushort);
Mastermind.Current.TriggerSurvivalWave(((PLOC_Base)__instance).m_owner.m_courseNode, 401u, 403u, ref num, (SurvivalWaveSpawnType)0, 0f, 0f, false, true, default(Vector3), "");
WardenObjectiveManager.RegisterSurvivalWaveID(num);
}
}
[HarmonyPatch(typeof(FirstPersonItemHolder), "UpdateAimInput")]
[HarmonyPostfix]
internal static void Aim__Postfix(FirstPersonItemHolder __instance)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Invalid comparison between Unknown and I4
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Invalid comparison between Unknown and I4
if ((Object)(object)__instance.WieldedItem != (Object)null && __instance.WieldedItem.ArchetypeID == 202 && (int)__instance.m_currentState == 3 && ((Agent)__instance.m_owner).IsLocallyOwned)
{
weaponAimed = true;
}
else if ((int)__instance.m_currentState != 3)
{
weaponAimed = false;
}
}
[HarmonyPatch(typeof(ChainedPuzzleInstance), "OnPuzzleDone")]
[HarmonyPostfix]
internal static void Puzzle__Postfix(ChainedPuzzleInstance __instance, int puzzleIndex)
{
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(19.02f, 0.01f, 39.96f);
Vector3 val2 = default(Vector3);
((Vector3)(ref val2))..ctor(300.53f, -1f, 275.5f);
Vector3 val3 = default(Vector3);
((Vector3)(ref val3))..ctor(-295.15f, -2.51f, 199.65f);
Logger.Warn("puzzleIndex " + puzzleIndex);
Logger.Warn("m_puzzleUID " + __instance.m_puzzleUID);
Logger.Warn("uid counter " + ChainedPuzzleInstance.m_uidCounter);
Logger.Warn((object)ChainedPuzzleManager.Current);
if (!(__instance.m_puzzleUID == "CPUID_1"))
{
return;
}
Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
while (enumerator.MoveNext())
{
PlayerAgent current = enumerator.Current;
switch (current.PlayerSlotIndex)
{
case 0:
case 3:
case 6:
case 7:
Logger.Warn("Teleport!");
current.TeleportTo(val);
break;
case 1:
case 4:
current.TeleportTo(val2);
break;
case 2:
case 5:
current.TeleportTo(val3);
break;
}
}
}
[HarmonyPatch(typeof(ChainedPuzzleManager), "OnLevelCleanup")]
[HarmonyPostfix]
internal static void LC__Postfix()
{
ChainedPuzzleInstance.m_uidCounter = 0u;
}
}
}
namespace RaidCore.Plugin
{
[BepInPlugin("cactus.RaidCore", "RaidCore", "1.0.0")]
public class Plugin : BasePlugin
{
public Harmony m_Harmony;
public override void Load()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(17, 0, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin is loaded!");
}
log.LogInfo(val);
m_Harmony = new Harmony("cactus.RaidCore");
m_Harmony.PatchAll();
}
}
}