using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using GlobalEnums;
using HutongGames.PlayMaker;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PetDatDawg")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © Ruttie 2025")]
[assembly: AssemblyFileVersion("1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.0+881a35193fbdc41ba1dd266b6ecba2bcefcf6519")]
[assembly: AssemblyProduct("PetDatDawg")]
[assembly: AssemblyTitle("PetDatDawg")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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 PetDatDawg
{
public readonly struct Beast
{
public const string GO_NAME = "Bone Beast NPC";
public const string FSM_NAME = "Interaction";
public const string FSM_STATE_SHAKE = "Wait for Turn";
public const string FSM_STATE_ACTIVATE = "Activate";
public const string FSM_FIELD_WASASLEEP = "Was Asleep";
public const string FSM_FIELD_HASENTEREDRANGE = "Has Entered Range";
public const string FSM_FIELD_THISLOCATION = "This Location";
public readonly GameObject GO;
public readonly PlayMakerFSM FSM;
public readonly FsmState ActivateState;
public readonly FastTravelLocations Location;
private Beast(GameObject obj, PlayMakerFSM fsm, FsmState activateState, FastTravelLocations loc)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
GO = obj;
FSM = fsm;
Location = loc;
ActivateState = activateState;
}
public static Beast? Find(Scene scene)
{
GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
GameObject val = ((IEnumerable<GameObject>)rootGameObjects).FirstOrDefault((Func<GameObject, bool>)((GameObject x) => ((Object)x).name == "Bone Beast NPC"));
if (val != null)
{
return TryCreate(val);
}
Transform? obj = rootGameObjects.Select((GameObject x) => x.transform.Find("Bone Beast NPC")).FirstOrDefault((Func<Transform, bool>)((Transform x) => (Object)(object)x != (Object)null));
GameObject val2 = ((obj != null) ? ((Component)obj).gameObject : null);
if (val2 != null)
{
return TryCreate(val2);
}
return null;
}
public static Beast? TryCreate(GameObject obj)
{
//IL_007e: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
PlayMakerFSM val = ((IEnumerable<PlayMakerFSM>)obj.GetComponents<PlayMakerFSM>()).FirstOrDefault((Func<PlayMakerFSM, bool>)((PlayMakerFSM x) => x.FsmName == "Interaction"));
if (val == null)
{
return null;
}
if (!HasField(val, "Was Asleep") || !HasField(val, "Has Entered Range") || !HasField(val, "This Location"))
{
return null;
}
FastTravelLocations loc = (FastTravelLocations)(object)val.FsmVariables.GetFsmEnum("This Location").Value;
FsmState val2 = ((IEnumerable<FsmState>)val.FsmStates).FirstOrDefault((Func<FsmState, bool>)((FsmState x) => x.Name == "Activate"));
if (val2 == null)
{
return null;
}
return new Beast(obj, val, val2, loc);
static bool HasField(PlayMakerFSM fsm, string name)
{
return Extensions.IsVariableValid(fsm, name, true).GetValueOrDefault();
}
}
public void Inject()
{
Beast beast = this;
Action<FsmState> prev = FSM.Fsm.StateChanged;
bool activated = false;
FSM.Fsm.StateChanged = delegate(FsmState state)
{
if (!activated && state.Name == "Activate")
{
PetManager.CreateInteract(beast);
activated = true;
}
prev?.Invoke(state);
};
}
public bool IsAsleep()
{
if (FSM.FsmVariables.GetFsmBool("Was Asleep").Value)
{
return !FSM.FsmVariables.GetFsmBool("Has Entered Range").Value;
}
return false;
}
public void Rumble()
{
FSM.SetState("Wait for Turn");
}
}
[BepInPlugin("petdatdawg", "PetDatDawg", "1.1.0")]
public sealed class PetDatDawg : BaseUnityPlugin
{
private void Awake()
{
SceneManager.sceneLoaded += SceneLoaded;
}
private void SceneLoaded(Scene scene, LoadSceneMode mode)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
PlayerData instance = PlayerData.instance;
if (instance == null || !instance.UnlockedFastTravel || instance.BellCentipedeLocked)
{
return;
}
Beast? beast = Beast.Find(scene);
if (beast.HasValue)
{
Beast valueOrDefault = beast.GetValueOrDefault();
if (instance.FastTravelNPCLocation != valueOrDefault.Location)
{
valueOrDefault.Inject();
}
else
{
PetManager.CreateInteract(valueOrDefault);
}
}
}
private void OnDestroy()
{
SceneManager.sceneLoaded -= SceneLoaded;
}
}
public sealed class PetManager : InteractableBase
{
private readonly struct HeroFreeze : IDisposable
{
private readonly HeroController hc;
private readonly HeroAnimationController animator;
private readonly WaitForSeconds animWait;
public HeroFreeze()
{
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
hc = HeroController.instance ?? throw new InvalidOperationException("Hero not in scene");
animator = ((Component)hc).gameObject.GetComponent<HeroAnimationController>() ?? throw new InvalidOperationException("Hero has no animator");
hc.RelinquishControl();
animator.PlayClip("Collect Stand 1");
animWait = new WaitForSeconds(animator.GetCurrentClipDuration());
animator.StopControl();
}
public WaitForSeconds Wait()
{
return animWait;
}
public void Dispose()
{
hc.RegainControl(true);
animator.StartControl();
}
}
public const string HORNET_PET_ANIM_NAME = "Collect Stand 1";
public const string PET_NPC_GO_NAME = "petGo";
public const float PET_DURATION = 0.4f;
public const float INTERACTION_COLLIDER_HEIGHT = 10f;
public const float INTERACTION_COLLIDER_WIDTH = 5f;
private Beast beast;
public override string InteractLabelDisplay => "Accept";
public static PetManager CreateInteract(Beast dawg)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("petGo", new Type[2]
{
typeof(PetManager),
typeof(BoxCollider2D)
});
val.SetActive(dawg.GO.activeSelf);
val.transform.SetParent(dawg.GO.transform);
val.transform.localPosition = Vector2.op_Implicit(Vector2.zero);
BoxCollider2D component = val.GetComponent<BoxCollider2D>();
component.size = new Vector2(5f, 10f);
((Collider2D)component).isTrigger = true;
PetManager component2 = val.GetComponent<PetManager>();
component2.beast = dawg;
return component2;
}
public override void Interact()
{
((MonoBehaviour)this).StartCoroutine(HornetPet());
}
private IEnumerator HornetPet()
{
yield return null;
if ((Object)(object)beast.GO == (Object)null)
{
yield break;
}
using HeroFreeze freeze = new HeroFreeze();
yield return freeze.Wait();
if (!beast.IsAsleep())
{
beast.Rumble();
}
yield return (object)new WaitForSeconds(0.4f);
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "petdatdawg";
public const string PLUGIN_NAME = "PetDatDawg";
public const string PLUGIN_VERSION = "1.1.0";
}
}