using System;
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 BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Birbe.BirbeMods")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Birbe.BirbeMods")]
[assembly: AssemblyTitle("Birbe.BirbeMods")]
[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 BirbeMods.BirbeMods
{
internal class PluginInfo
{
public const string PLUGIN_GUID = "Birbe.BirbeMods";
public const string PLUGIN_NAME = "BirbeMods";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace Birbe.BirbeMods
{
[BepInPlugin("Birbe.BirbeMods", "BirbeMods", "1.0.0")]
public class BirbeMods : BaseUnityPlugin
{
private static BirbeMods instance;
public static AssetBundle? BirbeAssets;
public static ManualLogSource mls;
private static Harmony mod = new Harmony("Birbe.BirbeMods");
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
if ((Object)instance == (Object)null)
{
instance = this;
}
mls = Logger.CreateLogSource("Birbe.BirbeMods");
instance = this;
BirbeScrapMod.LoadMod();
mod.PatchAll(typeof(ForestKeeperPatches));
mod.PatchAll(typeof(ManeaterPatches));
mls.LogInfo((object)"BirbeMods has floated in.");
}
}
internal class BirbeScrapMod
{
public static AssetBundle? BirbeAssets;
public static void LoadMod()
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
BirbeAssets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "birbebundle"));
if ((Object)(object)BirbeAssets == (Object)null)
{
BirbeMods.mls.LogError((object)"Failed to load Birbe scrap custom assets.");
return;
}
Item val = BirbeAssets.LoadAsset<Item>("Assets/Birbe.asset");
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>
{
{
(LevelTypes)(-1),
6
},
{
(LevelTypes)128,
15
},
{
(LevelTypes)256,
12
},
{
(LevelTypes)512,
10
},
{
(LevelTypes)8192,
8
},
{
(LevelTypes)4096,
10
},
{
(LevelTypes)4,
0
},
{
(LevelTypes)16,
0
}
};
Items.RegisterScrap(val, dictionary, (Dictionary<string, int>)null);
BirbeMods.mls.LogInfo((object)"Birbe scrap mod loaded!");
}
}
[HarmonyPatch]
internal class ForestKeeperPatches
{
[HarmonyPatch(typeof(ForestGiantAI), "LookForPlayers")]
[HarmonyPostfix]
private static void ForestGiantAI_LookForPlayersPostfix(ForestGiantAI __instance)
{
Traverse val = Traverse.Create((object)__instance);
object value = val.Field("allPlayersInLineOfSight").GetValue();
if (value != null)
{
return;
}
for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
{
if (__instance.playerStealthMeters[i] > 0.33f)
{
__instance.playerStealthMeters[i] -= Time.deltaTime * 0.1f;
}
__instance.playerStealthMeters[i] = Mathf.Clamp(__instance.playerStealthMeters[i], -5f, 8f);
}
}
}
[HarmonyPatch]
internal class ManeaterPatches
{
[HarmonyPatch(typeof(CaveDwellerAI), "Start")]
[HarmonyPostfix]
private static void CaveDwellerAI_StartPostfix(CaveDwellerAI __instance)
{
__instance.growthSpeedMultiplier *= 0.8f;
__instance.increaseLonelinessMultiplier *= 0.8f;
__instance.babyRoamFromPlayersThreshold *= 1.1f;
}
[HarmonyPatch(typeof(CaveDwellerAI), "DoAIInterval")]
[HarmonyPrefix]
private static void CaveDwellerAI_DoAIIntervalPrefix(CaveDwellerAI __instance)
{
if (__instance.eatingScrap)
{
if (__instance.growthMeter > 0.6f)
{
BirbeMods.mls.LogInfo((object)"Baby ate scrap due to high growth.");
return;
}
BirbeMods.mls.LogInfo((object)("Baby tried to eat scrap but is happy enough already. (growth: " + __instance.growthMeter * 100f + "%)"));
__instance.eatingScrap = false;
}
}
[HarmonyPatch(typeof(CaveDwellerAI), "StopObserving")]
[HarmonyPostfix]
private static void CaveDwellerAI_StopObservingPostfix(CaveDwellerAI __instance, ref bool eatScrap)
{
BirbeMods.mls.LogInfo((object)"StopObservingPostfix");
if (eatScrap)
{
float num = __instance.growthMeter * 100f;
__instance.growthMeter = Mathf.Clamp(__instance.growthMeter - 0.1f, 0f, 1f);
BirbeMods.mls.LogInfo((object)("Baby ate tasty scrap and is a little happier. (growth: " + num + "% -> " + __instance.growthMeter * 100f + "%)"));
__instance.babyPuked = false;
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Birbe.BirbeMods";
public const string PLUGIN_NAME = "Birbe.BirbeMods";
public const string PLUGIN_VERSION = "1.0.0";
}
}