using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Belltopia.Behaviours;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
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("Belltopia")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Belltopia")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b95bc0c4-cdb2-42e8-b089-4aa4987e122b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Belltopia
{
[BepInPlugin("Belvis.Belltopia", "Belltopia", "1.0.5.0")]
public class BelltopiaMod : BaseUnityPlugin
{
private const string modGUID = "Belvis.Belltopia";
private const string modName = "Belltopia";
private const string modVersion = "1.0.5.0";
private readonly Harmony harmony = new Harmony("Belvis.Belltopia");
private static BelltopiaMod Instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "belvisitemmod");
AssetBundle val = AssetBundle.LoadFromFile(text);
Item val2 = val.LoadAsset<Item>("Assets/TrueTrumpet/TrumpetScrap.asset");
NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
Utilities.FixMixerGroups(val2.spawnPrefab);
Items.RegisterScrap(val2, 25, (LevelTypes)(-1));
Item val3 = val.LoadAsset<Item>("Assets/BelvisBar/BelvisBar.asset");
BelvisBarFunctionality belvisBarFunctionality = val3.spawnPrefab.AddComponent<BelvisBarFunctionality>();
((GrabbableObject)belvisBarFunctionality).grabbable = true;
((GrabbableObject)belvisBarFunctionality).grabbableToEnemies = true;
((GrabbableObject)belvisBarFunctionality).itemProperties = val3;
NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
Utilities.FixMixerGroups(val3.spawnPrefab);
TerminalNode val4 = val.LoadAsset<TerminalNode>("Assets/TerminalNoded/iTerminalNode.asset");
Items.RegisterShopItem(val3, (TerminalNode)null, (TerminalNode)null, val4, 20);
Item val5 = val.LoadAsset<Item>("Assets/DaffyDuckScap/DaffyItem.asset");
NetworkPrefabs.RegisterNetworkPrefab(val5.spawnPrefab);
Utilities.FixMixerGroups(val5.spawnPrefab);
Items.RegisterScrap(val5, 30, (LevelTypes)(-1));
Item val6 = val.LoadAsset<Item>("Assets/Bomb/BombProperties.asset");
BombFunctionality bombFunctionality = val6.spawnPrefab.AddComponent<BombFunctionality>();
((GrabbableObject)bombFunctionality).grabbable = true;
((GrabbableObject)bombFunctionality).grabbableToEnemies = true;
((GrabbableObject)bombFunctionality).itemProperties = val6;
NetworkPrefabs.RegisterNetworkPrefab(val6.spawnPrefab);
Utilities.FixMixerGroups(val6.spawnPrefab);
Items.RegisterScrap(val6, 20, (LevelTypes)(-1));
Item val7 = val.LoadAsset<Item>("Assets/B_Waypoint/WaypointItemProp.asset");
NetworkPrefabs.RegisterNetworkPrefab(val7.spawnPrefab);
Utilities.FixMixerGroups(val7.spawnPrefab);
TerminalNode val8 = val.LoadAsset<TerminalNode>("Assets/TerminalNoded/WaypointTerminalNode.asset");
Items.RegisterShopItem(val7, (TerminalNode)null, (TerminalNode)null, val8, 60);
Item val9 = val.LoadAsset<Item>("Assets/BowlingBall/BowlingBallProperties.asset");
NetworkPrefabs.RegisterNetworkPrefab(val9.spawnPrefab);
Utilities.FixMixerGroups(val9.spawnPrefab);
Items.RegisterScrap(val9, 50, (LevelTypes)(-1));
mls = Logger.CreateLogSource("Belvis.Belltopia");
harmony.PatchAll(typeof(BelltopiaMod));
mls.LogInfo((object)"Belltopia has loaded! Help us all.");
}
}
}
namespace Belltopia.Behaviours
{
internal class BelvisBarFunctionality : PhysicsProp
{
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: 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)
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (!buttonDown)
{
return;
}
if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
{
int num = Random.Range(0, 150);
Debug.Log((object)num.ToString());
((GrabbableObject)this).playerHeldBy.sprintMeter = 1f;
((GrabbableObject)this).playerHeldBy.DamagePlayer(5, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
if (num == 32)
{
((GrabbableObject)this).playerHeldBy.DamagePlayer(100, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
}
((GrabbableObject)this).playerHeldBy.DespawnHeldObject();
}
else
{
Debug.Log((object)"Holding player not found for some incredibly strange reason. Curse you zeekerss!");
}
}
}
internal class BombFunctionality : PhysicsProp
{
public PlayerControllerB playerThrownBy;
public bool ItemIsPlaced = false;
public override void EquipItem()
{
((PhysicsProp)this).EquipItem();
playerThrownBy = ((GrabbableObject)this).playerHeldBy;
ItemIsPlaced = false;
}
public override void OnPlaceObject()
{
((GrabbableObject)this).OnPlaceObject();
ItemIsPlaced = true;
Debug.Log((object)"Bomb item placed status: ");
}
public override void DiscardItem()
{
((GrabbableObject)this).DiscardItem();
if (!ItemIsPlaced)
{
((MonoBehaviour)this).StartCoroutine(DelayExplosion(0.5f));
}
}
public IEnumerator DelayExplosion(float delay)
{
yield return (object)new WaitForSeconds(delay);
Landmine.SpawnExplosion(((Component)this).transform.position + Vector3.up * 0.2f, true, 3f, 10f, 60, 45f, (GameObject)null, false);
Debug.Log((object)"Bomb Has Exploded");
((GrabbableObject)this).DestroyObjectInHand(playerThrownBy);
}
}
}