using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using MoveStylerApi;
using Reptile;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("RabbitMS")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Rabbit Movestyle")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RabbitMS")]
[assembly: AssemblyTitle("RabbitMS")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
internal static class JsonUtilityEx
{
[Serializable]
private class Wrapper<T>
{
public T[] array;
}
public static T[] getJsonArray<T>(string json)
{
return JsonUtility.FromJson<Wrapper<T>>("{ \"array\": " + json + "}").array;
}
public static string arrayToJson<T>(T[] array)
{
return JsonUtility.ToJson((object)new Wrapper<T>
{
array = array
});
}
}
namespace MoveStyler.Utility
{
public class TextureUtil
{
public static Texture2D GetTextureFromBitmap(Bitmap bitmap, FilterMode filterMode = 1)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: 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_0042: Expected O, but got Unknown
byte[] array = (byte[])((TypeConverter)new ImageConverter()).ConvertTo((object?)bitmap, typeof(byte[]));
Texture2D val = new Texture2D(((Image)bitmap).Width, ((Image)bitmap).Height);
ImageConversion.LoadImage(val, array);
((Texture)val).filterMode = filterMode;
val.Apply();
return val;
}
}
}
namespace RabbitMS
{
[BepInPlugin("Ariki.RabbitMS", "RabbitMS", "1.0.0")]
[BepInDependency("Ariki.MoveStylers", "4.0.0")]
public class Plugin : BaseUnityPlugin
{
private const string MoveStylerGUID = "Ariki.MoveStylers";
private const string MoveStylerVersion = "4.0.0";
private const string HopMovestyleGUID = "cea6de7b-eac4-44c1-bb4e-d9263467d9df";
private const string HopMovestyleName = "Hop";
public static float hopComboTime = 0.5f;
public static float hopTimer = 0f;
public static int hopCombo = 0;
public static float[] hopMultiplier = new float[3] { 0.5f, 1f, 3f };
private static Player _player;
private static int hopMoveStyleID = -1;
private static ManualLogSource DebugLog = Logger.CreateLogSource("Rabbit Plugin");
private void Awake()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
((BaseUnityPlugin)this).Logger.LogMessage((object)"RabbitMS v1.0.0 starting...");
new Harmony("ariki.RabbitMS").PatchAll();
}
private void FixedUpdate()
{
if ((double)hopTimer > 0.0)
{
hopTimer -= Core.dt;
if ((double)hopTimer <= 0.0 && (Object)(object)_player != (Object)null)
{
endHopCombo(_player);
_player = null;
}
}
}
public static void Hop(Player _p, bool farJump = false)
{
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
hopTimer = 30f;
_player = _p;
_p.StopCurrentAbility();
_p.jumpedThisFrame = true;
_p.isJumping = true;
_p.maintainSpeedJump = true;
_p.jumpConsumed = true;
_p.jumpRequested = false;
_p.jumpedThisFrame = true;
_p.timeSinceLastJump = 0f;
_p.ForceUnground(true);
_p.radialHitbox.SetActive(true);
_p.AudioManager.PlaySfxGameplay((SfxCollectionID)20, (AudioClipID)130, _p.playerOneShotAudioSource, 0f);
_p.PlayVoice((AudioClipID)489, (VoicePriority)0, true);
float jumpSpeed = _p.jumpSpeed;
if (hopCombo == 1)
{
_p.PlayAnim(Animator.StringToHash("jumpTrick2"), true, false, -1f);
jumpSpeed *= 2f;
_p.scoreFactor = 3f;
_p.currentTrickPoints = 50;
_p.DoTrick((TrickType)0, "Jump", 0);
}
else
{
_p.PlayAnim(Animator.StringToHash("jumpTrick1"), true, false, -1f);
jumpSpeed *= 1.25f;
_p.scoreFactor = 1.5f;
_p.currentTrickPoints = 50;
_p.DoTrick((TrickType)0, "Skip", 0);
}
if (farJump)
{
Vector3 dir = _p.dir;
Vector3 velocity = ((Vector3)(ref dir)).normalized + Vector3.up * 0.75f;
velocity = ((Vector3)(ref velocity)).normalized * jumpSpeed;
_p.motor.velocity = velocity;
_p.DoJumpEffects(((Vector3)(ref velocity)).normalized);
}
else
{
Vector3 normalized = ((Vector3)(ref _p.moveInput)).normalized;
Vector3 val = Vector3.Scale(_p.motor.velocity, new Vector3(1f, 0f, 1f));
Vector3 velocity2 = ((Vector3)(ref normalized)).normalized * ((Vector3)(ref val)).magnitude;
velocity2.y = jumpSpeed;
_p.DoJumpEffects(_p.motor.groundNormalVisual * -1f);
_p.motor.velocity = velocity2;
}
hopCombo = (hopCombo + 1) % 3;
}
public static void endHopCombo(Player _p)
{
hopCombo = 0;
hopTimer = 0f;
_p.scoreFactor = 1f;
}
public static void hopLand(Player _p)
{
hopTimer = hopComboTime;
if (hopCombo >= 2)
{
endHopCombo(_p);
}
}
public static int getMovestyleID()
{
if (hopMoveStyleID > 5)
{
return hopMoveStyleID;
}
if (MoveStyleAPIDatabase.IsInitialized)
{
return MoveStyleAPIDatabase.GetMovestyleFromName("Hop");
}
return -1;
}
public static bool isHopMovestyle(MoveStyle moveStyle)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Invalid comparison between I4 and Unknown
return getMovestyleID() == (int)moveStyle;
}
}
[HarmonyPatch(typeof(Player))]
public class PlayerPatches
{
private static ManualLogSource DebugLog = Logger.CreateLogSource("Rabbit Player Patch");
[HarmonyPrefix]
[HarmonyPatch("HandleJump")]
public static bool HandleJumpPatch(Player __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (Plugin.isHopMovestyle(__instance.moveStyle))
{
bool flag = true;
flag = !__instance.jumpConsumed && flag && (Object)(object)__instance.vertShape == (Object)null && (__instance.IsGrounded() || __instance.timeSinceLastAbleToJump <= __instance.JumpPostGroundingGraceTime);
__instance.jumpedThisFrame = false;
__instance.timeSinceJumpRequested += Core.dt;
if (__instance.jumpRequested && flag)
{
if (Plugin.hopTimer > 0f)
{
Plugin.Hop(__instance, __instance.boostButtonHeld);
return false;
}
__instance.currentTrickPoints = 0;
__instance.DoTrick((TrickType)0, "Hop", 0);
}
}
return true;
}
[HarmonyPostfix]
[HarmonyPatch("OnLanded")]
public static void OnLandedPatch(Player __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (Plugin.isHopMovestyle(__instance.moveStyle))
{
Plugin.hopLand(__instance);
}
}
}
[HarmonyPatch(typeof(CharacterVisual))]
public class CharacterVisualPatches
{
[HarmonyPostfix]
[HarmonyPatch("SetMoveStyleVisualProps")]
public static void SetMoveStyleVisualPropsPatch(CharacterVisual __instance, Player player, MoveStyle setMoveStyle)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Invalid comparison between Unknown and I4
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
if ((int)setMoveStyle == Plugin.getMovestyleID())
{
((Component)__instance.footL).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
((Component)__instance.footR).transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
}
else
{
((Component)__instance.footL).transform.localScale = new Vector3(1f, 1f, 1f);
((Component)__instance.footR).transform.localScale = new Vector3(1f, 1f, 1f);
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "RabbitMS";
public const string PLUGIN_NAME = "RabbitMS";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace RabbitMS.Properties
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
public class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
resourceMan = new ResourceManager("RabbitMS.Properties.Resources", typeof(Resources).Assembly);
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
public static Bitmap logo_background => (Bitmap)ResourceManager.GetObject("logo_background", resourceCulture);
public static Bitmap phoneAppIcon => (Bitmap)ResourceManager.GetObject("phoneAppIcon", resourceCulture);
internal Resources()
{
}
}
}
namespace OutfitSwitcher
{
public static class LoadUtil
{
public static readonly BindingFlags BindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
public static Assets GetAssets(CharacterLoader instance)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
return (Assets)(((object)instance).GetType().GetField("assets", BindingFlags)?.GetValue(instance));
}
public static MethodInfo GetMethod(this object instance, string name)
{
return instance.GetType().GetMethod(name, BindingFlags);
}
public static void InvokeMethod(this object instance, string name, params object[] parameters)
{
Traverse.Create(instance).Method(name, parameters).GetValue(parameters);
}
public static void InvokeMethod(this object instance, string name, Type[] types, params object[] parameters)
{
Traverse.Create(instance).Method(name, types, (object[])null).GetValue(parameters);
}
public static FieldInfo GetField(this object instance, string name)
{
return instance.GetType().GetField(name, BindingFlags);
}
public static T GetComponentValue<T>(this object instance, string name) where T : Component
{
object? value = instance.GetField(name).GetValue(instance);
return (T)((value is T) ? value : null);
}
public static T GetFieldValue<T>(this object instance, string name) where T : class
{
return instance.GetField(name).GetValue(instance) as T;
}
public static void SetField(this object instance, string name, object value)
{
instance.GetField(name).SetValue(instance, value);
}
}
}
namespace OutfitSwitcher.Patches
{
[HarmonyPatch(typeof(Player))]
internal class OutfitSwitcherPlayerPatch
{
private static ManualLogSource DebugLog = Logger.CreateLogSource("Outfit Switcher Player Patch");
[HarmonyPostfix]
[HarmonyPatch("SwitchToEquippedMovestyle")]
public static void SwitchToEquippedMovestylePatch()
{
}
}
}