using System;
using System.Collections.Generic;
using System.Diagnostics;
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 Microsoft.CodeAnalysis;
using PEAKLib.Core;
using PEAKLib.Items.UnityEditor;
using Photon.Pun;
using PvPEAK.UnlitDynamite.GameObjects;
using UnityEngine;
using Zorro.Core;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.HuFlungDu.PvPEAK.UnlitDynamite")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a7115b6b41600b36710a0d3c96850aa2a2851420")]
[assembly: AssemblyProduct("com.github.HuFlungDu.PvPEAK.UnlitDynamite")]
[assembly: AssemblyTitle("PvPEAK.UnlitDynamite")]
[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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace PvPEAK.UnlitDynamite
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.github.HuFlungDu.PvPEAK.UnlitDynamite", "PvPEAK.UnlitDynamite", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
private readonly Harmony _harmony = new Harmony("com.github.HuFlungDu.PvPEAK.UnlitDynamite");
public static GameObject? prefab;
public static PeakBundle? item_bundle;
public const string Id = "com.github.HuFlungDu.PvPEAK.UnlitDynamite";
public static string Name => "PvPEAK.UnlitDynamite";
public static string Version => "1.0.0";
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin com.github.HuFlungDu.PvPEAK.UnlitDynamite is loaded!");
BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "pvpeak-unlitdynamite.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
{
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Expected O, but got Unknown
item_bundle = peakBundle;
UnityItemContent val = peakBundle.LoadAsset<UnityItemContent>("UnlitDynamite");
prefab = val.ItemPrefab;
prefab.AddComponent<PvPEAK.UnlitDynamite.GameObjects.UnlitDynamite>();
ParticleSystemRenderer[] componentsInChildren = prefab.GetComponentsInChildren<ParticleSystemRenderer>(true);
ParticleSystemRenderer[] array = componentsInChildren;
foreach (ParticleSystemRenderer val2 in array)
{
if ((Object)(object)((Renderer)val2).sharedMaterial != (Object)null)
{
string text;
if (((Object)((Component)val2).gameObject).name.ToLower().Contains("photosensitive"))
{
text = "Particle_Transparent";
}
else
{
if (!((Object)((Component)val2).gameObject).name.ToLower().Contains("sparks"))
{
continue;
}
text = "GD/FireParticle";
}
Shader shader = Shader.Find(text);
Material val3 = new Material(((Renderer)val2).sharedMaterial);
val3.shader = shader;
((Renderer)val2).material = val3;
}
}
Dynamite component = ((Component)SingletonAsset<ItemDatabase>.Instance.itemLookup[106]).GetComponent<Dynamite>();
prefab.GetComponent<Dynamite>().explosionPrefab = (prefab.GetComponent<ItemCooking>().explosionPrefab = component.explosionPrefab);
prefab.GetComponent<Dynamite>().smokeVFXPrefab = component.smokeVFXPrefab;
peakBundle.Mod.RegisterContent();
});
}
}
}
namespace PvPEAK.UnlitDynamite.Patches
{
internal class DebugSpawnPatch
{
[HarmonyPatch(typeof(Campfire), "Awake")]
[HarmonyPostfix]
public static void Postfix(Campfire __instance)
{
if (PhotonNetwork.IsMasterClient && ((Object)((Component)((Component)__instance).gameObject.transform.parent).gameObject).name.ToLower().Contains("wings"))
{
SpawnBeachItems(__instance);
}
}
public static void SpawnBeachItems(Campfire campfire)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: 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_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
Item component = Plugin.prefab.GetComponent<Item>();
Item val = SingletonAsset<ItemDatabase>.Instance.itemLookup[106];
BotSpawner component2 = GameObject.Find("BotSpawner").GetComponent<BotSpawner>();
if (!((Object)(object)component != (Object)null))
{
return;
}
foreach (Vector3 item in Utility.GetEvenlySpacedPointsAroundCampfire(4, 4f, 4f, ((Component)campfire).gameObject.transform.position, ((Component)campfire).gameObject.transform.eulerAngles, campfire.advanceToSegment))
{
Vector3 val2 = item + new Vector3(0f, 10f, 0f);
Quaternion val3 = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
Item val4 = Utility.Add(val, val2, val3);
Utility.Add(component, val2, val3);
}
}
public static List<Vector3> GetEvenlySpacedPointsAroundCampfire(int numPoints, float innerRadius, float outerRadius, Vector3 campfirePosition, Vector3 campfireAngles, Segment advanceToSegment)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: 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_0057: 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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: 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_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_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_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
List<Vector3> list = new List<Vector3>();
Quaternion val = Quaternion.Euler(campfireAngles);
Vector3 val2 = default(Vector3);
for (int i = 0; i < numPoints; i++)
{
float num = outerRadius;
if (i % 2 == 0)
{
num = innerRadius;
}
float num2 = (float)i * MathF.PI * 2f / (float)numPoints;
float num3 = num * Mathf.Cos(num2);
float num4 = num * Mathf.Sin(num2);
((Vector3)(ref val2))..ctor(num3, 0f, num4);
Vector3 val3 = val * val2;
Vector3 val4 = campfirePosition + val3;
val4.y += -0.05f;
Vector3 val5 = SetToGround(val4);
if (Vector3.Distance(val4, val5) <= 1f)
{
val4 = val5;
}
list.Add(val4);
}
return list;
}
private static Vector3 SetToGround(Vector3 vector)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
return HelperFunctions.GetGroundPos(vector, (LayerType)1, 0f);
}
public static Item Add(Item item, Vector3 position, Quaternion rotation)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: 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)
Plugin.Logger.LogInfo((object)$"Spawn item: {((Object)item).name} at {position}");
if (!PhotonNetwork.IsConnected)
{
return null;
}
return PhotonNetwork.InstantiateItemRoom(((Object)item).name, position, rotation).GetComponent<Item>();
}
}
}
namespace PvPEAK.UnlitDynamite.GameObjects
{
internal class UnlitDynamite : ItemComponent
{
public Dynamite? dynamite;
public Item? item;
public void Awake()
{
((ItemComponent)this).Awake();
item = ((Component)this).GetComponent<Item>();
dynamite = ((Component)this).GetComponent<Dynamite>();
item.OnPrimaryFinishedCast = (Action)Delegate.Combine(item.OnPrimaryFinishedCast, new Action(OnPrimaryFinishedCast));
item.UIData.canPocket = true;
}
public override void OnInstanceDataSet()
{
if (((ItemComponent)dynamite).GetData<BoolItemData>((DataEntryKey)3).Value)
{
item.UIData.canPocket = false;
}
}
public void OnPrimaryFinishedCast()
{
if (((MonoBehaviourPun)item).photonView.IsMine)
{
dynamite.lightFuseRadius = 10f;
item.UIData.canPocket = false;
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}