using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MoreMountains.Feedbacks;
using UnityEngine;
[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("FapFap1337")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("fap fap palka zvuki blya")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("stick_new_sound")]
[assembly: AssemblyTitle("stick_new_sound")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 SINEBLIVOYKASHOLKI
{
[BepInPlugin("fapfap1337.sineblivoykasholki.palka", "stick_new_sound", "1.0.0")]
public sealed class StickNewSoundPlugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(MetalBat), "HitEffectRpc")]
private static class PatchPalki
{
private static readonly FieldInfo EtapRpc = AccessTools.Field(typeof(MetalBat), "__rpc_exec_stage");
private static void Prefix(MetalBat __instance, HitType ___hitType, MMF_Player ___fleshPlayer, MMF_Player ___normalPlayer)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Invalid comparison between Unknown and I4
if ((int)___hitType == 2 && !(EtapRpc == null) && Convert.ToInt32(EtapRpc.GetValue(__instance)) == 1)
{
if (fapLogger != null)
{
fapLogger.LogInfo((object)"fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap fap f apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf apf\tapF APF APF APF APF APF APF APF APF APF APF APF APF APF APF APF APF APF APF APF APF APF APF APF APF.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP F.AP.F.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF.APF A PF A PF A PF A PF A PF A PF A PF A PF A PF A PF A PF A PF A PF A PF A PF A PF A PF A PF A PF A PF A PF A PF A PF A PF A PF");
}
Zvukpizduk(___fleshPlayer);
Zvukpizduk(___normalPlayer);
porchamoegoimushestva();
}
}
}
private const string Klyuch = "fapfap1337.sineblivoykasholki.palka";
private const string Imya = "stick_new_sound";
private const string Versiya = "1.0.0";
private const string Resurs = "SINEBLIVOYKASHOLKI.assets.fapfap.wav";
private static AudioClip ebashilovoZvuk;
private static ManualLogSource fapLogger;
private Harmony shaman;
private void Awake()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
fapLogger = ((BaseUnityPlugin)this).Logger;
shaman = new Harmony("fapfap1337.sineblivoykasholki.palka");
shaman.PatchAll(typeof(PatchPalki));
Zvukhuyuk();
}
private void OnDestroy()
{
Harmony obj = shaman;
if (obj != null)
{
obj.UnpatchSelf();
}
if ((Object)(object)ebashilovoZvuk != (Object)null)
{
Object.Destroy((Object)(object)ebashilovoZvuk);
ebashilovoZvuk = null;
}
}
private void Zvukhuyuk()
{
try
{
byte[] array;
using (Stream stream = ((object)this).GetType().Assembly.GetManifestResourceStream("SINEBLIVOYKASHOLKI.assets.fapfap.wav"))
{
if (stream == null)
{
fapLogger.LogError((object)"resurs proebalsya gdeto");
return;
}
array = new byte[stream.Length];
stream.Read(array, 0, array.Length);
}
int num = 0;
int num2 = 0;
int num3 = 0;
int num4 = 0;
int num5 = 0;
int num6 = 12;
while (num6 + 8 <= array.Length)
{
string text = Encoding.ASCII.GetString(array, num6, 4);
int num7 = BitConverter.ToInt32(array, num6 + 4);
int num8 = num6 + 8;
if (text == "fmt ")
{
num = BitConverter.ToInt16(array, num8 + 2);
num2 = BitConverter.ToInt32(array, num8 + 4);
num3 = BitConverter.ToInt16(array, num8 + 14);
}
else if (text == "data")
{
num4 = num8;
num5 = num7;
break;
}
num6 = num8 + num7 + (num7 & 1);
}
if (num < 1 || num2 < 1 || num3 != 16 || num5 < 2)
{
fapLogger.LogError((object)"wav kakoy-to krivoy blya");
return;
}
int num9 = num5 / 2;
float[] array2 = new float[num9];
for (int i = 0; i < num9; i++)
{
array2[i] = (float)BitConverter.ToInt16(array, num4 + i * 2) / 32768f;
}
ebashilovoZvuk = AudioClip.Create("PalkaEbashit", num9 / num, num, num2, false);
ebashilovoZvuk.SetData(array2, 0);
fapLogger.LogInfo((object)"vse, zvuk ebashit, fapfap rulaez");
}
catch (Exception ex)
{
fapLogger.LogError((object)("ne smogli skushat wav: " + ex.Message));
}
}
private static void Zvukpizduk(MMF_Player igrok)
{
if (igrok?.FeedbacksList == null || (Object)(object)ebashilovoZvuk == (Object)null)
{
return;
}
foreach (MMF_Feedback feedbacks in igrok.FeedbacksList)
{
MMF_MMSoundManagerSound val = (MMF_MMSoundManagerSound)(object)((feedbacks is MMF_MMSoundManagerSound) ? feedbacks : null);
if (val != null)
{
val.SoundDataSO = null;
val.AudioResourceToPlay = null;
val.Sfx = ebashilovoZvuk;
val.RandomSfx = Array.Empty<AudioClip>();
((MMF_Feedback)val).Active = false;
continue;
}
MMF_Sound val2 = (MMF_Sound)(object)((feedbacks is MMF_Sound) ? feedbacks : null);
if (val2 != null)
{
val2.Sfx = ebashilovoZvuk;
val2.RandomSfx = Array.Empty<AudioClip>();
((MMF_Feedback)val2).Active = false;
}
}
}
private static void porchamoegoimushestva()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
if (!((Object)(object)ebashilovoZvuk == (Object)null))
{
GameObject val = new GameObject("palka_audio_hueta");
AudioSource obj = val.AddComponent<AudioSource>();
obj.playOnAwake = false;
obj.spatialBlend = 0f;
obj.clip = ebashilovoZvuk;
obj.Play();
Object.Destroy((Object)val, ebashilovoZvuk.length + 0.1f);
}
}
}
}