Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Engineer Turret Taunt v0.2.201
EngineerTurretTaunt.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using EmotesAPI; using MonoMod.RuntimeDetour; using R2API.Networking; using R2API.Networking.Interfaces; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("EngineerTurretTaunt")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("EngineerTurretTaunt")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("412f3f43-5a2f-4e54-b86e-c94a7fc5a879")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace EngineerTurretTaunt; public delegate void PlayAnimationOrig(string animationName, int pos); public delegate void PlayAnimationHandler(PlayAnimationOrig orig, string animationName, int pos); [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.kanggamming.EngineerTurretTaunt", "Engineer Turret Taunt", "0.2.2")] public class EngineerTurretTauntPlugin : BaseUnityPlugin { private IDetour _playAnimHook; public static ConfigEntry<bool> allAlliesEmote; public static ConfigEntry<KeyboardShortcut> stopEmotingSolo; public static ConfigEntry<KeyboardShortcut> joinEmoteSolo; public static ConfigEntry<KeyboardShortcut> stopEmotingAllies; public static ConfigEntry<KeyboardShortcut> joinEmoteAllies; public EngineerTurretTauntPlugin() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) allAlliesEmote = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "All allies emote", false, "Whether all of your allies will taunt with you. (Does not make other players or their allies taunt)"); stopEmotingSolo = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds", "Stop emoting (yourself)", KeyboardShortcut.Empty, "Keybind to make only yourself stop emoting."); joinEmoteSolo = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds", "Join emote (yourself)", KeyboardShortcut.Empty, "Keybind to join a Join Spot without making your allies join with you. (alternatively you can just press Sync With Nearest Emote in the original mod)"); stopEmotingAllies = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds", "Stop emoting (allies only)", KeyboardShortcut.Empty, "Keybind to make only your allies stop emoting."); joinEmoteAllies = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinds", "Join emote (allies only)", KeyboardShortcut.Empty, "Keybind to make only your allies join a Join Spot or sync with you. (the join spot can be buggy... for reasons I don't know)"); } public void Awake() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown _playAnimHook = (IDetour)new Hook((Delegate)new PlayAnimationOrig(CustomEmotesAPI.PlayAnimation), (Delegate)new PlayAnimationHandler(OnPlayAnimation)); ModSettingsManager.SetModDescription("A mod that makes your turrets taunt/emote with you. Need I say more?"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allAlliesEmote, new CheckBoxConfig { category = "General", description = "Whether all of your allies will taunt/emote with you. (Does not make other players or their allies taunt.)", name = "All Allies Emote" })); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(stopEmotingSolo, new KeyBindConfig { category = "General", description = "Keybind to make only yourself stop emoting.", name = "Stop emoting (yourself)" })); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(stopEmotingAllies, new KeyBindConfig { category = "General", description = "Keybind to make only your allies stop emoting.", name = "Stop emoting (allies only)" })); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(joinEmoteSolo, new KeyBindConfig { category = "General", description = "Keybind to join a Join Spot without making your allies join with you. (alternatively you can just press Sync With Nearest Emote in the original mod)", name = "Join emote spot (yourself)" })); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(joinEmoteAllies, new KeyBindConfig { category = "General", description = "Keybind to make only your allies join a Join Spot or sync with you. Only allies within the Join Spot will join your emote. If it's a non-join emote, the allies will instead sync with your emote. (the join spot can be a little jank)", name = "Join emote spot (allies only)" })); } private void OpenBMCLink() { Process.Start("https://buymeacoffee.com/kaangamgimginnkagnagnking"); } public void Update() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Run.instance != (Object)null)) { return; } CharacterBody body = NetworkUser.readOnlyLocalPlayersList[0].master.GetBody(); KeyboardShortcut value = stopEmotingSolo.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { SendAnimation(body, "none"); } value = joinEmoteSolo.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { JoinAnimation(body); } value = stopEmotingAllies.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { List<CharacterBody> allyTargets = GetAllyTargets(body, allAlliesEmote.Value); for (int i = 0; i < allyTargets.Count; i++) { SendAnimation(allyTargets[i], "none"); } } value = joinEmoteAllies.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { List<CharacterBody> allyTargets2 = GetAllyTargets(body, allAlliesEmote.Value); for (int j = 0; j < allyTargets2.Count; j++) { JoinAnimation(allyTargets2[j]); } } } private void SendAnimation(CharacterBody body, string animationName, int pos = -2) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown NetMessageExtensions.Send((INetMessage)new SyncAnimationToServer(((NetworkBehaviour)body).netId, animationName, pos), (NetworkDestination)2); } private void JoinAnimation(CharacterBody body) { BoneMapper boneMapper = GetBoneMapper(body); if ((Object)(object)boneMapper.currentEmoteSpot != (Object)null) { boneMapper.JoinEmoteSpot(); } } private BoneMapper GetBoneMapper(CharacterBody body) { return ((List<BoneMapper>)typeof(BoneMapper).GetField("allMappers").GetValue(null)).Find((BoneMapper x) => (Object)(object)x.mapperBody == (Object)(object)body); } private List<CharacterBody> GetAllyTargets(CharacterBody playerBody, bool turretsOnly) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers(playerBody.teamComponent.teamIndex); List<CharacterBody> list = new List<CharacterBody>(); for (int i = 0; i < teamMembers.Count; i++) { if ((teamMembers[i].body.baseNameToken == "ENGITURRET_BODY_NAME" || (turretsOnly && !Object.op_Implicit((Object)(object)teamMembers[i].body.master.playerCharacterMasterController))) && OwnershipCheck(teamMembers[i].body.master, playerBody.master)) { list.Add(teamMembers[i].body); } } return list; } private bool OwnershipCheck(CharacterMaster minion, CharacterMaster owner) { if ((Object)(object)owner != (Object)null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)(minion.GetBody().GetDisplayName() + "'s owner is " + owner.GetBody().GetDisplayName())); } else { ((BaseUnityPlugin)this).Logger.LogInfo((object)(minion.GetBody().GetDisplayName() + " doesnt have an owner")); } return (Object)(object)minion.minionOwnership.ownerMaster == (Object)(object)owner; } private void OnPlayAnimation(PlayAnimationOrig orig, string animationName, int pos) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown orig(animationName, pos); CharacterBody body = NetworkUser.readOnlyLocalPlayersList[0].master.GetBody(); List<CharacterBody> allyTargets = GetAllyTargets(body, allAlliesEmote.Value); if (allyTargets.Count >= 1) { for (int i = 0; i < allyTargets.Count; i++) { NetMessageExtensions.Send((INetMessage)new SyncAnimationToServer(((NetworkBehaviour)allyTargets[i]).netId, animationName, pos), (NetworkDestination)2); } } } }