using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using WhazzupPhone.Patches;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("WhazzupPhone")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WhazzupPhone")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("bc200086-648c-4f26-9d5b-02673f0ee69f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace WhazzupPhone
{
[BepInPlugin("ta-xao.whazzupphone", "Whazzup Phone", "1.0.1")]
public class WhazzupPhone : BaseUnityPlugin
{
private const string modGUID = "ta-xao.whazzupphone";
private const string modName = "Whazzup Phone";
private const string modVersion = "1.0.1";
private readonly Harmony harmony = new Harmony("ta-xao.whazzupphone");
private static WhazzupPhone Instance;
internal ManualLogSource mls;
internal static List<AudioClip> SoundFX;
internal static AssetBundle Bundle;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("ta-xao.whazzupphone");
mls.LogInfo((object)"[Whazzup Phone] 1.0.1 is loaded!");
harmony.PatchAll(typeof(AnimatedItemPatch));
mls = ((BaseUnityPlugin)this).Logger;
SoundFX = new List<AudioClip>();
string location = ((BaseUnityPlugin)Instance).Info.Location;
location = location.TrimEnd("WhazzupPhone.dll".ToCharArray());
mls.LogInfo((object)("[Whazzup Phone] Trying to load " + location + "whazzupphoneassetbundle."));
Bundle = AssetBundle.LoadFromFile(location + "whazzupphoneassetbundle");
if ((Object)(object)Bundle != (Object)null)
{
mls.LogInfo((object)"[Whazzup Phone] Asset bundle loaded successfully.");
SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
}
else
{
mls.LogError((object)"[Whazzup Phone] Failed to load asset bundle.");
}
}
}
}
namespace WhazzupPhone.Patches
{
[HarmonyPatch(typeof(AnimatedItem))]
internal class AnimatedItemPatch
{
private static bool grabSFXplayedOnce;
private static AudioClip backupGrabSFX;
[HarmonyPatch("EquipItem")]
[HarmonyPostfix]
private static void OverrideEquipItemAudio(AnimatedItem __instance)
{
if (((GrabbableObject)__instance).itemProperties.itemName == "Old phone")
{
__instance.chanceToTriggerAnimation = 100;
if (!grabSFXplayedOnce)
{
backupGrabSFX = ((GrabbableObject)__instance).itemProperties.grabSFX;
((GrabbableObject)__instance).itemProperties.grabSFX = WhazzupPhone.SoundFX[0];
grabSFXplayedOnce = true;
}
else
{
((GrabbableObject)__instance).itemProperties.grabSFX = backupGrabSFX;
}
__instance.grabAudio = WhazzupPhone.SoundFX[0];
}
}
}
}