using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ZombeyMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ZombeyMod")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("017b125a-3d2a-4ed5-b367-0e21a476a047")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ZombeyScrap;
public class Assets
{
public static AssetBundle ZombeyAssets;
public static Item zomblo;
public static Item dado;
public static Item moggy;
public static Item peanut;
public static Item chicken;
public static Item isaac;
public static void Init()
{
ZombeyAssets = AssetBundle.LoadFromStream(GetEmbededResource());
zomblo = ZombeyAssets.LoadAsset<Item>("Assets/Zomblo/Zomblo.asset");
dado = ZombeyAssets.LoadAsset<Item>("Assets/Maudado/dadoItem.asset");
moggy = ZombeyAssets.LoadAsset<Item>("Assets/Moggy/MoggyItem.asset");
peanut = ZombeyAssets.LoadAsset<Item>("Assets/Peanut/PeanutItem.asset");
chicken = ZombeyAssets.LoadAsset<Item>("Assets/Chicken/ChickenItem.asset");
isaac = ZombeyAssets.LoadAsset<Item>("Assets/Isaac/IsaacItem.asset");
}
internal static Stream GetEmbededResource()
{
return Assembly.GetExecutingAssembly().GetManifestResourceStream("ZombeyMod.zomtems");
}
}
[BepInPlugin("ZombeyMod", "ZombeyMod", "0.8")]
public class ZombeyMod : BaseUnityPlugin
{
[HarmonyPatch(typeof(GameNetworkManager))]
internal class GameNetworkManagerPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void StartPatch()
{
((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().AddNetworkPrefab(Assets.zomblo.spawnPrefab);
((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().AddNetworkPrefab(Assets.dado.spawnPrefab);
((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().AddNetworkPrefab(Assets.moggy.spawnPrefab);
((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().AddNetworkPrefab(Assets.peanut.spawnPrefab);
((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().AddNetworkPrefab(Assets.chicken.spawnPrefab);
((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().AddNetworkPrefab(Assets.isaac.spawnPrefab);
}
}
[HarmonyPatch(typeof(StartOfRound))]
internal class customScrap
{
[HarmonyPatch("Awake")]
[HarmonyPostfix]
private static void addLootToLevels(ref StartOfRound __instance)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//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_0037: Expected O, but got Unknown
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Expected O, but got Unknown
//IL_00a4: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Expected O, but got Unknown
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Expected O, but got Unknown
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Expected O, but got Unknown
SelectableLevel[] levels = __instance.levels;
foreach (SelectableLevel val in levels)
{
SpawnableItemWithRarity item = new SpawnableItemWithRarity
{
spawnableItem = Assets.zomblo,
rarity = zombloSpawn.Value
};
val.spawnableScrap.Add(item);
SpawnableItemWithRarity item2 = new SpawnableItemWithRarity
{
spawnableItem = Assets.dado,
rarity = dadoSpawn.Value
};
val.spawnableScrap.Add(item2);
SpawnableItemWithRarity item3 = new SpawnableItemWithRarity
{
spawnableItem = Assets.moggy,
rarity = moggySpawn.Value
};
val.spawnableScrap.Add(item3);
SpawnableItemWithRarity item4 = new SpawnableItemWithRarity
{
spawnableItem = Assets.peanut,
rarity = peanutSpawn.Value
};
val.spawnableScrap.Add(item4);
SpawnableItemWithRarity item5 = new SpawnableItemWithRarity
{
spawnableItem = Assets.chicken,
rarity = chickenSpawn.Value
};
val.spawnableScrap.Add(item5);
SpawnableItemWithRarity item6 = new SpawnableItemWithRarity
{
spawnableItem = Assets.isaac,
rarity = isaacSpawn.Value
};
val.spawnableScrap.Add(item6);
}
if (!__instance.allItemsList.itemsList.Contains(Assets.zomblo))
{
__instance.allItemsList.itemsList.Add(Assets.zomblo);
}
if (!__instance.allItemsList.itemsList.Contains(Assets.dado))
{
__instance.allItemsList.itemsList.Add(Assets.dado);
}
if (!__instance.allItemsList.itemsList.Contains(Assets.moggy))
{
__instance.allItemsList.itemsList.Add(Assets.moggy);
}
if (!__instance.allItemsList.itemsList.Contains(Assets.peanut))
{
__instance.allItemsList.itemsList.Add(Assets.peanut);
}
if (!__instance.allItemsList.itemsList.Contains(Assets.chicken))
{
__instance.allItemsList.itemsList.Add(Assets.chicken);
}
if (!__instance.allItemsList.itemsList.Contains(Assets.isaac))
{
__instance.allItemsList.itemsList.Add(Assets.isaac);
}
}
}
public const string modGUID = "ZombeyMod";
public const string modName = "ZombeyMod";
public const string modVersion = "0.8";
public static ConfigEntry<int> zombloSpawn;
public static ConfigEntry<int> dadoSpawn;
public static ConfigEntry<int> moggySpawn;
public static ConfigEntry<int> peanutSpawn;
public static ConfigEntry<int> chickenSpawn;
public static ConfigEntry<int> isaacSpawn;
private readonly Harmony harmony = new Harmony("ZombeyMod");
private void Awake()
{
Assets.Init();
ManualLogSource val = Logger.CreateLogSource("ZombeyMod");
val.LogMessage((object)"ZombeyMod has loaded succesfully.");
harmony.PatchAll();
if ((Object)(object)Assets.ZombeyAssets == (Object)null)
{
val.LogMessage((object)"Failed to load custom assets.");
return;
}
val.LogMessage((object)"Assets loaded successfully");
zombloSpawn = ((BaseUnityPlugin)this).Config.Bind<int>("ScrapSpawns", "ZomblobRarity", 15, "Spawn rarity for Zomblob - Higher = More Spawns");
dadoSpawn = ((BaseUnityPlugin)this).Config.Bind<int>("ScrapSpawns", "DadoRarity", 10, "Spawn rarity for Blue Alien - Higher = More Spawns");
moggySpawn = ((BaseUnityPlugin)this).Config.Bind<int>("ScrapSpawns", "MoggyRarity", 10, "Spawn rarity for Moggy - Higher = More Spawns");
peanutSpawn = ((BaseUnityPlugin)this).Config.Bind<int>("ScrapSpawns", "PeanutRarity", 15, "Spawn rarity for Strange Peanut - Higher = More Spawns");
isaacSpawn = ((BaseUnityPlugin)this).Config.Bind<int>("ScrapSpawns", "IsaacRarity", 15, "Spawn rarity for Isaac - Higher = More Spawns");
chickenSpawn = ((BaseUnityPlugin)this).Config.Bind<int>("ScrapSpawns", "ChickenRarity", 10, "Spawn rarity for Chicken Plushie - Higher = More Spawns");
}
}