using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Xml.Serialization;
using BepInEx;
using BepInEx.Logging;
using EF.BuffSystem;
using EF.Essential.BuffSystem;
using EF.Essential.PostSystem;
using EF.PostSystem;
using FistVR;
using HarmonyLib;
using OtherLoader;
using Sodalite.Api;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace EF.Essential.BuffSystem
{
public struct BuffEffect
{
public bool isAddHealthPercent;
public float AddHealthPercent;
public bool isRemoveBleeding;
public bool isBleedingKillers;
public float BleedingKillersTime;
public bool isLowHealthKillers;
public float LowHealthKillersTime;
public bool isTremor;
public float TremorTime;
public bool isFracture;
public float FractureTime;
public bool isTunnelvision;
public float TunnelvisionTime;
public bool isRemovePain;
public bool isPainkillers;
public float PainkillersTime;
public LevelBuff Pain;
public LevelBuff Bleeding;
public LevelBuff SpeedUp;
public LevelBuff StrengthUp;
public LevelBuff ContinuedHeal;
public LevelBuff DamageResist;
public LevelBuff DamageScaler;
public LevelBuff AddMaxHealth;
public float MaxHealthReducePercent;
public BuffEffect(bool ignore = false)
{
isAddHealthPercent = false;
AddHealthPercent = 0f;
isRemoveBleeding = false;
isBleedingKillers = false;
BleedingKillersTime = 0f;
isLowHealthKillers = false;
LowHealthKillersTime = 0f;
isTremor = false;
TremorTime = 0f;
isFracture = false;
FractureTime = 0f;
isTunnelvision = false;
TunnelvisionTime = 0f;
isRemovePain = false;
isPainkillers = false;
PainkillersTime = 0f;
Pain = default(LevelBuff);
Bleeding = default(LevelBuff);
SpeedUp = default(LevelBuff);
StrengthUp = default(LevelBuff);
ContinuedHeal = default(LevelBuff);
DamageResist = default(LevelBuff);
DamageScaler = default(LevelBuff);
AddMaxHealth = default(LevelBuff);
MaxHealthReducePercent = 0f;
}
}
public struct BuffItem
{
public int PowerupType;
public BuffEffect Effect;
public float DelayedEffectTime;
public BuffEffect DelayedEffect;
public BuffItem(bool ignore = false)
{
PowerupType = 0;
Effect = default(BuffEffect);
DelayedEffect = default(BuffEffect);
DelayedEffectTime = 0f;
}
}
public struct BuffStat
{
public bool isBleedingKillers;
public float BleedingKillersTime;
public bool isLowHealthKillers;
public float LowHealthKillersTime;
public bool isTremor;
public float TremorTime;
public bool isFracture;
public float FractureTime;
public bool isTunnelvision;
public float TunnelvisionTime;
public bool isPainkillers;
public float PainkillersTime;
public List<LevelBuff> PainList;
public List<LevelBuff> BleedingList;
public List<LevelBuff> SpeedUpList;
public List<LevelBuff> StrengthUpList;
public List<LevelBuff> ContinuedHealList;
public List<LevelBuff> DamageResistList;
public List<LevelBuff> DamageScalerList;
public List<LevelBuff> AddMaxHealthList;
public float MaxHealthReducePercent;
public BuffStat(bool ignore = false)
{
isBleedingKillers = false;
BleedingKillersTime = 0f;
isLowHealthKillers = false;
LowHealthKillersTime = 0f;
isFracture = false;
FractureTime = 0f;
isTremor = false;
TremorTime = 0f;
isTunnelvision = false;
TunnelvisionTime = 0f;
isPainkillers = false;
PainkillersTime = 0f;
PainList = new List<LevelBuff>();
SpeedUpList = new List<LevelBuff>();
StrengthUpList = new List<LevelBuff>();
BleedingList = new List<LevelBuff>();
ContinuedHealList = new List<LevelBuff>();
DamageResistList = new List<LevelBuff>();
DamageScalerList = new List<LevelBuff>();
AddMaxHealthList = new List<LevelBuff>();
MaxHealthReducePercent = 0f;
}
}
}
namespace EF.Essential.PatchSystem
{
public class BuffSystemPatch : PatchPlugin
{
public List<BuffItem> BuffItemsList = new List<BuffItem>();
public override void DoPatch()
{
foreach (BuffItem buffItems in BuffItemsList)
{
if (GlobalBuffItemList.GetInstance().List.ContainsKey(buffItems.PowerupType))
{
Console.Write("BuffSystemPatch:{0}:Duplicate item define!!!{1}", PatchName, buffItems.PowerupType);
}
else
{
GlobalBuffItemList.GetInstance().List.Add(buffItems.PowerupType, buffItems);
}
}
}
}
}
namespace EF.Essential.Tools
{
public class FVRObjectSpawner : MonoBehaviour
{
public string ID;
private bool hasspawned = false;
private float t = 0f;
private float f = 0.5f;
private void Update()
{
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
if (hasspawned)
{
return;
}
t += Time.deltaTime;
if (!(t > f))
{
return;
}
if (IM.OD.ContainsKey(ID))
{
AnvilCallback<GameObject> gameObjectAsync = ((AnvilAsset)IM.OD[ID]).GetGameObjectAsync();
if (Object.op_Implicit((Object)(object)gameObjectAsync.Result))
{
GameObject val = Object.Instantiate<GameObject>(gameObjectAsync.Result);
val.transform.position = ((Component)this).transform.position;
val.transform.rotation = ((Component)this).transform.rotation;
hasspawned = true;
}
}
t -= f;
}
private void OnDrawGizmos()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: 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_004a: 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)
Gizmos.color = new Color(0.9f, 0.2f, 0.2f, 0.5f);
Gizmos.DrawLine(((Component)this).transform.position, ((Component)this).transform.position + ((Component)this).transform.right * 0.3f);
Gizmos.DrawSphere(((Component)this).transform.position, 0.2f);
}
}
}
namespace EF.Essential.BuffSystem
{
public class GlobalBuffItemList
{
private static readonly GlobalBuffItemList Instance = new GlobalBuffItemList();
public Dictionary<int, BuffItem> List;
private GlobalBuffItemList()
{
List = new Dictionary<int, BuffItem>();
}
public static GlobalBuffItemList GetInstance()
{
return Instance;
}
}
}
namespace EF.Essential.PostSystem
{
public class GlobalPostChangeList
{
private static readonly GlobalPostChangeList Instance = new GlobalPostChangeList();
public List<PostFloatChange> CL_brightness;
public List<PostFloatChange> CL_contrast;
public List<PostFloatChange> CL_saturation;
public List<PostFloatChange> CL_rbcount;
public List<PostFloatChange> CL_rbdesat;
public List<PostFloatChange> CL_rbdist;
public List<PostFloatChange> CL_lscount;
public List<PostFloatChange> CL_lsscale;
public List<PostFloatChange> CL_lowhealthenable;
public List<PostFloatChange> CL_tunnelvisionenable;
public List<PostFloatChange> CL_distortstrength;
public List<PostFloatChange> CL_tremorenable;
public GlobalPostChangeList()
{
CL_brightness = new List<PostFloatChange>();
CL_contrast = new List<PostFloatChange>();
CL_saturation = new List<PostFloatChange>();
CL_rbcount = new List<PostFloatChange>();
CL_rbdesat = new List<PostFloatChange>();
CL_rbdist = new List<PostFloatChange>();
CL_lscount = new List<PostFloatChange>();
CL_lsscale = new List<PostFloatChange>();
CL_lowhealthenable = new List<PostFloatChange>();
CL_tunnelvisionenable = new List<PostFloatChange>();
CL_distortstrength = new List<PostFloatChange>();
CL_tremorenable = new List<PostFloatChange>();
}
public static GlobalPostChangeList GetInstance()
{
return Instance;
}
}
}
namespace EF.Essential.BuffSystem
{
public struct LevelBuff
{
public bool Enable;
public float Time;
public int Level;
public LevelBuff(bool ignore = false)
{
Enable = false;
Time = 0f;
Level = 0;
}
}
}
namespace EF.Essential.PatchSystem
{
public class PatchPlugin : BaseUnityPlugin
{
public string PatchName = "NoneNamePatch";
public void Start()
{
Initial();
DoPatch();
}
public virtual void Initial()
{
}
public virtual void DoPatch()
{
}
}
}
namespace EF.Essential.PostSystem
{
public class PostFloatChange
{
public float Value = 0f;
}
}
namespace EF.Essential.Tools
{
public class ScrollBarActions : MonoBehaviour
{
public Scrollbar Target;
public void Roll(float a)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
Scrollbar target = Target;
target.value += a;
((Selectable)Target).OnMove(new AxisEventData(EventSystem.current));
}
}
[StructLayout(LayoutKind.Sequential, Size = 1)]
public struct StringActions
{
public static Vector3 ParseVector3FromString(string str)
{
//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_0057: Unknown result type (might be due to invalid IL or missing references)
str = str.Replace("(", " ").Replace(")", " ");
string[] array = str.Split(new char[1] { ',' });
return new Vector3(float.Parse(array[0]), float.Parse(array[1]), float.Parse(array[2]));
}
public static Quaternion ParseQuaternionFromString(string str)
{
//IL_0054: 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_005f: Unknown result type (might be due to invalid IL or missing references)
str = str.Replace("(", " ").Replace(")", " ");
string[] array = str.Split(new char[1] { ',' });
return new Quaternion(float.Parse(array[0]), float.Parse(array[1]), float.Parse(array[2]), float.Parse(array[3]));
}
public static string BuildTagString(string SourceStr, string tagname)
{
return "[" + tagname + "]" + SourceStr + "[/" + tagname + "]";
}
public static string GetInTagString(string SourceStr, string tagname, int mode = 0)
{
string text = "[" + tagname + "]";
string value = "[/" + tagname + "]";
int num = SourceStr.IndexOf(text, 0) + text.Length;
int num2 = ((mode != 1) ? SourceStr.IndexOf(value, num) : SourceStr.LastIndexOf(value));
return SourceStr.Substring(num, num2 - num);
}
public static List<string> SplitMultiTagString(string SourceStr, string tagname)
{
List<string> list = new List<string>();
string oldValue = "[" + tagname + "]";
string text = "[/" + tagname + "]";
string text2 = SourceStr.Replace(oldValue, "");
string[] source = text2.Split(new string[1] { text }, StringSplitOptions.None);
list = source.ToList();
list.RemoveAt(list.Count - 1);
return list;
}
}
public class WorldInteraction
{
private static readonly WorldInteraction Instance = new WorldInteraction();
public static WorldInteraction GetInstance()
{
return Instance;
}
public List<FVRQuickBeltSlot> GetDirectQBSListOfItem(FVRPhysicalObject TargetObject)
{
List<FVRQuickBeltSlot> list = new List<FVRQuickBeltSlot>();
if (((Component)TargetObject).GetComponentsInChildren<FVRFireArmAttachmentMount>() != null)
{
FVRFireArmAttachmentMount[] componentsInChildren = ((Component)TargetObject).GetComponentsInChildren<FVRFireArmAttachmentMount>();
foreach (FVRFireArmAttachmentMount val in componentsInChildren)
{
if (!Object.op_Implicit((Object)(object)val) || val.AttachmentsList == null)
{
continue;
}
foreach (FVRFireArmAttachment attachments in val.AttachmentsList)
{
if (!Object.op_Implicit((Object)(object)attachments))
{
continue;
}
List<FVRQuickBeltSlot> list2 = ((Component)attachments).GetComponentsInChildren<FVRQuickBeltSlot>().ToList();
if (list2 == null)
{
continue;
}
foreach (FVRQuickBeltSlot item in list2)
{
if (Object.op_Implicit((Object)(object)item))
{
list.Add(item);
}
}
}
}
}
List<FVRQuickBeltSlot> list3 = new List<FVRQuickBeltSlot>();
if (((Component)TargetObject).GetComponentsInChildren<FVRQuickBeltSlot>() != null)
{
FVRQuickBeltSlot[] componentsInChildren2 = ((Component)TargetObject).GetComponentsInChildren<FVRQuickBeltSlot>();
foreach (FVRQuickBeltSlot val2 in componentsInChildren2)
{
if (Object.op_Implicit((Object)(object)val2) && !list.Contains(val2))
{
list3.Add(val2);
}
}
}
return list3;
}
public void DeletePhysicalObject(FVRPhysicalObject TargetObject)
{
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Expected O, but got Unknown
List<FVRQuickBeltSlot> list = new List<FVRQuickBeltSlot>();
List<FVRFireArmAttachmentMount> list2 = new List<FVRFireArmAttachmentMount>();
list = GetDirectQBSListOfItem(TargetObject);
if (TargetObject.AttachmentMounts != null)
{
list2 = TargetObject.AttachmentMounts;
}
foreach (FVRQuickBeltSlot item in list)
{
if ((Object)(object)item.CurObject != (Object)null)
{
DeletePhysicalObject(item.CurObject);
}
}
if (list2 != null)
{
foreach (FVRFireArmAttachmentMount item2 in list2)
{
if (!((Object)(object)item2 != (Object)null) || item2.AttachmentsList == null || item2.AttachmentsList.Count <= 0)
{
continue;
}
foreach (FVRFireArmAttachment attachments in item2.AttachmentsList)
{
if (Object.op_Implicit((Object)(object)attachments))
{
DeletePhysicalObject((FVRPhysicalObject)(object)attachments);
}
}
}
}
if (TargetObject is FVRFireArmRound)
{
FVRFireArmRound val = (FVRFireArmRound)TargetObject;
if (val.ProxyRounds.Count > 0)
{
for (int i = 0; i < val.ProxyRounds.Count; i++)
{
val.ProxyRounds[i] = null;
}
val.ProxyRounds.Clear();
}
val.UpdateProxyDisplay();
}
if (Object.op_Implicit((Object)(object)TargetObject.QuickbeltSlot))
{
TargetObject.ClearQuickbeltState();
}
if (Object.op_Implicit((Object)(object)((FVRInteractiveObject)TargetObject).m_hand))
{
FVRViveHand hand = ((FVRInteractiveObject)TargetObject).m_hand;
((FVRInteractiveObject)TargetObject).EndInteraction(((FVRInteractiveObject)TargetObject).m_hand);
hand.ForceSetInteractable((FVRInteractiveObject)null);
}
((FVRInteractiveObject)TargetObject).ForceBreakInteraction();
GameObject gameObject = ((Component)TargetObject).gameObject;
if (((Component)TargetObject).GetComponentsInChildren<FVRPhysicalObject>() != null)
{
FVRPhysicalObject[] componentsInChildren = ((Component)TargetObject).GetComponentsInChildren<FVRPhysicalObject>();
foreach (FVRPhysicalObject val2 in componentsInChildren)
{
if (Object.op_Implicit((Object)(object)val2))
{
Object.DestroyImmediate((Object)(object)val2);
}
}
}
if (Object.op_Implicit((Object)(object)TargetObject))
{
Object.DestroyImmediate((Object)(object)TargetObject);
}
if (Object.op_Implicit((Object)(object)gameObject))
{
Object.Destroy((Object)(object)gameObject);
}
}
public List<FVRQuickBeltSlot> GetPlayerQBSList()
{
List<FVRQuickBeltSlot> list = new List<FVRQuickBeltSlot>();
foreach (FVRQuickBeltSlot quickbeltSlot in GM.CurrentPlayerBody.QuickbeltSlots)
{
if (quickbeltSlot.IsPlayer && ((Object)((Component)quickbeltSlot).gameObject.transform.parent).name == "Torso")
{
list.Add(quickbeltSlot);
}
}
return list;
}
}
public static class XMLHelper
{
public static string GetUserProfilePath()
{
return Environment.ExpandEnvironmentVariables("%USERPROFILE%\\AppData\\LocalLow\\RUST LTD\\Hot Dogs Horseshoes and Hand Grenades");
}
public static string CheckConfigFolder(string CategoryName)
{
string userProfilePath = GetUserProfilePath();
string text = userProfilePath + "\\" + CategoryName;
if (!Directory.Exists(text))
{
Directory.CreateDirectory(text);
}
return text;
}
public static void StoreXML<T>(string path, T Target)
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
FileStream fileStream = File.OpenWrite(path);
fileStream.Seek(0L, SeekOrigin.Begin);
fileStream.SetLength(0L);
xmlSerializer.Serialize(fileStream, Target);
fileStream.Flush();
fileStream.Close();
}
public static T ReadXML<T>(string path) where T : new()
{
FileStream fileStream = new FileStream(path, FileMode.Open);
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
T val = new T();
val = (T)xmlSerializer.Deserialize(fileStream);
fileStream.Close();
return val;
}
}
}
namespace EF.BuffSystem
{
public class Configer : MonoBehaviour
{
public Text AllDebuff;
public Text AllGoodBuff;
public Text Bleeding;
public Text Pain;
public Text Fracture;
public Text Tunnelvision;
public Text LowHealthEffect;
public Text BleedingChance;
public Text FractureHeight;
public Text Tremor;
public Text Injure;
public Text DisableBreathAudio;
public Text DisableTookdamageAudio;
public Text DisableTnHItemStore;
private EF_BuffSystem_GlobalObject GO;
private void Start()
{
GO = EF_BuffSystem_GlobalObject.GetInstance();
RefreshUIStat();
}
public void ToggleDisableAllDebuff()
{
GO.Config.DisableAllDebuff = !GO.Config.DisableAllDebuff;
RefreshUIStat();
StoreConfig();
}
public void ToggleDisableAllGoodBuff()
{
GO.Config.DisableAllGoodBuff = !GO.Config.DisableAllGoodBuff;
RefreshUIStat();
StoreConfig();
}
public void ToggleDisableBleeding()
{
GO.Config.DisableBleeding = !GO.Config.DisableBleeding;
RefreshUIStat();
StoreConfig();
}
public void ToggleDisableMaxHealthReduce()
{
GO.Config.DisableMaxHealthReduce = !GO.Config.DisableMaxHealthReduce;
RefreshUIStat();
StoreConfig();
}
public void ToggleDisablePain()
{
GO.Config.DisablePain = !GO.Config.DisablePain;
RefreshUIStat();
StoreConfig();
}
public void ToggleDisableFracture()
{
GO.Config.DisableFracture = !GO.Config.DisableFracture;
RefreshUIStat();
StoreConfig();
}
public void ToggleDisableTunnelvision()
{
GO.Config.DisableTunnelvision = !GO.Config.DisableTunnelvision;
RefreshUIStat();
StoreConfig();
}
public void ToggleDisableLowHealthEffect()
{
GO.Config.DisableLowHealthEffect = !GO.Config.DisableLowHealthEffect;
RefreshUIStat();
StoreConfig();
}
public void ToggleDisableTremor()
{
GO.Config.DisableTremor = !GO.Config.DisableTremor;
RefreshUIStat();
StoreConfig();
}
public void ToggleBreathAudio()
{
GO.Config.DisableBreathAudio = !GO.Config.DisableBreathAudio;
RefreshUIStat();
StoreConfig();
}
public void ToggleTookDamageAudio()
{
GO.Config.DisableTookDamageAudio = !GO.Config.DisableTookDamageAudio;
RefreshUIStat();
StoreConfig();
}
public void ToggleTnHItemStore()
{
GO.Config.DisableTnHItemStore = !GO.Config.DisableTnHItemStore;
RefreshUIStat();
StoreConfig();
}
public void ChangeBleedingChance(int Value)
{
GO.Config.PerShotBleedingChance += Value;
RefreshUIStat();
StoreConfig();
}
public void ChangeFractureHeight(int Value)
{
GO.Config.FractureHeight += Value;
RefreshUIStat();
StoreConfig();
}
private void RefreshUIStat()
{
AllDebuff.text = "AllDebuff:" + (GO.Config.DisableAllDebuff ? "OFF" : "ON");
AllGoodBuff.text = "AllGoodBuff:" + (GO.Config.DisableAllGoodBuff ? "OFF" : "ON");
Bleeding.text = "Bleeding:" + (GO.Config.DisableBleeding ? "OFF" : "ON");
Pain.text = "Pain:" + (GO.Config.DisablePain ? "OFF" : "ON");
Fracture.text = "Fracture:" + (GO.Config.DisableFracture ? "OFF" : "ON");
Tunnelvision.text = "Tunnelvision:" + (GO.Config.DisableTunnelvision ? "OFF" : "ON");
LowHealthEffect.text = "LowHealthFX:" + (GO.Config.DisableLowHealthEffect ? "OFF" : "ON");
Tremor.text = "Tremor:" + (GO.Config.DisableTremor ? "OFF" : "ON");
Injure.text = "Injure:" + (GO.Config.DisableMaxHealthReduce ? "OFF" : "ON");
DisableBreathAudio.text = "BreathAudio:" + (GO.Config.DisableBreathAudio ? "OFF" : "ON");
DisableTookdamageAudio.text = "TookDamageAudio:" + (GO.Config.DisableTookDamageAudio ? "OFF" : "ON");
DisableTnHItemStore.text = "TnHItemStore:" + (GO.Config.DisableTnHItemStore ? "OFF" : "ON");
BleedingChance.text = GO.Config.PerShotBleedingChance.ToString();
FractureHeight.text = ((int)GO.Config.FractureHeight).ToString();
}
private void StoreConfig()
{
GO.StoreConfig();
}
}
[Serializable]
public class BuffSystemSetting
{
[XmlElement]
public bool DisableAllDebuff = false;
[XmlElement]
public bool DisableAllGoodBuff = false;
[XmlElement]
public bool DisableBleeding = false;
[XmlElement]
public bool DisablePain = false;
[XmlElement]
public bool DisableTremor = false;
[XmlElement]
public bool DisableFracture = false;
[XmlElement]
public bool DisableTunnelvision = false;
[XmlElement]
public bool DisableMaxHealthReduce = false;
[XmlElement]
public bool DisableLowHealthEffect = false;
[XmlElement]
public int PerShotBleedingChance = 10;
[XmlElement]
public int PerShotBleedingLevel = 1;
[XmlElement]
public float PerShotBleedingTime = 30f;
[XmlElement]
public float MultShotBleedingMaxInterval = 2f;
[XmlElement]
public int MultShotBleedingChance = 100;
[XmlElement]
public int MultShotBleedingLevel = 2;
[XmlElement]
public float MultShotBleedingTime = 30f;
[XmlElement]
public int LowArmorPerShotPainChance = 100;
[XmlElement]
public int LowArmorPerShotPainLevel = 2;
[XmlElement]
public float LowArmorPerShotPainTime = 10f;
[XmlElement]
public int LowArmorPerShotSpeedDownChance = 50;
[XmlElement]
public int LowArmorPerShotSpeedDownLevel = -2;
[XmlElement]
public float LowArmorPerShotSpeedDownTime = 10f;
[XmlElement]
public int HighArmorPerShotPainChance = 100;
[XmlElement]
public int HighArmorPerShotPainLevel = 1;
[XmlElement]
public float HighArmorPerShotPainTime = 10f;
[XmlElement]
public int HighArmorPerShotSpeedDownChance = 50;
[XmlElement]
public int HighArmorPerShotSpeedDownLevel = -1;
[XmlElement]
public float HighArmorPerShotSpeedDownTime = 10f;
[XmlElement]
public float PerShotMaxHealthReducePercentOfDamage = 0.15f;
[XmlElement]
public float FractureHeight = 10f;
[XmlElement]
public float FractureTime = 60f;
[XmlElement]
public float FractureEffect = 0.5f;
[XmlElement]
public float LowHealthEffectThreshold = 0.3f;
[XmlElement]
public int ContinuedHealMinLevel = -5;
[XmlElement]
public int ContinuedHealMaxLevel = 5;
[XmlElement]
public float ContinuedHealPerLevelEffect = 0.3f;
[XmlElement]
public int BleedingMaxLevel = 5;
[XmlElement]
public float BleedingPerLevelEffect = 0.25f;
[XmlElement]
public bool BleedingCauseDead = false;
[XmlElement]
public int DamageResistMinLevel = -8;
[XmlElement]
public int DamageResistMaxLevel = 8;
[XmlElement]
public float DamageResistPerLevelEffectPercent = 0.1f;
[XmlElement]
public int SpeedUpMinLevel = -4;
[XmlElement]
public int SpeedUpMaxLevel = 5;
[XmlElement]
public float SpeedUpPerLevelEffect = 0.2f;
[XmlElement]
public int StrengthUpMinLevel = -5;
[XmlElement]
public int StrengthUpMaxLevel = 5;
[XmlElement]
public int DamageScalerMinLevel = -5;
[XmlElement]
public int DamageScalerMaxLevel = 5;
[XmlElement]
public float DamageScalerPerLevelUp = 0.65f;
[XmlElement]
public float DamageScalerPerLevelDownPercent = 0.8f;
[XmlElement]
public int AddMaxHealthMinLevel = -4;
[XmlElement]
public int AddMaxHealthMaxLevel = 10;
[XmlElement]
public float AddMaxHealthPerLevelEffect = 0.1f;
[XmlElement]
public float MaxMaxHealthReducePercent = 0.5f;
[XmlElement]
public bool DisableBreathAudio = true;
[XmlElement]
public bool DisableTookDamageAudio = true;
[XmlElement]
public bool DisableTnHItemStore = true;
}
public static class ConfigHelper
{
public static string GetUserProfilePath()
{
return Environment.ExpandEnvironmentVariables("%USERPROFILE%\\AppData\\LocalLow\\RUST LTD\\Hot Dogs Horseshoes and Hand Grenades");
}
public static string CheckEFConfigFolder(string SubName)
{
string userProfilePath = GetUserProfilePath();
string text = userProfilePath + "\\EF\\" + SubName + "\\";
if (!Directory.Exists(text))
{
Directory.CreateDirectory(text);
}
return text;
}
}
public class EF_BuffSystem_GlobalObject
{
private static readonly EF_BuffSystem_GlobalObject Instance = new EF_BuffSystem_GlobalObject();
public BuffSystemSetting Config;
private EF_BuffSystem_GlobalObject()
{
}
public void StoreConfig()
{
string text = ConfigHelper.CheckEFConfigFolder("BuffSystem");
StoreBuffSettingHelper.Store(text + "BuffSystemSettings.xml", Config);
}
public void ReadConfig()
{
string text = ConfigHelper.CheckEFConfigFolder("BuffSystem");
Config = StoreBuffSettingHelper.Read(text + "BuffSystemSettings.xml");
}
public static EF_BuffSystem_GlobalObject GetInstance()
{
return Instance;
}
}
}
namespace EF.PostSystem
{
public class Manager : MonoBehaviour
{
private class BuffEffectWithDelayTime
{
public float LastTime;
public BuffEffect BE;
}
public float curH;
public float lastH;
public float dam;
private float timer = 0f;
private float UpdateRate = 0.0666667f;
public BuffStat CurrentBuffEffect = default(BuffStat);
private List<BuffEffectWithDelayTime> DelayedBuffList = new List<BuffEffectWithDelayTime>();
public GlobalPostChangeList TargetGlobalPostCL = GlobalPostChangeList.GetInstance();
private PostFloatChange PainCL_rbcount;
private PostFloatChange PainCL_rbdesat;
private PostFloatChange PainCL_rbdist;
private PostFloatChange PainCL_brightness;
private PostFloatChange LowHealthCL_lowhealthenable;
private PostFloatChange LowHealthCL_saturation;
private PostFloatChange TunnelvisionCL_tunnelvisionenable;
private PostFloatChange PainkillersCL_brightness;
private PostFloatChange PainkillersCL_lsscale;
private PostFloatChange PainkillersCL_lscount;
private PostFloatChange Bleeding_distortsrength;
private PostFloatChange Tremor_tremorenable;
private EF_BuffSystem_GlobalObject ConfigObj;
private bool NeedRefreshLowHealthEffect = false;
private float LastDamageTime = 0f;
private Vector3 ThisFrameInitial2AxisVelocity = Vector3.zero;
private Vector3 ThisFrameInitialSwingArmVelocity = Vector3.zero;
private Vector3 TremorCurrentDirect = Vector3.zero;
private Vector3 TremorCurrentPath = Vector3.zero;
private Vector3 TremorLeftHandPosOver = Vector3.zero;
private Vector3 TremorRightHandPosOver = Vector3.zero;
private bool NeedRefreshTremorOffset = false;
private float TremorSingleShakeStrength = 0f;
private float TremorSingleShakeTime = 0f;
private float TremorSingleShakeTimeLength = 0f;
private float IntoAirHeight = -114514f;
private float StoredPlayerMaxHealth;
private float CurrentPlayerMaxHealth;
public int ThisFramePainLevel;
public float ThisFramePainTime;
public int ThisFrameBleedingLevel;
public float ThisFrameBleedingTime;
public int ThisFrameSpeedUpLevel;
public float ThisFrameSpeedUpTime;
public int ThisFrameStrengthUpLevel;
public float ThisFrameStrengthUpTime;
public int ThisFrameContinuedHealLevel;
public float ThisFrameContinuedHealTime;
public int ThisFrameDamageResistLevel;
public float ThisFrameDamageResistTime;
public int ThisFrameDamageScalerLevel;
public float ThisFrameDamageScalerTime;
public int ThisFrameAddMaxHealthLevel;
public float ThisFrameAddMaxHealthTime;
public void Start()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Expected O, but got Unknown
ConfigObj = EF_BuffSystem_GlobalObject.GetInstance();
ConfigObj.ReadConfig();
GM.CurrentSceneSettings.PowerupUseEvent -= new PowerupUse(PowerupEvent);
GM.CurrentSceneSettings.PowerupUseEvent += new PowerupUse(PowerupEvent);
StoredPlayerMaxHealth = GM.CurrentPlayerBody.m_startingHealth;
CurrentPlayerMaxHealth = GM.CurrentPlayerBody.m_startingHealth;
AssignPostCLObj();
ResetCurrentBuffEffect();
Console.Write("BuffSystem:Start");
}
private void OnDestroy()
{
DesignPostCLObj();
Console.Write("BuffSystem:Destroy");
}
public void AssignPostCLObj()
{
PainCL_rbcount = new PostFloatChange();
TargetGlobalPostCL.CL_rbcount.Add(PainCL_rbcount);
PainCL_rbdesat = new PostFloatChange();
TargetGlobalPostCL.CL_rbdesat.Add(PainCL_rbdesat);
PainCL_rbdist = new PostFloatChange();
TargetGlobalPostCL.CL_rbdist.Add(PainCL_rbdist);
PainCL_brightness = new PostFloatChange();
TargetGlobalPostCL.CL_brightness.Add(PainCL_brightness);
LowHealthCL_lowhealthenable = new PostFloatChange();
TargetGlobalPostCL.CL_lowhealthenable.Add(LowHealthCL_lowhealthenable);
LowHealthCL_saturation = new PostFloatChange();
TargetGlobalPostCL.CL_saturation.Add(LowHealthCL_saturation);
TunnelvisionCL_tunnelvisionenable = new PostFloatChange();
TargetGlobalPostCL.CL_tunnelvisionenable.Add(TunnelvisionCL_tunnelvisionenable);
PainkillersCL_brightness = new PostFloatChange();
TargetGlobalPostCL.CL_brightness.Add(PainkillersCL_brightness);
PainkillersCL_lsscale = new PostFloatChange();
TargetGlobalPostCL.CL_lsscale.Add(PainkillersCL_lsscale);
PainkillersCL_lscount = new PostFloatChange();
TargetGlobalPostCL.CL_lscount.Add(PainkillersCL_lscount);
Bleeding_distortsrength = new PostFloatChange();
TargetGlobalPostCL.CL_distortstrength.Add(Bleeding_distortsrength);
Tremor_tremorenable = new PostFloatChange();
TargetGlobalPostCL.CL_tremorenable.Add(Tremor_tremorenable);
}
public void DesignPostCLObj()
{
TargetGlobalPostCL.CL_rbcount.Remove(PainCL_rbcount);
TargetGlobalPostCL.CL_rbdesat.Remove(PainCL_rbdesat);
TargetGlobalPostCL.CL_rbdist.Remove(PainCL_rbdist);
TargetGlobalPostCL.CL_lowhealthenable.Remove(LowHealthCL_lowhealthenable);
TargetGlobalPostCL.CL_saturation.Remove(LowHealthCL_saturation);
TargetGlobalPostCL.CL_tunnelvisionenable.Remove(TunnelvisionCL_tunnelvisionenable);
TargetGlobalPostCL.CL_brightness.Remove(PainkillersCL_brightness);
TargetGlobalPostCL.CL_lsscale.Remove(PainkillersCL_lsscale);
TargetGlobalPostCL.CL_lscount.Remove(PainkillersCL_lscount);
TargetGlobalPostCL.CL_distortstrength.Remove(Bleeding_distortsrength);
TargetGlobalPostCL.CL_tremorenable.Remove(Tremor_tremorenable);
}
private void ResetCurrentBuffEffect()
{
CurrentBuffEffect = default(BuffStat);
CurrentBuffEffect.BleedingList = new List<LevelBuff>();
CurrentBuffEffect.PainList = new List<LevelBuff>();
CurrentBuffEffect.ContinuedHealList = new List<LevelBuff>();
CurrentBuffEffect.DamageResistList = new List<LevelBuff>();
CurrentBuffEffect.DamageScalerList = new List<LevelBuff>();
CurrentBuffEffect.SpeedUpList = new List<LevelBuff>();
CurrentBuffEffect.StrengthUpList = new List<LevelBuff>();
CurrentBuffEffect.AddMaxHealthList = new List<LevelBuff>();
}
public void Update()
{
curH = GM.CurrentPlayerBody.GetPlayerHealthRaw();
dam = lastH - curH;
lastH = curH;
if (dam > 10f)
{
DamageEvent(dam);
}
if (GM.CurrentPlayerBody.GetPlayerHealthRaw() <= 0)
{
DeathEvent(killedself: false);
}
UpdateSelf();
UpdateMaxHealthChangeDetect();
timer += Time.deltaTime;
if (timer > UpdateRate)
{
timer -= UpdateRate;
UpdateLevelBuffInfomation();
UpdateDelayedBuffList();
UpdateBuffStat();
UpdateBuffEffect_LowRate();
}
UpdateFractureDetect();
UpdateBuffEffect_HighRate();
}
private void UpdateMaxHealthChangeDetect()
{
if (GM.CurrentPlayerBody.m_startingHealth != CurrentPlayerMaxHealth)
{
Console.Write("BuffSystem : Detect other max health changing in level.");
StoredPlayerMaxHealth = GM.CurrentPlayerBody.m_startingHealth;
CalcMaxHealthChanging();
}
}
private void UpdateBuffEffect_HighRate()
{
CalcVelocity();
CalcTremorHand();
}
private void UpdateDelayedBuffList()
{
foreach (BuffEffectWithDelayTime delayedBuff in DelayedBuffList)
{
delayedBuff.LastTime -= UpdateRate;
}
foreach (BuffEffectWithDelayTime delayedBuff2 in DelayedBuffList)
{
if (delayedBuff2.LastTime <= 0f)
{
AssignNewBuffEffect(delayedBuff2.BE);
DelayedBuffList.Remove(delayedBuff2);
break;
}
}
}
private void UpdateFractureDetect()
{
//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_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Invalid comparison between Unknown and I4
//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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Invalid comparison between Unknown and I4
//IL_005c: 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_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
if (IntoAirHeight == -114514f)
{
IntoAirHeight = GM.CurrentPlayerBody.Head.position.y;
return;
}
MovementMode mode = GM.CurrentMovementManager.Mode;
if ((int)mode != 6)
{
if ((int)mode != 4)
{
IntoAirHeight = GM.CurrentPlayerBody.Head.position.y;
return;
}
if (GM.CurrentMovementManager.m_smoothLocoVelocity.y > -4f && !GM.CurrentMovementManager.m_isGrounded)
{
IntoAirHeight = GM.CurrentPlayerBody.Head.position.y;
}
if (GM.CurrentMovementManager.m_isGrounded)
{
if (GM.CurrentPlayerBody.Head.position.y < IntoAirHeight && IntoAirHeight - GM.CurrentPlayerBody.Head.position.y > ConfigObj.Config.FractureHeight)
{
AssignNewBuffEffect(new BuffEffect
{
isFracture = true,
FractureTime = ConfigObj.Config.FractureTime
});
}
IntoAirHeight = GM.CurrentPlayerBody.Head.position.y;
}
return;
}
if (GM.CurrentMovementManager.m_smoothLocoVelocity.y > -4f && !GM.CurrentMovementManager.m_isGrounded)
{
IntoAirHeight = GM.CurrentPlayerBody.Head.position.y;
}
if (GM.CurrentMovementManager.m_isGrounded)
{
if (GM.CurrentPlayerBody.Head.position.y < IntoAirHeight && IntoAirHeight - GM.CurrentPlayerBody.Head.position.y > ConfigObj.Config.FractureHeight)
{
AssignNewBuffEffect(new BuffEffect
{
isFracture = true,
FractureTime = ConfigObj.Config.FractureTime
});
}
IntoAirHeight = GM.CurrentPlayerBody.Head.position.y;
}
}
public void UpdateSelf()
{
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: 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_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_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: 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)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: 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_004f: 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_005e: 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_007c: 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)
//IL_0095: 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_00a4: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
if (WristMenuAPI.Instance2.m_isActive)
{
if (WristMenuAPI.Instance2.m_currentHand.IsThisTheRightHand)
{
((Component)this).transform.position = ((Component)WristMenuAPI.Instance2).gameObject.transform.position + ((Component)WristMenuAPI.Instance2).gameObject.transform.forward * -0f + ((Component)WristMenuAPI.Instance2).gameObject.transform.right * -0.3f + ((Component)WristMenuAPI.Instance2).gameObject.transform.up * 0.05f;
Quaternion val = Quaternion.AngleAxis(-90f, new Vector3(1f, 0f, 0f));
((Component)this).transform.rotation = ((Component)WristMenuAPI.Instance2).gameObject.transform.rotation * val;
}
else
{
((Component)this).transform.position = ((Component)WristMenuAPI.Instance2).gameObject.transform.position + ((Component)WristMenuAPI.Instance2).gameObject.transform.forward * -0f + ((Component)WristMenuAPI.Instance2).gameObject.transform.right * 0.1f + ((Component)WristMenuAPI.Instance2).gameObject.transform.up * 0.05f;
Quaternion val2 = Quaternion.AngleAxis(-90f, new Vector3(1f, 0f, 0f));
((Component)this).transform.rotation = ((Component)WristMenuAPI.Instance2).gameObject.transform.rotation * val2;
}
}
else
{
((Component)this).transform.position = new Vector3(10000f, 10000f, 500f);
}
}
public void UpdateBuffStat()
{
if (CurrentBuffEffect.isBleedingKillers)
{
CurrentBuffEffect.BleedingKillersTime -= UpdateRate;
if (CurrentBuffEffect.BleedingKillersTime <= 0f)
{
CurrentBuffEffect.BleedingKillersTime = 0f;
CurrentBuffEffect.isBleedingKillers = false;
}
}
if (CurrentBuffEffect.isLowHealthKillers)
{
CurrentBuffEffect.LowHealthKillersTime -= UpdateRate;
if (CurrentBuffEffect.LowHealthKillersTime <= 0f)
{
CurrentBuffEffect.LowHealthKillersTime = 0f;
CurrentBuffEffect.isLowHealthKillers = false;
}
}
if (CurrentBuffEffect.isTremor)
{
CurrentBuffEffect.TremorTime -= UpdateRate;
if (CurrentBuffEffect.TremorTime <= 0f)
{
CurrentBuffEffect.TremorTime = 0f;
CurrentBuffEffect.isTremor = false;
}
}
if (CurrentBuffEffect.isFracture)
{
CurrentBuffEffect.FractureTime -= UpdateRate;
if (CurrentBuffEffect.FractureTime <= 0f)
{
CurrentBuffEffect.FractureTime = 0f;
CurrentBuffEffect.isFracture = false;
}
}
if (CurrentBuffEffect.isTunnelvision)
{
CurrentBuffEffect.TunnelvisionTime -= UpdateRate;
if (CurrentBuffEffect.TunnelvisionTime <= 0f)
{
CurrentBuffEffect.TunnelvisionTime = 0f;
CurrentBuffEffect.isTunnelvision = false;
}
}
if (CurrentBuffEffect.isPainkillers)
{
CurrentBuffEffect.PainkillersTime -= UpdateRate;
if (CurrentBuffEffect.PainkillersTime <= 0f)
{
CurrentBuffEffect.PainkillersTime = 0f;
CurrentBuffEffect.isPainkillers = false;
}
}
LevelBuffListUpdate(CurrentBuffEffect.PainList);
LevelBuffListUpdate(CurrentBuffEffect.BleedingList);
LevelBuffListUpdate(CurrentBuffEffect.SpeedUpList);
LevelBuffListUpdate(CurrentBuffEffect.StrengthUpList);
LevelBuffListUpdate(CurrentBuffEffect.ContinuedHealList);
LevelBuffListUpdate(CurrentBuffEffect.DamageResistList);
LevelBuffListUpdate(CurrentBuffEffect.DamageScalerList);
LevelBuffListUpdate(CurrentBuffEffect.AddMaxHealthList);
}
public void UpdateLevelBuffInfomation()
{
GetTotalLevelFromList(CurrentBuffEffect.DamageResistList, ConfigObj.Config.DamageResistMinLevel, ConfigObj.Config.DamageResistMaxLevel, out ThisFrameDamageResistLevel, out ThisFrameDamageResistTime);
GetTotalLevelFromList(CurrentBuffEffect.StrengthUpList, ConfigObj.Config.StrengthUpMinLevel, ConfigObj.Config.StrengthUpMaxLevel, out ThisFrameStrengthUpLevel, out ThisFrameStrengthUpTime);
GetTotalLevelFromList(CurrentBuffEffect.DamageScalerList, ConfigObj.Config.DamageScalerMinLevel, ConfigObj.Config.DamageScalerMaxLevel, out ThisFrameDamageScalerLevel, out ThisFrameDamageScalerTime);
GetTotalLevelFromList(CurrentBuffEffect.AddMaxHealthList, ConfigObj.Config.AddMaxHealthMinLevel, ConfigObj.Config.AddMaxHealthMaxLevel, out ThisFrameAddMaxHealthLevel, out ThisFrameAddMaxHealthTime);
GetTotalLevelFromList(CurrentBuffEffect.SpeedUpList, ConfigObj.Config.SpeedUpMinLevel, ConfigObj.Config.SpeedUpMaxLevel, out ThisFrameSpeedUpLevel, out ThisFrameSpeedUpTime);
GetTotalLevelFromList(CurrentBuffEffect.BleedingList, 0, ConfigObj.Config.BleedingMaxLevel, out ThisFrameBleedingLevel, out ThisFrameBleedingTime);
GetTotalLevelFromList(CurrentBuffEffect.ContinuedHealList, ConfigObj.Config.ContinuedHealMinLevel, ConfigObj.Config.ContinuedHealMaxLevel, out ThisFrameContinuedHealLevel, out ThisFrameContinuedHealTime);
GetTotalLevelFromList(CurrentBuffEffect.PainList, 0, 5, out ThisFramePainLevel, out ThisFramePainTime);
}
public void UpdateBuffEffect_LowRate()
{
CalcStrengthUpBuff();
CalcBleeding();
CalcContinuedHeal();
CalcLowHealthEffect();
CalcPainEffect();
CalcTremorEffect();
CalcTunnelvisionEffect();
CalcPainkillerEffect();
CalcDamageScalerBuff();
CalcMaxHealthChanging();
}
private void PowerupEvent(PowerupType type)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected I4, but got Unknown
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected I4, but got Unknown
if (GlobalBuffItemList.GetInstance().List.ContainsKey((int)type))
{
BuffItem buffItem = GlobalBuffItemList.GetInstance().List[(int)type];
if ((double)buffItem.DelayedEffectTime > 0.0)
{
BuffEffectWithDelayTime buffEffectWithDelayTime = new BuffEffectWithDelayTime();
buffEffectWithDelayTime.LastTime = buffItem.DelayedEffectTime;
buffEffectWithDelayTime.BE = buffItem.DelayedEffect;
DelayedBuffList.Add(buffEffectWithDelayTime);
}
BuffEffect effect = buffItem.Effect;
AssignNewBuffEffect(effect);
}
}
private void DeathEvent(bool killedself)
{
ResetCurrentBuffEffect();
}
public void DamageEvent(float percentOfLife)
{
float percentOfLifeAffterBuffSystem = CalcHealthWhenGetDamage(ThisFrameDamageResistLevel, percentOfLife);
CalcDebuffWhenGetDamage(0, percentOfLifeAffterBuffSystem);
LastDamageTime = Time.timeSinceLevelLoad;
}
public void LevelBuffListUpdate(List<LevelBuff> TargetList)
{
for (int i = 0; i < TargetList.Count; i++)
{
LevelBuff levelBuff = TargetList[i];
LevelBuff value = levelBuff;
if (value.Enable)
{
value.Time -= UpdateRate;
if (value.Time <= 0f)
{
value.Time = 0f;
value.Enable = false;
}
}
TargetList[i] = value;
}
foreach (LevelBuff Target in TargetList)
{
if (!Target.Enable)
{
TargetList.Remove(Target);
break;
}
}
}
private void GetTotalLevelFromList(List<LevelBuff> TargetBuffList, int Min, int Max, out int TotalLevel, out float MaximumTime)
{
int num = 0;
float num2 = 0f;
foreach (LevelBuff TargetBuff in TargetBuffList)
{
num += TargetBuff.Level;
num2 = Mathf.Max(num2, TargetBuff.Time);
}
num = Mathf.Clamp(num, Min, Max);
TotalLevel = num;
MaximumTime = num2;
}
private void CalcStrengthUpBuff()
{
int thisFrameStrengthUpLevel = ThisFrameStrengthUpLevel;
if (thisFrameStrengthUpLevel > 0)
{
float num = 1f + (float)thisFrameStrengthUpLevel * 0.65f;
if (GM.CurrentPlayerBody.m_buffTime_MuscleMeat <= 0.1f || GM.CurrentPlayerBody.m_muscleMeatPower < num)
{
GM.CurrentPlayerBody.m_muscleMeatPower = num;
GM.CurrentPlayerBody.m_isMuscleMeat = true;
GM.CurrentPlayerBody.m_isWeakMeat = false;
GM.CurrentPlayerBody.m_buffTime_MuscleMeat = 1f;
}
}
else if (thisFrameStrengthUpLevel < 0)
{
float num2 = 1f * Mathf.Pow(0.8f, (float)Mathf.Abs(thisFrameStrengthUpLevel));
if (GM.CurrentPlayerBody.m_debuffTime_WeakMeat <= 0.1f || GM.CurrentPlayerBody.m_muscleMeatPower > num2)
{
GM.CurrentPlayerBody.m_muscleMeatPower = num2;
GM.CurrentPlayerBody.m_isMuscleMeat = false;
GM.CurrentPlayerBody.m_isWeakMeat = true;
GM.CurrentPlayerBody.m_debuffTime_WeakMeat = 1f;
}
}
}
private void CalcDamageScalerBuff()
{
int thisFrameDamageScalerLevel = ThisFrameDamageScalerLevel;
if (thisFrameDamageScalerLevel > 0)
{
float num = 1f + (float)thisFrameDamageScalerLevel * ConfigObj.Config.DamageScalerPerLevelUp;
if (GM.CurrentPlayerBody.m_buffTime_DamPowerUp <= 0.1f || GM.CurrentPlayerBody.m_damageMult < num)
{
GM.CurrentPlayerBody.m_damageMult = num;
GM.CurrentPlayerBody.m_isDamPowerUp = true;
GM.CurrentPlayerBody.m_isDamPowerDown = false;
GM.CurrentPlayerBody.m_buffTime_DamPowerUp = 1f;
}
}
else if (thisFrameDamageScalerLevel < 0)
{
float num2 = 1f * Mathf.Pow(ConfigObj.Config.DamageScalerPerLevelDownPercent, (float)Mathf.Abs(thisFrameDamageScalerLevel));
if (GM.CurrentPlayerBody.m_debuffTime_DamPowerDown <= 0.1f || GM.CurrentPlayerBody.m_damageMult > num2)
{
GM.CurrentPlayerBody.m_muscleMeatPower = num2;
GM.CurrentPlayerBody.m_isDamPowerUp = false;
GM.CurrentPlayerBody.m_isDamPowerDown = true;
GM.CurrentPlayerBody.m_debuffTime_DamPowerDown = 1f;
}
}
}
private float CalcHealthWhenGetDamage(int ThisDamageEventTotalDamageResist, float damagepercentOfLife)
{
float health = GM.CurrentPlayerBody.Health;
float num = GM.CurrentPlayerBody.m_startingHealth * damagepercentOfLife * (float)ThisDamageEventTotalDamageResist * ConfigObj.Config.DamageResistPerLevelEffectPercent;
health += num;
if (health >= GM.CurrentPlayerBody.m_startingHealth)
{
health = GM.CurrentPlayerBody.m_startingHealth;
}
GM.CurrentPlayerBody.Health = health;
return damagepercentOfLife - num / GM.CurrentPlayerBody.m_startingHealth;
}
private void CalcDebuffWhenGetDamage(int ThisDamageEventArmorLevel, float percentOfLifeAffterBuffSystem)
{
if (Time.timeSinceLevelLoad - LastDamageTime >= 0f && Time.timeSinceLevelLoad - LastDamageTime <= ConfigObj.Config.MultShotBleedingMaxInterval && ThisDamageEventArmorLevel <= 4)
{
Random random = new Random();
int num = random.Next(0, 100);
if (num <= ConfigObj.Config.MultShotBleedingChance)
{
BuffEffect targetBE = default(BuffEffect);
targetBE.Bleeding.Enable = true;
targetBE.Bleeding.Level = ConfigObj.Config.MultShotBleedingLevel;
targetBE.Bleeding.Time = ConfigObj.Config.MultShotBleedingTime;
AssignNewBuffEffect(targetBE);
}
}
if (ThisDamageEventArmorLevel <= 2)
{
bool flag = false;
Random random2 = new Random();
int num2 = random2.Next(0, 100);
if (num2 <= ConfigObj.Config.PerShotBleedingChance)
{
BuffEffect targetBE2 = default(BuffEffect);
targetBE2.Bleeding.Enable = true;
targetBE2.Bleeding.Level = ConfigObj.Config.PerShotBleedingLevel;
targetBE2.Bleeding.Time = ConfigObj.Config.PerShotBleedingTime;
AssignNewBuffEffect(targetBE2);
flag = true;
}
int num3 = random2.Next(0, 100);
if (num3 <= ConfigObj.Config.LowArmorPerShotPainChance)
{
BuffEffect targetBE3 = default(BuffEffect);
targetBE3.Pain.Enable = true;
targetBE3.Pain.Level = ConfigObj.Config.LowArmorPerShotPainLevel;
targetBE3.Pain.Time = ConfigObj.Config.LowArmorPerShotPainTime;
AssignNewBuffEffect(targetBE3);
if (!CurrentBuffEffect.isPainkillers)
{
int num4 = random2.Next(0, 100);
if (num4 <= ConfigObj.Config.LowArmorPerShotSpeedDownChance)
{
BuffEffect targetBE4 = default(BuffEffect);
targetBE4.SpeedUp.Enable = true;
targetBE4.SpeedUp.Level = ConfigObj.Config.LowArmorPerShotSpeedDownLevel;
targetBE4.SpeedUp.Time = ConfigObj.Config.LowArmorPerShotSpeedDownTime;
AssignNewBuffEffect(targetBE4);
}
}
flag = true;
}
if (!flag)
{
}
}
else if (ThisDamageEventArmorLevel <= 4)
{
bool flag2 = false;
Random random3 = new Random();
int num5 = random3.Next(0, 100);
if (num5 <= ConfigObj.Config.HighArmorPerShotPainChance)
{
BuffEffect targetBE5 = default(BuffEffect);
targetBE5.Pain.Enable = true;
targetBE5.Pain.Level = ConfigObj.Config.HighArmorPerShotPainLevel;
targetBE5.Pain.Time = ConfigObj.Config.HighArmorPerShotPainTime;
AssignNewBuffEffect(targetBE5);
if (!CurrentBuffEffect.isPainkillers)
{
int num6 = random3.Next(0, 100);
if (num6 <= ConfigObj.Config.HighArmorPerShotSpeedDownChance)
{
BuffEffect targetBE6 = default(BuffEffect);
targetBE6.SpeedUp.Enable = true;
targetBE6.SpeedUp.Level = ConfigObj.Config.HighArmorPerShotSpeedDownLevel;
targetBE6.SpeedUp.Time = ConfigObj.Config.HighArmorPerShotSpeedDownTime;
AssignNewBuffEffect(targetBE6);
}
}
flag2 = true;
}
if (!flag2)
{
}
}
AssignNewBuffEffect(new BuffEffect
{
MaxHealthReducePercent = percentOfLifeAffterBuffSystem * ConfigObj.Config.PerShotMaxHealthReducePercentOfDamage
});
}
private void CalcMaxHealthChanging()
{
float num = 1f;
num += (float)ThisFrameAddMaxHealthLevel * ConfigObj.Config.AddMaxHealthPerLevelEffect;
num -= CurrentBuffEffect.MaxHealthReducePercent;
GM.CurrentPlayerBody.m_startingHealth = StoredPlayerMaxHealth * num;
CurrentPlayerMaxHealth = StoredPlayerMaxHealth * num;
}
private void CalcVelocity()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0303: Unknown result type (might be due to invalid IL or missing references)
//IL_0308: Unknown result type (might be due to invalid IL or missing references)
//IL_0313: Unknown result type (might be due to invalid IL or missing references)
//IL_0318: Unknown result type (might be due to invalid IL or missing references)
ThisFrameInitial2AxisVelocity = GM.CurrentMovementManager.m_smoothLocoVelocity;
ThisFrameInitialSwingArmVelocity = GM.CurrentMovementManager.m_smoothLocoVelocity;
Vector3 zero = Vector3.zero;
if (CurrentBuffEffect.isFracture)
{
zero.x -= ConfigObj.Config.FractureEffect;
zero.y -= ConfigObj.Config.FractureEffect;
zero.z -= ConfigObj.Config.FractureEffect;
}
float num = (float)ThisFrameSpeedUpLevel * ConfigObj.Config.SpeedUpPerLevelEffect;
zero.x += num;
zero.z += num;
float num2 = (float)ThisFrameStrengthUpLevel * 0.2f;
zero.y += Mathf.Clamp(num2, -1f, 1f);
Vector3 val = zero;
if (!GM.CurrentMovementManager.m_isGrounded)
{
val.x *= 0f;
val.y *= 0.015f;
val.z *= 0f;
}
val += Vector3.one;
val.x = Mathf.Max(val.x, 0.2f);
val.y = Mathf.Max(val.y, 0.05f);
val.z = Mathf.Max(val.z, 0.2f);
ref Vector3 thisFrameInitial2AxisVelocity = ref ThisFrameInitial2AxisVelocity;
thisFrameInitial2AxisVelocity.x *= val.x;
if (ThisFrameInitial2AxisVelocity.y > 0f)
{
ref Vector3 thisFrameInitial2AxisVelocity2 = ref ThisFrameInitial2AxisVelocity;
thisFrameInitial2AxisVelocity2.y *= val.y;
}
ref Vector3 thisFrameInitial2AxisVelocity3 = ref ThisFrameInitial2AxisVelocity;
thisFrameInitial2AxisVelocity3.z *= val.z;
Vector3 val2 = zero;
if (!GM.CurrentMovementManager.m_isGrounded)
{
val2.x *= 0f;
val2.y *= 0.015f;
val2.z *= 0f;
}
val2 += Vector3.one;
val2.x = Mathf.Max(val2.x, 0.2f);
val2.y = Mathf.Max(val2.y, 0.05f);
val2.z = Mathf.Max(val2.z, 0.2f);
ref Vector3 thisFrameInitialSwingArmVelocity = ref ThisFrameInitialSwingArmVelocity;
thisFrameInitialSwingArmVelocity.x *= val2.x;
if (ThisFrameInitialSwingArmVelocity.y > 0f)
{
ref Vector3 thisFrameInitialSwingArmVelocity2 = ref ThisFrameInitialSwingArmVelocity;
thisFrameInitialSwingArmVelocity2.y *= val2.y;
}
ref Vector3 thisFrameInitialSwingArmVelocity3 = ref ThisFrameInitialSwingArmVelocity;
thisFrameInitialSwingArmVelocity3.z *= val2.z;
GM.CurrentMovementManager.m_smoothLocoVelocity = ThisFrameInitial2AxisVelocity;
GM.CurrentMovementManager.m_smoothLocoVelocity = ThisFrameInitialSwingArmVelocity;
}
private void CalcBleeding()
{
if ((float)ThisFrameBleedingLevel > 0f)
{
float health = GM.CurrentPlayerBody.Health;
health -= GM.CurrentPlayerBody.m_startingHealth * UpdateRate * (float)ThisFrameBleedingLevel * 0.01f * ConfigObj.Config.BleedingPerLevelEffect;
if (health <= 1f)
{
if (ConfigObj.Config.BleedingCauseDead)
{
GM.CurrentPlayerBody.KillPlayer(false);
}
else
{
health = 1f;
}
}
SetBleedingEffectPost((float)ThisFrameBleedingLevel * 0.2f);
GM.CurrentPlayerBody.Health = health;
}
else
{
SetBleedingEffectPost(0f);
}
}
private void CalcContinuedHeal()
{
float num = (float)ThisFrameContinuedHealLevel * 0.01f * ConfigObj.Config.ContinuedHealPerLevelEffect;
if (num != 0f)
{
float health = GM.CurrentPlayerBody.Health;
health += GM.CurrentPlayerBody.m_startingHealth * UpdateRate * num;
if (health >= GM.CurrentPlayerBody.m_startingHealth)
{
health = GM.CurrentPlayerBody.m_startingHealth;
}
GM.CurrentPlayerBody.Health = health;
}
}
private void CalcLowHealthEffect()
{
float num = GM.CurrentPlayerBody.Health / GM.CurrentPlayerBody.m_startingHealth;
if (num <= ConfigObj.Config.LowHealthEffectThreshold && !ConfigObj.Config.DisableLowHealthEffect && !CurrentBuffEffect.isLowHealthKillers)
{
NeedRefreshLowHealthEffect = true;
SetLowHealthEffectPost(1f - Mathf.Clamp(num - 0.1f, 0f, 1f) / 0.3f);
}
else if (NeedRefreshLowHealthEffect)
{
SetLowHealthEffectPost(0f);
NeedRefreshLowHealthEffect = false;
}
}
private void CalcPainEffect()
{
if (CurrentBuffEffect.isPainkillers)
{
SetPainEffectPost(0f);
return;
}
float painEffectPost = (float)ThisFramePainLevel * 0.2f;
SetPainEffectPost(painEffectPost);
}
private void CalcTremorEffect()
{
}
private void CalcTremorHand()
{
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: 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_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: 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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: 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_0077: Unknown result type (might be due to invalid IL or missing references)
if (CurrentBuffEffect.isTremor)
{
if (TremorSingleShakeTime >= TremorSingleShakeTimeLength)
{
TremorSingleShakeTimeLength = Random.Range(0.4f, 0.6f);
TremorSingleShakeTime = 0f;
TremorCurrentDirect = new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), Random.Range(-1f, 1f));
TremorSingleShakeStrength = Random.Range(0.01f, 0.03f);
}
TremorCurrentPath += TremorCurrentDirect * TremorSingleShakeStrength * Time.deltaTime;
TremorCurrentPath = ((Vector3)(ref TremorCurrentPath)).normalized * Mathf.Clamp(((Vector3)(ref TremorCurrentPath)).magnitude, 0f, 0.05f);
TremorSingleShakeTime += Time.deltaTime;
GM.CurrentMovementManager.Hands[0].PoseOverride.localPosition = TremorCurrentPath;
GM.CurrentMovementManager.Hands[1].PoseOverride.localPosition = TremorCurrentPath;
NeedRefreshTremorOffset = true;
}
else
{
TremorCurrentDirect = Vector3.zero;
TremorCurrentPath = Vector3.zero;
TremorSingleShakeStrength = 0f;
TremorSingleShakeTime = 0f;
TremorSingleShakeTimeLength = 0f;
if (NeedRefreshTremorOffset)
{
GM.CurrentMovementManager.Hands[0].PoseOverride.localPosition = TremorLeftHandPosOver;
GM.CurrentMovementManager.Hands[1].PoseOverride.localPosition = TremorRightHandPosOver;
NeedRefreshTremorOffset = false;
}
}
}
private void CalcTunnelvisionEffect()
{
if (CurrentBuffEffect.isTunnelvision)
{
SetTunnelvisionEffectPost(Enable: true);
}
else
{
SetTunnelvisionEffectPost(Enable: false);
}
}
private void CalcPainkillerEffect()
{
if (CurrentBuffEffect.isPainkillers)
{
SetPainkillersEffectPost(Enable: true);
}
else
{
SetPainkillersEffectPost(Enable: false);
}
}
public void AssignNewBuffEffect(BuffEffect TargetBE)
{
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
if (TargetBE.isAddHealthPercent)
{
FVRPlayerBody currentPlayerBody = GM.CurrentPlayerBody;
currentPlayerBody.Health += GM.CurrentPlayerBody.m_startingHealth * TargetBE.AddHealthPercent;
if (GM.CurrentPlayerBody.Health > GM.CurrentPlayerBody.m_startingHealth)
{
GM.CurrentPlayerBody.Health = GM.CurrentPlayerBody.m_startingHealth;
}
}
if (TargetBE.isRemoveBleeding)
{
CurrentBuffEffect.BleedingList.Clear();
}
if (TargetBE.isBleedingKillers)
{
CurrentBuffEffect.isBleedingKillers = true;
CurrentBuffEffect.BleedingKillersTime += TargetBE.BleedingKillersTime;
}
if (TargetBE.isLowHealthKillers)
{
CurrentBuffEffect.isLowHealthKillers = true;
CurrentBuffEffect.LowHealthKillersTime += TargetBE.LowHealthKillersTime;
}
if (TargetBE.isTremor && !ConfigObj.Config.DisableAllDebuff && !ConfigObj.Config.DisableTremor)
{
if (!CurrentBuffEffect.isTremor)
{
TremorLeftHandPosOver = GM.CurrentMovementManager.Hands[0].PoseOverride.localPosition;
TremorRightHandPosOver = GM.CurrentMovementManager.Hands[1].PoseOverride.localPosition;
}
CurrentBuffEffect.isTremor = true;
CurrentBuffEffect.TremorTime += TargetBE.TremorTime;
}
if (TargetBE.isFracture && !ConfigObj.Config.DisableAllDebuff && !ConfigObj.Config.DisableFracture)
{
CurrentBuffEffect.isFracture = true;
CurrentBuffEffect.FractureTime += TargetBE.FractureTime;
if (!(TargetBE.FractureTime > 0f))
{
}
}
if (TargetBE.isTunnelvision && !ConfigObj.Config.DisableAllDebuff && !ConfigObj.Config.DisableTunnelvision)
{
CurrentBuffEffect.isTunnelvision = true;
CurrentBuffEffect.TunnelvisionTime += TargetBE.TunnelvisionTime;
}
if (TargetBE.isPainkillers)
{
CurrentBuffEffect.isPainkillers = true;
CurrentBuffEffect.PainkillersTime += TargetBE.PainkillersTime;
}
if (TargetBE.isRemovePain)
{
CurrentBuffEffect.PainList.Clear();
}
if (TargetBE.Pain.Enable && !ConfigObj.Config.DisableAllDebuff && !ConfigObj.Config.DisablePain)
{
CurrentBuffEffect.PainList.Add(TargetBE.Pain);
}
if (TargetBE.Bleeding.Enable && !ConfigObj.Config.DisableAllDebuff && !ConfigObj.Config.DisableBleeding && !CurrentBuffEffect.isBleedingKillers)
{
CurrentBuffEffect.BleedingList.Add(TargetBE.Bleeding);
}
if (TargetBE.SpeedUp.Enable)
{
CurrentBuffEffect.SpeedUpList.Add(TargetBE.SpeedUp);
}
if (TargetBE.StrengthUp.Enable)
{
CurrentBuffEffect.StrengthUpList.Add(TargetBE.StrengthUp);
}
if (TargetBE.ContinuedHeal.Enable)
{
CurrentBuffEffect.ContinuedHealList.Add(TargetBE.ContinuedHeal);
}
if (TargetBE.DamageResist.Enable)
{
CurrentBuffEffect.DamageResistList.Add(TargetBE.DamageResist);
}
if (TargetBE.DamageScaler.Enable)
{
CurrentBuffEffect.DamageScalerList.Add(TargetBE.DamageScaler);
}
if (TargetBE.AddMaxHealth.Enable)
{
CurrentBuffEffect.AddMaxHealthList.Add(TargetBE.AddMaxHealth);
}
if (Mathf.Abs(TargetBE.MaxHealthReducePercent) > 0f && !ConfigObj.Config.DisableMaxHealthReduce)
{
CurrentBuffEffect.MaxHealthReducePercent = Mathf.Max(CurrentBuffEffect.MaxHealthReducePercent + TargetBE.MaxHealthReducePercent, 0f);
CurrentBuffEffect.MaxHealthReducePercent = Mathf.Min(CurrentBuffEffect.MaxHealthReducePercent, ConfigObj.Config.MaxMaxHealthReducePercent);
}
}
private void SetPainEffectPost(float PainLevel)
{
PainCL_rbcount.Value = ((!(PainLevel <= 0f)) ? 6 : 0);
PainCL_rbdesat.Value = -0.75f * PainLevel;
PainCL_rbdist.Value = 1.44444f * PainLevel;
PainCL_brightness.Value = -0.55f * PainLevel;
}
private void SetLowHealthEffectPost(float LowHealthLevel)
{
LowHealthCL_lowhealthenable.Value = LowHealthLevel;
LowHealthCL_saturation.Value = -0.55f * LowHealthLevel;
}
private void SetTunnelvisionEffectPost(bool Enable)
{
TunnelvisionCL_tunnelvisionenable.Value = (Enable ? 1f : 0f);
}
private void SetBleedingEffectPost(float BleedingLevel)
{
Bleeding_distortsrength.Value = BleedingLevel;
}
private void SetTremorEffectPost(bool Enable)
{
Tremor_tremorenable.Value = (Enable ? 1f : 0f);
}
private void SetPainkillersEffectPost(bool Enable)
{
PainkillersCL_brightness.Value = (Enable ? 0.25f : 0f);
PainkillersCL_lsscale.Value = (Enable ? 1.15f : 0f);
PainkillersCL_lscount.Value = (Enable ? 1.5f : 0f);
}
}
}
namespace EF.BuffSystem
{
public static class StoreBuffSettingHelper
{
public static void Store(string path, BuffSystemSetting Target)
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(BuffSystemSetting));
FileStream fileStream = File.OpenWrite(path);
fileStream.Seek(0L, SeekOrigin.Begin);
fileStream.SetLength(0L);
xmlSerializer.Serialize(fileStream, Target);
fileStream.Flush();
fileStream.Close();
}
public static BuffSystemSetting Read(string path)
{
FileStream fileStream = new FileStream(path, FileMode.Open);
XmlSerializer xmlSerializer = new XmlSerializer(typeof(BuffSystemSetting));
BuffSystemSetting buffSystemSetting = new BuffSystemSetting();
buffSystemSetting = (BuffSystemSetting)xmlSerializer.Deserialize(fileStream);
fileStream.Close();
return buffSystemSetting;
}
}
}
namespace EF.VoiceSystem
{
public class EF_VoiceSystem : MonoBehaviour
{
private float timer = 0f;
private float UpdateRate = 0.1f;
public AudioSource HitPainAudioSource;
public AudioSource BreathAudioSource;
public AudioSource DeathAudioSource;
public AudioSource FractureAudioSource;
public List<AudioClip> HitPain = new List<AudioClip>();
public List<AudioClip> Breath = new List<AudioClip>();
public List<AudioClip> Death = new List<AudioClip>();
public List<AudioClip> Fracture = new List<AudioClip>();
private int CurrentBreathClip = 0;
private void Start()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
GM.CurrentSceneSettings.PlayerDeathEvent += new PlayerDeath(PlayDeathAudio);
}
private void Update()
{
timer += Time.deltaTime;
if (!(timer > UpdateRate))
{
return;
}
timer -= UpdateRate;
if (EF_BuffSystem_GlobalObject.GetInstance().Config.DisableBreathAudio)
{
BreathAudioSource.mute = true;
}
else if ((double)(GM.CurrentPlayerBody.Health / GM.CurrentPlayerBody.m_startingHealth) <= 0.2)
{
if (CurrentBreathClip != 2)
{
ChangeBreathAudio(2);
}
}
else if (CurrentBreathClip != 0)
{
ChangeBreathAudio(0);
}
}
public void PlayHitPainAudio()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: 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_005f: 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_006a: 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)
if ((Object)(object)HitPainAudioSource != (Object)null)
{
Object.Destroy((Object)(object)HitPainAudioSource);
}
if (!EF_BuffSystem_GlobalObject.GetInstance().Config.DisableTookDamageAudio)
{
AudioEvent val = new AudioEvent();
val.Clips = HitPain;
val.VolumeRange = new Vector2(0.4f, 0.4f);
val.PitchRange = Vector2.one;
val.ClipLengthRange = Vector2.one;
AudioEvent val2 = val;
SM.PlayGenericSound(val2, GM.CurrentPlayerBody.headPositionFiltered);
}
}
public void ChangeBreathAudio(int Clip)
{
switch (Clip)
{
case 2:
BreathAudioSource.clip = Breath[2];
BreathAudioSource.Play();
CurrentBreathClip = 2;
break;
case 0:
BreathAudioSource.clip = Breath[0];
BreathAudioSource.Play();
CurrentBreathClip = 0;
break;
}
}
public void PlayDeathAudio(bool killself)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: 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_005f: 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_006a: 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)
if ((Object)(object)DeathAudioSource != (Object)null)
{
Object.Destroy((Object)(object)DeathAudioSource);
}
if (!EF_BuffSystem_GlobalObject.GetInstance().Config.DisableTookDamageAudio)
{
AudioEvent val = new AudioEvent();
val.Clips = Death;
val.VolumeRange = new Vector2(0.4f, 0.4f);
val.PitchRange = Vector2.one;
val.ClipLengthRange = Vector2.one;
AudioEvent val2 = val;
SM.PlayGenericSound(val2, GM.CurrentPlayerBody.headPositionFiltered);
}
}
public void PlayFractureAudio()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: 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_005f: 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_006a: 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)
if ((Object)(object)FractureAudioSource != (Object)null)
{
Object.Destroy((Object)(object)FractureAudioSource);
}
if (!EF_BuffSystem_GlobalObject.GetInstance().Config.DisableTookDamageAudio)
{
AudioEvent val = new AudioEvent();
val.Clips = Fracture;
val.VolumeRange = new Vector2(0.4f, 0.4f);
val.PitchRange = Vector2.one;
val.ClipLengthRange = Vector2.one;
AudioEvent val2 = val;
SM.PlayGenericSound(val2, GM.CurrentPlayerBody.headPositionFiltered);
}
}
}
}
namespace EF.BuffSystem.UI
{
[ExecuteInEditMode]
public class BuffBlockUpdate : MonoBehaviour
{
public Image Pannel = null;
public Text LV = null;
public Text LVTitle = null;
public Text Time = null;
public Text Special = null;
public bool HasLV = true;
public bool IsSpecial = false;
public Color GoodBuffColor = Color.green;
public Color BadBuffColor = Color.red;
public Color DeactiveBuffColor = Color.black;
public void Refresh(bool active, bool GoodBuff, int iLV = 0, float iTime = 0f, string iSpecial = "none")
{
//IL_0019: 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_0086: Unknown result type (might be due to invalid IL or missing references)
((Graphic)Pannel).color = (GoodBuff ? GoodBuffColor : BadBuffColor);
if (IsSpecial)
{
Special.text = iSpecial;
}
else
{
LV.text = iLV.ToString();
Time.text = ((int)iTime).ToString();
}
if (!active)
{
((Graphic)Pannel).color = DeactiveBuffColor;
}
}
private void Start()
{
if (HasLV)
{
((Behaviour)LV).enabled = true;
((Behaviour)LVTitle).enabled = true;
}
else
{
((Behaviour)LV).enabled = false;
((Behaviour)LVTitle).enabled = false;
}
}
}
[ExecuteInEditMode]
public class UIUpdater : MonoBehaviour
{
public GameObject TransformObj;
public Manager BSM;
public GameObject Pain;
public GameObject Bleeding;
public GameObject Tremor;
public GameObject Fracture;
public GameObject Tunnelvision;
public GameObject Painkiller;
public GameObject Adrenaline;
public GameObject PvtBleed;
public GameObject SpeedUp;
public GameObject StrengthUp;
public GameObject Healing;
public GameObject DamResist;
public GameObject DamScaler;
public GameObject MaxHealth;
public GameObject Injure;
public Text HPText;
private float time = 0f;
private float rate = 0.06666f;
private void Start()
{
}
private void Update()
{
//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_004d: Unknown result type (might be due to invalid IL or missing references)
Vector3 localScale = ((Component)this).gameObject.transform.localScale;
if (WristMenuAPI.Instance2.m_isActive)
{
localScale.x = 0.00035f;
}
else
{
localScale.x = 0f;
}
((Component)this).gameObject.transform.localScale = localScale;
time += Time.deltaTime;
if (time > rate)
{
time -= rate;
Pain.GetComponent<BuffBlockUpdate>().Refresh(BSM.ThisFramePainLevel != 0, GoodBuff: false, BSM.ThisFramePainLevel, (int)BSM.ThisFramePainTime);
Bleeding.GetComponent<BuffBlockUpdate>().Refresh(BSM.ThisFrameBleedingLevel != 0, GoodBuff: false, BSM.ThisFrameBleedingLevel, (int)BSM.ThisFrameBleedingTime);
Tremor.GetComponent<BuffBlockUpdate>().Refresh(BSM.CurrentBuffEffect.isTremor, GoodBuff: false, 0, (int)BSM.CurrentBuffEffect.TremorTime);
Fracture.GetComponent<BuffBlockUpdate>().Refresh(BSM.CurrentBuffEffect.isFracture, GoodBuff: false, 0, (int)BSM.CurrentBuffEffect.FractureTime);
Tunnelvision.GetComponent<BuffBlockUpdate>().Refresh(BSM.CurrentBuffEffect.isTunnelvision, GoodBuff: false, 0, (int)BSM.CurrentBuffEffect.TunnelvisionTime);
Painkiller.GetComponent<BuffBlockUpdate>().Refresh(BSM.CurrentBuffEffect.isPainkillers, GoodBuff: true, 0, (int)BSM.CurrentBuffEffect.PainkillersTime);
Adrenaline.GetComponent<BuffBlockUpdate>().Refresh(BSM.CurrentBuffEffect.isLowHealthKillers, GoodBuff: true, 0, (int)BSM.CurrentBuffEffect.LowHealthKillersTime);
PvtBleed.GetComponent<BuffBlockUpdate>().Refresh(BSM.CurrentBuffEffect.isBleedingKillers, GoodBuff: true, 0, (int)BSM.CurrentBuffEffect.BleedingKillersTime);
SpeedUp.GetComponent<BuffBlockUpdate>().Refresh(BSM.ThisFrameSpeedUpLevel != 0, BSM.ThisFrameSpeedUpLevel >= 0, BSM.ThisFrameSpeedUpLevel, (int)BSM.ThisFrameSpeedUpTime);
StrengthUp.GetComponent<BuffBlockUpdate>().Refresh(BSM.ThisFrameStrengthUpLevel != 0, BSM.ThisFrameStrengthUpLevel >= 0, BSM.ThisFrameStrengthUpLevel, (int)BSM.ThisFrameStrengthUpTime);
Pain.GetComponent<BuffBlockUpdate>().Refresh(BSM.ThisFramePainLevel != 0, GoodBuff: false, BSM.ThisFramePainLevel, (int)BSM.ThisFramePainTime);
Healing.GetComponent<BuffBlockUpdate>().Refresh(BSM.ThisFrameContinuedHealLevel != 0, BSM.ThisFrameContinuedHealLevel >= 0, BSM.ThisFrameContinuedHealLevel, (int)BSM.ThisFrameContinuedHealTime);
DamResist.GetComponent<BuffBlockUpdate>().Refresh(BSM.ThisFrameDamageResistLevel != 0, BSM.ThisFrameDamageResistLevel >= 0, BSM.ThisFrameDamageResistLevel, (int)BSM.ThisFrameDamageResistTime);
DamScaler.GetComponent<BuffBlockUpdate>().Refresh(BSM.ThisFrameDamageScalerLevel != 0, BSM.ThisFrameDamageScalerLevel >= 0, BSM.ThisFrameDamageScalerLevel, (int)BSM.ThisFrameDamageScalerTime);
MaxHealth.GetComponent<BuffBlockUpdate>().Refresh(BSM.ThisFrameAddMaxHealthLevel != 0, BSM.ThisFrameAddMaxHealthLevel >= 0, BSM.ThisFrameAddMaxHealthLevel, (int)BSM.ThisFrameAddMaxHealthTime);
Injure.GetComponent<BuffBlockUpdate>().Refresh(BSM.CurrentBuffEffect.MaxHealthReducePercent > 0f, GoodBuff: false, 0, 0f, ((int)(BSM.CurrentBuffEffect.MaxHealthReducePercent * 100f)).ToString());
HPText.text = "HP : " + (int)GM.CurrentPlayerBody.Health + "/" + (int)GM.CurrentPlayerBody.m_startingHealth;
}
}
}
}
namespace EF.PostSystem
{
public class EFPost_AutoHook : MonoBehaviour
{
public Shader RefShader;
public Texture2D RefLowHealthTexture;
public Texture2D RefNoiseTexture;
public EFPost_CamScript EFP;
private void Start()
{
if (Object.op_Implicit((Object)(object)GM.CurrentPlayerBody) && Object.op_Implicit((Object)(object)GM.CurrentPlayerBody.EyeCam))
{
EFPost_CamScript component = ((Component)GM.CurrentPlayerBody.EyeCam).gameObject.GetComponent<EFPost_CamScript>();
if ((Object)(object)component == (Object)null)
{
EFP = ((Component)GM.CurrentPlayerBody.EyeCam).gameObject.AddComponent<EFPost_CamScript>();
}
else
{
EFP = component;
}
EFP.LowHealthTexture = RefLowHealthTexture;
EFP.NoiseTexture = RefNoiseTexture;
EFP.shader = RefShader;
}
}
private void Update()
{
//IL_0011: 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_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: 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_0048: 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_0067: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.position = GM.CurrentPlayerBody.LeftHand.position + GM.CurrentPlayerBody.LeftHand.forward * -0.15f + GM.CurrentPlayerBody.LeftHand.right * -0.1f;
((Component)this).transform.rotation = GM.CurrentPlayerBody.LeftHand.rotation;
}
}
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
public class EFPost_BaseClass : MonoBehaviour
{
public Shader shader = null;
private Material _material = null;
public Material _Material
{
get
{
if ((Object)(object)_material == (Object)null)
{
_material = GenerateMaterial(shader);
}
return _material;
}
}
protected Material GenerateMaterial(Shader shader)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
if ((Object)(object)shader == (Object)null)
{
return null;
}
if (!shader.isSupported)
{
return null;
}
Material val = new Material(shader);
((Object)val).hideFlags = (HideFlags)52;
if (Object.op_Implicit((Object)(object)val))
{
return val;
}
return null;
}
}
public class EFPost_CamScript : EFPost_BaseClass
{
public Texture2D LowHealthTexture;
public Texture2D NoiseTexture;
public float brightness = 1f;
public float contrast = 1f;
public float saturation = 1f;
public Color multcolor = Color.white;
public float rbcount = 0f;
public float rbdist = 0f;
public float rbdesat = 0.9f;
public float rbnoise = 0.9f;
public float rbcenterreduce = 0.02f;
public float lscount = 0f;
public float lsscale = 0f;
public float lowhealthenable = 0f;
public float tunnelvisionenable = 0f;
public float distortstrength = 0f;
public float tremorenable = 0f;
private GlobalPostChangeList TargetGlobalPostCL = GlobalPostChangeList.GetInstance();
private float timer = 0f;
private float UpdateRate = 0.01666667f;
private void Update()
{
timer += Time.deltaTime;
if (timer > UpdateRate)
{
timer -= UpdateRate;
UpdateValues();
}
}
private void OnRenderImage(RenderTexture src, RenderTexture dest)
{
ApplyPost(src, dest);
}
private void UpdateValues()
{
UpdateFloatValue(out brightness, brightness, TargetGlobalPostCL.CL_brightness, 1f, 4f, 15f, 0.3f);
UpdateFloatValue(out contrast, contrast, TargetGlobalPostCL.CL_contrast, 1f, 4f, 2f, 0f);
UpdateFloatValue(out saturation, saturation, TargetGlobalPostCL.CL_saturation, 1f, 4f, 2f, 0f);
UpdateFloatValue(out rbcount, rbcount, TargetGlobalPostCL.CL_rbcount, 0f, 4f, 16f, 0f);
UpdateFloatValue(out rbdesat, rbdesat, TargetGlobalPostCL.CL_rbdesat, 0.8f, 4f, 1f, 0f);
UpdateFloatValue(out rbdist, rbdist, TargetGlobalPostCL.CL_rbdist, 0f, 4f, 2f, 0f);
UpdateFloatValue(out lscount, lscount, TargetGlobalPostCL.CL_lscount, 0f, 16f, 3f, 0f);
UpdateFloatValue(out lsscale, lsscale, TargetGlobalPostCL.CL_lsscale, 0f, 4f, 3f, 0f);
UpdateFloatValue(out lowhealthenable, lowhealthenable, TargetGlobalPostCL.CL_lowhealthenable, 0f, 4f, 1f, 0f);
UpdateFloatValue(out tunnelvisionenable, tunnelvisionenable, TargetGlobalPostCL.CL_tunnelvisionenable, 0f, 4f, 1f, 0f);
UpdateFloatValue(out distortstrength, distortstrength, TargetGlobalPostCL.CL_distortstrength, 0f, 4f, 1f, 0f);
UpdateFloatValue(out tremorenable, tremorenable, TargetGlobalPostCL.CL_tremorenable, 0f, 4f, 1f, 0f);
}
private void UpdateFloatValue(out float TargetFloat, float CurrentValue, List<PostFloatChange> TargetCL, float DefaultValue, float ChangeSpeed, float max = 99999f, float min = -99999f)
{
float num = 0f;
foreach (PostFloatChange item in TargetCL)
{
if (item == null)
{
TargetCL.Remove(item);
Console.Write("PostSystem : except change list found");
}
else
{
num += item.Value;
}
}
float num2 = DefaultValue + num;
float num3 = num2 - CurrentValue;
float num4;
if ((double)Mathf.Sqrt(num3) < 0.0001)
{
num4 = num2;
}
else
{
float num5 = num3 * Mathf.Clamp(UpdateRate * ChangeSpeed, 0f, 1f);
num4 = CurrentValue + num5;
}
TargetFloat = Mathf.Clamp(num4, min, max);
}
private void ApplyPost(RenderTexture src, RenderTexture dest)
{
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)base._Material))
{
base._Material.SetTexture("_LowHealthTex", (Texture)(object)LowHealthTexture);
base._Material.SetFloat("_LowHealthEnable", lowhealthenable);
base._Material.SetFloat("_TunnelvisionEnable", tunnelvisionenable);
base._Material.SetFloat("_DistortStrength", distortstrength);
base._Material.SetTexture("_NoiseTexture", (Texture)(object)NoiseTexture);
base._Material.SetFloat("_TremorEnable", tremorenable);
base._Material.SetFloat("_Brightness", brightness);
base._Material.SetFloat("_Saturation", saturation);
base._Material.SetFloat("_Contrast", contrast);
base._Material.SetColor("_MultColor", multcolor);
base._Material.SetInt("_RBCount", (int)Mathf.Floor(rbcount));
base._Material.SetFloat("_RBDist", rbdist);
base._Material.SetFloat("_RBDesat", rbdesat);
base._Material.SetFloat("_RBNoise", rbnoise);
base._Material.SetFloat("_RBCenterReduce", rbcenterreduce);
base._Material.SetInt("_LSCount", (int)Mathf.Floor(lscount));
base._Material.SetFloat("_LSScale", lsscale);
Graphics.Blit((Texture)(object)src, dest, base._Material);
}
else
{
Graphics.Blit((Texture)(object)src, dest);
}
}
}
}
[BepInPlugin("Ax.EscapeFrame_PostSystem", "EscapeFrame_PostSystem", "1.0.1")]
[BepInProcess("h3vr.exe")]
[BepInDependency("h3vr.otherloader", "1.1.5")]
public class EscapeFrame_PostSystemPlugin : BaseUnityPlugin
{
private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
public void Awake()
{
LoadAssets();
}
private void LoadAssets()
{
OtherLoader.RegisterDirectLoad(BasePath, "Ax.EscapeFrame_PostSystem", "", "ef.postsystem", "", "");
}
}
namespace JerryAr.EscapeFrame_PostSystem_Fixed
{
[BepInPlugin("JerryAr.EscapeFrame_PostSystem_Fixed", "EscapeFrame_PostSystem_Fixed", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class EscapeFrame_PostSystem_FixedPlugin : BaseUnityPlugin
{
private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
internal static ManualLogSource Logger;
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
LoadAssets();
}
private void LoadAssets()
{
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "JerryAr.EscapeFrame_PostSystem_Fixed");
OtherLoader.RegisterDirectLoad(BasePath, "JerryAr.EscapeFrame_PostSystem_Fixed", "", "ef.postsystem", "", "");
}
}
}