using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using CustomSosigLoader;
using FistVR;
using H3MP;
using H3MP.Networking;
using H3MP.Scripts;
using H3MP.Tracking;
using Microsoft.CodeAnalysis;
using OtherLoader;
using SosigPlayerBody.CSL;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("Packer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Custom Sosig Player Body for H3MP")]
[assembly: AssemblyFileVersion("0.9.4.0")]
[assembly: AssemblyInformationalVersion("0.9.4+f1696585f8f6980e82b420ab36349c4195cfafda")]
[assembly: AssemblyProduct("Packer.SosigPlayerBody")]
[assembly: AssemblyTitle("Sosig Player Body")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.9.4.0")]
[module: UnverifiableCode]
[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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string id = null, string name = null, string version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null)
{
}
}
}
namespace SosigPlayerBody
{
public class SBP_AIEntity : AIEntity
{
}
public class SBP_FVRObject : FVRObject
{
}
public class SPB_FVRPointableButton : FVRPointableButton
{
}
public class SBP_PlayerHitBox : PlayerHitbox
{
}
public class SPB_ObjectTemprature : ObjectTemperature
{
}
public static class Global
{
public static T Next<T>(this T src) where T : struct
{
if (!typeof(T).IsEnum)
{
throw new ArgumentException($"Argument {typeof(T).FullName} is not an Enum");
}
T[] array = (T[])Enum.GetValues(src.GetType());
int num = Array.IndexOf(array, src) + 1;
return (array.Length == num) ? array[0] : array[num];
}
}
public class Networking
{
private static int h3mpEnabled = -1;
public static bool H3MPEnabled
{
get
{
if (h3mpEnabled == -1)
{
h3mpEnabled = (Chainloader.PluginInfos.ContainsKey("VIP.TommySoucy.H3MP") ? 1 : 0);
}
return h3mpEnabled == 1;
}
}
private static bool isServerRunning => (!((Object)(object)Mod.managerObject == (Object)null)) ? true : false;
private static bool isHosting
{
get
{
if ((Object)(object)Mod.managerObject == (Object)null)
{
return false;
}
if (ThreadManager.host)
{
return true;
}
return false;
}
}
public static bool ServerRunning()
{
if (H3MPEnabled)
{
return isServerRunning;
}
return false;
}
public static bool IsClient()
{
if (H3MPEnabled)
{
return isClient();
}
return false;
}
private static bool isClient()
{
if ((Object)(object)Mod.managerObject == (Object)null)
{
return false;
}
if (!ThreadManager.host)
{
return true;
}
return false;
}
public static bool IsHost()
{
if (H3MPEnabled)
{
return isHosting;
}
return false;
}
public static int GetPlayerCount()
{
if (H3MPEnabled)
{
return GetNetworkPlayerCount();
}
return 1;
}
private static int GetNetworkPlayerCount()
{
return GameManager.players.Count;
}
public static int[] GetPlayerIDs()
{
int[] array = new int[GameManager.players.Count];
int num = 0;
foreach (KeyValuePair<int, PlayerManager> player in GameManager.players)
{
array[num] = player.Key;
num++;
}
return array;
}
public static int GetLocalPlayerID()
{
return GameManager.ID;
}
public static int RegisterHostCustomPacket(string identifier)
{
if (Mod.registeredCustomPacketIDs.ContainsKey(identifier))
{
return Mod.registeredCustomPacketIDs[identifier];
}
return Server.RegisterCustomPacketType(identifier, 0);
}
public static TrackedPlayerBody GetTrackedPlayerBody(int id)
{
if (!H3MPEnabled)
{
return null;
}
if (GameManager.players == null)
{
return null;
}
if (GameManager.players.TryGetValue(id, out var value) && (Object)(object)value.playerBody != (Object)null)
{
return GameManager.players[id].playerBody;
}
return null;
}
public static PlayerBody GetPlayerBody(int id)
{
if (!H3MPEnabled)
{
return null;
}
TrackedPlayerBody trackedPlayerBody = GetTrackedPlayerBody(id);
if ((Object)(object)trackedPlayerBody == (Object)null)
{
return null;
}
return GetTrackedPlayerBody(id).physicalPlayerBody;
}
public static PlayerData GetPlayer(int i)
{
if (!H3MPEnabled)
{
return null;
}
return PlayerData.GetPlayer(i);
}
}
public class PlayerData
{
public Transform head;
public string username;
public Transform handLeft;
public Transform handRight;
public int ID;
public float health;
public int iff;
public static PlayerData GetPlayer(int i)
{
return new PlayerData
{
head = GameManager.players[i].head,
username = GameManager.players[i].username,
handLeft = GameManager.players[i].leftHand,
handRight = GameManager.players[i].rightHand
};
}
}
[BepInPlugin("Packer.SosigPlayerBody", "Sosig Player Body", "1.0.0")]
[BepInProcess("h3vr.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class SosigPlayerBodyPlugin : BaseUnityPlugin
{
public delegate void SosigPlayerBodyReadyDelegate();
[CompilerGenerated]
private static class <>O
{
public static OnConnectionDelegate <0>__SetupPacketTypes;
public static OnConnectionDelegate <1>__TrySyncPlayerBody;
}
public static SosigPlayerBodyPlugin instance;
public static bool SosigPlayerBodyReady;
public static bool CustomSosigLoaderEnabled;
public const string sosigPrefabID = "SosigPlayerBody";
public static Material[] sosigMaterials;
private bool sosigCreationInProgress = false;
public static SPB_Assets spbAssets;
public static AssetBundle spbBundle;
public static bool assetsLoading;
public static bool loadedAssets;
public static float timeout;
internal static ManualLogSource Logger { get; private set; }
public static event SosigPlayerBodyReadyDelegate SosigPlayerBodyReadyEvent;
private void Awake()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Expected O, but got Unknown
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Expected O, but got Unknown
//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_0086: Expected O, but got Unknown
instance = this;
Logger = ((BaseUnityPlugin)this).Logger;
CustomSosigLoaderEnabled = Chainloader.PluginInfos.ContainsKey("Sosig_Squad.CustomSosigLoader");
if (CustomSosigLoaderEnabled)
{
global::SosigPlayerBody.CSL.CSL.HookLoadingComplete();
}
else
{
LoaderStatus.ProgressUpdated += new StatusUpdate(SosigPlayerBodyCheck);
}
object obj = <>O.<0>__SetupPacketTypes;
if (obj == null)
{
OnConnectionDelegate val = SPB_Networking.SetupPacketTypes;
<>O.<0>__SetupPacketTypes = val;
obj = (object)val;
}
Mod.OnConnection += (OnConnectionDelegate)obj;
object obj2 = <>O.<1>__TrySyncPlayerBody;
if (obj2 == null)
{
OnConnectionDelegate val2 = TrySyncPlayerBody;
<>O.<1>__TrySyncPlayerBody = val2;
obj2 = (object)val2;
}
Mod.OnConnection += (OnConnectionDelegate)obj2;
SceneManager.activeSceneChanged += CreateWristMenuSceneOnSceneChange;
}
private static void TrySyncPlayerBody()
{
if (Object.op_Implicit((Object)(object)SPB_WristMenu.instance))
{
SPB_WristMenu.instance.Apply();
}
}
private void Update()
{
if (Input.GetKey((KeyCode)307) && Input.GetKeyDown((KeyCode)122))
{
((MonoBehaviour)this).StartCoroutine(TestSosigBody());
}
}
public void CreateWristMenuSceneOnSceneChange(Scene current, Scene next)
{
((MonoBehaviour)this).StartCoroutine(DelayCreateWristMenu());
}
public IEnumerator DelayCreateWristMenu()
{
yield return (object)new WaitForSeconds(1f);
SPB_WristMenu.CreateWristMenu();
}
public IEnumerator TestSosigBody()
{
if (!sosigCreationInProgress)
{
sosigCreationInProgress = true;
GameManager.SetPlayerPrefab("SosigPlayerBody");
yield return (object)new WaitForSeconds(2f);
SPB_WristMenu.instance.AdjustSosigID(1);
yield return null;
sosigCreationInProgress = false;
}
}
private void OnDestroy()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
//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_0060: Expected O, but got Unknown
if (CustomSosigLoaderEnabled)
{
global::SosigPlayerBody.CSL.CSL.UnHookLoadingComplete();
}
else
{
LoaderStatus.ProgressUpdated -= new StatusUpdate(SosigPlayerBodyCheck);
}
object obj = <>O.<0>__SetupPacketTypes;
if (obj == null)
{
OnConnectionDelegate val = SPB_Networking.SetupPacketTypes;
<>O.<0>__SetupPacketTypes = val;
obj = (object)val;
}
Mod.OnConnection -= (OnConnectionDelegate)obj;
object obj2 = <>O.<1>__TrySyncPlayerBody;
if (obj2 == null)
{
OnConnectionDelegate val2 = TrySyncPlayerBody;
<>O.<1>__TrySyncPlayerBody = val2;
obj2 = (object)val2;
}
Mod.OnConnection -= (OnConnectionDelegate)obj2;
}
public void SosigPlayerBodyCheck(float progress)
{
if (!SosigPlayerBodyReady && !(progress < 1f))
{
((MonoBehaviour)this).StartCoroutine(LoadSPBAssets());
}
}
public static void SosigPlayerBodyComplete()
{
if (!SosigPlayerBodyReady)
{
((MonoBehaviour)instance).StartCoroutine(LoadSPBAssets());
}
}
private void SosigPlayerBodySetReady()
{
SosigPlayerBodyReady = true;
if (SosigPlayerBodyPlugin.SosigPlayerBodyReadyEvent != null)
{
SosigPlayerBodyPlugin.SosigPlayerBodyReadyEvent();
}
Logger.LogMessage((object)"Finished Loading Sosig Player Body Data - Player Body is now Ready");
}
public static IEnumerator LoadSPBAssets()
{
if (assetsLoading || timeout > Time.time)
{
yield break;
}
assetsLoading = true;
string path = Paths.PluginPath + "/Packer-Sosig_Player_Body/sosigplayerbody.spb";
if (!loadedAssets)
{
AssetBundleCreateRequest asyncBundleRequest = AssetBundle.LoadFromFileAsync(path);
yield return asyncBundleRequest;
AssetBundle localAssetBundle = asyncBundleRequest.assetBundle;
if ((Object)(object)localAssetBundle == (Object)null)
{
Logger.LogMessage((object)"Failed to load Sosig Player Body AssetBundle");
yield break;
}
spbBundle = localAssetBundle;
}
AssetBundleRequest assetRequest = spbBundle.LoadAssetWithSubAssetsAsync<SPB_Assets>("SosigPlayerBody");
yield return assetRequest;
if (assetRequest == null)
{
Logger.LogMessage((object)"Missing SPB Assets");
yield break;
}
spbAssets = assetRequest.asset as SPB_Assets;
loadedAssets = true;
assetsLoading = false;
yield return null;
timeout = Time.time + 10f;
FVRObject fvrBody = spbAssets.sosigsPlayerBodyFVRObject;
((AnvilAsset)fvrBody).m_anvilPrefab.Bundle = path;
IM.OD.Add("SosigPlayerBody", fvrBody);
GameManager.playerPrefabs.Add("SosigPlayerBody", (Object)(object)fvrBody);
GameManager.playerPrefabIDs.Add("SosigPlayerBody");
sosigMaterials = spbAssets.sosigMaterials;
spbBundle.Unload(false);
instance.SosigPlayerBodySetReady();
}
}
public class SosigPlayerBody : PlayerBody
{
public class SosigSelected
{
public GameObject sosig;
public int sosigPrefabID;
}
public enum Parts
{
Body,
Head,
Hands
}
public enum ClothingOption
{
Torsowear,
Headwear,
Pantswear,
Pantswear_Lower,
Facewear,
Eyewear,
Backpacks,
TorosDecoration,
Belt
}
[Header("Sosig Body")]
public MeshRenderer[] bodyLinks;
private List<GameObject> clothing = new List<GameObject>();
private Material defaultMaterial;
private Material prevMaterial;
private PlayerManager pm;
public override void Awake()
{
defaultMaterial = (prevMaterial = ((Renderer)((Component)bodyLinks[0]).GetComponent<MeshRenderer>()).material);
((PlayerBody)this).Awake();
}
public virtual void Start()
{
((MonoBehaviour)this).StartCoroutine(SPB_WristMenu.MenuCheck(this));
if (Networking.ServerRunning() && Networking.IsHost() && GameManager.players != null)
{
((MonoBehaviour)this).StartCoroutine(DelaySetHostBody());
}
}
public IEnumerator DelaySetHostBody()
{
yield return (object)new WaitForSeconds(1f);
foreach (KeyValuePair<int, PlayerManager> item in GameManager.players)
{
TrackedPlayerBody body = item.Value.playerBody;
if ((Object)(object)body != (Object)null && (Object)(object)body.physicalPlayerBody != (Object)null)
{
SosigPlayerBody checkBody = (SosigPlayerBody)(object)body.physicalPlayerBody;
if ((Object)(object)checkBody != (Object)null)
{
SPB_Networking.SetPlayerClothing(SPB_Networking.playerSosigs[item.Key]);
((PlayerBody)this).SetColor(GameManager.colors[GameManager.players[item.Key].colorIndex]);
break;
}
}
}
}
public override void Init()
{
((PlayerBody)this).Init();
SPB_WristMenu.CreateWristMenu();
if (Networking.ServerRunning() && (Object)(object)GameManager.currentPlayerBody == (Object)(object)this)
{
SPB_WristMenu.SetLocalBody(this);
}
}
public void ReceiveSosigClothing(SPB_Networking.PlayerSosig body)
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
ClearSosigCustomisation();
SetClothing(GenerateSosigOutfit(body));
SetSosigMaterial(SosigPlayerBodyPlugin.sosigMaterials[body.sosigMaterial]);
((PlayerBody)this).SetColor(GameManager.colors[GameManager.players[body.playerID].colorIndex]);
SPB_WristMenu.UpdateWristDisplay();
}
public void SetLocalToSosigID(SosigEnemyID id)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Invalid comparison between Unknown and I4
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
if ((int)id != -1 && ManagerSingleton<IM>.Instance.odicSosigObjsByID.ContainsKey(id))
{
SosigEnemyTemplate val = ManagerSingleton<IM>.Instance.odicSosigObjsByID[id];
ClearSosigCustomisation();
SetClothing(val.OutfitConfig[Random.Range(0, val.OutfitConfig.Count)]);
SetSosigMaterial(SosigPlayerBodyPlugin.sosigMaterials[SPB_Networking.localSosig.sosigMaterial]);
((PlayerBody)this).SetColor(GameManager.colors[GameManager.colorIndex]);
((PlayerBody)this).SetBodyVisible(GameManager.bodyVisible);
((PlayerBody)this).SetHandsVisible(GameManager.handsVisible);
SPB_WristMenu.UpdateWristDisplay();
}
}
public SosigSelected CreateSosig(SosigEnemyTemplate template, int prefabIndex = -1)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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_0061: Unknown result type (might be due to invalid IL or missing references)
SosigSelected sosigSelected = new SosigSelected();
if (prefabIndex == -1)
{
sosigSelected.sosigPrefabID = Random.Range(0, template.SosigPrefabs.Count);
}
else
{
sosigSelected.sosigPrefabID = prefabIndex;
}
sosigSelected.sosig = Object.Instantiate<GameObject>(((AnvilAsset)template.SosigPrefabs[sosigSelected.sosigPrefabID]).GetGameObject(), ((Component)this).transform.position + Vector3.up, ((Component)this).transform.rotation);
return sosigSelected;
}
public void ClearSosigCustomisation()
{
SetSosigMaterial(defaultMaterial);
ClearClothing();
}
public void SetSosigMaterial(Material mat)
{
for (int i = 0; i < bodyLinks.Length; i++)
{
((Renderer)bodyLinks[i]).sharedMaterial = mat;
}
}
private void ClearClothing()
{
for (int i = 0; i < clothing.Count; i++)
{
Object.Destroy((Object)(object)clothing[i]);
}
clothing.Clear();
}
private void SetClothing(SosigOutfitConfig outfit)
{
float num = Random.Range(0f, 1f);
int num2 = -1;
if (num < outfit.Chance_Torsowear)
{
num2 = SpawnAccessoryToLink(outfit.Torsowear, bodyLinks[1], this, -1, ClothingOption.Torsowear, Parts.Hands);
}
else
{
SetLocalAccessory(ClothingOption.Torsowear, this);
}
float num3 = Random.Range(0f, 1f);
int index2 = -1;
if (outfit.HeadUsesTorsoIndex)
{
index2 = num2;
}
if (num3 < outfit.Chance_Headwear)
{
SpawnAccessoryToLink(outfit.Headwear, bodyLinks[0], this, index2, ClothingOption.Headwear, Parts.Hands);
}
else
{
SetLocalAccessory(ClothingOption.Headwear, this);
}
float num4 = Random.Range(0f, 1f);
int index3 = -1;
if (outfit.PantsUsesTorsoIndex)
{
index3 = num2;
}
if (num4 < outfit.Chance_Pantswear)
{
SpawnAccessoryToLink(outfit.Pantswear, bodyLinks[2], this, index3, ClothingOption.Pantswear);
}
else
{
SetLocalAccessory(ClothingOption.Pantswear, this);
}
float num5 = Random.Range(0f, 1f);
int index4 = -1;
if (outfit.PantsLowerUsesPantsIndex)
{
index4 = num2;
}
if (num5 < outfit.Chance_Pantswear_Lower)
{
SpawnAccessoryToLink(outfit.Pantswear_Lower, bodyLinks[3], this, index4, ClothingOption.Pantswear_Lower);
}
else
{
SetLocalAccessory(ClothingOption.Pantswear_Lower, this);
}
if (Random.Range(0f, 1f) < outfit.Chance_Facewear)
{
SpawnAccessoryToLink(outfit.Facewear, bodyLinks[0], this, -1, ClothingOption.Facewear, Parts.Hands);
}
else
{
SetLocalAccessory(ClothingOption.Facewear, this);
}
if (Random.Range(0f, 1f) < outfit.Chance_Eyewear)
{
SpawnAccessoryToLink(outfit.Eyewear, bodyLinks[0], this, -1, ClothingOption.Eyewear, Parts.Hands);
}
else
{
SetLocalAccessory(ClothingOption.Eyewear, this);
}
if (Random.Range(0f, 1f) < outfit.Chance_Backpacks)
{
SpawnAccessoryToLink(outfit.Backpacks, bodyLinks[1], this, -1, ClothingOption.Backpacks, Parts.Hands);
}
else
{
SetLocalAccessory(ClothingOption.Backpacks, this);
}
if (Random.Range(0f, 1f) < outfit.Chance_TorosDecoration)
{
SpawnAccessoryToLink(outfit.TorosDecoration, bodyLinks[1], this, -1, ClothingOption.TorosDecoration, Parts.Hands);
}
else
{
SetLocalAccessory(ClothingOption.TorosDecoration, this);
}
if (Random.Range(0f, 1f) < outfit.Chance_Belt)
{
SpawnAccessoryToLink(outfit.Belt, bodyLinks[2], this, -1, ClothingOption.Belt);
}
else
{
SetLocalAccessory(ClothingOption.Belt, this);
}
if (base.bodyRenderers != null)
{
base.bodyRendererLayers = new int[base.bodyRenderers.Length];
for (int i = 0; i < base.bodyRenderers.Length; i++)
{
if ((Object)(object)base.bodyRenderers[i] != (Object)null)
{
base.bodyRendererLayers[i] = ((Component)base.bodyRenderers[i]).gameObject.layer;
}
}
}
if (base.handRenderers != null)
{
base.handRendererLayers = new int[base.handRenderers.Length];
for (int j = 0; j < base.handRenderers.Length; j++)
{
if ((Object)(object)base.handRenderers[j] != (Object)null)
{
base.handRendererLayers[j] = ((Component)base.handRenderers[j]).gameObject.layer;
}
}
}
((PlayerBody)this).SetHandsVisible(GameManager.handsVisible);
static Renderer[] AddToRenderers(Renderer[] oldList, Renderer newItem)
{
List<Renderer> list = new List<Renderer>();
list.AddRange(oldList);
list.Add(newItem);
return list.ToArray();
}
static void SetLocalAccessory(ClothingOption option, SosigPlayerBody body, string item = "")
{
if (Networking.ServerRunning() && !((Object)(object)GameManager.currentPlayerBody != (Object)(object)body))
{
switch (option)
{
default:
SPB_Networking.localSosig.Torsowear = item;
break;
case ClothingOption.Headwear:
SPB_Networking.localSosig.Headwear = item;
break;
case ClothingOption.Pantswear:
SPB_Networking.localSosig.Pantswear = item;
break;
case ClothingOption.Pantswear_Lower:
SPB_Networking.localSosig.Pantswear_Lower = item;
break;
case ClothingOption.Facewear:
SPB_Networking.localSosig.Facewear = item;
break;
case ClothingOption.Eyewear:
SPB_Networking.localSosig.Eyewear = item;
break;
case ClothingOption.Backpacks:
SPB_Networking.localSosig.Backpacks = item;
break;
case ClothingOption.TorosDecoration:
SPB_Networking.localSosig.TorosDecoration = item;
break;
case ClothingOption.Belt:
SPB_Networking.localSosig.Belt = item;
break;
}
}
}
static int SpawnAccessoryToLink(IList<FVRObject> gs, MeshRenderer l, SosigPlayerBody body, int index = -1, ClothingOption option = ClothingOption.Headwear, Parts part = Parts.Body)
{
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
if (gs == null || gs.Count < 1 || index >= gs.Count)
{
SetLocalAccessory(option, body);
return -1;
}
if (index <= -1)
{
index = Random.Range(0, gs.Count);
}
GameObject val = (((Object)(object)gs[index] != (Object)null) ? ((AnvilAsset)gs[index]).GetGameObject() : null);
if ((Object)(object)val == (Object)null)
{
SetLocalAccessory(option, body);
return -1;
}
Transform transform = ((Component)l).transform;
GameObject val2 = Object.Instantiate<GameObject>(val, transform.position, transform.rotation, transform);
body.clothing.Add(val2);
SetLocalAccessory(option, body, gs[index].ItemID);
SosigWearable component = val2.GetComponent<SosigWearable>();
if ((Object)(object)component != (Object)null)
{
component.m_rendMain = ((Component)component).GetComponent<Renderer>();
if ((Object)(object)component.m_rendMain != (Object)null)
{
component.hasRendMain = true;
}
else if ((Object)(object)component.OverrideRendMain != (Object)null)
{
component.m_rendMain = component.OverrideRendMain;
component.hasRendMain = true;
}
for (int k = 0; k < component.Cols.Count; k++)
{
component.Cols[k].enabled = false;
}
if ((Object)(object)component.m_rendMain != (Object)null)
{
((PlayerBody)body).bodyRenderers = AddToRenderers(((PlayerBody)body).bodyRenderers, component.m_rendMain);
switch (part)
{
case Parts.Head:
((PlayerBody)body).headRenderers = AddToRenderers(((PlayerBody)body).headRenderers, component.m_rendMain);
break;
case Parts.Hands:
((PlayerBody)body).handRenderers = AddToRenderers(((PlayerBody)body).handRenderers, component.m_rendMain);
break;
}
}
((Behaviour)component).enabled = false;
}
return index;
}
}
private SosigOutfitConfig GenerateSosigOutfit(SPB_Networking.PlayerSosig body)
{
SosigOutfitConfig val = ScriptableObject.CreateInstance<SosigOutfitConfig>();
val.Torsowear = SetupItem(body.Torsowear);
val.Chance_Torsowear = 1f;
val.Headwear = SetupItem(body.Headwear);
val.Chance_Headwear = 1f;
val.Pantswear = SetupItem(body.Pantswear);
val.Chance_Pantswear = 1f;
val.Pantswear_Lower = SetupItem(body.Pantswear_Lower);
val.Chance_Pantswear_Lower = 1f;
val.Facewear = SetupItem(body.Facewear);
val.Chance_Facewear = 1f;
val.Eyewear = SetupItem(body.Eyewear);
val.Chance_Eyewear = 1f;
val.Backpacks = SetupItem(body.Backpacks);
val.Chance_Backpacks = 1f;
val.TorosDecoration = SetupItem(body.TorosDecoration);
val.Chance_TorosDecoration = 1f;
val.Belt = SetupItem(body.Belt);
val.Chance_Belt = 1f;
return val;
static List<FVRObject> SetupItem(string itemID)
{
List<FVRObject> list = new List<FVRObject>();
if (itemID == "")
{
return list;
}
if (IM.OD.ContainsKey(itemID))
{
list.Add(IM.OD[itemID]);
}
else
{
SosigPlayerBodyPlugin.Logger.LogMessage((object)("Networking: Item ID not found: " + itemID));
}
return list;
}
}
}
[CreateAssetMenu(fileName = "SPB Asset", menuName = "SPB Asset", order = 1)]
public class SPB_Assets : ScriptableObject
{
public FVRObject sosigsPlayerBodyFVRObject;
public GameObject sosigPlayerBody;
public GameObject menuBodySelector;
public Material[] sosigMaterials;
}
public class SPB_Networking
{
public class PlayerSosig
{
public int playerID = -1;
public int sosigID = -1;
public int sosigPrefabIndex = -1;
public string Torsowear = "";
public string Headwear = "";
public string Pantswear = "";
public string Pantswear_Lower = "";
public string Facewear = "";
public string Eyewear = "";
public string Backpacks = "";
public string TorosDecoration = "";
public string Belt = "";
public int sosigMaterial = 0;
}
[CompilerGenerated]
private static class <>O
{
public static CustomPacketHandler <0>__SosigToServer_Handler;
public static CustomPacketHandler <1>__SendClientsSosigs_Handler;
public static CustomPacketHandlerReceivedDelegate <2>__SosigToServer_Received;
public static CustomPacketHandlerReceivedDelegate <3>__SendClientsSosigs_Received;
}
private static int SendSosigToServer_ID = -1;
private static int SendClientsSosigs_ID = -1;
public static readonly string sendSosigKey = "SBP_SendSosig";
public static readonly string sendClientsSosigsKey = "SBP_SendClientsSosigs";
public static Dictionary<int, SosigPlayerBody> playerBodies = new Dictionary<int, SosigPlayerBody>();
public static Dictionary<int, PlayerSosig> playerSosigs = new Dictionary<int, PlayerSosig>();
public static PlayerSosig localSosig = new PlayerSosig();
public static void SetupPacketTypes()
{
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Expected O, but got Unknown
//IL_0124: 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_012f: Expected O, but got Unknown
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Expected O, but got Unknown
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Expected O, but got Unknown
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Expected O, but got Unknown
localSosig.playerID = GameManager.ID;
if (Networking.IsHost())
{
if (Mod.registeredCustomPacketIDs.ContainsKey(sendSosigKey))
{
SendSosigToServer_ID = Mod.registeredCustomPacketIDs[sendSosigKey];
}
else
{
SendSosigToServer_ID = Server.RegisterCustomPacketType(sendSosigKey, 0);
}
CustomPacketHandler[] customPacketHandlers = Mod.customPacketHandlers;
int sendSosigToServer_ID = SendSosigToServer_ID;
object obj = <>O.<0>__SosigToServer_Handler;
if (obj == null)
{
CustomPacketHandler val = SosigToServer_Handler;
<>O.<0>__SosigToServer_Handler = val;
obj = (object)val;
}
customPacketHandlers[sendSosigToServer_ID] = (CustomPacketHandler)obj;
if (Mod.registeredCustomPacketIDs.ContainsKey(sendClientsSosigsKey))
{
SendClientsSosigs_ID = Mod.registeredCustomPacketIDs[sendClientsSosigsKey];
}
else
{
SendClientsSosigs_ID = Server.RegisterCustomPacketType(sendClientsSosigsKey, 0);
}
CustomPacketHandler[] customPacketHandlers2 = Mod.customPacketHandlers;
int sendClientsSosigs_ID = SendClientsSosigs_ID;
object obj2 = <>O.<1>__SendClientsSosigs_Handler;
if (obj2 == null)
{
CustomPacketHandler val2 = SendClientsSosigs_Handler;
<>O.<1>__SendClientsSosigs_Handler = val2;
obj2 = (object)val2;
}
customPacketHandlers2[sendClientsSosigs_ID] = (CustomPacketHandler)obj2;
return;
}
if (Mod.registeredCustomPacketIDs.ContainsKey(sendSosigKey))
{
SendSosigToServer_ID = Mod.registeredCustomPacketIDs[sendSosigKey];
CustomPacketHandler[] customPacketHandlers3 = Mod.customPacketHandlers;
int sendSosigToServer_ID2 = SendSosigToServer_ID;
object obj3 = <>O.<0>__SosigToServer_Handler;
if (obj3 == null)
{
CustomPacketHandler val3 = SosigToServer_Handler;
<>O.<0>__SosigToServer_Handler = val3;
obj3 = (object)val3;
}
customPacketHandlers3[sendSosigToServer_ID2] = (CustomPacketHandler)obj3;
}
else
{
ClientSend.RegisterCustomPacketType(sendSosigKey);
object obj4 = <>O.<2>__SosigToServer_Received;
if (obj4 == null)
{
CustomPacketHandlerReceivedDelegate val4 = SosigToServer_Received;
<>O.<2>__SosigToServer_Received = val4;
obj4 = (object)val4;
}
Mod.CustomPacketHandlerReceived += (CustomPacketHandlerReceivedDelegate)obj4;
}
if (Mod.registeredCustomPacketIDs.ContainsKey(sendClientsSosigsKey))
{
SendClientsSosigs_ID = Mod.registeredCustomPacketIDs[sendClientsSosigsKey];
CustomPacketHandler[] customPacketHandlers4 = Mod.customPacketHandlers;
int sendClientsSosigs_ID2 = SendClientsSosigs_ID;
object obj5 = <>O.<1>__SendClientsSosigs_Handler;
if (obj5 == null)
{
CustomPacketHandler val5 = SendClientsSosigs_Handler;
<>O.<1>__SendClientsSosigs_Handler = val5;
obj5 = (object)val5;
}
customPacketHandlers4[sendClientsSosigs_ID2] = (CustomPacketHandler)obj5;
}
else
{
ClientSend.RegisterCustomPacketType(sendClientsSosigsKey);
object obj6 = <>O.<3>__SendClientsSosigs_Received;
if (obj6 == null)
{
CustomPacketHandlerReceivedDelegate val6 = SendClientsSosigs_Received;
<>O.<3>__SendClientsSosigs_Received = val6;
obj6 = (object)val6;
}
Mod.CustomPacketHandlerReceived += (CustomPacketHandlerReceivedDelegate)obj6;
}
}
private static PlayerSosig GetPlayerSosig(int id)
{
if (!playerSosigs.ContainsKey(id))
{
PlayerSosig playerSosig = new PlayerSosig
{
playerID = id
};
playerSosigs.Add(id, playerSosig);
return playerSosig;
}
return playerSosigs[id];
}
private static void SetPlayerSosig(PlayerSosig player)
{
if (!playerSosigs.ContainsKey(player.playerID))
{
playerSosigs.Add(player.playerID, player);
}
else
{
playerSosigs[player.playerID] = player;
}
}
public static void SetPlayerClothing(PlayerSosig player)
{
if ((Object)(object)Networking.GetPlayerBody(player.playerID) == (Object)null || Networking.GetPlayerBody(player.playerID).playerPrefabID != "SosigPlayerBody")
{
return;
}
SosigPlayerBody sosigPlayerBody = null;
if (player.playerID == Networking.GetLocalPlayerID())
{
PlayerBody currentPlayerBody = GameManager.currentPlayerBody;
if ((Object)(object)currentPlayerBody != (Object)null)
{
sosigPlayerBody = (SosigPlayerBody)(object)currentPlayerBody;
}
}
else
{
TrackedPlayerBody playerBody = GameManager.players[player.playerID].playerBody;
if ((Object)(object)playerBody != (Object)null && (Object)(object)playerBody.physicalPlayerBody != (Object)null)
{
PlayerBody physicalPlayerBody = playerBody.physicalPlayerBody;
if ((Object)(object)physicalPlayerBody != (Object)null)
{
sosigPlayerBody = (SosigPlayerBody)(object)physicalPlayerBody;
}
}
}
if ((Object)(object)sosigPlayerBody != (Object)null)
{
sosigPlayerBody.ReceiveSosigClothing(player);
}
}
public static void SendClientsSosigs_Send()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
if (!Networking.ServerRunning() || Networking.IsClient())
{
return;
}
SosigPlayerBodyPlugin.Logger.LogMessage((object)"Networking: Send Clients Sosigs");
Packet val = new Packet(SendClientsSosigs_ID);
List<int> list = new List<int>();
list.Add(Networking.GetLocalPlayerID());
list.AddRange(Networking.GetPlayerIDs());
int num = 0;
for (int i = 0; i < list.Count; i++)
{
PlayerSosig playerSosig = GetPlayerSosig(list[i]);
if (playerSosig != null)
{
num++;
}
}
val.Write(num);
for (int j = 0; j < list.Count; j++)
{
PlayerSosig playerSosig2 = playerSosigs[list[j]];
if (playerSosig2 != null)
{
val.Write(playerSosig2.sosigID);
val.Write(playerSosig2.sosigPrefabIndex);
val.Write(playerSosig2.Torsowear);
val.Write(playerSosig2.Headwear);
val.Write(playerSosig2.Pantswear);
val.Write(playerSosig2.Pantswear_Lower);
val.Write(playerSosig2.Facewear);
val.Write(playerSosig2.Eyewear);
val.Write(playerSosig2.Backpacks);
val.Write(playerSosig2.TorosDecoration);
val.Write(playerSosig2.Belt);
val.Write(playerSosig2.sosigMaterial);
}
}
ServerSend.SendTCPDataToAll(val, true);
}
public static void SendClientsSosigs_Handler(int clientID, Packet packet)
{
SosigPlayerBodyPlugin.Logger.LogMessage((object)"Networking: Send Clients Sosigs Received");
List<PlayerSosig> list = new List<PlayerSosig>();
int num = packet.ReadInt(true);
for (int i = 0; i < num; i++)
{
PlayerSosig playerSosig = new PlayerSosig
{
playerID = clientID,
sosigID = packet.ReadInt(true),
sosigPrefabIndex = packet.ReadInt(true),
Torsowear = packet.ReadString(true),
Headwear = packet.ReadString(true),
Pantswear = packet.ReadString(true),
Pantswear_Lower = packet.ReadString(true),
Facewear = packet.ReadString(true),
Eyewear = packet.ReadString(true),
Backpacks = packet.ReadString(true),
TorosDecoration = packet.ReadString(true),
Belt = packet.ReadString(true),
sosigMaterial = packet.ReadInt(true)
};
if (playerSosig.playerID != Networking.GetLocalPlayerID())
{
SetPlayerSosig(playerSosig);
list.Add(playerSosig);
}
}
for (int j = 0; j < list.Count; j++)
{
SetPlayerClothing(list[j]);
}
}
private static void SendClientsSosigs_Received(string handlerID, int index)
{
//IL_002d: 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_0038: Expected O, but got Unknown
//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_0054: Expected O, but got Unknown
if (handlerID == sendClientsSosigsKey)
{
SendClientsSosigs_ID = index;
CustomPacketHandler[] customPacketHandlers = Mod.customPacketHandlers;
object obj = <>O.<1>__SendClientsSosigs_Handler;
if (obj == null)
{
CustomPacketHandler val = SendClientsSosigs_Handler;
<>O.<1>__SendClientsSosigs_Handler = val;
obj = (object)val;
}
customPacketHandlers[index] = (CustomPacketHandler)obj;
object obj2 = <>O.<3>__SendClientsSosigs_Received;
if (obj2 == null)
{
CustomPacketHandlerReceivedDelegate val2 = SendClientsSosigs_Received;
<>O.<3>__SendClientsSosigs_Received = val2;
obj2 = (object)val2;
}
Mod.CustomPacketHandlerReceived -= (CustomPacketHandlerReceivedDelegate)obj2;
}
}
public static void SosigToServer_Send()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
if (Networking.ServerRunning() && !Networking.IsHost())
{
SosigPlayerBodyPlugin.Logger.LogMessage((object)"Networking: Client Sending Sosig");
Packet val = new Packet(SendSosigToServer_ID);
val.Write(localSosig.sosigID);
val.Write(localSosig.sosigPrefabIndex);
val.Write(localSosig.Torsowear);
val.Write(localSosig.Headwear);
val.Write(localSosig.Pantswear);
val.Write(localSosig.Pantswear_Lower);
val.Write(localSosig.Facewear);
val.Write(localSosig.Eyewear);
val.Write(localSosig.Backpacks);
val.Write(localSosig.TorosDecoration);
val.Write(localSosig.Belt);
val.Write(localSosig.sosigMaterial);
ClientSend.SendTCPData(val, true);
}
}
public static void SosigToServer_Handler(int clientID, Packet packet)
{
SosigPlayerBodyPlugin.Logger.LogMessage((object)"Networking: Received Sosig");
PlayerSosig playerSosig = new PlayerSosig
{
playerID = clientID,
sosigID = packet.ReadInt(true),
sosigPrefabIndex = packet.ReadInt(true),
Torsowear = packet.ReadString(true),
Headwear = packet.ReadString(true),
Pantswear = packet.ReadString(true),
Pantswear_Lower = packet.ReadString(true),
Facewear = packet.ReadString(true),
Eyewear = packet.ReadString(true),
Backpacks = packet.ReadString(true),
TorosDecoration = packet.ReadString(true),
Belt = packet.ReadString(true),
sosigMaterial = packet.ReadInt(true)
};
SetPlayerSosig(playerSosig);
SetPlayerClothing(playerSosig);
SendClientsSosigs_Send();
}
private static void SosigToServer_Received(string handlerID, int index)
{
//IL_002d: 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_0038: Expected O, but got Unknown
//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_0054: Expected O, but got Unknown
if (handlerID == sendSosigKey)
{
SendSosigToServer_ID = index;
CustomPacketHandler[] customPacketHandlers = Mod.customPacketHandlers;
object obj = <>O.<0>__SosigToServer_Handler;
if (obj == null)
{
CustomPacketHandler val = SosigToServer_Handler;
<>O.<0>__SosigToServer_Handler = val;
obj = (object)val;
}
customPacketHandlers[index] = (CustomPacketHandler)obj;
object obj2 = <>O.<2>__SosigToServer_Received;
if (obj2 == null)
{
CustomPacketHandlerReceivedDelegate val2 = SosigToServer_Received;
<>O.<2>__SosigToServer_Received = val2;
obj2 = (object)val2;
}
Mod.CustomPacketHandlerReceived -= (CustomPacketHandlerReceivedDelegate)obj2;
}
}
}
public class SPB_WristMenu : MonoBehaviour
{
public class SosigInfo
{
public string name;
public int id;
}
public static SPB_WristMenu instance;
public static SosigPlayerBody bodyInstance;
public static bool stopInput;
public GameObject menu;
public InputField sosigIDInputField;
public Text sosigNameText;
public static int sosigIndex;
public static SosigEnemyID sosigID;
private static SosigInfo[] sosigList;
public static SosigInfo[] SosigList
{
get
{
if (sosigList == null)
{
List<SosigInfo> list = new List<SosigInfo>();
int[] array = (int[])Enum.GetValues(typeof(SosigEnemyID));
for (int i = 0; i < array.Length; i++)
{
string name = Enum.GetName(typeof(SosigEnemyID), array[i]);
name = ((name == "") ? "Custom" : name.Replace("_", " "));
SosigInfo item = new SosigInfo
{
name = name,
id = array[i]
};
list.Add(item);
}
SosigPlayerBodyPlugin.Logger.LogMessage((object)("Found base game Sosig IDs: " + list.Count));
if (SosigPlayerBodyPlugin.CustomSosigLoaderEnabled)
{
List<SosigInfo> list2 = new List<SosigInfo>();
list2.AddRange(global::SosigPlayerBody.CSL.CSL.GetCustomSosigIDs());
SosigPlayerBodyPlugin.Logger.LogMessage((object)("Found Custom Sosig IDs: " + list2.Count));
list.AddRange(list2);
}
SosigPlayerBodyPlugin.Logger.LogMessage((object)("Total Sosig IDs: " + list.Count));
sosigList = list.ToArray();
}
return sosigList;
}
}
private void Awake()
{
instance = this;
}
public void Apply()
{
//IL_003f: 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_005e: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)BodyInstance() != (Object)null)
{
SosigEnemyID localToSosigID = (SosigEnemyID)SosigList[sosigIndex].id;
bodyInstance.SetLocalToSosigID(localToSosigID);
SendSosigToServer();
SM.PlayGlobalUISound((GlobalUISound)0, ((Component)sosigIDInputField).transform.position);
}
else
{
SM.PlayGlobalUISound((GlobalUISound)2, ((Component)sosigIDInputField).transform.position);
}
}
private SosigPlayerBody BodyInstance()
{
if ((Object)(object)bodyInstance == (Object)null && (Object)(object)GameManager.currentPlayerBody != (Object)null)
{
bodyInstance = ((Component)GameManager.currentPlayerBody).gameObject.GetComponent<SosigPlayerBody>();
}
return bodyInstance;
}
public void SetSosigMaterial(int id)
{
//IL_007c: 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)
SPB_Networking.localSosig.sosigMaterial = id;
if ((Object)(object)BodyInstance() != (Object)null && SosigPlayerBodyPlugin.sosigMaterials != null && SosigPlayerBodyPlugin.sosigMaterials.Length != 0)
{
SPB_Networking.localSosig.sosigMaterial = id;
bodyInstance.SetSosigMaterial(SosigPlayerBodyPlugin.sosigMaterials[id]);
((PlayerBody)bodyInstance).SetColor(GameManager.colors[GameManager.colorIndex]);
}
SendSosigToServer();
SM.PlayGlobalUISound((GlobalUISound)0, ((Component)sosigIDInputField).transform.position);
}
public void AdjustSosigID(int amount)
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
if (CreateWristMenu())
{
sosigIndex += amount;
if (sosigIndex >= SosigList.Length)
{
sosigIndex = 0;
}
else if (sosigIndex < 0)
{
sosigIndex = SosigList.Length - 1;
}
UpdateWristDisplay();
SM.PlayGlobalUISound((GlobalUISound)0, ((Component)sosigIDInputField).transform.position);
}
}
public static void SendSosigToServer()
{
CreateWristMenu();
if (Networking.ServerRunning() && (Object)(object)GameManager.currentPlayerBody == (Object)(object)bodyInstance)
{
SPB_Networking.SosigToServer_Send();
}
}
public void SetSosigIDInput()
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
if (stopInput || (Object)(object)bodyInstance == (Object)null || sosigIDInputField.text == "")
{
return;
}
int result = -1;
if (!int.TryParse(sosigIDInputField.text, out result))
{
return;
}
if (result == -1 || result == -1)
{
SM.PlayGlobalUISound((GlobalUISound)2, ((Component)sosigIDInputField).transform.position);
return;
}
bool flag = false;
for (int i = 0; i < SosigList.Length; i++)
{
if (SosigList[i].id == result)
{
sosigIndex = i;
flag = true;
break;
}
}
if (!flag)
{
SosigPlayerBodyPlugin.Logger.LogMessage((object)("Invalid Sosig Enemy ID, could not find: " + sosigIDInputField.text));
return;
}
sosigID = (SosigEnemyID)SosigList[sosigIndex].id;
SM.PlayGlobalUISound((GlobalUISound)0, ((Component)sosigIDInputField).transform.position);
}
public static IEnumerator MenuCheck(SosigPlayerBody spb)
{
yield return (object)new WaitForSeconds(1f);
if (Networking.ServerRunning() && (Object)(object)GameManager.currentPlayerBody == (Object)(object)spb)
{
SetMenu(spb);
}
}
public static void SetLocalBody(SosigPlayerBody body)
{
//IL_001e: 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)
if (!((Object)(object)body == (Object)null))
{
SosigEnemyID localToSosigID = (SosigEnemyID)SosigList[sosigIndex].id;
body.SetLocalToSosigID(localToSosigID);
}
}
public static void UpdateWristDisplay()
{
if (CreateWristMenu())
{
stopInput = true;
instance.sosigIDInputField.text = SosigList[sosigIndex].id.ToString();
instance.sosigNameText.text = SosigList[sosigIndex].name;
stopInput = false;
}
}
public static void SetMenu(SosigPlayerBody spb)
{
if (!((Object)(object)spb == (Object)null))
{
CreateWristMenu();
bodyInstance = spb;
if ((Object)(object)instance != (Object)null && (Object)(object)instance.menu != (Object)null)
{
instance.menu.SetActive(true);
}
}
}
public static bool CreateWristMenu()
{
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)instance != (Object)null)
{
return true;
}
if ((Object)(object)instance == (Object)null && (Object)(object)SosigPlayerBodyPlugin.spbAssets != (Object)null && (Object)(object)SosigPlayerBodyPlugin.spbAssets.menuBodySelector != (Object)null && (Object)(object)BodyWristMenuSection.playerBodyText != (Object)null)
{
instance = Object.Instantiate<GameObject>(SosigPlayerBodyPlugin.spbAssets.menuBodySelector, ((Component)BodyWristMenuSection.playerBodyText).transform.position, ((Component)BodyWristMenuSection.playerBodyText).transform.rotation, ((Component)BodyWristMenuSection.playerBodyText).transform.parent).GetComponent<SPB_WristMenu>();
stopInput = true;
instance.sosigIDInputField.text = SosigList[sosigIndex].id.ToString();
instance.sosigNameText.text = SosigList[sosigIndex].name;
stopInput = false;
return true;
}
return false;
}
private void CheckBody()
{
if (BodyWristMenuSection.playerBodyText.text == "Sosig Player Body")
{
menu.SetActive(true);
}
else
{
menu.SetActive(false);
}
}
}
}
namespace SosigPlayerBody.CSL
{
public class CSL
{
[CompilerGenerated]
private static class <>O
{
public static SosigsLoadedComplete <0>__SosigPlayerBodyComplete;
}
public static void HookLoadingComplete()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
object obj = <>O.<0>__SosigPlayerBodyComplete;
if (obj == null)
{
SosigsLoadedComplete val = SosigPlayerBodyPlugin.SosigPlayerBodyComplete;
<>O.<0>__SosigPlayerBodyComplete = val;
obj = (object)val;
}
CustomSosigLoaderPlugin.SosigsLoadedCompleted += (SosigsLoadedComplete)obj;
}
public static void UnHookLoadingComplete()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
object obj = <>O.<0>__SosigPlayerBodyComplete;
if (obj == null)
{
SosigsLoadedComplete val = SosigPlayerBodyPlugin.SosigPlayerBodyComplete;
<>O.<0>__SosigPlayerBodyComplete = val;
obj = (object)val;
}
CustomSosigLoaderPlugin.SosigsLoadedCompleted -= (SosigsLoadedComplete)obj;
}
public static SPB_WristMenu.SosigInfo[] GetCustomSosigIDs()
{
//IL_002d: 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_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Expected I4, but got Unknown
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected I4, but got Unknown
SPB_WristMenu.SosigInfo[] array = new SPB_WristMenu.SosigInfo[CustomSosigLoaderPlugin.customSosigIDs.Keys.Count];
int num = 0;
foreach (SosigEnemyID key in CustomSosigLoaderPlugin.customSosigIDs.Keys)
{
array[num] = new SPB_WristMenu.SosigInfo
{
name = CustomSosigLoaderPlugin.customSosigs[(int)key].DisplayName,
id = (int)key
};
num++;
}
return array;
}
}
}
namespace SosigPlayerBody.Compatiblity
{
internal class RBOffsetFollower : MonoBehaviour
{
public Transform transformToFollow;
public float followOffset = -0.2f;
public float currentOffset = -0.2f;
public Vector3 rotationAxes;
public Rigidbody rb;
public void FixedUpdate()
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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_0059: 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_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
Quaternion rotation = transformToFollow.rotation;
float num = ((Quaternion)(ref rotation)).eulerAngles.x * rotationAxes.x;
rotation = transformToFollow.rotation;
float num2 = ((Quaternion)(ref rotation)).eulerAngles.y * rotationAxes.y;
rotation = transformToFollow.rotation;
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(num, num2, ((Quaternion)(ref rotation)).eulerAngles.z * rotationAxes.z);
rb.MoveRotation(Quaternion.Euler(val));
Vector3 val2 = transformToFollow.position + transformToFollow.up * followOffset + ((Component)this).transform.up * currentOffset;
rb.MovePosition(val2);
}
}
}