using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BunchOfEmotes;
using BunchOfEmotes.Patches;
using CommonAPI;
using CommonAPI.Phone;
using HarmonyLib;
using MapStation.API;
using Reptile;
using Reptile.Phone;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MyUnityGameMod1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MyUnityGameMod1")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e59b1fb1-39dd-4018-81da-ce9714f55f21")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[HarmonyPatch(typeof(SitAbility))]
internal class SitAbilityPatch
{
[HarmonyPrefix]
[HarmonyPatch("SetState")]
private static bool SetState_Prefix(SitAbility __instance, State setState)
{
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Invalid comparison between Unknown and I4
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Invalid comparison between Unknown and I4
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Invalid comparison between Unknown and I4
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Invalid comparison between Unknown and I4
if (BunchOfEmotesPlugin.traversal && BunchOfEmotesPlugin.inAnimation)
{
((Ability)__instance).rotateSpeed = BunchOfEmotesPlugin.myTraversalTurningRadius.Value;
((Ability)__instance).normalRotation = true;
}
else
{
((Ability)__instance).rotateSpeed = -1f;
((Ability)__instance).normalRotation = false;
}
if (BunchOfEmotesPlugin.customMenu)
{
if ((int)setState != 1)
{
return true;
}
if ((int)setState == 1)
{
int childCount = ((Component)BunchOfEmotesPlugin.player).transform.GetChild(0).childCount;
((Ability)__instance).p.StopCurrentAbility();
((Component)((Component)BunchOfEmotesPlugin.player).transform.GetChild(0).GetChild(childCount - 1).GetChild(0)).GetComponent<Animator>().runtimeAnimatorController = BunchOfEmotesPlugin.myAnim;
BunchOfEmotesPlugin.player.anim.SetLayerWeight(5, 0f);
}
if (((Ability)__instance).p.curAnim != __instance.startSitHash && ((Ability)__instance).p.curAnim != __instance.stopSitHash)
{
BunchOfEmotesPlugin.player.anim.SetLayerWeight(5, 0f);
((Ability)__instance).p.StopCurrentAbility();
return false;
}
return true;
}
if ((int)setState == 1 && !BunchOfEmotesPlugin.inAnimation)
{
((Ability)__instance).p.PlayAnim(__instance.stopSitHash, false, false, -1f);
return true;
}
if ((int)setState != 1)
{
return true;
}
if (((Ability)__instance).p.curAnim != __instance.startSitHash && ((Ability)__instance).p.curAnim != __instance.stopSitHash)
{
((Ability)__instance).rotateSpeed = -1f;
BunchOfEmotesPlugin.inAnimation = false;
((Ability)__instance).normalRotation = false;
int childCount2 = ((Component)BunchOfEmotesPlugin.player).transform.GetChild(0).childCount;
BunchOfEmotesPlugin.player.anim.SetLayerWeight(5, 0f);
((Component)((Component)BunchOfEmotesPlugin.player).transform.GetChild(0).GetChild(childCount2 - 1).GetChild(0)).GetComponent<Animator>().runtimeAnimatorController = BunchOfEmotesPlugin.myAnim;
((Ability)__instance).p.StopCurrentAbility();
return false;
}
return true;
}
}
namespace BunchOfEmotes
{
public class FavouriteApp : CustomApp
{
public bool Actualyfilled = false;
public override bool Available => false;
public static void Initialize()
{
PhoneAPI.RegisterApp<FavouriteApp>("Emote select", (Sprite)null);
}
public override void OnAppDisable()
{
BunchOfEmotesPlugin.phoneSlotSave[999] = base.ScrollView.SelectedIndex;
}
public override void OnAppInit()
{
if (BunchOfEmotesPlugin.myCustomAnimsInject.Count == 0 && (Object)(object)BunchOfEmotesPlugin.myAnim != (Object)null)
{
string clipPath = BunchOfEmotesPlugin.BunchOfEmotesPath + "/bunchofemotes";
BunchOfEmotesPlugin.AddAnimationClipToController(BunchOfEmotesPlugin.myAnim, clipPath);
BunchOfEmotesPlugin.initEmotes();
}
((CustomApp)this).OnAppInit();
((CustomApp)this).CreateIconlessTitleBar("Select Emote", 80f);
base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f);
try
{
SimplePhoneButton val = PlayEmote(1);
}
catch
{
SimplePhoneButton val = null;
}
int num = 0;
foreach (KeyValuePair<int, string> item in BunchOfEmotesPlugin.myCustomAnimsInject)
{
Actualyfilled = true;
SimplePhoneButton val;
try
{
val = PlayEmote(num);
}
catch
{
Console.WriteLine("error while initialising PlayEmote " + num + ". Skipping");
val = PlayEmote(1);
}
base.ScrollView.AddButton((PhoneButton)(object)val);
num++;
}
}
private SimplePhoneButton PlayEmote(int Index)
{
SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton(BunchOfEmotesPlugin.myCustomAnimsInject.ElementAt(Index).Value);
((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
{
BunchOfEmotesPlugin.inAnimation = true;
BunchOfEmotesPlugin.player.ActivateAbility((Ability)(object)BunchOfEmotesPlugin.player.sitAbility);
BunchOfEmotesPlugin.player.PlayAnim(BunchOfEmotesPlugin.myCustomAnimsInject.ElementAt(Index).Key, false, false, -1f);
BunchOfEmotesPlugin.player.ui.TurnOn(true);
});
return val;
}
public override void OnAppEnable()
{
base.ScrollView.RemoveAllButtons();
if (BunchOfEmotesPlugin.myCustomAnimsInject.Count == 0 && (Object)(object)BunchOfEmotesPlugin.myAnim != (Object)null)
{
string clipPath = BunchOfEmotesPlugin.BunchOfEmotesPath + "/bunchofemotes";
BunchOfEmotesPlugin.AddAnimationClipToController(BunchOfEmotesPlugin.myAnim, clipPath);
BunchOfEmotesPlugin.initEmotes();
}
try
{
SimplePhoneButton val = PlayEmote(1);
}
catch
{
SimplePhoneButton val = null;
}
int num = 0;
foreach (KeyValuePair<int, string> item in BunchOfEmotesPlugin.myCustomAnimsInject)
{
Actualyfilled = true;
SimplePhoneButton val;
try
{
val = PlayEmote(num);
}
catch
{
Console.WriteLine("error while initialising PlayEmote " + num + ". Skipping");
val = PlayEmote(1);
}
base.ScrollView.AddButton((PhoneButton)(object)val);
num++;
}
if (BunchOfEmotesPlugin.phoneSlotSave.ContainsKey(999))
{
if (BunchOfEmotesPlugin.phoneSlotSave[999] != 0)
{
base.ScrollView.SelectedIndex = BunchOfEmotesPlugin.phoneSlotSave[999];
base.ScrollView.UpdateButtons();
base.ScrollView.ScrollUp();
base.ScrollView.ScrollDown();
base.ScrollView.CancelAnimation();
}
}
else
{
BunchOfEmotesPlugin.phoneSlotSave[999] = 0;
}
}
public void NullCheck()
{
base.ScrollView.RemoveAllButtons();
try
{
SimplePhoneButton val = PlayEmote(1);
}
catch
{
SimplePhoneButton val = null;
}
int num = 0;
foreach (KeyValuePair<int, string> item in BunchOfEmotesPlugin.myCustomAnimsInject)
{
SimplePhoneButton val;
try
{
val = PlayEmote(num);
}
catch
{
Console.WriteLine("error while initialising PlayEmote " + num + ". Skipping");
val = PlayEmote(1);
}
base.ScrollView.AddButton((PhoneButton)(object)val);
num++;
}
}
}
public class CustomEmotesApp : CustomApp
{
public override bool Available => false;
public static void Initialize()
{
PhoneAPI.RegisterApp<CustomEmotesApp>("Emote select", (Sprite)null);
}
public override void OnAppDisable()
{
BunchOfEmotesPlugin.phoneSlotSave[EmoteApps.currSlot] = base.ScrollView.SelectedIndex;
}
public override void OnAppInit()
{
if (BunchOfEmotesPlugin.myCustomAnims.Count == 0 && (Object)(object)BunchOfEmotesPlugin.myAnim != (Object)null)
{
string clipPath = BunchOfEmotesPlugin.BunchOfEmotesPath + "/bunchofemotes";
BunchOfEmotesPlugin.AddAnimationClipToController(BunchOfEmotesPlugin.myAnim, clipPath);
BunchOfEmotesPlugin.initEmotes();
}
((CustomApp)this).OnAppInit();
((CustomApp)this).CreateIconlessTitleBar("Select Emote", 80f);
base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f);
try
{
SimplePhoneButton val = PlayEmote(1);
}
catch
{
SimplePhoneButton val = null;
}
int num = 0;
foreach (KeyValuePair<int, string> item in BunchOfEmotesPlugin.myCustomAnims2)
{
SimplePhoneButton val;
try
{
val = PlayEmote(num);
}
catch
{
Console.WriteLine("error while initialising PlayEmote " + num + ". Skipping");
val = PlayEmote(1);
}
base.ScrollView.AddButton((PhoneButton)(object)val);
num++;
}
}
public override void OnAppEnable()
{
if (BunchOfEmotesPlugin.phoneSlotSave.ContainsKey(EmoteApps.currSlot))
{
if (BunchOfEmotesPlugin.phoneSlotSave[EmoteApps.currSlot] != 0)
{
base.ScrollView.SelectedIndex = BunchOfEmotesPlugin.phoneSlotSave[EmoteApps.currSlot];
base.ScrollView.UpdateButtons();
base.ScrollView.ScrollUp();
base.ScrollView.ScrollDown();
base.ScrollView.CancelAnimation();
}
}
else
{
BunchOfEmotesPlugin.phoneSlotSave[EmoteApps.currSlot] = 0;
}
}
private SimplePhoneButton PlayEmote(int Index)
{
SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton(BunchOfEmotesPlugin.myCustomAnims2.ElementAt(Index).Value);
((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
{
BunchOfEmotesPlugin.inAnimation = true;
BunchOfEmotesPlugin.player.ActivateAbility((Ability)(object)BunchOfEmotesPlugin.player.sitAbility);
BunchOfEmotesPlugin.player.PlayAnim(BunchOfEmotesPlugin.myCustomAnims2.ElementAt(Index).Key, false, false, -1f);
BunchOfEmotesPlugin.Log.LogMessage((object)((Object)((RuntimeAnimatorController)BunchOfEmotesPlugin.GlobalControllers).animationClips[Index + BunchOfEmotesPlugin.trueCustomIndex]).name);
BunchOfEmotesPlugin.Log.LogMessage((object)BunchOfEmotesPlugin.myCustomAnims2.ElementAt(Index).Value);
BunchOfEmotesPlugin.player.ui.TurnOn(true);
});
return val;
}
public void SetBundleFilter(int bundle = 0)
{
if (bundle == 0)
{
return;
}
BunchOfEmotesPlugin.Log.LogInfo((object)("bundle : " + bundle));
base.ScrollView.RemoveAllButtons();
SimplePhoneButton val = PlayEmote(1);
int num = 0;
int num2 = 1;
long num3 = 0L;
long num4 = 0L;
if (bundle != 1)
{
FileInfo[] fileInfo = BunchOfEmotesPlugin.fileInfo;
foreach (FileInfo fileInfo2 in fileInfo)
{
num3 = BunchOfEmotesPlugin.lengthOfEmotes[bundle - 2];
num4 = BunchOfEmotesPlugin.lengthOfEmotes[bundle - 1];
num2++;
}
}
int num5 = BunchOfEmotesPlugin.lengthOfEmotes[1] - BunchOfEmotesPlugin.lengthOfEmotes[0];
int trueCustomIndex = BunchOfEmotesPlugin.trueCustomIndex;
if (bundle == 1)
{
foreach (KeyValuePair<int, string> item in BunchOfEmotesPlugin.myCustomAnims2)
{
if (num < BunchOfEmotesPlugin.lengthOfEmotes[0] - trueCustomIndex)
{
val = PlayEmote(num);
base.ScrollView.AddButton((PhoneButton)(object)val);
num++;
}
}
return;
}
foreach (KeyValuePair<int, string> item2 in BunchOfEmotesPlugin.myCustomAnims2)
{
if (num > num3 - (trueCustomIndex + 1) && num < num4 - trueCustomIndex)
{
val = PlayEmote(num);
base.ScrollView.AddButton((PhoneButton)(object)val);
}
num++;
}
}
}
public class BaseEmotesApp : CustomApp
{
public bool Actualyfilled = false;
public override bool Available => false;
public static void Initialize()
{
PhoneAPI.RegisterApp<BaseEmotesApp>("Emote select", (Sprite)null);
}
public override void OnAppDisable()
{
BunchOfEmotesPlugin.phoneSlotSave[0] = base.ScrollView.SelectedIndex;
}
public override void OnAppInit()
{
if (BunchOfEmotesPlugin.myCustomAnims.Count == 0 && (Object)(object)BunchOfEmotesPlugin.myAnim != (Object)null)
{
string clipPath = BunchOfEmotesPlugin.BunchOfEmotesPath + "/bunchofemotes";
BunchOfEmotesPlugin.AddAnimationClipToController(BunchOfEmotesPlugin.myAnim, clipPath);
BunchOfEmotesPlugin.initEmotes();
}
((CustomApp)this).OnAppInit();
((CustomApp)this).CreateIconlessTitleBar("Select Emote", 80f);
base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f);
try
{
SimplePhoneButton val = PlayEmote(1);
}
catch
{
SimplePhoneButton val = null;
}
int num = 0;
foreach (KeyValuePair<int, string> myCustomAnim in BunchOfEmotesPlugin.myCustomAnims)
{
Actualyfilled = true;
SimplePhoneButton val;
try
{
val = PlayEmote(num);
}
catch
{
Console.WriteLine("error while initialising PlayEmote " + num + ". Skipping");
val = PlayEmote(1);
}
base.ScrollView.AddButton((PhoneButton)(object)val);
num++;
}
}
private SimplePhoneButton PlayEmote(int Index)
{
SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton(BunchOfEmotesPlugin.myCustomAnims.ElementAt(Index).Value);
((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
{
BunchOfEmotesPlugin.inAnimation = true;
BunchOfEmotesPlugin.player.ActivateAbility((Ability)(object)BunchOfEmotesPlugin.player.sitAbility);
BunchOfEmotesPlugin.player.PlayAnim(BunchOfEmotesPlugin.myCustomAnims.ElementAt(Index).Key, false, false, -1f);
BunchOfEmotesPlugin.player.ui.TurnOn(true);
});
return val;
}
public override void OnAppEnable()
{
if (BunchOfEmotesPlugin.phoneSlotSave.ContainsKey(0))
{
if (BunchOfEmotesPlugin.phoneSlotSave[0] != 0)
{
base.ScrollView.SelectedIndex = BunchOfEmotesPlugin.phoneSlotSave[0];
base.ScrollView.UpdateButtons();
base.ScrollView.ScrollUp();
base.ScrollView.ScrollDown();
base.ScrollView.CancelAnimation();
}
}
else
{
BunchOfEmotesPlugin.phoneSlotSave[0] = 0;
}
}
public void NullCheck()
{
base.ScrollView.RemoveAllButtons();
try
{
SimplePhoneButton val = PlayEmote(1);
}
catch
{
SimplePhoneButton val = null;
}
int num = 0;
foreach (KeyValuePair<int, string> myCustomAnim in BunchOfEmotesPlugin.myCustomAnims)
{
SimplePhoneButton val;
try
{
val = PlayEmote(num);
}
catch
{
Console.WriteLine("error while initialising PlayEmote " + num + ". Skipping");
val = PlayEmote(1);
}
base.ScrollView.AddButton((PhoneButton)(object)val);
num++;
}
}
}
public class EmoteApps : CustomApp
{
private static Sprite IconSprite;
public static bool inOnce;
public static int currSlot;
public static void Initialize()
{
try
{
IconSprite = TextureUtility.LoadSprite(Path.Combine(BunchOfEmotesPlugin.BunchOfEmotesPath, "Homescreen Icon.png"));
}
catch
{
Console.WriteLine("error loading icon sprite for Bunch Of Emotes, Check if the icon for the app is present");
IconSprite = null;
}
PhoneAPI.RegisterApp<EmoteApps>("Emotes", IconSprite);
}
public override void OnAppEnable()
{
((App)this).OnAppEnable();
base.ScrollView.RemoveAllButtons();
SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Toggle traversal");
SimplePhoneButton obj = val;
((PhoneButton)obj).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj).OnConfirm, (Action)delegate
{
BunchOfEmotesPlugin.timer = 5f;
BunchOfEmotesPlugin.traversal = !BunchOfEmotesPlugin.traversal;
if (BunchOfEmotesPlugin.traversal)
{
UI.Instance.ShowNotification("", "Traversal ON", "");
}
else
{
UI.Instance.ShowNotification("", "Traversal OFF", "");
}
});
base.ScrollView.AddButton((PhoneButton)(object)val);
val = PhoneUIUtility.CreateSimpleButton("Favourite list");
SimplePhoneButton obj2 = val;
((PhoneButton)obj2).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj2).OnConfirm, (Action)delegate
{
currSlot = 999;
((App)this).MyPhone.GetAppInstance<FavouriteApp>().NullCheck();
((App)this).MyPhone.OpenApp(typeof(FavouriteApp));
});
base.ScrollView.AddButton((PhoneButton)(object)val);
val = PhoneUIUtility.CreateSimpleButton("Base emotes");
SimplePhoneButton obj3 = val;
((PhoneButton)obj3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj3).OnConfirm, (Action)delegate
{
currSlot = 0;
BunchOfEmotesPlugin.customMenu = false;
BunchOfEmotesPlugin.initEmotes();
((App)this).MyPhone.GetAppInstance<BaseEmotesApp>().NullCheck();
((App)this).MyPhone.OpenApp(typeof(BaseEmotesApp));
});
base.ScrollView.AddButton((PhoneButton)(object)val);
val = PhoneUIUtility.CreateSimpleButton("Bundle 1");
SimplePhoneButton obj4 = val;
((PhoneButton)obj4).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj4).OnConfirm, (Action)delegate
{
currSlot = 1;
((App)this).MyPhone.GetAppInstance<CustomEmotesApp>().SetBundleFilter(1);
((App)this).MyPhone.OpenApp(typeof(CustomEmotesApp));
});
base.ScrollView.AddButton((PhoneButton)(object)val);
int num = 2;
int num2 = BunchOfEmotesPlugin.fileInfo.Length + 1;
FileInfo[] fileInfo = BunchOfEmotesPlugin.fileInfo;
foreach (FileInfo fileInfo2 in fileInfo)
{
val = PhoneUIUtility.CreateSimpleButton("Bundle " + num);
int capturez = num;
SimplePhoneButton obj5 = val;
((PhoneButton)obj5).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj5).OnConfirm, (Action)delegate
{
try
{
currSlot = capturez;
((App)this).MyPhone.GetAppInstance<CustomEmotesApp>().SetBundleFilter(capturez);
((App)this).MyPhone.OpenApp(typeof(CustomEmotesApp));
}
catch (Exception)
{
BunchOfEmotesPlugin.Log.LogError((object)"Non existing bundle oopsie !");
}
});
base.ScrollView.AddButton((PhoneButton)(object)val);
num++;
}
if (BunchOfEmotesPlugin.phoneSlotSave.ContainsKey(998))
{
if (BunchOfEmotesPlugin.phoneSlotSave[998] != 0)
{
base.ScrollView.SelectedIndex = BunchOfEmotesPlugin.phoneSlotSave[998];
base.ScrollView.UpdateButtons();
base.ScrollView.ScrollUp();
base.ScrollView.ScrollDown();
base.ScrollView.CancelAnimation();
}
}
else
{
BunchOfEmotesPlugin.phoneSlotSave[998] = 0;
}
}
public override void OnAppDisable()
{
BunchOfEmotesPlugin.phoneSlotSave[998] = base.ScrollView.SelectedIndex;
}
public override void OnAppInit()
{
((CustomApp)this).OnAppInit();
((CustomApp)this).CreateTitleBar("Emotes", IconSprite, 80f);
base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f);
}
}
[BepInPlugin("com.Dragsun.BunchOfEmotes", "Bunch of emotes", "2.2.2")]
public class BunchOfEmotesPlugin : BaseUnityPlugin
{
private const string MyGUID = "com.Dragsun.BunchOfEmotes";
private const string PluginName = "Bunch of emotes";
private const string VersionString = "2.2.2";
public static string KeyboardPlusKey = "Next emote";
public static string KeyboardMinusKey = "Previous emote";
public static string KeyboardConfirmKey = "Confirm / Open menu";
public static string KeyboardSwapKey = "Swap between injected and normal emotes";
public static ConfigEntry<KeyboardShortcut> KeyboardPlus;
public static ConfigEntry<KeyboardShortcut> KeyboardMinus;
public static ConfigEntry<KeyboardShortcut> KeyboardConfirm;
public static ConfigEntry<KeyboardShortcut> KeyboardSwap;
public static ConfigEntry<bool> customList;
public static ConfigEntry<bool> wantACustomListOfInject;
public static ConfigEntry<bool> reloadAllBundles;
public static ConfigEntry<string> myCustomList;
public static ConfigEntry<bool> myWantReload;
public static ConfigEntry<string> myCustomListOfInject;
public static ConfigEntry<float> myTraversalTurningRadius;
public static ConfigEntry<float> myTraversalSpeed;
public static DieAbility dieAbility;
public static StageManager stageManager;
public static bool showMenu = false;
public static bool traversal = false;
public static bool myVariable = true;
public static float timer = 0f;
public static bool keyIsPressed = false;
public static bool inAnimation = false;
public static string customListKey = "Enable custom default list";
public static string wantACustomListOfInjectKey = "Swap injected list to favorite list (old menu)";
public static string wantReload = "Reloads all pack on f5";
public static string myCustomListKey = "Default emotes list";
public static string myCustomListOfInjectKey = "Favorite emotes list";
public static string traversalSpeed = "Forward speed";
public static string traversalTurningRadius = "Turning speed";
public static string popularList = "propFrankBallIdle,frankBallIdle,knockback,housedanceLoop,softBounce1,freestyle1,softBounce2,freestyle2,softBounce3,freestyle3,softBounce4,freestyle4,softBounce5,freestyle5,softBounce6,freestyle6,softBounce7,freestyle7,softBounce8,freestyle8,softBounce9,freestyle9,softBounce10,freestyle10,softBounce11,freestyle11,softBounce12,freestyle12,softBounce13,freestyle13,softBounce14,freestyle14,softBounce15,freestyle15,softBounce16,freestyle16,softBounce17,freestyle17,softBounce18,freestyle18,freestyle19,sit,squat,sitSadFloor,SolaceSit,sitLegsCrossed,redsitGroundIdle,dance1,dance2,dance3,dance4,dance5,dance6,dance7,dance8,dance9,solaceLayingDown,tryceCrossedArms,redKnockedOut,die,crouchingIdle,storyLookAround,leanWall,leanWallStill,tryceLeaningArmIdle,FauxSit,sitLaidback,IrenePowerPose,rightHandOnHipIdle,presentingIdle,lockpickIdle,headScrewing,joinCypher1,joinCypher2,joinCypher3,joinCypher4,joinCypher5,getUp,highFiveIdle,highFiveEndIdle,surrender,VinylStrangledIdle,DJStranglesIdle,lieDown,lockpickIdle,frankHandsOnHipsIdle,pushedAgainstWallIdle,HandsOnHipsIdle,belStandingPhoneIdle,jetpackCaptainSit,redCrouchIdle,headScrewing,frankBallTaunt,berlageStorySitIdle1,copStoryIdle,copStoryIdleCrossedArms,copStorySaluteIdle,RedHeadacheIdle,tryceCrouch,tryceCrouchLook,belCrouchLook,belCrouch,Ayoooo,SolaceBetweenBuildingsIdle,SolaceBetweenBuildingsTalkIdle,sitPhoneHighTyping,IreneCall,sitPhoneTyping,getHit,getHitBig,getHitFar,getHitShieldBash";
private static readonly Harmony Harmony = new Harmony("com.Dragsun.BunchOfEmotes");
public static ManualLogSource Log = new ManualLogSource("Bunch of emotes");
public static GameplayUI ui;
private readonly string animationFolder = Path.Combine(Application.streamingAssetsPath, "Mods", "BunchOfEmotes", "Anims");
public static Vector3 playerpos1;
private float keyPressStartTime = 0f;
public static int myAnimationKey = 0;
public static int childcount = 0;
public static Dictionary<int, int> phoneSlotSave = new Dictionary<int, int>();
public static Dictionary<int, string> myCustomAnims = new Dictionary<int, string>();
public static Dictionary<int, string> myCustomAnims2 = new Dictionary<int, string>();
public static Dictionary<int, string> myCustomAnimsInject = new Dictionary<int, string>();
private float holdDurationThreshold = 0.5f;
public static string BunchOfEmotesPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
public static bool customMenu = false;
public static NPC myNPC;
public static RuntimeAnimatorController myAnim;
public static RuntimeAnimatorController myAnimBMX;
public static RuntimeAnimatorController myAnimInlines;
public static RuntimeAnimatorController myAnimSkateboard;
public static RuntimeAnimatorController myAnimUntouched;
public static RuntimeAnimatorController myAnim2;
public static Animation anim;
public static AssetBundle bundle;
public static AssetBundle bundleController;
public static AssetBundle bundleControllerinlines;
public static AssetBundle bundleControllerSkateboard;
public static int trueCustomIndex;
public static int[] customemoteshash;
public static int[] customemotesCheck = null;
public static List<int> lengthOfEmotes = new List<int>();
public static AnimatorOverrideController[] Controllers;
public static AnimatorOverrideController GlobalControllers = new AnimatorOverrideController();
public static RuntimeAnimatorController[] AControllers;
public static AnimationClip[] animationClips;
public static FileInfo[] fileInfo;
public static Animator playerAn;
public static BunchOfEmotesPlugin Instance { get; private set; }
public static Player player { get; set; }
public DirectoryInfo AssetFolder { get; protected set; }
private void Awake()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: 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_008d: Unknown result type (might be due to invalid IL or missing references)
KeyboardPlus = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("4 ---- Menu controls", KeyboardPlusKey, new KeyboardShortcut((KeyCode)91, Array.Empty<KeyCode>()), (ConfigDescription)null);
KeyboardMinus = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("4 ---- Menu controls", KeyboardMinusKey, new KeyboardShortcut((KeyCode)93, Array.Empty<KeyCode>()), (ConfigDescription)null);
KeyboardConfirm = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("4 ---- Menu controls", KeyboardConfirmKey, new KeyboardShortcut((KeyCode)110, Array.Empty<KeyCode>()), (ConfigDescription)null);
KeyboardSwap = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("4 ---- Menu controls", KeyboardSwapKey, new KeyboardShortcut((KeyCode)98, Array.Empty<KeyCode>()), (ConfigDescription)null);
customList = ((BaseUnityPlugin)this).Config.Bind<bool>("1 ---- Custom default list", customListKey, false, "The custom emote list replaces the default one when the mod is triggered. Find the full list on my GitHub.");
myCustomList = ((BaseUnityPlugin)this).Config.Bind<string>("1 ---- Custom default list", myCustomListKey, popularList, "Your custom list of animations must have no spaces and be separated by commas");
wantACustomListOfInject = ((BaseUnityPlugin)this).Config.Bind<bool>("2 ---- Favorite list", wantACustomListOfInjectKey, false, "A custom list but for the injected animations");
myWantReload = ((BaseUnityPlugin)this).Config.Bind<bool>("Reload bundles", wantReload, false, "Reloads all pack on f5");
myCustomListOfInject = ((BaseUnityPlugin)this).Config.Bind<string>("2 ---- Favorite list", myCustomListOfInjectKey, "jumpNEW,fallNEW,wallRunLeftNEW,grafSlashUP_RIGHT", "Same as the custom list, but this one also supports custom animations. Copy the full name perfectly.");
myTraversalSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("3 ---- Traversals", traversalSpeed, 0.8f, "The speed of traversal emotes");
myTraversalTurningRadius = ((BaseUnityPlugin)this).Config.Bind<float>("3 ---- Traversals", traversalTurningRadius, 10f, "The turn rate of the traversals");
KeyboardPlus.SettingChanged += ConfigSettingChanged;
Instance = this;
EmoteApps.Initialize();
BaseEmotesApp.Initialize();
FavouriteApp.Initialize();
CustomEmotesApp.Initialize();
Harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: Bunch of emotes, VersionString: 2.2.2 is loaded.");
Log = ((BaseUnityPlugin)this).Logger;
}
private void Update()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: 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)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0498: Unknown result type (might be due to invalid IL or missing references)
//IL_049d: Unknown result type (might be due to invalid IL or missing references)
//IL_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_052c: Unknown result type (might be due to invalid IL or missing references)
//IL_0531: Unknown result type (might be due to invalid IL or missing references)
//IL_056d: Unknown result type (might be due to invalid IL or missing references)
//IL_057c: Unknown result type (might be due to invalid IL or missing references)
//IL_058b: Unknown result type (might be due to invalid IL or missing references)
//IL_0595: Unknown result type (might be due to invalid IL or missing references)
//IL_059a: Unknown result type (might be due to invalid IL or missing references)
//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
//IL_05be: Unknown result type (might be due to invalid IL or missing references)
//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)player != (Object)null))
{
return;
}
if (myCustomAnims.Count == 0 && (Object)(object)myAnim != (Object)null)
{
string clipPath = BunchOfEmotesPath + "/bunchofemotes";
AddAnimationClipToController(myAnim, clipPath);
initEmotes();
}
KeyboardShortcut value = KeyboardMinus.Value;
if (((KeyboardShortcut)(ref value)).IsPressed())
{
if (keyPressStartTime == 0f && myAnimationKey != 0)
{
myAnimationKey--;
}
if (Time.time - keyPressStartTime > holdDurationThreshold)
{
keyPressStartTime = Time.time;
}
}
else
{
value = KeyboardPlus.Value;
if (((KeyboardShortcut)(ref value)).IsPressed())
{
if (keyPressStartTime == 0f && myAnimationKey != myCustomAnims.Count - 1)
{
myAnimationKey++;
}
if (Time.time - keyPressStartTime > holdDurationThreshold)
{
keyPressStartTime = Time.time;
}
}
else
{
keyPressStartTime = 0f;
}
}
value = KeyboardSwap.Value;
if (((KeyboardShortcut)(ref value)).IsDown() && myCustomAnims2 != null)
{
customMenu = !customMenu;
initEmotes();
}
if (showMenu)
{
if (myAnimationKey == 0)
{
if (myCustomAnims.Count != 1)
{
UI.Instance.ShowNotification("", myCustomAnims.ElementAt(myAnimationKey).Value + " <", myCustomAnims.ElementAt(myAnimationKey + 1).Value);
}
else
{
UI.Instance.ShowNotification("", myCustomAnims.ElementAt(myAnimationKey).Value + " <", "");
}
}
else if (myAnimationKey == myCustomAnims.Count - 1)
{
UI.Instance.ShowNotification(myCustomAnims.ElementAt(myAnimationKey - 1).Value, myCustomAnims.ElementAt(myAnimationKey).Value + " <", "");
}
else
{
UI.Instance.ShowNotification(myCustomAnims.ElementAt(myAnimationKey - 1).Value, myCustomAnims.ElementAt(myAnimationKey).Value + " <", myCustomAnims.ElementAt(myAnimationKey + 1).Value);
}
value = KeyboardConfirm.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
inAnimation = true;
childcount = ((Component)player).transform.GetChild(0).childCount;
if (customMenu && !wantACustomListOfInject.Value)
{
player.ActivateAbility((Ability)(object)player.sitAbility);
player.PlayAnim(myCustomAnims2.ElementAt(myAnimationKey).Key, false, false, -1f);
}
else if (customMenu && wantACustomListOfInject.Value)
{
player.ActivateAbility((Ability)(object)player.sitAbility);
player.PlayAnim(myCustomAnimsInject.ElementAt(myAnimationKey).Key, false, false, -1f);
}
else
{
player.ActivateAbility((Ability)(object)player.sitAbility);
player.PlayAnim(myCustomAnims.ElementAt(myAnimationKey).Key, false, false, -1f);
}
UI.Instance.HideNotification();
timer = 0.1f;
showMenu = false;
player.ui.TurnOn(true);
}
}
value = KeyboardConfirm.Value;
if (((KeyboardShortcut)(ref value)).IsDown() && ((object)(MoveStyle)(ref player.moveStyle)).ToString() == "ON_FOOT")
{
initEmotes();
}
if (timer > 0f)
{
timer -= Time.deltaTime;
}
if (!showMenu && timer <= 0f)
{
UI.Instance.HideNotification();
value = KeyboardConfirm.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
showMenu = true;
}
}
if (inAnimation && traversal)
{
Transform transform = ((Component)player).transform;
transform.position += ((Component)player).transform.forward * myTraversalSpeed.Value * Core.dt;
((Component)player).transform.rotation = Quaternion.LookRotation(((Component)player).transform.forward);
((Component)player.characterVisual).transform.rotation = Quaternion.LookRotation(((Component)player).transform.forward);
}
}
public static void initEmotes()
{
childcount = ((Component)player).transform.GetChild(0).childCount;
AnimationClip[] array = myAnim.animationClips;
if (customList.Value && myCustomList.Value != "")
{
myCustomAnims = FillDictionaryFromCommaSeparatedString(myCustomList.Value);
}
else
{
string input = "lieDown,sit,SolaceSit,surrender,HandsOnHipsIdle,belStandingPhoneIdle,redCrouchIdle,tryceCrossedArms,headScrewing,leanWall,leanWallStill,rightHandOnHipIdle,presentingIdle,redKnockedOut,redsitGroundIdle,crouchingIdle,berlageStorySitIdle1,berlageStorySitIdle2,berlageStorySitIdle3,copStoryIdle,copStoryIdleCrossedArms,copStorySaluteIdle,squatPhone,squatPhoneHuh,FauxSit,sitLaidback,oldheadAIdle,oldheadASitIdle,oldheadBIdle,oldheadBSitIdle,oldheadCIdle,oldheadCSitIdle,tryceCrouch,tryceCrouchLook,copRadio,belCrouchLook,belCrouch,sniperCaptainSlumpedIdle,Ayoooo,shoutStory,sitLegsCrossed,RedSnipedHandOnEyeIdle,RedSnipedEndIdle,sniperCaptainKO,VinylStrangledIdle,DJStranglesIdle,RedHeadacheIdle,SolaceBetweenBuildingsIdle,sitSadFloor,storyLookAround,belShowsToStandingPhone,IrenePowerPose,sitPhoneHighTyping,sitPhoneHigh,solaceLayingDown,IreneCall,belShowsIdlePhone,sitPhoneTyping,leanWallSlowClappingIdle,onCouchIdle,RedLyingOnCouch,injuredLookUp,protectArmsWideIdle,layingFloor,highFiveIdle,eclipseStand_idle,eclipse_foresight02_idle,eclipse_foresight01_idle,gaspShock,squat";
myCustomAnims = FillDictionaryFromCommaSeparatedString(input);
}
if (customMenu && !wantACustomListOfInject.Value)
{
myCustomAnims = myCustomAnims2;
}
else if (customMenu && wantACustomListOfInject.Value)
{
myCustomAnims = myCustomAnimsInject;
}
if (myAnimationKey > myCustomAnims.Count - 1)
{
myAnimationKey = myCustomAnims.Count - 1;
}
}
public static void AddAnimationClipToController(RuntimeAnimatorController baseController, string clipPath = null)
{
//IL_0253: Unknown result type (might be due to invalid IL or missing references)
//IL_025a: Expected O, but got Unknown
//IL_025a: Unknown result type (might be due to invalid IL or missing references)
//IL_0261: Expected O, but got Unknown
//IL_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Expected O, but got Unknown
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Expected O, but got Unknown
if (clipPath == null)
{
clipPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "bunchofemotes");
}
string path = BunchOfEmotesPath + "/bunchofemotescontroller";
string text = BunchOfEmotesPath + "/bunchofemotescontrollerbmx";
string path2 = BunchOfEmotesPath + "/bunchofemotescontrollerinlines";
string path3 = BunchOfEmotesPath + "/bunchofemotescontrollerskateboard";
string path4 = BunchOfEmotesPath + "/replace";
string path5 = BunchOfEmotesPath + "/replacebmx";
string path6 = BunchOfEmotesPath + "/replaceinline";
string path7 = BunchOfEmotesPath + "/replaceskateboard";
AssetBundle bundleTemp = null;
AssetBundle bundleTemp2 = null;
AssetBundle bundleTemp3 = null;
AssetBundle bundleTemp4 = null;
AnimationClip[] array = null;
AnimationClip[] array2 = null;
AnimationClip[] array3 = null;
AnimationClip[] array4 = null;
RuntimeAnimatorController[] array5 = null;
RuntimeAnimatorController[] array6 = null;
RuntimeAnimatorController[] array7 = null;
bundleController = loadFromString(path, bundleController);
bundleControllerinlines = loadFromString(path2, bundleControllerinlines);
bundleControllerSkateboard = loadFromString(path3, bundleControllerSkateboard);
bundleTemp = loadFromString(path4, bundleTemp);
bundleTemp2 = loadFromString(path5, bundleTemp2);
bundleTemp3 = loadFromString(path6, bundleTemp3);
bundleTemp4 = loadFromString(path7, bundleTemp4);
if (AControllers == null)
{
AControllers = bundleController.LoadAllAssets<RuntimeAnimatorController>();
}
if ((Object)(object)bundleControllerinlines != (Object)null)
{
array5 = bundleControllerinlines.LoadAllAssets<RuntimeAnimatorController>();
}
if ((Object)(object)bundleControllerSkateboard != (Object)null)
{
array7 = bundleControllerSkateboard.LoadAllAssets<RuntimeAnimatorController>();
}
if (array == null && (Object)(object)bundleTemp != (Object)null)
{
array = bundleTemp.LoadAllAssets<AnimationClip>();
}
if (array2 == null && (Object)(object)bundleTemp2 != (Object)null)
{
array2 = bundleTemp2.LoadAllAssets<AnimationClip>();
}
if (array3 == null && (Object)(object)bundleTemp3 != (Object)null)
{
array3 = bundleTemp3.LoadAllAssets<AnimationClip>();
}
if (array4 == null && (Object)(object)bundleTemp4 != (Object)null)
{
array4 = bundleTemp4.LoadAllAssets<AnimationClip>();
}
if ((Object)(object)bundle == (Object)null)
{
if (!File.Exists(clipPath))
{
Log.LogError((object)"No custom animation files found, mod will work with only the one from the game.");
myAnim2 = null;
return;
}
bundle = AssetBundle.LoadFromFile(clipPath);
}
AnimationClip val = null;
AnimatorOverrideController val2 = new AnimatorOverrideController();
AnimatorOverrideController val3 = new AnimatorOverrideController();
AnimatorOverrideController val4 = new AnimatorOverrideController();
AnimatorOverrideController val5 = new AnimatorOverrideController();
RuntimeAnimatorController[] aControllers = AControllers;
foreach (RuntimeAnimatorController runtimeAnimatorController in aControllers)
{
bool flag = true;
val2.runtimeAnimatorController = runtimeAnimatorController;
GlobalControllers.runtimeAnimatorController = runtimeAnimatorController;
}
if (array5 != null)
{
RuntimeAnimatorController[] array8 = array5;
foreach (RuntimeAnimatorController runtimeAnimatorController2 in array8)
{
bool flag2 = true;
val4.runtimeAnimatorController = runtimeAnimatorController2;
((Object)val4).name = "BunchOfEmotesControllerinlines";
}
}
if (array7 != null)
{
RuntimeAnimatorController[] array9 = array7;
foreach (RuntimeAnimatorController runtimeAnimatorController3 in array9)
{
bool flag3 = true;
val5.runtimeAnimatorController = runtimeAnimatorController3;
((Object)val5).name = "BunchOfEmotesControllerSkateboard";
}
}
Log.LogDebug((object)((Object)val2.runtimeAnimatorController).name);
((Object)val2).name = "BunchOfEmotesController";
int num = 0;
animationClips = bundle.LoadAllAssets<AnimationClip>();
HashSet<string> hashSet = new HashSet<string>();
List<int> list = new List<int>();
AnimationClip[] array10 = baseController.animationClips;
foreach (AnimationClip val6 in array10)
{
if (!((Object)(object)val6 != (Object)null))
{
continue;
}
CollectionExtensions.AddItem<int>((IEnumerable<int>)customemoteshash, ((object)val6).GetHashCode());
string name = ((Object)val6).name;
if (!hashSet.Contains(name))
{
try
{
string name2 = ((Object)val6).name;
val2[name2] = val6;
hashSet.Add(name);
}
catch (Exception)
{
Log.LogError((object)(((Object)val6).name + " is causing problems"));
}
}
}
AnimationClip[] array11 = player.animatorControllerSkates.animationClips;
foreach (AnimationClip val7 in array11)
{
if (!((Object)(object)val7 != (Object)null) || array5 == null)
{
continue;
}
CollectionExtensions.AddItem<int>((IEnumerable<int>)customemoteshash, ((object)val7).GetHashCode());
string name3 = ((Object)val7).name;
if (!hashSet.Contains(name3))
{
try
{
string name4 = ((Object)val7).name;
val4[name4] = val7;
hashSet.Add(name3);
}
catch (Exception)
{
Log.LogError((object)(((Object)val7).name + " is causing problems"));
}
}
}
if ((Object)(object)bundleControllerinlines != (Object)null)
{
player.animatorControllerSkates = (RuntimeAnimatorController)(object)val4;
}
AnimationClip[] array12 = player.animatorControllerSkateboard.animationClips;
foreach (AnimationClip val8 in array12)
{
if (!((Object)(object)val8 != (Object)null) || array5 == null)
{
continue;
}
CollectionExtensions.AddItem<int>((IEnumerable<int>)customemoteshash, ((object)val8).GetHashCode());
string name5 = ((Object)val8).name;
if (!hashSet.Contains(name5))
{
try
{
string name6 = ((Object)val8).name;
val5[name6] = val8;
hashSet.Add(name5);
}
catch (Exception)
{
Log.LogError((object)(((Object)val8).name + " is causing problems"));
}
}
}
if ((Object)(object)bundleControllerSkateboard != (Object)null)
{
player.animatorControllerSkateboard = (RuntimeAnimatorController)(object)val5;
}
Log.LogDebug((object)"before the count");
trueCustomIndex = 0;
AnimationClip[] array13 = ((RuntimeAnimatorController)val2).animationClips;
foreach (AnimationClip val9 in array13)
{
try
{
if (((Object)val9).name == "z1" || ((Object)val9).name == "z1000" || ((Object)val9).name == "z601" || trueCustomIndex != 0)
{
trueCustomIndex = num;
Log.LogDebug((object)("found " + num));
break;
}
}
catch (Exception ex4)
{
Log.LogError((object)ex4.Message);
}
num++;
}
Log.LogDebug((object)"after the count");
num = AddAnimations(animationClips, val2, num, list);
lengthOfEmotes.Add(num);
injectAnimation(array, val2);
injectAnimation(array2, player.animatorControllerBMX);
injectAnimation(array3, player.animatorControllerSkates);
injectAnimation(array4, player.animatorControllerSkateboard);
string pattern = "bunchofemotes\\d";
string pattern2 = "bunchofemotesACN\\d";
Regex regex = new Regex(pattern);
Regex regex2 = new Regex(pattern2);
DirectoryInfo directoryInfo = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "BunchOfEmotes"));
if (!Directory.Exists(Path.Combine(Paths.ConfigPath, "BunchOfEmotes")))
{
Directory.CreateDirectory(Path.Combine(Paths.ConfigPath, "BunchOfEmotes"));
}
int num3 = 1;
BunchOfEmotesPlugin.fileInfo = directoryInfo.GetFiles();
FileInfo[] array14 = BunchOfEmotesPlugin.fileInfo;
foreach (FileInfo fileInfo in array14)
{
try
{
if (regex.IsMatch(fileInfo.Name))
{
Log.LogInfo((object)("Loading " + fileInfo.Name));
bundle.Unload(false);
bundle = AssetBundle.LoadFromFile(fileInfo.FullName);
animationClips = bundle.LoadAllAssets<AnimationClip>();
num = AddAnimations(animationClips, val2, num, list);
lengthOfEmotes.Add(num);
Log.LogMessage((object)(fileInfo.Name + " loaded"));
num3++;
}
}
catch (Exception ex5)
{
Log.LogError((object)"bundle couldn't be fitted in the animation controller, you likely have too many emotes for your current controller. If you don't think that is the case then get help in modding servers.");
Log.LogError((object)num);
Log.LogError((object)ex5);
}
}
DirectoryInfo directoryInfo2 = new DirectoryInfo(Paths.PluginPath);
IEnumerable<DirectoryInfo> enumerable = from d in directoryInfo2.GetDirectories("*", SearchOption.AllDirectories)
where !d.FullName.EndsWith("Dragsun-Bunch_Of_Emotes", StringComparison.OrdinalIgnoreCase)
select d;
foreach (DirectoryInfo item in enumerable)
{
Log.LogWarning((object)("Processing directory: " + item.FullName));
}
IEnumerable<FileInfo> enumerable2 = from f in enumerable.SelectMany((DirectoryInfo d) => d.GetFiles("*", SearchOption.TopDirectoryOnly))
where !f.FullName.Contains("Dragsun-Bunch_Of_Emotes") && string.IsNullOrEmpty(f.Extension)
select f;
foreach (FileInfo item2 in enumerable2)
{
Log.LogWarning((object)item2.Name);
if (regex2.IsMatch(item2.Name))
{
Log.LogInfo((object)" hahahahahahha");
bundle.Unload(false);
bundle = AssetBundle.LoadFromFile(item2.FullName);
animationClips = bundle.LoadAllAssets<AnimationClip>();
num = AddAnimations(animationClips, val2, num, list);
lengthOfEmotes.Add(num);
Log.LogMessage((object)(item2.Name + " loaded"));
num3++;
}
}
customemotesCheck = list.ToArray();
Log.LogMessage((object)"Custom animations succesfully loaded.");
myAnim = (RuntimeAnimatorController)(object)val2;
myAnimBMX = player.animatorControllerBMX;
myAnimInlines = player.animatorControllerSkates;
myAnimSkateboard = player.animatorControllerSkateboard;
bundle.Unload(false);
}
public static Dictionary<int, string> FillDictionaryFromCommaSeparatedString(string input)
{
Dictionary<int, string> dictionary = new Dictionary<int, string>();
string[] array = input.Split(new char[1] { ',' });
string[] array2 = array;
foreach (string text in array2)
{
int key = Animator.StringToHash(text);
dictionary[key] = text;
}
return dictionary;
}
private void ConfigSettingChanged(object sender, EventArgs e)
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((e is SettingChangedEventArgs) ? e : null);
if (val != null && val.ChangedSetting.Definition.Key == KeyboardPlusKey)
{
KeyboardShortcut val2 = (KeyboardShortcut)val.ChangedSetting.BoxedValue;
}
}
private static AssetBundle loadFromString(string path, AssetBundle bundleTemp)
{
if ((Object)(object)bundleTemp == (Object)null)
{
if (!File.Exists(path))
{
return null;
}
bundleTemp = AssetBundle.LoadFromFile(path);
}
return bundleTemp;
}
private static void injectAnimation(AnimationClip[] replaceAnimations, AnimatorOverrideController animatorOverrideController)
{
if (replaceAnimations == null)
{
return;
}
foreach (AnimationClip val in replaceAnimations)
{
try
{
animatorOverrideController[((Object)val).name] = val;
Log.LogDebug((object)("successfully replaced " + ((Object)val).name));
}
catch (Exception)
{
Log.LogMessage((object)(((Object)val).name + " is causing problems in the replace"));
}
}
}
private static void injectAnimation(AnimationClip[] replaceAnimations, RuntimeAnimatorController animatorOverrideController)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
if (replaceAnimations == null)
{
return;
}
AnimatorOverrideController val = new AnimatorOverrideController();
val.runtimeAnimatorController = animatorOverrideController;
foreach (AnimationClip val2 in replaceAnimations)
{
try
{
val[((Object)val2).name] = val2;
Log.LogMessage((object)(((Object)val2).name + " > " + (object)val2));
}
catch (Exception)
{
Log.LogError((object)(((Object)val2).name + " is causing problems in the replace"));
}
}
animatorOverrideController = (RuntimeAnimatorController)(object)val;
}
private static int AddAnimations(AnimationClip[] animationClips, AnimatorOverrideController animatorOverrideController, int count, List<int> termsList)
{
if (myCustomAnimsInject.Count == 0)
{
myCustomAnimsInject = FillDictionaryFromCommaSeparatedString(myCustomListOfInject.Value);
}
foreach (AnimationClip val in animationClips)
{
AnimationClip val2 = val;
if ((Object)(object)val2 == (Object)null)
{
Debug.LogError((object)("Animation clip not found: " + animationClips));
break;
}
termsList.Add(((object)val2).GetHashCode());
string name = ((Object)((RuntimeAnimatorController)animatorOverrideController).animationClips[count]).name;
myCustomAnims2[Animator.StringToHash(name)] = ((Object)val2).name;
animatorOverrideController[name] = val2;
string name2 = ((Object)val2).name;
int key = Animator.StringToHash(name2);
if (myCustomAnimsInject.ContainsKey(key))
{
int key2 = Animator.StringToHash(((Object)val2).name);
if (myCustomAnimsInject.Remove(key2))
{
myCustomAnimsInject.Add(Animator.StringToHash(name), ((Object)val2).name);
}
else
{
Log.LogError((object)"Failed to remove the key.");
}
}
count++;
}
return count;
}
}
}
namespace BunchOfEmotes.Patches
{
[HarmonyPatch(typeof(StageManager))]
internal class StageManagerPatches
{
[HarmonyPatch("SetupWorldHandler")]
[HarmonyPostfix]
public static void SetupWorldHandler_Postfix(StageManager __instance)
{
BunchOfEmotesPlugin.stageManager = __instance;
}
}
[HarmonyPatch(typeof(GameplayUI))]
public class GameplayUIPatch
{
[HarmonyPostfix]
[HarmonyPatch("Init")]
public static void Init(GameplayUI __instance)
{
BunchOfEmotesPlugin.ui = __instance;
((Component)__instance.gameplayScreen).gameObject.AddComponent<UI>();
}
}
[HarmonyPatch(typeof(CharacterVisual))]
internal class CharacterVisualAnimationEventRelayPatches
{
[HarmonyPatch("Init")]
[HarmonyPrefix]
public static void Init_Prefix(CharacterVisual __instance, ref RuntimeAnimatorController animatorController)
{
if ((Object)(object)BunchOfEmotesPlugin.myNPC != (Object)null)
{
if (BunchOfEmotesPlugin.myNPC.animators.Length != 0)
{
animatorController = BunchOfEmotesPlugin.myNPC.animators[0].runtimeAnimatorController;
}
else if ((Object)(object)BunchOfEmotesPlugin.myAnimUntouched != (Object)null)
{
animatorController = BunchOfEmotesPlugin.myAnimUntouched;
}
}
}
}
[HarmonyPatch(typeof(NPC))]
internal class NPCPatches
{
[HarmonyPatch("InitSceneObject")]
[HarmonyPostfix]
public static void Awake_Postfix(NPC __instance)
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Invalid comparison between Unknown and I4
try
{
if ((Object)(object)BunchOfEmotesPlugin.myNPC == (Object)null && __instance.anim.Length > 6)
{
BunchOfEmotesPlugin.myNPC = __instance;
}
if ((Object)(object)BunchOfEmotesPlugin.myAnim == (Object)null && (int)__instance.crew != 0 && (int)__instance.character != 11 && __instance.animators != null && (Object)(object)BunchOfEmotesPlugin.myAnim == (Object)null)
{
BunchOfEmotesPlugin.myAnim = ((Component)((Component)__instance).transform.GetChild(0).GetChild(1)).GetComponent<Animator>().runtimeAnimatorController;
if ((Object)(object)BunchOfEmotesPlugin.myAnimUntouched == (Object)null)
{
BunchOfEmotesPlugin.myAnimUntouched = ((Component)((Component)__instance).transform.GetChild(0).GetChild(1)).GetComponent<Animator>().runtimeAnimatorController;
}
}
}
catch
{
}
}
}
[HarmonyPatch(typeof(DieAbility))]
internal class DieAbilityPatches
{
[HarmonyPatch("Init")]
[HarmonyPostfix]
public static void Init_Postfix(DieAbility __instance)
{
BunchOfEmotesPlugin.dieAbility = __instance;
}
}
public class UI : MonoBehaviour
{
public static UI Instance;
private TextMeshProUGUI m_label = null;
private TextMeshProUGUI m_label1 = null;
private TextMeshProUGUI m_label2 = null;
private float m_notificationTimer = 5f;
private bool m_active;
private void Awake()
{
Instance = this;
SetupLabel();
SetupLabelPause();
}
public void ShowNotification(string textbef, string textmid, string textaft)
{
((TMP_Text)m_label1).text = textbef;
((TMP_Text)m_label).text = textmid;
((TMP_Text)m_label2).text = textaft;
m_notificationTimer = 5f;
((Component)m_label).gameObject.SetActive(true);
((Component)m_label1).gameObject.SetActive(true);
((Component)m_label2).gameObject.SetActive(true);
}
public void HideNotification()
{
((Component)m_label1).gameObject.SetActive(false);
((Component)m_label).gameObject.SetActive(false);
((Component)m_label2).gameObject.SetActive(false);
}
private void SetupLabel()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
m_label = new GameObject("Emote").AddComponent<TextMeshProUGUI>();
m_label1 = new GameObject("EmotePrev").AddComponent<TextMeshProUGUI>();
m_label2 = new GameObject("EmoteAft").AddComponent<TextMeshProUGUI>();
UIManager uIManager = Core.Instance.UIManager;
GameplayUI value = Traverse.Create((object)uIManager).Field<GameplayUI>("gameplay").Value;
TextMeshProUGUI graffitiNewLabel = value.graffitiNewLabel;
((TMP_Text)m_label).font = ((TMP_Text)graffitiNewLabel).font;
((TMP_Text)m_label1).font = ((TMP_Text)graffitiNewLabel).font;
((TMP_Text)m_label2).font = ((TMP_Text)graffitiNewLabel).font;
((TMP_Text)m_label2).alpha = 0.3f;
((TMP_Text)m_label1).alpha = 0.3f;
((TMP_Text)m_label).fontSize = 32f;
((TMP_Text)m_label1).fontSize = 32f;
((TMP_Text)m_label2).fontSize = 32f;
((TMP_Text)m_label).fontMaterial = ((TMP_Text)graffitiNewLabel).fontMaterial;
((TMP_Text)m_label1).fontMaterial = ((TMP_Text)graffitiNewLabel).fontMaterial;
((TMP_Text)m_label2).fontMaterial = ((TMP_Text)graffitiNewLabel).fontMaterial;
((TMP_Text)m_label).alignment = (TextAlignmentOptions)260;
((TMP_Text)m_label1).alignment = (TextAlignmentOptions)260;
((TMP_Text)m_label2).alignment = (TextAlignmentOptions)260;
RectTransform rectTransform = ((TMP_Text)m_label).rectTransform;
RectTransform rectTransform2 = ((TMP_Text)m_label1).rectTransform;
RectTransform rectTransform3 = ((TMP_Text)m_label2).rectTransform;
rectTransform.anchorMin = new Vector2(0.1f, 0.5f);
rectTransform2.anchorMin = new Vector2(0.1f, 0.5f);
rectTransform3.anchorMin = new Vector2(0.1f, 0.5f);
rectTransform.anchorMax = new Vector2(0.868f, 0.9f);
rectTransform2.anchorMax = new Vector2(0.868f, 0.95f);
rectTransform3.anchorMax = new Vector2(0.868f, 0.85f);
rectTransform.pivot = new Vector2(0f, 1f);
rectTransform2.pivot = new Vector2(0f, 1f);
rectTransform3.pivot = new Vector2(0f, 1f);
rectTransform.anchoredPosition = new Vector2(1f, 0.2f);
rectTransform2.anchoredPosition = new Vector2(1f, 0.2f);
rectTransform3.anchoredPosition = new Vector2(1f, 0.2f);
((Transform)((TMP_Text)m_label).rectTransform).SetParent((Transform)(object)((Component)value.gameplayScreen).GetComponent<RectTransform>(), false);
((Transform)((TMP_Text)m_label1).rectTransform).SetParent((Transform)(object)((Component)value.gameplayScreen).GetComponent<RectTransform>(), false);
((Transform)((TMP_Text)m_label2).rectTransform).SetParent((Transform)(object)((Component)value.gameplayScreen).GetComponent<RectTransform>(), false);
}
private void SetupLabelPause()
{
}
}
[HarmonyPatch(typeof(Player))]
internal class PlayerPatches
{
[HarmonyPatch("Init")]
[HarmonyPrefix]
public static bool Awake_Prefix(Player __instance)
{
if ((Object)(object)BunchOfEmotesPlugin.player == (Object)null)
{
BunchOfEmotesPlugin.player = __instance;
if (BunchOfEmotesPlugin.myCustomAnims.Count != 0 && BunchOfEmotesPlugin.myWantReload.Value)
{
BunchOfEmotesPlugin.Log.LogMessage((object)"in now");
BunchOfEmotesPlugin.myCustomAnims = new Dictionary<int, string>();
BunchOfEmotesPlugin.myCustomAnimsInject = new Dictionary<int, string>();
}
}
return true;
}
[HarmonyPatch("EnablePlayer")]
[HarmonyPostfix]
public static void EnablePlayer(Player __instance)
{
bool flag = ((Object)__instance).name.Contains("AI") || ((Object)__instance).name.Contains("(Clone)");
if ((Object)(object)__instance.animatorController != (Object)(object)BunchOfEmotesPlugin.myAnim && !flag)
{
__instance.animatorController = BunchOfEmotesPlugin.myAnim;
}
}
[HarmonyPatch("PlayAnim")]
[HarmonyPostfix]
public static void PlayAnim(Player __instance)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected I4, but got Unknown
bool flag = ((Object)__instance).name.Contains("AI") || ((Object)__instance).name.Contains("(Clone)");
IMapStationAPI aPI = APIManager.API;
if (aPI != null && (Object)(object)BunchOfEmotesPlugin.myAnimUntouched == (Object)null)
{
Scene activeScene = SceneManager.GetActiveScene();
Stage val = Utility.SceneNameToStage(((Scene)(ref activeScene)).name);
ICustomStage customStageByID = aPI.GetCustomStageByID((int)val);
bool flag2 = customStageByID != null;
BunchOfEmotesPlugin.Log.LogMessage((object)(flag2 + " is my stage"));
if (flag2 && (Object)(object)BunchOfEmotesPlugin.myAnimUntouched == (Object)null && (Object)(object)BunchOfEmotesPlugin.myAnim == (Object)null)
{
BunchOfEmotesPlugin.myAnim = __instance.animatorController;
BunchOfEmotesPlugin.myAnimUntouched = __instance.animatorController;
}
}
if (!flag)
{
if ((Object)(object)BunchOfEmotesPlugin.myAnimUntouched == (Object)null)
{
BunchOfEmotesPlugin.Log.LogMessage((object)((Object)__instance.animatorController).name);
BunchOfEmotesPlugin.myAnimUntouched = __instance.animatorController;
}
if ((Object)(object)__instance.animatorController != (Object)(object)BunchOfEmotesPlugin.myAnim)
{
__instance.animatorController = BunchOfEmotesPlugin.myAnim;
__instance.anim.runtimeAnimatorController = BunchOfEmotesPlugin.myAnim;
}
if ((Object)(object)BunchOfEmotesPlugin.myAnimBMX != (Object)null && (Object)(object)__instance.animatorControllerBMX != (Object)(object)BunchOfEmotesPlugin.myAnimBMX)
{
__instance.animatorControllerBMX = BunchOfEmotesPlugin.myAnimBMX;
}
if ((Object)(object)BunchOfEmotesPlugin.myAnimInlines != (Object)null && (Object)(object)__instance.animatorControllerSkates != (Object)(object)BunchOfEmotesPlugin.myAnimInlines)
{
__instance.animatorControllerSkates = BunchOfEmotesPlugin.myAnimInlines;
}
if ((Object)(object)BunchOfEmotesPlugin.myAnimSkateboard != (Object)null && (Object)(object)__instance.animatorControllerSkateboard != (Object)(object)BunchOfEmotesPlugin.myAnimSkateboard)
{
__instance.animatorControllerSkateboard = BunchOfEmotesPlugin.myAnimSkateboard;
}
}
else if (((Object)__instance).name.Contains("(Clone)") && (Object)(object)__instance.anim.runtimeAnimatorController != (Object)(object)BunchOfEmotesPlugin.myNPC.animators[0].runtimeAnimatorController)
{
__instance.animatorController = BunchOfEmotesPlugin.myNPC.animators[0].runtimeAnimatorController;
__instance.anim.runtimeAnimatorController = BunchOfEmotesPlugin.myNPC.animators[0].runtimeAnimatorController;
}
}
}
}