using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib.BoneMenu;
using HarmonyLib;
using HolsterHider;
using HolsterHiderSync;
using HolsterHiderSync.Packets;
using HolsterHiderSync.Reps;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Bonelab;
using Il2CppSLZ.Marrow;
using LabFusion.Data;
using LabFusion.Entities;
using LabFusion.Network;
using LabFusion.Player;
using LabFusion.SDK.Modules;
using LabFusion.Utilities;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(HolsterHiderSyncMainClass), "HolsterHiderSync", "1.0.0", "notnotnotswipez, updated by Mabel Amber", null)]
[assembly: AssemblyTitle("HolsterHiderSync")]
[assembly: AssemblyDescription("Syncs Holster Hider settings across Fusion clients.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HolsterHiderSync")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d8cb1995-ef63-4b54-8167-7c700c3f91af")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 HolsterHiderSync
{
public class HolsterHiderSyncMainClass : MelonMod
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static PlayerUpdate <>9__14_0;
public static UpdateEvent <>9__14_1;
internal void <OnInitializeMelon>b__14_0(PlayerId id)
{
repHolsterConfigurations.Remove(id);
}
internal void <OnInitializeMelon>b__14_1()
{
foreach (RepHolsterConfiguration value in repHolsterConfigurations.Values)
{
value.cached = false;
}
}
}
public static Dictionary<PlayerId, RepHolsterConfiguration> repHolsterConfigurations = new Dictionary<PlayerId, RepHolsterConfiguration>();
public static HolsterHiderMod instance;
public static MelonPreferences_Category HolsterHiderSyncCategory;
public static MelonPreferences_Entry<bool> overrideReps;
public static MelonPreferences_Entry<HolsterVisibility> headOverride;
public static MelonPreferences_Entry<HolsterVisibility> rightShoulderOverride;
public static MelonPreferences_Entry<HolsterVisibility> leftShoulderOverride;
public static MelonPreferences_Entry<HolsterVisibility> rightUnderarmOverride;
public static MelonPreferences_Entry<HolsterVisibility> leftUnderarmOverride;
public static MelonPreferences_Entry<HolsterVisibility> backOverride;
public static MelonPreferences_Entry<HolsterVisibility> ammoPouchOverride;
public static MelonPreferences_Entry<HolsterVisibility> bodyLogOverride;
public static Page mainCategory;
internal static Instance logger;
public override void OnInitializeMelon()
{
//IL_011b: 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_0154: Expected O, but got Unknown
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Expected O, but got Unknown
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Expected O, but got Unknown
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Expected O, but got Unknown
logger = ((MelonBase)this).LoggerInstance;
HolsterHiderSyncCategory = MelonPreferences.CreateCategory("HolsterHiderSync");
overrideReps = HolsterHiderSyncCategory.CreateEntry<bool>("OverrideReps", false, "Override other player settings with your own settings", (string)null, false, false, (ValueValidator)null, (string)null);
headOverride = HolsterHiderSyncCategory.CreateEntry<HolsterVisibility>("HeadOverride", (HolsterVisibility)0, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
rightShoulderOverride = HolsterHiderSyncCategory.CreateEntry<HolsterVisibility>("RightShoulderOverride", (HolsterVisibility)0, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
leftShoulderOverride = HolsterHiderSyncCategory.CreateEntry<HolsterVisibility>("LeftShoulderOverride", (HolsterVisibility)0, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
rightUnderarmOverride = HolsterHiderSyncCategory.CreateEntry<HolsterVisibility>("RightUnderarmOverride", (HolsterVisibility)0, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
leftUnderarmOverride = HolsterHiderSyncCategory.CreateEntry<HolsterVisibility>("LeftUnderarmOverride", (HolsterVisibility)0, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
backOverride = HolsterHiderSyncCategory.CreateEntry<HolsterVisibility>("BackOverride", (HolsterVisibility)0, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
ammoPouchOverride = HolsterHiderSyncCategory.CreateEntry<HolsterVisibility>("AmmoPouchOverride", (HolsterVisibility)0, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
bodyLogOverride = HolsterHiderSyncCategory.CreateEntry<HolsterVisibility>("BodyLogOverride", (HolsterVisibility)0, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
mainCategory = Page.Root.CreatePage("Holster Hider Sync", Color.yellow, 0, true);
CreateMenu();
NetworkPlayer.OnNetworkRigCreated += MultiplayerHooking_OnPlayerRepCreated;
MultiplayerHooking.OnPlayerJoin += new PlayerUpdate(MultiplayerHooking_OnPlayerJoin);
Dictionary<PlayerId, RepHolsterConfiguration> dictionary = repHolsterConfigurations;
MultiplayerHooking.OnDisconnect += new ServerEvent(dictionary.Clear);
object obj = <>c.<>9__14_0;
if (obj == null)
{
PlayerUpdate val = delegate(PlayerId id)
{
repHolsterConfigurations.Remove(id);
};
<>c.<>9__14_0 = val;
obj = (object)val;
}
MultiplayerHooking.OnPlayerLeave += (PlayerUpdate)obj;
object obj2 = <>c.<>9__14_1;
if (obj2 == null)
{
UpdateEvent val2 = delegate
{
foreach (RepHolsterConfiguration value in repHolsterConfigurations.Values)
{
value.cached = false;
}
};
<>c.<>9__14_1 = val2;
obj2 = (object)val2;
}
MultiplayerHooking.OnLoadingBegin += (UpdateEvent)obj2;
ModuleManager.RegisterModule<HolsterSyncModule>();
}
private void CreateMenu()
{
//IL_000a: 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_0043: 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_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
Page obj = mainCategory.CreatePage("Overrides", Color.white, 0, true);
obj.CreateBool("Override Enabled", Color.yellow, overrideReps.Value, (Action<bool>)delegate(bool b)
{
overrideReps.Value = b;
HolsterHiderSyncCategory.SaveToFile(false);
ReloadAllRepHolsterStates();
});
obj.CreateEnum("Head", Color.yellow, (Enum)(object)headOverride.Value, (Action<Enum>)delegate(Enum b)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
headOverride.Value = (HolsterVisibility)(object)b;
HolsterHiderSyncCategory.SaveToFile(false);
ReloadAllRepHolsterStates();
});
obj.CreateEnum("Right Shoulder", Color.yellow, (Enum)(object)rightShoulderOverride.Value, (Action<Enum>)delegate(Enum b)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
rightShoulderOverride.Value = (HolsterVisibility)(object)b;
HolsterHiderSyncCategory.SaveToFile(false);
ReloadAllRepHolsterStates();
});
obj.CreateEnum("Left Shoulder", Color.yellow, (Enum)(object)leftShoulderOverride.Value, (Action<Enum>)delegate(Enum b)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
leftShoulderOverride.Value = (HolsterVisibility)(object)b;
HolsterHiderSyncCategory.SaveToFile(false);
ReloadAllRepHolsterStates();
});
obj.CreateEnum("Right Underarm", Color.yellow, (Enum)(object)rightUnderarmOverride.Value, (Action<Enum>)delegate(Enum b)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
rightUnderarmOverride.Value = (HolsterVisibility)(object)b;
HolsterHiderSyncCategory.SaveToFile(false);
ReloadAllRepHolsterStates();
});
obj.CreateEnum("Left Underarm", Color.yellow, (Enum)(object)leftUnderarmOverride.Value, (Action<Enum>)delegate(Enum b)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
leftUnderarmOverride.Value = (HolsterVisibility)(object)b;
HolsterHiderSyncCategory.SaveToFile(false);
ReloadAllRepHolsterStates();
});
obj.CreateEnum("Back", Color.yellow, (Enum)(object)backOverride.Value, (Action<Enum>)delegate(Enum b)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
backOverride.Value = (HolsterVisibility)(object)b;
HolsterHiderSyncCategory.SaveToFile(false);
ReloadAllRepHolsterStates();
});
obj.CreateEnum("Ammo Pouch", Color.yellow, (Enum)(object)ammoPouchOverride.Value, (Action<Enum>)delegate(Enum b)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
ammoPouchOverride.Value = (HolsterVisibility)(object)b;
HolsterHiderSyncCategory.SaveToFile(false);
ReloadAllRepHolsterStates();
});
obj.CreateEnum("Body Log", Color.yellow, (Enum)(object)bodyLogOverride.Value, (Action<Enum>)delegate(Enum b)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
bodyLogOverride.Value = (HolsterVisibility)(object)b;
HolsterHiderSyncCategory.SaveToFile(false);
ReloadAllRepHolsterStates();
});
}
private void ReloadAllRepHolsterStates()
{
foreach (RepHolsterConfiguration value in repHolsterConfigurations.Values)
{
value.ForceUpdateAll();
}
}
private void MultiplayerHooking_OnPlayerJoin(PlayerId playerId)
{
if (!NetworkInfo.HasServer || !NetworkInfo.IsServer)
{
return;
}
HolsterStateData holsterStateData = HolsterStateData.Create(PlayerIdManager.LocalId.SmallId, GetLocalHolsterInformation(instance));
FusionWriter val = FusionWriter.Create();
try
{
using HolsterStateData holsterStateData2 = holsterStateData;
val.Write<HolsterStateData>(holsterStateData2);
FusionMessage val2 = FusionMessage.ModuleCreate<HolsterStateMessage>(val);
try
{
MessageSender.SendFromServer(PlayerId.op_Implicit(playerId), (NetworkChannel)0, val2);
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
foreach (KeyValuePair<PlayerId, RepHolsterConfiguration> repHolsterConfiguration in repHolsterConfigurations)
{
HolsterStateData holsterStateData3 = HolsterStateData.Create(repHolsterConfiguration.Key.SmallId, repHolsterConfiguration.Value.GetHolsterInformation());
FusionWriter val3 = FusionWriter.Create();
try
{
using HolsterStateData holsterStateData4 = holsterStateData3;
val3.Write<HolsterStateData>(holsterStateData4);
FusionMessage val4 = FusionMessage.ModuleCreate<HolsterStateMessage>(val3);
try
{
MessageSender.SendFromServer(PlayerId.op_Implicit(playerId), (NetworkChannel)0, val4);
}
finally
{
((IDisposable)val4)?.Dispose();
}
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
}
public static HolsterInformation[] GetLocalHolsterInformation(HolsterHiderMod mod)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//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_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: 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_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: 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_0125: 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)
BodyPreference val = (BodyPreference)typeof(HolsterHiderMod).GetField("_bodyPreferences", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
return new HolsterInformation[8]
{
new HolsterInformation
{
Type = HolsterGroupType.HEAD,
Visibility = val.HeadPreference.preference.Value
},
new HolsterInformation
{
Type = HolsterGroupType.RIGHT_SHOULDER,
Visibility = val.RightShoulderPreference.preference.Value
},
new HolsterInformation
{
Type = HolsterGroupType.LEFT_SHOULDER,
Visibility = val.LeftShoulderPreference.preference.Value
},
new HolsterInformation
{
Type = HolsterGroupType.RIGHT_UNDERARM,
Visibility = val.RightUnderarmPreference.preference.Value
},
new HolsterInformation
{
Type = HolsterGroupType.LEFT_UNDERARM,
Visibility = val.LeftUnderarmPreference.preference.Value
},
new HolsterInformation
{
Type = HolsterGroupType.BACK,
Visibility = val.BackPreference.preference.Value
},
new HolsterInformation
{
Type = HolsterGroupType.AMMO_POUCH,
Visibility = val.AmmoPouchPreference.preference.Value
},
new HolsterInformation
{
Type = HolsterGroupType.BODY_LOG,
Visibility = val.BodyLogPreference.preference.Value
}
};
}
private void MultiplayerHooking_OnPlayerRepCreated(NetworkPlayer networkPlayer, RigManager rigManager)
{
NetworkPlayer val = null;
if (NetworkPlayerManager.TryGetPlayer(rigManager, ref val))
{
if (repHolsterConfigurations.ContainsKey(val.PlayerId))
{
repHolsterConfigurations[val.PlayerId].CacheAll(val);
return;
}
RepHolsterConfiguration repHolsterConfiguration = new RepHolsterConfiguration();
repHolsterConfiguration.CacheAll(val);
repHolsterConfigurations.Add(val.PlayerId, repHolsterConfiguration);
}
}
}
public class HolsterSyncModule : Module
{
public override string Name => "Holster Hider Sync";
public override string Author => "notnotnotswipez, updated by Mabel Amber";
public override Version Version => new Version(1, 0, 0);
protected override void OnModuleRegistered()
{
((Module)this).LoggerInstance.Log("Loaded Holster Hider Sync Module!", ConsoleColor.White);
ModuleMessageHandler.RegisterHandler<HolsterStateMessage>();
}
}
}
namespace HolsterHiderSync.Reps
{
public enum HolsterGroupType
{
HEAD,
RIGHT_SHOULDER,
LEFT_SHOULDER,
RIGHT_UNDERARM,
LEFT_UNDERARM,
BACK,
AMMO_POUCH,
BODY_LOG
}
public class RepHolsterConfiguration
{
public Dictionary<HolsterGroupType, RepHolsterGroup> holsterGroups = new Dictionary<HolsterGroupType, RepHolsterGroup>();
public bool cached;
public RepHolsterGroup HeadGroup => holsterGroups[HolsterGroupType.HEAD];
public RepHolsterGroup RightShoulderGroup => holsterGroups[HolsterGroupType.RIGHT_SHOULDER];
public RepHolsterGroup LeftShoulderGroup => holsterGroups[HolsterGroupType.LEFT_SHOULDER];
public RepHolsterGroup RightUnderarmGroup => holsterGroups[HolsterGroupType.RIGHT_UNDERARM];
public RepHolsterGroup LeftUnderarmGroup => holsterGroups[HolsterGroupType.LEFT_UNDERARM];
public RepHolsterGroup BackGroup => holsterGroups[HolsterGroupType.BACK];
public RepHolsterGroup AmmoPouchGroup => holsterGroups[HolsterGroupType.AMMO_POUCH];
public RepHolsterGroup BodyLogGroup => holsterGroups[HolsterGroupType.BODY_LOG];
public RepHolsterConfiguration()
{
holsterGroups.Add(HolsterGroupType.HEAD, new RepHolsterGroup());
holsterGroups.Add(HolsterGroupType.RIGHT_SHOULDER, new RepHolsterGroup());
holsterGroups.Add(HolsterGroupType.LEFT_SHOULDER, new RepHolsterGroup());
holsterGroups.Add(HolsterGroupType.RIGHT_UNDERARM, new RepHolsterGroup());
holsterGroups.Add(HolsterGroupType.LEFT_UNDERARM, new RepHolsterGroup());
holsterGroups.Add(HolsterGroupType.BACK, new RepHolsterGroup());
holsterGroups.Add(HolsterGroupType.AMMO_POUCH, new RepHolsterGroup());
holsterGroups.Add(HolsterGroupType.BODY_LOG, new RepHolsterGroup());
}
public void CacheAll(NetworkPlayer rep)
{
RigManager rigManager = rep.RigRefs.RigManager;
Il2CppReferenceArray<SlotContainer> bodySlots = rigManager.inventory.bodySlots;
PopulateHolster((InventoryHandReceiver)(object)((Component)((Rig)rigManager.physicsRig).m_head).GetComponentInChildren<InventorySlotReceiver>(true), HeadGroup);
PopulateHolster((InventoryHandReceiver)(object)((Il2CppArrayBase<SlotContainer>)(object)bodySlots)[3].inventorySlotReceiver, RightShoulderGroup);
PopulateHolster((InventoryHandReceiver)(object)((Il2CppArrayBase<SlotContainer>)(object)bodySlots)[2].inventorySlotReceiver, LeftShoulderGroup);
PopulateHolster((InventoryHandReceiver)(object)((Il2CppArrayBase<SlotContainer>)(object)bodySlots)[5].inventorySlotReceiver, RightUnderarmGroup);
PopulateHolster((InventoryHandReceiver)(object)((Il2CppArrayBase<SlotContainer>)(object)bodySlots)[0].inventorySlotReceiver, LeftUnderarmGroup);
PopulateHolster((InventoryHandReceiver)(object)((Il2CppArrayBase<SlotContainer>)(object)bodySlots)[4].inventorySlotReceiver, BackGroup);
PopulateHolster((InventoryHandReceiver)(object)((Component)rigManager.physicsRig).GetComponentInChildren<InventoryAmmoReceiver>(), AmmoPouchGroup);
PopulatePullCord(((Component)((Il2CppArrayBase<SlotContainer>)(object)rigManager.inventory.specialItems)[0]).GetComponentInChildren<PullCordDevice>(true), BodyLogGroup);
cached = true;
ForceUpdateAll();
}
public void ForceUpdateAll()
{
//IL_001d: 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_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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_0061: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
if (cached)
{
if (HolsterHiderSyncMainClass.overrideReps.Value)
{
HolsterVisibility value = HolsterHiderSyncMainClass.headOverride.Value;
HolsterVisibility value2 = HolsterHiderSyncMainClass.rightShoulderOverride.Value;
HolsterVisibility value3 = HolsterHiderSyncMainClass.leftShoulderOverride.Value;
HolsterVisibility value4 = HolsterHiderSyncMainClass.rightUnderarmOverride.Value;
HolsterVisibility value5 = HolsterHiderSyncMainClass.leftUnderarmOverride.Value;
HolsterVisibility value6 = HolsterHiderSyncMainClass.backOverride.Value;
HolsterVisibility value7 = HolsterHiderSyncMainClass.ammoPouchOverride.Value;
HolsterVisibility value8 = HolsterHiderSyncMainClass.bodyLogOverride.Value;
HeadGroup.OverrideVisibility = value;
RightShoulderGroup.OverrideVisibility = value2;
LeftShoulderGroup.OverrideVisibility = value3;
RightUnderarmGroup.OverrideVisibility = value4;
LeftUnderarmGroup.OverrideVisibility = value5;
BackGroup.OverrideVisibility = value6;
AmmoPouchGroup.OverrideVisibility = value7;
BodyLogGroup.OverrideVisibility = value8;
}
HeadGroup.ForceUpdate();
RightShoulderGroup.ForceUpdate();
LeftShoulderGroup.ForceUpdate();
RightUnderarmGroup.ForceUpdate();
LeftUnderarmGroup.ForceUpdate();
BackGroup.ForceUpdate();
AmmoPouchGroup.ForceUpdate();
BodyLogGroup.ForceUpdate();
}
}
private void PopulateHolster(InventoryHandReceiver receiver, RepHolsterGroup group)
{
Transform parent = ((Component)receiver).transform.parent;
group.CacheValues(Il2CppArrayBase<MeshRenderer>.op_Implicit(((Component)parent).GetComponentsInChildren<MeshRenderer>(true)), Il2CppArrayBase<Collider>.op_Implicit(((Component)parent).GetComponentsInChildren<Collider>(true)));
}
private void PopulatePullCord(PullCordDevice pullCord, RepHolsterGroup group)
{
group.CacheValues(Il2CppArrayBase<MeshRenderer>.op_Implicit(((Component)((Component)pullCord).transform.Find("BodyLog")).GetComponentsInChildren<MeshRenderer>(true)), Il2CppArrayBase<Collider>.op_Implicit(((Component)((Component)pullCord).transform).GetComponentsInChildren<Collider>(true)));
}
public HolsterInformation[] GetHolsterInformation()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: 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_0040: 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_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
return new HolsterInformation[8]
{
new HolsterInformation
{
Type = HolsterGroupType.HEAD,
Visibility = HeadGroup.Visibility
},
new HolsterInformation
{
Type = HolsterGroupType.RIGHT_SHOULDER,
Visibility = RightShoulderGroup.Visibility
},
new HolsterInformation
{
Type = HolsterGroupType.LEFT_SHOULDER,
Visibility = LeftShoulderGroup.Visibility
},
new HolsterInformation
{
Type = HolsterGroupType.RIGHT_UNDERARM,
Visibility = RightUnderarmGroup.Visibility
},
new HolsterInformation
{
Type = HolsterGroupType.LEFT_UNDERARM,
Visibility = LeftUnderarmGroup.Visibility
},
new HolsterInformation
{
Type = HolsterGroupType.BACK,
Visibility = BackGroup.Visibility
},
new HolsterInformation
{
Type = HolsterGroupType.AMMO_POUCH,
Visibility = AmmoPouchGroup.Visibility
},
new HolsterInformation
{
Type = HolsterGroupType.BODY_LOG,
Visibility = BodyLogGroup.Visibility
}
};
}
}
public class RepHolsterGroup
{
private readonly bool _disableGameObjects;
public MeshRenderer[] renderers;
public Collider[] triggers;
public HolsterVisibility Visibility;
public HolsterVisibility OverrideVisibility;
public RepHolsterGroup(bool disableGameObjects = false)
{
_disableGameObjects = disableGameObjects;
}
public void CacheValues(MeshRenderer[] renderers, Collider[] triggers)
{
this.renderers = renderers;
this.triggers = triggers;
}
public void ForceUpdate()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: 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_001e: Invalid comparison between Unknown and I4
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Invalid comparison between Unknown and I4
HolsterVisibility val = Visibility;
if (HolsterHiderSyncMainClass.overrideReps.Value)
{
val = OverrideVisibility;
}
if (val - 1 <= 1)
{
MeshRenderer[] array = renderers;
for (int i = 0; i < array.Length; i++)
{
((Renderer)array[i]).enabled = false;
}
}
else
{
MeshRenderer[] array = renderers;
for (int i = 0; i < array.Length; i++)
{
((Renderer)array[i]).enabled = true;
}
}
Collider[] array2;
if ((int)val != 2)
{
array2 = triggers;
foreach (Collider val2 in array2)
{
val2.enabled = true;
if (_disableGameObjects)
{
((Component)val2).gameObject.SetActive(true);
}
}
return;
}
array2 = triggers;
foreach (Collider val3 in array2)
{
val3.enabled = false;
if (_disableGameObjects)
{
((Component)val3).gameObject.SetActive(false);
}
}
}
}
}
namespace HolsterHiderSync.Patches
{
public class HolsterGroupPatches
{
[HarmonyPatch(typeof(RepHolsterGroup), "ForceUpdate")]
public static class OnGroupForceUpdate
{
public static void Postfix(RepHolsterGroup __instance)
{
if (!NetworkInfo.HasServer || !NetworkInfo.IsServer)
{
return;
}
HolsterStateData holsterStateData = HolsterStateData.Create(PlayerIdManager.LocalId.SmallId, HolsterHiderSyncMainClass.GetLocalHolsterInformation(HolsterHiderSyncMainClass.instance));
FusionWriter val = FusionWriter.Create();
try
{
using HolsterStateData holsterStateData2 = holsterStateData;
val.Write<HolsterStateData>(holsterStateData2);
FusionMessage val2 = FusionMessage.ModuleCreate<HolsterStateMessage>(val);
try
{
MessageSender.BroadcastMessageExceptSelf((NetworkChannel)0, val2);
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
}
}
}
public class HolsterHiderInitializationPatches
{
[HarmonyPatch(typeof(HolsterHiderMod), "SetupBoneMenu")]
public static class OnBoneMenuSetup
{
public static void Prefix(HolsterHiderMod __instance)
{
HolsterHiderSyncMainClass.instance = __instance;
}
}
}
}
namespace HolsterHiderSync.Packets
{
public class HolsterInformation
{
public HolsterGroupType Type;
public HolsterVisibility Visibility;
}
public class HolsterStateData : IFusionSerializable, IDisposable
{
public byte playerIdShort;
public HolsterInformation[] holsterInformation = new HolsterInformation[8];
public void Dispose()
{
GC.SuppressFinalize(this);
}
public void Serialize(FusionWriter writer)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
writer.Write(playerIdShort);
for (int i = 0; i < holsterInformation.Length; i++)
{
writer.Write((byte)holsterInformation[i].Type);
writer.Write((byte)holsterInformation[i].Visibility);
}
}
public void Deserialize(FusionReader reader)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
playerIdShort = reader.ReadByte();
for (int i = 0; i < holsterInformation.Length; i++)
{
HolsterGroupType type = (HolsterGroupType)reader.ReadByte();
HolsterVisibility visibility = (HolsterVisibility)reader.ReadByte();
holsterInformation[i] = new HolsterInformation
{
Type = type,
Visibility = visibility
};
}
}
public static HolsterStateData Create(byte shortId, HolsterInformation[] informations)
{
return new HolsterStateData
{
playerIdShort = shortId,
holsterInformation = informations
};
}
}
public class HolsterStateMessage : ModuleMessageHandler
{
public override void HandleMessage(byte[] bytes, bool isServerHandled = false)
{
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
FusionReader val = FusionReader.Create(bytes);
try
{
using HolsterStateData holsterStateData = val.ReadFusionSerializable<HolsterStateData>();
if (NetworkInfo.IsServer && isServerHandled)
{
FusionMessage val2 = FusionMessage.ModuleCreate<HolsterStateMessage>(bytes);
try
{
MessageSender.BroadcastMessageExcept(holsterStateData.playerIdShort, (NetworkChannel)0, val2, true);
return;
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
PlayerId playerId = PlayerIdManager.GetPlayerId(holsterStateData.playerIdShort);
RepHolsterConfiguration repHolsterConfiguration;
if (!HolsterHiderSyncMainClass.repHolsterConfigurations.ContainsKey(playerId))
{
repHolsterConfiguration = new RepHolsterConfiguration();
HolsterHiderSyncMainClass.repHolsterConfigurations.Add(playerId, repHolsterConfiguration);
}
else
{
repHolsterConfiguration = HolsterHiderSyncMainClass.repHolsterConfigurations[playerId];
}
for (int i = 0; i < holsterStateData.holsterInformation.Length; i++)
{
repHolsterConfiguration.holsterGroups[holsterStateData.holsterInformation[i].Type].Visibility = holsterStateData.holsterInformation[i].Visibility;
}
repHolsterConfiguration.ForceUpdateAll();
}
finally
{
((IDisposable)val)?.Dispose();
}
}
}
}