using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using CSync.Extensions;
using CSync.Lib;
using Dissonance;
using GameNetcodeStuff;
using HarmonyLib;
using Lethal_Impact.Loader;
using Microsoft.CodeAnalysis;
using ModelReplacement;
using ModelReplacement.AvatarBodyUpdater;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("Lethal_Impact-ME")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Lethal_Impact-ME")]
[assembly: AssemblyTitle("Lethal_Impact-ME")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace Lethal_Impact
{
public class ModelScript : MonoBehaviour
{
[HarmonyPatch(typeof(ModelReplacementAPI), "SetPlayerModelReplacement")]
private static class ResetModelScale
{
private static bool Prefix(PlayerControllerB player, Type type)
{
//IL_000c: 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_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: 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 (((Component)player.gameplayCamera).transform.localPosition != Vector3.zero)
{
((Component)player.gameplayCamera).transform.localPosition = Vector3.zero;
}
if (((Component)player).gameObject.transform.localScale != Vector3.one)
{
((Component)player).gameObject.transform.localScale = Vector3.one;
}
return true;
}
}
private ModelScript modelScript = null;
protected VoicePlayerState voice;
public PlayerControllerB player;
private PlayerControllerB nearbyPlayer = null;
private readonly Harmony harmony = new Harmony("Zephy.Lethal_Impact.Script");
private static bool harmonyPatched;
private float distanceToPlayer = 30f;
private string modelName;
private Vector3 rootScale = Vector3.zero;
private Vector3 LastPosition = Vector3.zero;
public Vector3 modCamPos = Vector3.zero;
private bool isModdedCamHeight = false;
private bool StopSpamLog = false;
private readonly Dictionary<string, int> blendshapeIndex = new Dictionary<string, int>();
private Transform eyeBone;
private Transform dummyEyeBone;
private Vector3 DefaultEye_EulerAngles;
private float DesireAngle;
private float blendShapeValue = 0f;
private bool isRandomEnable = true;
private int mouthIndex = -1;
private int eyesIndex = -1;
private int OnScare = -1;
private int random = 0;
private float interval = 0f;
private float timer = 0f;
private readonly List<string> eyesName = new List<string> { "まばたき" };
private readonly List<string> mouthName = new List<string> { "あ" };
private readonly List<string> faceEmotion = new List<string> { "OnScare", "OnDeath 1", "OnDeath 2" };
private readonly Dictionary<string, Vector3> SpecialScaleList = new Dictionary<string, Vector3>
{
{
"Aponia",
new Vector3(0.98f, 0.98f, 0.98f)
},
{
"Mobius",
new Vector3(0.94f, 0.94f, 0.94f)
},
{
"Kosma",
Vector3.one
},
{
"Vill-V",
new Vector3(0.98f, 0.98f, 0.98f)
},
{
"YaeSakura",
new Vector3(0.98f, 0.98f, 0.98f)
}
};
public bool isHelmetDisable => Lethal_Impact_Config.disableHelmet.Value;
public bool isAllowHardcore => Lethal_Impact_Config.allowHardcore.Value;
public bool isDeveloperMode => Lethal_Impact_Config.developerMode.Value;
public float sensitivity => Lethal_Impact_Config.voiceSensitivity.Value;
public bool DisableMask => Lethal_Impact_Config.DisableMask.Value;
private float Map(float value, float min1, float max1, float min2, float max2)
{
float num = (value - min1) / (max1 - min1);
return num * (max2 - min2) + min2;
}
public void Model_Initialize(OffsetBuilder offsetBuilder)
{
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: 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_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)offsetBuilder != (Object)null)
{
modelName = ((Object)offsetBuilder).name;
Regex regex = new Regex("^(\\w+)[_-].*");
Match match = regex.Match(((Object)offsetBuilder).name);
voiceRecognize();
if (SpecialScaleList.ContainsKey(((Object)offsetBuilder).name))
{
((Component)player).gameObject.transform.localScale = SpecialScaleList[((Object)offsetBuilder).name];
}
else if (match.Success)
{
string value = match.Groups[1].Value;
((Component)player).gameObject.transform.localScale = (SpecialScaleList.ContainsKey(value) ? SpecialScaleList[value] : offsetBuilder.rootScale);
}
else
{
((Component)player).gameObject.transform.localScale = offsetBuilder.rootScale;
}
rootScale = ((Component)player).gameObject.transform.localScale;
if (rootScale.x > 1f || rootScale.y > 1f || rootScale.z > 1f)
{
isModdedCamHeight = true;
((Component)player).gameObject.transform.localScale = Vector3.one;
modCamPos = new Vector3(0f, 0.2f, 0f);
rootScale = ((Component)player).gameObject.transform.localScale;
}
else
{
isModdedCamHeight = false;
modCamPos = Vector3.zero;
rootScale = ((Component)player).gameObject.transform.localScale;
}
}
}
private void Accessories_Init()
{
string text = modelName;
string text2 = text;
if (text2 == "Kalpas")
{
((Component)this).gameObject.GetComponent<SkinnedMeshRenderer>().SetBlendShapeWeight(blendshapeIndex["Mask_disable"], DisableMask ? 100f : 0f);
}
}
private void CheckScaling()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: 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_008c: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Expected O, but got Unknown
//IL_00b7: Expected O, but got Unknown
//IL_00d0: 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)
if (!player.inTerminalMenu)
{
if (rootScale != Vector3.zero && rootScale != ((Component)player).gameObject.transform.localScale)
{
((Component)player).gameObject.transform.localScale = rootScale;
}
if (isModdedCamHeight && ((Component)player.gameplayCamera).transform.localPosition != modCamPos && (Object)player == (Object)StartOfRound.Instance.localPlayerController)
{
Transform transform = ((Component)player.gameplayCamera).transform;
transform.localPosition += modCamPos;
}
}
}
private Dictionary<string, Transform> GetBoneMap(Transform[] OriginalBone)
{
Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>();
foreach (Transform val in OriginalBone)
{
if ((Object)(object)val != (Object)null && !dictionary.ContainsKey(((Object)val).name))
{
dictionary.Add(((Object)val).name, val);
}
}
return dictionary;
}
private void voiceRecognize()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_0044: Expected O, but got Unknown
StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
voice = player.voicePlayerState;
if (voice == null && (Object)player == (Object)StartOfRound.Instance.localPlayerController)
{
voice = StartOfRound.Instance.voiceChatModule.FindPlayer(StartOfRound.Instance.voiceChatModule.LocalPlayerName);
}
}
private void UsingMouthMovement()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
if ((Object)StartOfRound.Instance.voiceChatModule == (Object)null)
{
return;
}
if (voice == null)
{
voiceRecognize();
return;
}
float num = Mathf.Clamp(Map(voice.Amplitude * sensitivity, 0f, 0.2f, 0f, 50f), 0f, 50f);
float num2 = ((voice.IsSpeaking && !player.isPlayerDead) ? num : 0f);
if (mouthIndex != -1)
{
((Component)this).gameObject.GetComponent<SkinnedMeshRenderer>().SetBlendShapeWeight(mouthIndex, num2);
}
}
private void IsBlinking(bool blink)
{
if (!blink)
{
return;
}
interval += Time.deltaTime;
SkinnedMeshRenderer componentInChildren = ((Component)this).gameObject.GetComponentInChildren<SkinnedMeshRenderer>();
componentInChildren.SetBlendShapeWeight(eyesIndex, 0f);
if (!isRandomEnable)
{
blendShapeValue += Time.deltaTime * 5000f;
if (random == Mathf.FloorToInt(interval) && interval % 1f < 0.3f)
{
componentInChildren.SetBlendShapeWeight(eyesIndex, Mathf.Clamp(blendShapeValue, 0f, 100f));
}
}
else
{
random = Random.Range(0, 5);
isRandomEnable = false;
}
if (interval > 5f)
{
interval = 0f;
blendShapeValue = 0f;
}
}
private void GetNearbyPlayers()
{
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
//IL_003e: 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_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Expected O, but got Unknown
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
PlayerControllerB[] array = allPlayerScripts;
foreach (PlayerControllerB val in array)
{
if (val.playerClientId != player.playerClientId)
{
float num = Vector3.Distance(((Component)val).transform.position, ((Component)player).transform.position);
if (num < 30f && ((Object)nearbyPlayer == (Object)null || num < distanceToPlayer))
{
nearbyPlayer = val;
distanceToPlayer = num;
}
}
}
if ((Object)nearbyPlayer != (Object)null)
{
ProceedNearbyPlayer(nearbyPlayer);
}
}
private void ProceedNearbyPlayer(PlayerControllerB _nearbyPlayer)
{
//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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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_0088: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: 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_01ac: 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_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
Transform[] bodyParts = _nearbyPlayer.bodyParts;
Transform[] array = bodyParts;
foreach (Transform val in array)
{
if (!(((Object)val).name == "spine.004") || modelName == null)
{
continue;
}
if (LastPosition == Vector3.zero)
{
LastPosition = ((Component)_nearbyPlayer).transform.position;
}
if (_nearbyPlayer.performingEmote || LastPosition != ((Component)_nearbyPlayer).transform.position)
{
LookAtTarget(val.position + new Vector3(0f, 0.25f, 0f), !player.performingEmote && !player.isSprinting);
LastPosition = ((Component)_nearbyPlayer).transform.position;
if (timer != 0f)
{
timer = 0f;
}
}
else
{
timer += Time.deltaTime;
if (timer < 5f)
{
LookAtTarget(val.position + new Vector3(0f, 0.25f, 0f), !player.performingEmote && !player.isSprinting);
}
else
{
LookAtTarget(val.position + new Vector3(0f, 0.25f, 0f), active: false);
}
}
}
}
private void LookAtTarget(Vector3 targetPosition, bool active)
{
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: 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_0065: 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_007c: 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_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: 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)
if ((Object)(object)eyeBone == (Object)null)
{
if (!StopSpamLog)
{
Debug.LogError((object)"Cannot find eyes bone rig, skipping looking at function");
StopSpamLog = true;
}
}
else if (active)
{
Vector3 val = targetPosition - ((Component)player.gameplayCamera).transform.position;
Vector3 normalized = ((Vector3)(ref val)).normalized;
DesireAngle = Vector3.Angle(((Component)player.gameplayCamera).transform.forward, normalized);
float num = Vector3.Distance(((Component)player).transform.position, targetPosition);
if (isDeveloperMode)
{
Debug.Log((object)$"Angle between this player and nearby player : {DesireAngle}");
}
if (num < 4.5f && Mathf.Abs(DesireAngle) > 0f && Mathf.Abs(DesireAngle) < 45f)
{
dummyEyeBone.position = eyeBone.position;
dummyEyeBone.LookAt(targetPosition);
if (dummyEyeBone.localEulerAngles.x > 270f && dummyEyeBone.localEulerAngles.x < 286f)
{
eyeBone.localRotation = Quaternion.Slerp(eyeBone.localRotation, dummyEyeBone.localRotation, Time.deltaTime * 10f);
}
eyeBone.localRotation = Quaternion.Slerp(eyeBone.localRotation, dummyEyeBone.localRotation, Time.deltaTime * 10f);
}
else
{
eyeBone.localRotation = Quaternion.Slerp(eyeBone.localRotation, Quaternion.Euler(DefaultEye_EulerAngles), Time.deltaTime * 5f);
}
}
else
{
eyeBone.localRotation = Quaternion.Slerp(eyeBone.localRotation, Quaternion.Euler(DefaultEye_EulerAngles), Time.deltaTime * 5f);
}
}
private void Awake()
{
if (!harmonyPatched)
{
harmony.PatchAll(typeof(ModelScript));
harmonyPatched = true;
}
modelScript = this;
}
private void OnEnable()
{
//IL_0007: 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_0020: Expected O, but got Unknown
//IL_0020: Expected O, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
if ((Object)player == (Object)StartOfRound.Instance.localPlayerController && isHelmetDisable && ((Component)player.localVisor).transform.localScale != Vector3.zero)
{
((Component)player.localVisor).transform.localScale = Vector3.zero;
}
}
private void OnDisable()
{
//IL_0007: 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_0020: Expected O, but got Unknown
//IL_0020: Expected O, but got Unknown
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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_005b: 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)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: 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)
if ((Object)player == (Object)StartOfRound.Instance.localPlayerController)
{
if (((Component)player).gameObject.transform.localScale != Vector3.one)
{
((Component)player).gameObject.transform.localScale = Vector3.one;
}
if (((Component)player.gameplayCamera).transform.localPosition != Vector3.zero)
{
((Component)player.gameplayCamera).transform.localPosition = Vector3.zero;
}
if (isHelmetDisable && ((Component)player.localVisor).transform.localScale != new Vector3(0.36f, 0.49f, 0.49f))
{
((Component)player.localVisor).transform.localScale = new Vector3(0.36f, 0.49f, 0.49f);
}
}
}
private void Start()
{
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Expected O, but got Unknown
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
SkinnedMeshRenderer component = ((Component)this).gameObject.GetComponent<SkinnedMeshRenderer>();
if (component.sharedMesh.blendShapeCount > 0)
{
for (int i = 0; i < component.sharedMesh.blendShapeCount; i++)
{
blendshapeIndex.Add(component.sharedMesh.GetBlendShapeName(i), i);
}
eyesIndex = (blendshapeIndex.ContainsKey("まばたき") ? blendshapeIndex["まばたき"] : (-1));
mouthIndex = (blendshapeIndex.ContainsKey("あ") ? blendshapeIndex["あ"] : (-1));
OnScare = (blendshapeIndex.ContainsKey("OnScare") ? blendshapeIndex["OnScare"] : (-1));
}
if (GetBoneMap(((Component)this).gameObject.GetComponent<SkinnedMeshRenderer>().bones) != null && GetBoneMap(player.bodyParts) != null)
{
if (GetBoneMap(((Component)this).gameObject.GetComponent<SkinnedMeshRenderer>().bones).ContainsKey("EyeLook"))
{
GameObject val = new GameObject("dummyBone");
dummyEyeBone = val.transform;
eyeBone = GetBoneMap(((Component)this).gameObject.GetComponent<SkinnedMeshRenderer>().bones)["EyeLook"];
DefaultEye_EulerAngles = eyeBone.localEulerAngles;
dummyEyeBone.parent = eyeBone.parent;
dummyEyeBone.rotation = eyeBone.rotation;
dummyEyeBone.position = eyeBone.position;
}
else if (isDeveloperMode)
{
HUDManager.Instance.DisplayTip("MODEL WARNING:", "Model is missing eye's control rig", true, false, "LC_Tip1");
Debug.LogError((object)(modelName + " is missing eye's control rig"));
}
}
Accessories_Init();
}
private void Update()
{
if (!player.isPlayerDead)
{
CheckScaling();
GetNearbyPlayers();
if (mouthIndex != -1)
{
UsingMouthMovement();
}
IsBlinking(eyesIndex != -1);
}
}
[HarmonyPatch(typeof(Terminal), "BeginUsingTerminal")]
[HarmonyPostfix]
private static void EnableModelAdjust()
{
//IL_0037: 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)
PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
ModelScript modelScript = Object.FindObjectOfType<ModelScript>();
if ((Object)(object)modelScript != (Object)null && !modelScript.isAllowHardcore)
{
((Component)localPlayerController).gameObject.transform.localScale = Vector3.one;
((Component)localPlayerController.gameplayCamera).transform.localPosition = Vector3.zero;
}
}
[HarmonyPatch(typeof(BodyReplacementBase), "OnDeath")]
[HarmonyPrefix]
private static void FaceEmoteOnDeath()
{
ModelScript modelScript = Object.FindObjectOfType<ModelScript>();
SkinnedMeshRenderer component = ((Component)modelScript).gameObject.GetComponent<SkinnedMeshRenderer>();
int blendShapeIndex = component.sharedMesh.GetBlendShapeIndex(modelScript.faceEmotion[1]);
int blendShapeIndex2 = component.sharedMesh.GetBlendShapeIndex(modelScript.faceEmotion[2]);
int blendShapeIndex3 = component.sharedMesh.GetBlendShapeIndex(modelScript.eyesName[0]);
if (blendShapeIndex3 == -1)
{
return;
}
if (component.sharedMesh.GetBlendShapeIndex("Mask_disable") != -1)
{
component.SetBlendShapeWeight(component.sharedMesh.GetBlendShapeIndex("Mask_disable"), 0f);
}
if (blendShapeIndex != -1 && blendShapeIndex2 != -1)
{
if (component.GetBlendShapeWeight(blendShapeIndex) != 100f && component.GetBlendShapeWeight(blendShapeIndex2) != 100f)
{
component.SetBlendShapeWeight((Random.Range(1, 10) % 2 == 0) ? blendShapeIndex : blendShapeIndex2, 100f);
}
}
else if (blendShapeIndex != -1)
{
if (component.GetBlendShapeWeight(blendShapeIndex) != 100f)
{
component.SetBlendShapeWeight(blendShapeIndex, 100f);
}
}
else
{
component.SetBlendShapeWeight(blendShapeIndex3, 100f);
}
}
}
[BepInPlugin("Zephy.LethalImpact_ME", "Lethal Impact - MANTIS Edition", "0.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public static Plugin Instance;
public static Lethal_Impact_Config config;
private void Awake()
{
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Expected O, but got Unknown
config = new Lethal_Impact_Config(((BaseUnityPlugin)this).Config);
Assets.PopulateAssets();
Dictionary<string, Type> dictionary = new Dictionary<string, Type>();
dictionary.Add("Aponia", typeof(APONIA));
dictionary.Add("Eden", typeof(EDEN));
dictionary.Add("Elysia", typeof(ELYSIA));
dictionary.Add("FuHua", typeof(FUHUA));
dictionary.Add("Griseo", typeof(GRISEO));
dictionary.Add("Kalpas", typeof(KALPAS));
dictionary.Add("Kevin", typeof(KEVIN));
dictionary.Add("Kosma", typeof(KOSMA));
dictionary.Add("Mobius", typeof(MOBIUS));
dictionary.Add("Pardofelis", typeof(PARDOFELIS));
dictionary.Add("Su", typeof(SU));
dictionary.Add("Vill-V", typeof(VILL_V));
dictionary.Add("YaeSakura", typeof(YAESAKURA));
Dictionary<string, Type> dictionary2 = dictionary;
foreach (KeyValuePair<string, Type> item in dictionary2)
{
ModelReplacementAPI.RegisterSuitModelReplacement(item.Key, item.Value);
}
Harmony val = new Harmony("Zephy.LethalImpact_ME");
val.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Zephy.LethalImpact_ME is loaded!");
}
}
public static class Assets
{
public static string mainAssetBundleName = "Lethal_Impact-ME";
public static AssetBundle MainAssetBundle = null;
private static string GetAssemblyName()
{
return Assembly.GetExecutingAssembly().GetName().Name.Replace(" ", "_");
}
public static void PopulateAssets()
{
if ((Object)(object)MainAssetBundle == (Object)null)
{
Console.WriteLine(GetAssemblyName() + "." + mainAssetBundleName);
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName);
MainAssetBundle = AssetBundle.LoadFromStream(stream);
}
}
}
public class Lethal_Impact_Config : SyncedConfig2<Lethal_Impact_Config>
{
public static ConfigEntry<float> voiceSensitivity { get; private set; }
public static ConfigEntry<bool> disableHelmet { get; private set; }
[field: SyncedEntryField]
public static SyncedEntry<bool> allowHardcore { get; private set; }
[field: SyncedEntryField]
public static SyncedEntry<bool> DisableMask { get; private set; }
public static ConfigEntry<bool> developerMode { get; private set; }
public Lethal_Impact_Config(ConfigFile config)
: base("Zephy.Lethal_Impact_ME")
{
voiceSensitivity = config.Bind<float>("Features Setting", "Sensitivity Value", 50f, "NEED TO REJOIN SESSION TO APPLY CHANGE.\n\nChange mic sensitivity value for mouth to open");
disableHelmet = config.Bind<bool>("Features Setting", "Disable helmet", true, "NEED TO REJOIN SESSION TO APPLY CHANGE.\n\nRemove helmet on player.\n\nRemove all the crack and blur on screen, make the visual clearer");
allowHardcore = SyncedBindingExtensions.BindSyncedEntry<bool>(config, "Features Setting", "Allow hardcore", false, "NEED TO REJOIN SESSION TO APPLY CHANGE.\n\nApply accurate height when using terminal.\n\nCause model become too tall or too short to use terminal.");
DisableMask = SyncedBindingExtensions.BindSyncedEntry<bool>(config, "Model Settings", "Disable helmet", false, "NEED TO REJOIN SESSION TO APPLY CHANGE.\n\nRemove Kalpas mask.");
developerMode = config.Bind<bool>("Developer Mode", "Confirm", false, "Enable developer mode.\n\nThis one is purely for me to check if any features is wrong or off");
ConfigManager.Register<Lethal_Impact_Config>((SyncedConfig2<Lethal_Impact_Config>)(object)this);
}
}
}
namespace Lethal_Impact.Loader
{
public class APONIA : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "Aponia";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
ModelScript modelScript = ((Component)base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>()).gameObject.AddComponent(typeof(ModelScript)) as ModelScript;
modelScript.player = ((BodyReplacementBase)this).controller;
modelScript.Model_Initialize(((BodyReplacementBase)this).LoadAssetsAndReturnModel().gameObject.GetComponentInChildren<OffsetBuilder>());
}
}
public class EDEN : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "Eden";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
ModelScript modelScript = ((Component)base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>()).gameObject.AddComponent(typeof(ModelScript)) as ModelScript;
modelScript.player = ((BodyReplacementBase)this).controller;
modelScript.Model_Initialize(((BodyReplacementBase)this).LoadAssetsAndReturnModel().gameObject.GetComponentInChildren<OffsetBuilder>());
}
}
public class ELYSIA : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "Elysia";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
ModelScript modelScript = ((Component)base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>()).gameObject.AddComponent(typeof(ModelScript)) as ModelScript;
modelScript.player = ((BodyReplacementBase)this).controller;
modelScript.Model_Initialize(((BodyReplacementBase)this).LoadAssetsAndReturnModel().gameObject.GetComponentInChildren<OffsetBuilder>());
}
}
public class FUHUA : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "FuHua";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
ModelScript modelScript = ((Component)base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>()).gameObject.AddComponent(typeof(ModelScript)) as ModelScript;
modelScript.player = ((BodyReplacementBase)this).controller;
modelScript.Model_Initialize(((BodyReplacementBase)this).LoadAssetsAndReturnModel().gameObject.GetComponentInChildren<OffsetBuilder>());
}
}
public class GRISEO : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "Griseo";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
ModelScript modelScript = ((Component)base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>()).gameObject.AddComponent(typeof(ModelScript)) as ModelScript;
modelScript.player = ((BodyReplacementBase)this).controller;
modelScript.Model_Initialize(((BodyReplacementBase)this).LoadAssetsAndReturnModel().gameObject.GetComponentInChildren<OffsetBuilder>());
}
}
public class KALPAS : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "Kalpas";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
ModelScript modelScript = ((Component)base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>()).gameObject.AddComponent(typeof(ModelScript)) as ModelScript;
modelScript.player = ((BodyReplacementBase)this).controller;
modelScript.Model_Initialize(((BodyReplacementBase)this).LoadAssetsAndReturnModel().gameObject.GetComponentInChildren<OffsetBuilder>());
}
}
public class KEVIN : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "Kevin";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
ModelScript modelScript = ((Component)base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>()).gameObject.AddComponent(typeof(ModelScript)) as ModelScript;
modelScript.player = ((BodyReplacementBase)this).controller;
modelScript.Model_Initialize(((BodyReplacementBase)this).LoadAssetsAndReturnModel().gameObject.GetComponentInChildren<OffsetBuilder>());
}
}
public class KOSMA : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "Kosma";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
ModelScript modelScript = ((Component)base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>()).gameObject.AddComponent(typeof(ModelScript)) as ModelScript;
modelScript.player = ((BodyReplacementBase)this).controller;
modelScript.Model_Initialize(((BodyReplacementBase)this).LoadAssetsAndReturnModel().gameObject.GetComponentInChildren<OffsetBuilder>());
}
}
public class MOBIUS : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "Mobius";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
ModelScript modelScript = ((Component)base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>()).gameObject.AddComponent(typeof(ModelScript)) as ModelScript;
modelScript.player = ((BodyReplacementBase)this).controller;
modelScript.Model_Initialize(((BodyReplacementBase)this).LoadAssetsAndReturnModel().gameObject.GetComponentInChildren<OffsetBuilder>());
}
}
public class PARDOFELIS : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "Pardofelis";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
ModelScript modelScript = ((Component)base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>()).gameObject.AddComponent(typeof(ModelScript)) as ModelScript;
modelScript.player = ((BodyReplacementBase)this).controller;
modelScript.Model_Initialize(((BodyReplacementBase)this).LoadAssetsAndReturnModel().gameObject.GetComponentInChildren<OffsetBuilder>());
}
}
public class SU : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "Su";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
ModelScript modelScript = ((Component)base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>()).gameObject.AddComponent(typeof(ModelScript)) as ModelScript;
modelScript.player = ((BodyReplacementBase)this).controller;
modelScript.Model_Initialize(((BodyReplacementBase)this).LoadAssetsAndReturnModel().gameObject.GetComponentInChildren<OffsetBuilder>());
}
}
public class VILL_V : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "Vill-V";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
ModelScript modelScript = ((Component)base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>()).gameObject.AddComponent(typeof(ModelScript)) as ModelScript;
modelScript.player = ((BodyReplacementBase)this).controller;
modelScript.Model_Initialize(((BodyReplacementBase)this).LoadAssetsAndReturnModel().gameObject.GetComponentInChildren<OffsetBuilder>());
}
}
public class YAESAKURA : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "YaeSakura";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
ModelScript modelScript = ((Component)base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>()).gameObject.AddComponent(typeof(ModelScript)) as ModelScript;
modelScript.player = ((BodyReplacementBase)this).controller;
modelScript.Model_Initialize(((BodyReplacementBase)this).LoadAssetsAndReturnModel().gameObject.GetComponentInChildren<OffsetBuilder>());
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}