using System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; 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("blacks7ar")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2")] [assembly: AssemblyInformationalVersion("1.0.0+f74efced646a1a2eec57d941de910a5f13560311")] [assembly: AssemblyProduct("OneHandWeaponOnTheHip")] [assembly: AssemblyTitle("OneHandWeaponOnTheHip")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.0")] [module: UnverifiableCode] [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 OneHandWeaponOnTheHip { [BepInPlugin("blacks7ar.OneHandWeaponOnTheHip", "OneHandWeaponOnTheHip", "1.0.2")] public class Plugin : BaseUnityPlugin { [HarmonyPatch] private static class Patch { [HarmonyPostfix] [HarmonyPatch(typeof(ObjectDB), "Awake")] private static void Awake_Postfix(ObjectDB __instance) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || __instance.m_items.Count <= 0 || !_enableMod.Value) { return; } foreach (ItemDrop item in from item in __instance.m_items select item.GetComponent() into component where (Object)(object)component != (Object)null && (int)component.m_itemData.m_shared.m_itemType == 3 && (int)component.m_itemData.m_shared.m_skillType != 5 select component) { item.m_itemData.m_shared.m_attachOverride = (ItemType)19; } } [HarmonyPostfix] [HarmonyPatch(typeof(VisEquipment), "AttachBackItem")] private static void AttachBackItem_Postfix(VisEquipment __instance, ref int hash) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Invalid comparison between Unknown and I4 //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || !__instance.m_isPlayer) { return; } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(hash); if (!((Object)(object)itemPrefab == (Object)null)) { ItemDrop component = itemPrefab.GetComponent(); if (!((Object)(object)component == (Object)null) && (int)component.m_itemData.m_shared.m_attachOverride != 0 && (int)component.m_itemData.m_shared.m_attachOverride == 19) { __instance.m_backTool.localPosition = new Vector3(0.00221f, 0.00275f, 0.00103f); __instance.m_backTool.localRotation = new Quaternion(0.59913f, 0.73131f, -0.19993f, 0.25742f); } } } } private const string modGUID = "blacks7ar.OneHandWeaponOnTheHip"; public const string modName = "OneHandWeaponOnTheHip"; public const string modAuthor = "blacks7ar"; public const string modVersion = "1.0.2"; private static readonly Harmony _harmony = new Harmony("blacks7ar.OneHandWeaponOnTheHip"); private static ConfigEntry _enableMod; public void Awake() { ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; _enableMod = ((BaseUnityPlugin)this).Config.Bind("General", "Enable Mod", true, "Enable/Disables the mod."); ((BaseUnityPlugin)this).Config.SaveOnConfigSet = true; ((BaseUnityPlugin)this).Config.Save(); Assembly executingAssembly = Assembly.GetExecutingAssembly(); _harmony.PatchAll(executingAssembly); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } } }