using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AK;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Unity.IL2CPP;
using GTFO.API;
using GTFO.API.Utilities;
using GameData;
using Gear;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
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("HardMode")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HardMode")]
[assembly: AssemblyTitle("HardMode")]
[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 HardMode
{
[HarmonyPatch]
internal class BalancePatch
{
public static bool hard = true;
[HarmonyPostfix]
[HarmonyPatch(typeof(StartMainGame), "Start")]
public static void ModifyWeapon()
{
EntryPoint.GetTheSettings();
if (!hard)
{
return;
}
float num = 0.5f;
float num2 = 3f;
Dictionary<string, WeaponCate> dictionary = new Dictionary<string, WeaponCate>();
ArchetypeDataBlock[] array = BalancePatch.Blocks<ArchetypeDataBlock>();
foreach (ArchetypeDataBlock val in array)
{
if (!((GameDataBlockBase<ArchetypeDataBlock>)(object)val).name.Contains("SentryGun"))
{
val.Damage *= num;
val.PrecisionDamageMulti *= num2;
val.AimTransitionTime *= 0.9f;
val.EquipTransitionTime *= 0.9f;
if (!val.PiercingBullets)
{
val.PiercingBullets = true;
val.PiercingDamageCountLimit = 2;
}
else
{
val.SpecialChargetupTime = Mathf.Clamp(val.SpecialChargetupTime, 0.1f, 2f);
val.PiercingDamageCountLimit += 3;
}
if (((GameDataBlockBase<ArchetypeDataBlock>)(object)val).name.Equals("GEAR_Revolver_HEL"))
{
val.DefaultClipSize = 6;
}
}
}
MeleeArchetypeDataBlock[] array2 = BalancePatch.Blocks<MeleeArchetypeDataBlock>();
foreach (MeleeArchetypeDataBlock val2 in array2)
{
val2.LightAttackDamage *= num;
val2.ChargedAttackDamage *= num;
val2.ChargedPrecisionMulti *= num2;
val2.LightPrecisionMulti *= num2;
val2.ChargedEnvironmentMulti *= 1.5f;
val2.LightEnvironmentMulti *= 1.5f;
val2.LightSleeperMulti *= 1.2f;
val2.ChargedSleeperMulti *= 1.2f;
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GlowstickInstance), "Setup")]
public static void ModifyGlowSticks(GlowstickInstance __instance)
{
__instance.s_lightLifeTime *= 2f;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(CellSettingsApply), "ApplyTextureSize")]
public static void ManualReload()
{
if (hard)
{
CellSettingsManager.SettingsData.Gameplay.AutoReload.Value = false;
CellSettingsManager.SettingsData.Gameplay.CameraShakeAmount.Value = 1f;
CellSettingsManager.SettingsData.HUD.Player_AlwaysShowTeammateInfo.Value = false;
CellSettingsManager.SettingsData.HUD.Player_HitIndicatorOpacity.Value = 0f;
CellSettingsManager.SettingsData.HUD.Player_CrosshairOpacity.Value = 0f;
CellSettingsManager.SettingsData.HUD.Objective_show.Value = false;
CellSettingsManager.SettingsData.HUD.Statusbar_show.Value = false;
CellSettingsManager.SettingsData.HUD.Subtitles_show.Value = false;
CellSettingsManager.SettingsData.HUD.Inventory_show.Value = false;
CellSettingsManager.SettingsData.HUD.Compass_show.Value = false;
}
}
public static T[] Blocks<T>() where T : GameDataBlockBase<T>
{
return Il2CppArrayBase<T>.op_Implicit(GameDataBlockBase<T>.GetAllBlocks());
}
public static T Block<T>(uint id) where T : GameDataBlockBase<T>
{
return GameDataBlockBase<T>.GetBlock(id);
}
public static T Block<T>(string name) where T : GameDataBlockBase<T>
{
return GameDataBlockBase<T>.GetBlock(name);
}
public static T Copy<T>(T block) where T : GameDataBlockBase<T>
{
return GameDataBlockBase<T>.CreateNewCopy(block);
}
}
internal struct WeaponCate
{
public string id;
public string baseItem;
public string toReplace;
public WeaponCate(string id, string baseItem, string toReplace)
{
this.id = id;
this.baseItem = baseItem;
this.toReplace = toReplace;
}
}
internal class Display : MonoBehaviour
{
public static ItemEquippable currentWeapon;
public static Transform weaponTransform;
public static PlayerInventoryLocal inventoryLocal;
private PlayerAmmoStorage ammo;
private int clip_ammo = 0;
public static GameObject invDisplay;
private Transform displayTransform;
private List<GameObject> ammoCont = new List<GameObject>();
private List<Material> ammoContMat = new List<Material>();
private List<GameObject> ammoBar = new List<GameObject>();
private List<Material> ammoBarMat = new List<Material>();
private float battery = 30f;
private static float consumption = 0f;
private float time = 0f;
private static GameObject lightBar;
private static Material lightBarMat;
private static Vector3 offset = new Vector3(0f, -10f, -4.5f);
private static Color blue = new Color(0.003f, 0.2895f, 0.5947f, 0.522f);
private static Color red = new Color(0.3f, 0.1f, 0.1f, 0.18f);
private static Color grey = new Color(0.37f, 0.37f, 0.37f, 0.5f);
private static Color darkGrey = new Color(0.25f, 0.25f, 0.25f, 0.5f);
public float StandardAmmoRel
{
get
{
BulletWeapon val = ((Il2CppObjectBase)currentWeapon).TryCast<BulletWeapon>();
if ((Object)(object)val == (Object)null)
{
return 0f;
}
clip_ammo = val.m_clip;
float num = (float)clip_ammo * ammo.StandardAmmo.BulletsToRelConv;
return ammo.StandardAmmo.BulletsRelInPack + num;
}
}
public float SpecialAmmoRel
{
get
{
BulletWeapon val = ((Il2CppObjectBase)currentWeapon).TryCast<BulletWeapon>();
if ((Object)(object)val == (Object)null)
{
return 0f;
}
clip_ammo = val.m_clip;
float num = (float)clip_ammo * ammo.SpecialAmmo.BulletsToRelConv;
return ammo.SpecialAmmo.BulletsRelInPack + num;
}
}
public float ToolAmmoRel => ammo.ClassAmmo.BulletsRelInPack;
public float ResAmmoRel => ammo.ResourcePackAmmo.BulletsRelInPack;
public float ConsAmmoRel => ammo.ConsumableAmmo.BulletsRelInPack;
public void Start()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Expected O, but got Unknown
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Expected O, but got Unknown
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Expected O, but got Unknown
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
ammo = PlayerBackpackManager.GetBackpack(SNet.LocalPlayer).AmmoStorage;
invDisplay = new GameObject("Display");
invDisplay.transform.parent = ((Component)this).transform;
invDisplay.transform.localScale = new Vector3(0.01f, 0.01f, 0.05f);
displayTransform = invDisplay.transform;
for (int i = 0; i < 10; i++)
{
ammoBar.Add(new GameObject("Bar-" + i));
MakeDisplay(ammoBar[i], ammoBarMat, SizeOption.Full, isLightBar: false);
ammoBar[i].transform.localPosition = new Vector3(0f, (float)i, 0f) + offset;
ammoBar[i].active = EntryPoint.ammoDisplay.Value == AmmoDisplay.Bars;
}
for (int j = 0; j < 2; j++)
{
ammoCont.Add(new GameObject("Cont-" + j));
MakeDisplay(ammoCont[j], ammoContMat, (SizeOption)(j + 1), isLightBar: false);
ammoCont[j].transform.localPosition = new Vector3(0f, 10f * (float)j, 0f) + offset;
ammoCont[j].active = EntryPoint.ammoDisplay.Value == AmmoDisplay.Continuous;
}
if ((Object)(object)lightBar == (Object)null)
{
lightBar = new GameObject("LightBar");
MakeDisplay(lightBar, null, SizeOption.Full, isLightBar: true);
lightBar.transform.localPosition = new Vector3(0f, 4.5f, 0.5f) + offset;
}
invDisplay.active = false;
}
public void MakeDisplay(GameObject bar, List<Material> matList, SizeOption meshOption, bool isLightBar)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: 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)
bar.transform.parent = invDisplay.transform;
MeshRenderer val = bar.AddComponent<MeshRenderer>();
Material val2 = new Material(Shader.Find("Cell/Hologram/Hologram"));
MeshFilter val3 = bar.AddComponent<MeshFilter>();
val3.mesh = CreateCubeMesh(new Vector3(1f, 1f, 1f), meshOption);
if (isLightBar && matList == null)
{
bar.transform.localScale = new Vector3(1f, 10f, 0.1f);
val2.color = grey;
lightBarMat = val2;
}
else
{
bar.transform.localScale = new Vector3(1f, 0.5f, 0.5f);
val2.color = red;
matList.Add(val2);
}
((Renderer)val).SetMaterial(val2);
}
public void FixedUpdate()
{
time += Time.fixedDeltaTime;
if (time > 1f && (Object)(object)inventoryLocal != (Object)null)
{
if (battery < 5f && battery > 2f && ((PlayerInventoryBase)inventoryLocal).FlashlightEnabled)
{
CoroutineDispatcher.StartCoroutine(flicker());
}
if (clip_ammo < 3)
{
CoroutineDispatcher.StartCoroutine(Ammoflicker());
}
time = 0f;
}
UpdateFlashLight();
if (invDisplay.active)
{
UpdateStatus();
}
}
public void Update()
{
if (Input.GetKeyDown((KeyCode)103))
{
invDisplay.active = !invDisplay.active;
}
if (invDisplay.active)
{
UpdateAmmoPosition();
}
}
public static void SetLightComsumption(float mul = 1f)
{
if (EntryPoint.difficulty.Value == Difficulty.Hard)
{
Light flashlight = ((PlayerInventoryBase)inventoryLocal).m_flashlight;
consumption = flashlight.intensity * 2f * (flashlight.range / 15f);
consumption *= mul;
}
else
{
consumption = 0f;
}
}
public static void SetWeaponOffSet()
{
//IL_000f: 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)
offset = new Vector3(0f, -10f, -4.5f);
}
public static void SetCamOffSet()
{
//IL_000f: 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)
offset = new Vector3(13f, -30f, 4f);
}
public void UpdateFlashLight()
{
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
if (((PlayerInventoryBase)inventoryLocal).FlashlightEnabled)
{
battery -= consumption * Time.fixedDeltaTime;
}
else
{
battery += Time.fixedDeltaTime;
}
battery = Mathf.Clamp(battery, 0f, 30f);
lightBar.transform.localScale = new Vector3(1f, battery / 3f, 0.1f);
lightBar.transform.localPosition = new Vector3(0f, 4.5f, 0.5f) + offset;
lightBarMat.color = (((PlayerInventoryBase)inventoryLocal).FlashlightEnabled ? grey : darkGrey);
if (battery < 1f)
{
((PlayerInventoryBase)inventoryLocal).SetFlashlightEnabled(false, false, true);
}
}
public void UpdateAmmoPosition()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
displayTransform.position = weaponTransform.position;
displayTransform.rotation = weaponTransform.rotation;
}
public void UpdateStatus()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: 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_0042: Expected I4, but got Unknown
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: 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_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)currentWeapon == (Object)null)
{
return;
}
float num = 0f;
AmmoType ammoType = currentWeapon.AmmoType;
AmmoType val = ammoType;
switch ((int)val)
{
case 0:
num = StandardAmmoRel;
break;
case 1:
num = SpecialAmmoRel;
break;
case 2:
num = ToolAmmoRel;
break;
case 3:
num = ResAmmoRel;
break;
case 4:
num = ConsAmmoRel;
break;
}
if (ammoCont[0].active)
{
ammoCont[0].transform.localScale = new Vector3(1f, 20f * num, 0.5f);
ammoCont[0].transform.localPosition = new Vector3(0f, 0f, 0f) + offset;
ammoCont[1].transform.localScale = new Vector3(1f, 20f - 20f * num, 0.5f);
ammoCont[1].transform.localPosition = new Vector3(0f, 10f, 0f) + offset;
}
if (!ammoBar[0].active)
{
return;
}
num = (int)(num * 10f);
for (int i = 0; i < 10; i++)
{
if ((float)i < num)
{
ammoBarMat[i].color = blue;
}
else
{
ammoBarMat[i].color = red;
}
ammoBar[i].transform.localPosition = new Vector3(0f, (float)i, 0f) + offset;
}
}
private IEnumerator flicker()
{
((PlayerInventoryBase)inventoryLocal).SetFlashlightEnabled(false, false, false);
yield return (object)new WaitForSeconds(0.05f);
((PlayerInventoryBase)inventoryLocal).SetFlashlightEnabled(true, false, false);
yield return (object)new WaitForSeconds(0.03f);
((PlayerInventoryBase)inventoryLocal).SetFlashlightEnabled(false, false, false);
yield return (object)new WaitForSeconds(0.05f);
((PlayerInventoryBase)inventoryLocal).SetFlashlightEnabled(true, false, false);
}
private IEnumerator Ammoflicker()
{
blue = new Color(0.4f, 0.1f, 0.1f, 0.18f);
yield return (object)new WaitForSeconds(0.1f);
blue = new Color(0.003f, 0.2895f, 0.5947f, 0.522f);
yield return (object)new WaitForSeconds(0.05f);
blue = new Color(0.4f, 0.1f, 0.1f, 0.18f);
yield return (object)new WaitForSeconds(0.1f);
blue = new Color(0.003f, 0.2895f, 0.5947f, 0.522f);
}
public static Mesh CreateCubeMesh(Vector3 size, SizeOption option)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//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_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: 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_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: 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_00fa: 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_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: 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_011e: 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_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: 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_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: 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: Unknown result type (might be due to invalid IL or missing references)
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: Unknown result type (might be due to invalid IL or missing references)
//IL_029b: Unknown result type (might be due to invalid IL or missing references)
//IL_02a2: 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_02b0: Unknown result type (might be due to invalid IL or missing references)
//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
//IL_02da: Unknown result type (might be due to invalid IL or missing references)
//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
//IL_030a: Unknown result type (might be due to invalid IL or missing references)
//IL_0310: Unknown result type (might be due to invalid IL or missing references)
//IL_0315: Unknown result type (might be due to invalid IL or missing references)
//IL_031c: 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_032e: Unknown result type (might be due to invalid IL or missing references)
//IL_0333: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: 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_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: 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_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: 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_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: 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_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
Mesh val = new Mesh();
Vector3 val2 = size * 0.5f;
Vector3[] array = option switch
{
SizeOption.Full => (Vector3[])(object)new Vector3[8]
{
new Vector3(0f - val2.x, 0f - val2.y, 0f - val2.z),
new Vector3(val2.x, 0f - val2.y, 0f - val2.z),
new Vector3(val2.x, 0f - val2.y, val2.z),
new Vector3(0f - val2.x, 0f - val2.y, val2.z),
new Vector3(0f - val2.x, val2.y, 0f - val2.z),
new Vector3(val2.x, val2.y, 0f - val2.z),
new Vector3(val2.x, val2.y, val2.z),
new Vector3(0f - val2.x, val2.y, val2.z)
},
SizeOption.TopHalf => (Vector3[])(object)new Vector3[8]
{
new Vector3(0f - val2.x, 0f, 0f - val2.z),
new Vector3(val2.x, 0f, 0f - val2.z),
new Vector3(val2.x, 0f, val2.z),
new Vector3(0f - val2.x, 0f, val2.z),
new Vector3(0f - val2.x, val2.y, 0f - val2.z),
new Vector3(val2.x, val2.y, 0f - val2.z),
new Vector3(val2.x, val2.y, val2.z),
new Vector3(0f - val2.x, val2.y, val2.z)
},
_ => (Vector3[])(object)new Vector3[8]
{
new Vector3(0f - val2.x, 0f - val2.y, 0f - val2.z),
new Vector3(val2.x, 0f - val2.y, 0f - val2.z),
new Vector3(val2.x, 0f - val2.y, val2.z),
new Vector3(0f - val2.x, 0f - val2.y, val2.z),
new Vector3(0f - val2.x, 0f, 0f - val2.z),
new Vector3(val2.x, 0f, 0f - val2.z),
new Vector3(val2.x, 0f, val2.z),
new Vector3(0f - val2.x, 0f, val2.z)
},
};
int[] array2 = new int[36]
{
0, 1, 2, 0, 2, 3, 4, 6, 5, 4,
7, 6, 0, 4, 1, 1, 4, 5, 1, 5,
2, 2, 5, 6, 2, 6, 3, 3, 6, 7,
3, 7, 0, 0, 7, 4
};
val.vertices = Il2CppStructArray<Vector3>.op_Implicit(array);
val.triangles = Il2CppStructArray<int>.op_Implicit(array2);
val.RecalculateNormals();
return val;
}
}
internal enum SizeOption
{
Full,
TopHalf,
BottomHalf
}
[BepInPlugin("Mushroom.Hardmode", "Hardmode", "1.0.4")]
public class EntryPoint : BasePlugin
{
public static EntryPoint entry;
private Harmony m_Harmony;
public static ConfigFile configFile;
public static ConfigEntry<Difficulty> difficulty;
public static ConfigEntry<ColorGrading> colorGrading;
public static ConfigEntry<AmmoDisplay> ammoDisplay;
public override void Load()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
entry = this;
m_Harmony = new Harmony("Mushroom.Hardmode");
LogIt("Hardcore >...< by time1pm");
ClassInjector.RegisterTypeInIl2Cpp<PostProcess>();
ClassInjector.RegisterTypeInIl2Cpp<Display>();
GetTheSettings();
m_Harmony.PatchAll();
LogIt("HardMode => " + PlayerStatsPatch.hard);
}
public static void GetTheSettings()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
configFile = new ConfigFile(Path.Combine(Paths.ConfigPath, "Mushroom.HardMode.cfg"), true);
difficulty = configFile.Bind<Difficulty>("Setup", "difficulty", Difficulty.Hard, "Hard will activate everything, vanilla if you just want the visuals");
colorGrading = configFile.Bind<ColorGrading>("Setup", "colorGrading", ColorGrading.Horror, "Visual Color Grading");
ammoDisplay = configFile.Bind<AmmoDisplay>("Setup", "ammoDisplay", AmmoDisplay.Continuous, "Visual for Ammo Display");
PlayerStatsPatch.hard = difficulty.Value == Difficulty.Hard;
HackingPatch.hard = difficulty.Value == Difficulty.Hard;
BalancePatch.hard = difficulty.Value == Difficulty.Hard;
}
public static void LogIt(object data)
{
((BasePlugin)entry).Log.LogInfo(data);
}
public override bool Unload()
{
return ((BasePlugin)this).Unload();
}
}
public enum Difficulty
{
Vanilla = 1,
Hard
}
public enum ColorGrading
{
NoGrading = 1,
Horror
}
public enum AmmoDisplay
{
NoDisplay = 1,
Continuous,
Bars
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "Mushroom.Hardmode";
public const string PLUGIN_NAME = "Hardmode";
public const string PLUGIN_VERSION = "1.0.4";
public const string AUTHOR = "time1pm";
public const string BRANCH = "VeryOfficial";
public const string INTERNAL_VERSION = "000551";
}
[HarmonyPatch]
internal class HackingPatch
{
private static int currentRow = 0;
private static int currentDir = -1;
public static bool hard = true;
[HarmonyPostfix]
[HarmonyPatch(typeof(HackingMinigame_TimingGrid), "StartGame")]
public static void GameStart(HackingMinigame_TimingGrid __instance)
{
if (hard)
{
__instance.m_fallBackSpeedMulti *= 12f;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(HackingMinigame_TimingGrid), "GetBoostedWidth")]
public static void Width(ref int orgWidth)
{
if (hard)
{
switch (orgWidth)
{
case 9:
orgWidth = 5;
break;
case 6:
orgWidth = 3;
break;
case 3:
orgWidth = 2;
break;
}
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(HackingMinigame_TimingGrid), "SetPuzzleLevel")]
public static void PreSet(ref float pauseDelay)
{
pauseDelay = 0.05f;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(HackingMinigame_TimingGrid), "SetPuzzleLevel")]
public static void PostSet(HackingMinigame_TimingGrid __instance)
{
if (hard)
{
__instance.m_movingRow = currentRow;
__instance.m_movingDir = -currentDir;
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(HackingMinigame_TimingGrid), "UpdateGame")]
public static void Width(HackingMinigame_TimingGrid __instance)
{
currentRow = __instance.m_movingRow;
currentDir = __instance.m_movingDir;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(HackingMinigame_TimingGrid), "OnHit")]
public static bool HitPre(HackingMinigame_TimingGrid __instance)
{
int num = (int)((ItemEquippable)__instance.m_tool).Sound.Post(EVENTS.HACKING_PUZZLE_CORRECT, true);
__instance.SetOneRowHeight(__instance.m_movingRow, 22f);
if (__instance.m_puzzleLevel < 3)
{
__instance.SetPuzzleLevel(__instance.m_puzzleLevel + 1, 0.8f, true);
}
else
{
__instance.GamePauseTimer = Clock.Time + 0.1f;
__instance.m_puzzleDone = true;
}
return false;
}
}
[HarmonyPatch]
internal class PlayerStatsPatch
{
public static bool hard = true;
[HarmonyPostfix]
[HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceiveMeleeDamage")]
public static void StaminaUpdateMelee(Dam_PlayerDamageLocal __instance, ref pFullDamageData data)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
PlayerTakeDamage(__instance, data);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceiveTentacleAttackDamage")]
public static void StaminaUpdateTentacle(Dam_PlayerDamageLocal __instance, ref pFullDamageData data)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
PlayerTakeDamage(__instance, data);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceiveShooterProjectileDamage")]
public static void StaminaUpdateProjectile(Dam_PlayerDamageLocal __instance, ref pFullDamageData data)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
PlayerTakeDamage(__instance, data);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceiveFallDamage")]
public static void StaminaUpdateFall(Dam_PlayerDamageLocal __instance, ref pFullDamageData data)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
PlayerTakeDamage(__instance, data, fallDamage: true);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceiveSetDead")]
public static void DeathPatch(Dam_PlayerDamageLocal __instance, ref pSetDeadData data)
{
if (hard)
{
((Dam_PlayerDamageBase)__instance).Infection = ((Dam_PlayerDamageBase)__instance).Infection + 0.3f;
}
}
public static void PlayerTakeDamage(Dam_PlayerDamageLocal __instance, pFullDamageData data, bool fallDamage = false)
{
if (hard)
{
float num = ((UFloat16)(ref data.damage)).Get(50f);
PlayerStamina stamina = ((Dam_PlayerDamageBase)__instance).Owner.Stamina;
stamina.Stamina -= num / 18f * (float)(1 + Convert.ToInt32(fallDamage));
((Dam_PlayerDamageBase)__instance).Infection = ((Dam_PlayerDamageBase)__instance).Infection + 0.02f * (float)Convert.ToInt32(!fallDamage);
}
}
}
internal class PostProcess : MonoBehaviour
{
public ComputeShader m_PostProcess;
public RenderTexture m_RenderTexture;
private static int threadX;
private static int threadY;
private static int kernel;
public static PostProcess current;
public void Start()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: 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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: 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_004e: Expected O, but got Unknown
current = this;
m_PostProcess = AssetAPI.GetLoadedAsset<ComputeShader>("Assets/PostProcess/PostProcessComputeShader.compute");
Vector2 value = CellSettingsManager.SettingsData.Video.Resolution.Value;
m_RenderTexture = new RenderTexture((int)value.x, (int)value.y, 1)
{
enableRandomWrite = true
};
m_RenderTexture.Create();
threadX = Mathf.CeilToInt((float)((Texture)m_RenderTexture).width / 32f);
threadY = Mathf.CeilToInt((float)((Texture)m_RenderTexture).height / 32f);
kernel = m_PostProcess.FindKernel("MapCulling");
m_PostProcess.SetTexture(kernel, "Result", (Texture)(object)m_RenderTexture);
SetContrast(2.5f);
SetSaturation(1.2f);
}
public void OnRenderImage(RenderTexture source, RenderTexture destination)
{
Graphics.Blit((Texture)(object)source, m_RenderTexture);
m_PostProcess.Dispatch(kernel, threadX, threadY, 1);
Graphics.Blit((Texture)(object)m_RenderTexture, destination);
}
public static void SetContrast(float value)
{
current.m_PostProcess.SetFloat("contrast", value);
}
public static void SetSaturation(float value)
{
current.m_PostProcess.SetFloat("saturation", value);
}
}
[HarmonyPatch]
internal class VisualPatch
{
private static HUDGlassShatter hud;
private static PlayerAgent localPlayer;
private static Transform cam;
[HarmonyPostfix]
[HarmonyPatch(typeof(FPSCamera), "Awake")]
public static void GetThings(FPSCamera __instance)
{
EntryPoint.GetTheSettings();
if (EntryPoint.colorGrading.Value == ColorGrading.Horror || EntryPoint.difficulty.Value == Difficulty.Hard)
{
((Component)__instance).gameObject.AddComponent<PostProcess>();
}
if (EntryPoint.ammoDisplay.Value > (AmmoDisplay)0)
{
((Component)__instance).gameObject.AddComponent<Display>();
}
hud = ((Component)__instance).gameObject.GetComponent<HUDGlassShatter>();
cam = ((Component)__instance).transform;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerInventoryLocal), "Setup")]
public static void GetLight(PlayerInventoryLocal __instance)
{
Display.inventoryLocal = __instance;
localPlayer = ((PlayerInventoryBase)__instance).Owner;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Dam_PlayerDamageLocal), "UpdateHealthGui")]
public static void HealthUpdate(Dam_PlayerDamageLocal __instance)
{
if (!((Object)(object)hud == (Object)null))
{
hud.SetGlassShatterProgression((1f - ((Dam_SyncedDamageBase)__instance).Health / 25f) / 1.3f);
if (((Dam_SyncedDamageBase)__instance).Health > 10f)
{
PostProcess.SetSaturation(1.2f);
}
else
{
PostProcess.SetSaturation(1.2f * (((Dam_SyncedDamageBase)__instance).Health / 10f));
}
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(ItemEquippable), "OnWield")]
public static void BulletShowCase(ItemEquippable __instance)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Invalid comparison between Unknown and I4
if (!((Object)(object)((Item)__instance).Owner != (Object)(object)localPlayer))
{
Display.currentWeapon = __instance;
if ((int)__instance.AmmoType < 2)
{
Display.weaponTransform = ((Component)__instance).transform.GetChild(0);
Display.SetWeaponOffSet();
}
else
{
Display.weaponTransform = cam;
Display.SetCamOffSet();
}
Display.SetLightComsumption(1f / (float)(1 + Convert.ToInt32(__instance.m_publicName.Equals("Long Range Flashlight"))));
}
}
}
}