using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Jotunn;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("JesusSlippers")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JesusSlippers")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
namespace JesusSlippers
{
[BepInPlugin("org.bepinex.plugins.bid.JesusSlippers", "JesusSlippers", "0.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class JesusSlippers : BaseUnityPlugin
{
public const string PluginGUID = "org.bepinex.plugins.bid.JesusSlippers";
public const string PluginName = "JesusSlippers";
public const string PluginVersion = "0.0.1";
private readonly Harmony harmony = new Harmony("org.bepinex.plugins.bid.JesusSlippers");
public static Component s_liquidObj = null;
public static bool s_enabled = true;
private void Awake()
{
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Expected O, but got Unknown
Logger.LogInfo((object)"JesusSlippers has landed");
AssetBundle val = AssetUtils.LoadAssetBundleFromResources("jesusslippers");
if ((Object)(object)val == (Object)null)
{
MonoBehaviour.print((object)"Error loading assetbundle jesusslippers");
return;
}
try
{
GameObject val2 = val.LoadAsset<GameObject>("JesusSlippers");
CustomItem val3 = new CustomItem(val2, true);
ItemManager.Instance.AddItem(val3);
Recipe obj = ScriptableObject.CreateInstance<Recipe>();
((Object)obj).name = "JesusSlippers";
obj.m_item = val2.GetComponent<ItemDrop>();
obj.m_craftingStation = Mock<CraftingStation>.Create("piece_workbench");
Requirement val4 = MockRequirement.Create("LinenThread", 10, true);
val4.m_amountPerLevel = 10;
Requirement val5 = MockRequirement.Create("DeerHide", 5, true);
val5.m_amountPerLevel = 5;
Requirement val6 = MockRequirement.Create("Silver", 2, true);
val6.m_amountPerLevel = 2;
Requirement val7 = MockRequirement.Create("Coins", 200, true);
val7.m_amountPerLevel = 200;
List<Requirement> list = new List<Requirement> { val4, val7, val5, val6 };
obj.m_resources = list.ToArray();
CustomRecipe val8 = new CustomRecipe(obj, true, true);
ItemManager.Instance.AddRecipe(val8);
}
catch (Exception arg)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while adding custom creatures: {arg}");
}
finally
{
val.Unload(false);
}
new Harmony("org.bepinex.plugins.bid.JesusSlippers").PatchAll();
}
private void OnDestroy()
{
harmony.UnpatchSelf();
}
public static bool OnWater(Character character)
{
//IL_001b: 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_0042: Unknown result type (might be due to invalid IL or missing references)
if (!CanWalkOnWater(character))
{
return false;
}
if (s_liquidObj is WaterVolume)
{
float waterSurface = ((WaterVolume)s_liquidObj).GetWaterSurface(((Component)character).transform.position, 1f);
if (Mathf.Max(0f, waterSurface - ((Component)character).transform.position.y) > 0f)
{
return true;
}
}
return false;
}
public static bool CanWalkOnWater(Character character)
{
if (s_enabled && Object.op_Implicit((Object)(object)Player.m_localPlayer) && (Object)(object)Player.m_localPlayer == (Object)(object)character)
{
return ((Humanoid)Player.m_localPlayer).m_visEquipment.m_legItem == "JesusSlippers";
}
return false;
}
}
}
namespace JesusSlippers.Patches
{
[HarmonyPatch(typeof(Character), "SetLiquidLevel")]
public static class Character_SetLiquidLevel_Patch
{
private static bool Prefix(float level, LiquidType type, Component liquidObj, ref Character __instance)
{
if ((Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)__instance != (Object)(object)Player.m_localPlayer)
{
return true;
}
JesusSlippers.s_liquidObj = liquidObj;
return true;
}
}
[HarmonyPatch(typeof(Character), "UpdateMotion")]
public static class CharacterUpdateMotion_Patch
{
private static bool Prefix(float dt, ref Character __instance)
{
//IL_001d: 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)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: 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_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: 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_00b8: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
if (JesusSlippers.OnWater(__instance))
{
__instance.m_lastGroundNormal = new Vector3(0f, 1f, 0f);
__instance.ResetGroundContact();
__instance.m_lastGroundTouch = 0f;
__instance.m_groundContact = false;
__instance.m_lastGroundNormal = new Vector3(0f, 1f, 0f);
__instance.UpdateWalking(dt);
float liquidLevel = __instance.GetLiquidLevel();
if (((Component)__instance).transform.position.y < liquidLevel)
{
float num = Mathf.Clamp01((liquidLevel - ((Component)__instance).transform.position.y) / 2f);
float num2 = Mathf.Lerp(0f, 10f, num);
Vector3 velocity = __instance.m_body.velocity;
velocity.y = Mathf.MoveTowards(velocity.y, num2, 50f * dt);
__instance.m_body.velocity = velocity;
}
else
{
float num3 = Mathf.Clamp01((0f - (liquidLevel - ((Component)__instance).transform.position.y)) / 1f);
float num4 = Mathf.Lerp(0f, 10f, num3);
Vector3 velocity2 = __instance.m_body.velocity;
velocity2.y = Mathf.MoveTowards(velocity2.y, 0f - num4, 30f * dt);
__instance.m_body.velocity = velocity2;
}
__instance.m_zanim.SetBool(Character.s_inWater, false);
__instance.m_zanim.SetBool(Character.s_onGround, __instance.IsOnGround());
__instance.m_zanim.SetBool(Character.s_encumbered, __instance.IsEncumbered());
__instance.m_zanim.SetBool(Character.s_flying, false);
__instance.m_zanim.SetBool(Character.s_animatorFalling, false);
return false;
}
return true;
}
}
[HarmonyPatch(typeof(SEMan), "Internal_AddStatusEffect")]
internal static class SEMan_Internal_AddStatusEffect_Patches
{
private static bool Prefix(int nameHash, bool resetTime, int itemLevel, float skillLevel, ref SEMan __instance)
{
if (nameHash == SEMan.s_statusEffectWet)
{
return !JesusSlippers.CanWalkOnWater(__instance.m_character);
}
return true;
}
}
}