using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
internal class <Module>
{
static <Module>()
{
}
}
public class TimerHUDComponents : MonoBehaviour
{
private static ManualLogSource Logger;
public TextMeshProUGUI textContainer;
public Image arrowImage;
public Image circleFillImage;
public Image circleBorderImage;
public Image barFillImage;
public Image barBackerImage;
public static void GetLogger(ManualLogSource PluginLogger)
{
Logger = PluginLogger;
}
public void GetTimerHUDComponents(VisibleTimerBase timerScript)
{
if ((Object)(object)timerScript == (Object)null)
{
Logger.LogError((object)"failed to find timerScript!");
return;
}
timerScript.textContainer = textContainer;
timerScript.arrowImage = arrowImage;
timerScript.circleFillImage = circleFillImage;
timerScript.circleBorderImage = circleBorderImage;
timerScript.barFillImage = barFillImage;
timerScript.barBackerImage = barBackerImage;
}
}
public class TimersManager : MonoBehaviour
{
private static ManualLogSource Logger;
public static TimersManager Singleton;
public List<VisibleTimerBase> allTimers;
public static void GetLogger(ManualLogSource PluginLogger)
{
Logger = PluginLogger;
}
private void Awake()
{
if (Object.op_Implicit((Object)(object)Singleton))
{
Object.Destroy((Object)(object)this);
}
else
{
Singleton = this;
}
allTimers = new List<VisibleTimerBase>();
}
public void AddTimer(VisibleTimerBase timerToAdd)
{
if (!allTimers.Contains(timerToAdd))
{
allTimers.Add(timerToAdd);
}
}
public void RemoveTimer(VisibleTimerBase timerToRemove)
{
if (allTimers.Contains(timerToRemove))
{
allTimers.Remove(timerToRemove);
}
}
}
public enum TimerType
{
Text,
Circle,
Bar
}
public class VTAssetsCollection
{
public static GameObject timerHUDPrefab;
public static GameObject dynamiteVisibleTimer;
public static GameObject tumbleweedVisibleTimer;
public static GameObject sunVisibleTimer;
public static GameObject staminaVisibleTimer;
public static GameObject leverVisibleTimer;
public static Material materialUI;
public static TMP_FontAsset turncoatFont;
public static Sprite arrowSprite;
public static Sprite gripFullSprite;
public static Sprite gripBorderSprite;
public static Sprite sprintHealthSprite;
public static void GetAssetsAssetBundle(AssetBundle __instance)
{
timerHUDPrefab = __instance.LoadAsset<GameObject>("Assets/LTOWVisibleTimersMod/Prefabs/TimerHUDComponents.prefab");
dynamiteVisibleTimer = __instance.LoadAsset<GameObject>("Assets/LTOWVisibleTimersMod/Prefabs/VisibleTimerBase/DynamiteTimerPrefab.prefab");
tumbleweedVisibleTimer = __instance.LoadAsset<GameObject>("Assets/LTOWVisibleTimersMod/Prefabs/VisibleTimerBase/TumbleweedTimerPrefab.prefab");
sunVisibleTimer = __instance.LoadAsset<GameObject>("Assets/LTOWVisibleTimersMod/Prefabs/VisibleTimerBase/SunTimerPrefab.prefab");
staminaVisibleTimer = __instance.LoadAsset<GameObject>("Assets/LTOWVisibleTimersMod/Prefabs/VisibleTimerBase/StaminaTimerPrefab.prefab");
leverVisibleTimer = __instance.LoadAsset<GameObject>("Assets/LTOWVisibleTimersMod/Prefabs/VisibleTimerBase/LeverTimerPrefab.prefab");
}
public static void GetAssetsHudManager(HudManager __instance)
{
Image component = ((Component)__instance.pickupPopUp_Object.transform.Find("Arrow Image")).GetComponent<Image>();
materialUI = ((Graphic)component).material;
arrowSprite = component.sprite;
gripFullSprite = __instance.gripMeter_Fill.sprite;
gripBorderSprite = ((Component)((Component)__instance.gripMeter_Fill).transform.parent).GetComponent<Image>().sprite;
sprintHealthSprite = __instance.sprintBarParent.GetComponent<Image>().sprite;
turncoatFont = __instance.heldObjectHintText.font;
}
}
public class VTComponentContainer : MonoBehaviour
{
public MonoBehaviour script;
}
public class BasicTimer : VisibleTimerBase
{
}
public class DynamiteTimer : VisibleTimerBase
{
public Dynamite dynamiteScript;
private float currentTime;
private float maxTime;
public override void Start()
{
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: 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)
ref Dynamite reference = ref dynamiteScript;
MonoBehaviour script = ((Component)((Component)this).transform.parent).GetComponent<VTComponentContainer>().script;
reference = (Dynamite)(object)((script is Dynamite) ? script : null);
startVisible = dynamiteScript.GetPrivateField<GameObject>("fuseParticles").activeSelf;
if (startVisible)
{
StartTimer(useMaxTime: false);
}
else if ((Object)(object)((Component)dynamiteScript).GetComponent<VTComponentContainer>() == (Object)null)
{
((Component)dynamiteScript).gameObject.AddComponent<VTComponentContainer>().script = (MonoBehaviour)(object)this;
}
SetTimerType(VTConfigs.dynamiteType.Value);
base.Start();
SetImagesColor(VTConfigs.dynamiteColorPrimary.Value, VTConfigs.dynamiteColorSecondary.Value);
SetShowArrow(VTConfigs.dynamiteArrow.Value);
SetSize(VTConfigs.dynamiteSize.Value);
SetVerticalOffset(VTConfigs.dynamiteVertical.Value);
SetMaxTime();
SetTimerMax(maxTime);
SetTextDecimals(VTConfigs.dynamiteDecimals.Value);
SetGradientInterval(VTConfigs.dynamiteColorInterval.Value);
SetBackerOpacity(VTConfigs.dynamiteBackerOpacity.Value);
SetCheckEveryXFrames(VTConfigs.dynamiteFrames.Value);
SetMinuteNotation(VTConfigs.dynamiteMinuteNotation.Value);
}
public override void Update()
{
if (!currentlyVisible && currentTime > 0f)
{
SetVisibility(visible: true);
}
if (currentlyVisible)
{
if (currentTime > 0f)
{
currentTime -= Time.deltaTime;
}
else
{
currentTime = 0f;
SetVisibility(visible: false);
}
}
base.Update();
}
public override void RetrieveTimerCurrent()
{
if (currentlyVisible)
{
SetTimerCurrent(currentTime);
}
}
public void StartTimer(bool useMaxTime, bool fromPickUp = false)
{
if (currentlyVisible)
{
VisibleTimerBase.Logger.LogDebug((object)$"dynamite #{((NetworkBehaviour)dynamiteScript).NetworkObjectId} already visible, returning");
return;
}
if (fromPickUp && !dynamiteScript.GetPrivateField<AudioSource>("fuseHissAudioSource").isPlaying)
{
VisibleTimerBase.Logger.LogDebug((object)$"dynamite #{((NetworkBehaviour)dynamiteScript).NetworkObjectId} not yet lit, returning");
return;
}
VisibleTimerBase.Logger.LogDebug((object)$"succeeded dynamite #{((NetworkBehaviour)dynamiteScript).NetworkObjectId}");
SetMaxTime();
if (useMaxTime)
{
currentTime = maxTime;
}
else
{
DynamiteTimer dynamiteTimer = ((Component)dynamiteScript).gameObject.GetComponent<VTComponentContainer>().script as DynamiteTimer;
currentTime = dynamiteTimer.currentTime;
}
SetVisibility(visible: true);
}
private void SetMaxTime()
{
maxTime = dynamiteScript.dynamiteMaxFuseTime;
}
}
public class InfinistaminaTimer : VisibleTimerBase
{
public StatusEffect effectScript;
private float currentTime;
private float maxTime;
public override void Start()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: 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)
effectScript = StatusEffectsBank.Singleton.statusEffects[2];
SetTimerType(VTConfigs.infinistaminaType.Value);
base.Start();
SetImagesColor(VTConfigs.infinistaminaColorPrimary.Value, VTConfigs.infinistaminaColorSecondary.Value);
SetShowArrow(VTConfigs.infinistaminaArrow.Value);
SetSize(VTConfigs.infinistaminaSize.Value);
SetVerticalOffset(VTConfigs.infinistaminaVertical.Value);
SetMaxTime();
SetTimerMax(maxTime);
SetTextDecimals(VTConfigs.infinistaminaDecimals.Value);
SetGradientInterval(VTConfigs.infinistaminaColorInterval.Value);
SetBackerOpacity(VTConfigs.infinistaminaBackerOpacity.Value);
SetCheckEveryXFrames(VTConfigs.infinistaminaFrames.Value);
SetMinuteNotation(VTConfigs.infinistaminaMinuteNotation.Value);
}
public override void Update()
{
if (!currentlyVisible && currentTime > 0f)
{
SetVisibility(visible: true);
}
if (currentlyVisible)
{
if (currentTime > 0f)
{
currentTime -= Time.deltaTime;
}
else
{
currentTime = 0f;
SetVisibility(visible: false);
}
}
base.Update();
}
public override void RetrieveTimerCurrent()
{
if (currentlyVisible)
{
SetTimerCurrent(currentTime);
}
}
public void StartTimer()
{
SetMaxTime();
currentTime = maxTime;
SetVisibility(visible: true);
}
private void SetMaxTime()
{
maxTime = effectScript.GetPrivateField<float>("duration");
}
}
public class LeverTimer : VisibleTimerBase
{
private float currentTime;
private float maxTime;
public override void Start()
{
//IL_0031: 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_005b: Unknown result type (might be due to invalid IL or missing references)
startVisible = GameManager.Singleton.trainLeverDisabledByTrainHornUsedRecently.Value;
SetTimerType(VTConfigs.leverType.Value);
base.Start();
SetImagesColor(VTConfigs.leverColorPrimary.Value, VTConfigs.leverColorSecondary.Value);
SetShowArrow(VTConfigs.leverArrow.Value);
SetSize(VTConfigs.leverSize.Value);
SetVerticalOffset(VTConfigs.leverVertical.Value);
SetMaxTime();
SetTimerMax(maxTime);
SetTextDecimals(VTConfigs.leverDecimals.Value);
SetGradientInterval(VTConfigs.leverColorInterval.Value);
SetBackerOpacity(VTConfigs.leverBackerOpacity.Value);
SetCheckEveryXFrames(VTConfigs.leverFrames.Value);
SetMinuteNotation(VTConfigs.leverMinuteNotation.Value);
}
public override void Update()
{
if (!currentlyVisible && currentTime > 0f)
{
SetVisibility(visible: true);
}
if (currentlyVisible)
{
if (currentTime > 0f)
{
currentTime -= Time.deltaTime;
}
else
{
currentTime = 0f;
SetVisibility(visible: false);
}
}
base.Update();
}
public override void RetrieveTimerCurrent()
{
if (currentlyVisible)
{
SetTimerCurrent(currentTime);
}
}
public void StartTimer()
{
SetMaxTime();
currentTime = maxTime;
SetVisibility(visible: true);
}
private void SetMaxTime()
{
maxTime = GameManager.Singleton.GetPrivateField<float>("trainHornLeverDisabledTimer_Max");
}
}
public class SunTimer : VisibleTimerBase
{
public override void Start()
{
//IL_001c: 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_0046: Unknown result type (might be due to invalid IL or missing references)
SetTimerType(VTConfigs.sunType.Value);
base.Start();
SetImagesColor(VTConfigs.sunColorPrimary.Value, VTConfigs.sunColorSecondary.Value);
SetShowArrow(VTConfigs.sunArrow.Value);
SetSize(VTConfigs.sunSize.Value);
SetVerticalOffset(VTConfigs.sunVertical.Value);
SetTextDecimals(VTConfigs.sunDecimals.Value);
SetGradientInterval(VTConfigs.sunColorInterval.Value);
SetBackerOpacity(VTConfigs.sunBackerOpacity.Value);
SetCheckEveryXFrames(VTConfigs.sunFrames.Value);
SetMinuteNotation(VTConfigs.sunMinuteNotation.Value);
}
public override void RetrieveTimerCurrent()
{
if (currentlyVisible)
{
float timeUntilSundown_Current = TimeOfDayManager.Singleton.timeUntilSundown_Current;
SetTimerCurrent(timeUntilSundown_Current);
}
}
public void SetNewMaxTimer()
{
((MonoBehaviour)this).StartCoroutine(SetNewMaxTimerOnDelay());
}
private IEnumerator SetNewMaxTimerOnDelay()
{
yield return (object)new WaitUntil((Func<bool>)(() => TimeOfDayManager.Singleton.GetPrivateField<bool>("hasRecievedSundownTimerFromServer")));
float timeUntilSundown_Starting = TimeOfDayManager.Singleton.timeUntilSundown_Starting;
SetTimerMax(timeUntilSundown_Starting);
VisibleTimerBase.Logger.LogDebug((object)$"set new max timer: {timeUntilSundown_Starting}");
if (MatchSettingsManager.Singleton.sundownNever)
{
VisibleTimerBase.Logger.LogDebug((object)"no sundown detected, returning");
SetVisibility(visible: false);
}
else
{
SetVisibility(visible: true);
}
}
}
public class TumbleweedTimer : VisibleTimerBase
{
public Tumbleweed tumbleweedScript;
private float currentTime;
private float maxTime;
public override void Start()
{
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: 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)
ref Tumbleweed reference = ref tumbleweedScript;
MonoBehaviour script = ((Component)((Component)this).transform.parent).GetComponent<VTComponentContainer>().script;
reference = (Tumbleweed)(object)((script is Tumbleweed) ? script : null);
startVisible = tumbleweedScript.timeWhenLit != 0f;
if (startVisible)
{
StartTimer(useMaxTime: false);
}
else if ((Object)(object)((Component)tumbleweedScript).GetComponent<VTComponentContainer>() == (Object)null)
{
((Component)tumbleweedScript).gameObject.AddComponent<VTComponentContainer>().script = (MonoBehaviour)(object)this;
}
SetTimerType(VTConfigs.tumbleweedType.Value);
base.Start();
SetImagesColor(VTConfigs.tumbleweedColorPrimary.Value, VTConfigs.tumbleweedColorSecondary.Value);
SetShowArrow(VTConfigs.tumbleweedArrow.Value);
SetSize(VTConfigs.tumbleweedSize.Value);
SetVerticalOffset(VTConfigs.tumbleweedVertical.Value);
SetTimerMax(tumbleweedScript.burnLifeTime_Max);
SetTextDecimals(VTConfigs.tumbleweedDecimals.Value);
SetGradientInterval(VTConfigs.tumbleweedColorInterval.Value);
SetBackerOpacity(VTConfigs.tumbleweedBackerOpacity.Value);
SetCheckEveryXFrames(VTConfigs.tumbleweedFrames.Value);
SetMinuteNotation(VTConfigs.tumbleweedMinuteNotation.Value);
}
public override void Update()
{
if (!currentlyVisible && currentTime > 0f)
{
SetVisibility(visible: true);
}
if (currentlyVisible)
{
if (currentTime > 0f)
{
currentTime -= Time.deltaTime;
}
else
{
currentTime = 0f;
SetVisibility(visible: false);
}
}
base.Update();
}
public override void RetrieveTimerCurrent()
{
if (currentlyVisible)
{
SetTimerCurrent(currentTime);
}
}
public void StartTimer(bool useMaxTime, bool fromPickUp = false)
{
if (currentlyVisible)
{
VisibleTimerBase.Logger.LogDebug((object)$"tumbleweed #{((NetworkBehaviour)tumbleweedScript).NetworkObjectId} already visible, returning");
return;
}
if (fromPickUp && tumbleweedScript.timeWhenLit == 0f)
{
VisibleTimerBase.Logger.LogDebug((object)$"tumbleweed #{((NetworkBehaviour)tumbleweedScript).NetworkObjectId} not yet lit, returning");
return;
}
VisibleTimerBase.Logger.LogDebug((object)$"succeeded tumbleweed #{((NetworkBehaviour)tumbleweedScript).NetworkObjectId}");
SetMaxTime();
if (useMaxTime)
{
currentTime = maxTime;
}
else
{
TumbleweedTimer tumbleweedTimer = ((Component)tumbleweedScript).GetComponent<VTComponentContainer>().script as TumbleweedTimer;
currentTime = tumbleweedTimer.currentTime;
}
SetVisibility(visible: true);
}
private void SetMaxTime()
{
maxTime = tumbleweedScript.burnLifeTime_Max;
}
}
public abstract class VisibleTimerBase : MonoBehaviour
{
public static ManualLogSource Logger;
[Header("Timer")]
public TextMeshProUGUI textContainer;
public Image arrowImage;
public Image circleFillImage;
public Image circleBorderImage;
public Image barFillImage;
public Image barBackerImage;
private Image[] allImages;
private float timerCurrent;
private float timerMax;
private TimerHUDComponents hudComponents;
[Space(3f)]
[Header("Configurable")]
public TimerType timerType;
private TimerType lastTimerType;
public float verticalOffset;
public bool showArrow;
public float textDecimals;
public Vector4 primaryColor;
public Vector4 secondaryColor;
public float backerOpacity;
public float gradientInterval;
public int checkEveryXFrames;
private int framesWaited;
private float gradientCooldown;
private bool minuteNotation;
[Space(3f)]
[Header("Runtime")]
public bool startVisible;
public bool currentlyVisible;
public GameObject followObject;
private Camera playerCam;
private bool setUpInitialVisibility;
public static void GetLogger(ManualLogSource PluginLogger)
{
Logger = PluginLogger;
}
private void Awake()
{
if (Object.op_Implicit((Object)(object)TimersManager.Singleton))
{
TimersManager.Singleton.AddTimer(this);
}
hudComponents = Object.Instantiate<GameObject>(VTAssetsCollection.timerHUDPrefab, ((Component)this).transform).GetComponent<TimerHUDComponents>();
if ((Object)(object)hudComponents == (Object)null)
{
Logger.LogError((object)"did not spawn with TimerHUDComponents");
DisableSelf();
}
else
{
hudComponents.GetTimerHUDComponents(this);
allImages = ((Component)this).GetComponentsInChildren<Image>();
ApplyAssets();
}
}
public virtual void Start()
{
lastTimerType = timerType;
SetFollowObject(((Component)((Component)this).transform.parent).gameObject);
((Component)this).transform.SetParent(HudManager.Singleton.pickupPopUp_Object.transform.parent, false);
((MonoBehaviour)this).StartCoroutine(GetLocalPlayerCamOnDelay());
}
public virtual void Update()
{
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_0325: Unknown result type (might be due to invalid IL or missing references)
//IL_0330: Unknown result type (might be due to invalid IL or missing references)
//IL_0335: Unknown result type (might be due to invalid IL or missing references)
//IL_0359: Unknown result type (might be due to invalid IL or missing references)
//IL_0369: Unknown result type (might be due to invalid IL or missing references)
//IL_036e: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_0378: Unknown result type (might be due to invalid IL or missing references)
//IL_0388: Unknown result type (might be due to invalid IL or missing references)
//IL_038d: Unknown result type (might be due to invalid IL or missing references)
//IL_0392: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_0283: Unknown result type (might be due to invalid IL or missing references)
if (!setUpInitialVisibility)
{
setUpInitialVisibility = true;
SetVisibility(startVisible);
}
if (currentlyVisible)
{
framesWaited++;
if (framesWaited >= checkEveryXFrames)
{
RetrieveTimerCurrent();
framesWaited = 0;
}
float currentTimerPercentage = GetCurrentTimerPercentage();
switch (timerType)
{
case TimerType.Text:
{
string text = "";
if (minuteNotation)
{
TimeSpan timeSpan = TimeSpan.FromSeconds(timerCurrent);
string text2 = "";
string text3 = ((timerMax >= 36000f) ? "hh" : "h");
string text4 = ((timerMax >= 600f) ? "mm" : "m");
string text5 = "";
if (textDecimals > 0f)
{
for (int i = 0; (float)i < textDecimals; i++)
{
text5 += "f";
}
}
text2 = ((timerMax >= 3600f && textDecimals > 0f) ? (text3 + "\\:" + text4 + "\\:ss\\," + text5) : ((timerMax >= 3600f && textDecimals <= 0f) ? (text3 + "\\:" + text4 + "\\:ss") : ((!(timerMax < 3600f) || !(textDecimals > 0f)) ? (text4 + "\\:ss") : (text4 + "\\:ss\\," + text5))));
text = timeSpan.ToString(text2);
}
else
{
text = timerCurrent.ToString($"F{textDecimals}");
}
((TMP_Text)textContainer).text = text;
break;
}
case TimerType.Circle:
circleFillImage.fillAmount = currentTimerPercentage;
break;
case TimerType.Bar:
barFillImage.fillAmount = currentTimerPercentage;
break;
}
if (primaryColor != secondaryColor)
{
if (gradientCooldown <= 0f)
{
Vector4 val = Vector4.Lerp(primaryColor, secondaryColor, 1f - currentTimerPercentage);
Image[] array = allImages;
for (int j = 0; j < array.Length; j++)
{
((Graphic)array[j]).color = Color.op_Implicit(val);
}
((Graphic)textContainer).color = Color.op_Implicit(val);
gradientCooldown = gradientInterval;
KeepBarBackerOpacity();
if (timerType != lastTimerType)
{
SetVisibility(visible: true);
lastTimerType = timerType;
Logger.LogDebug((object)$"!!detected timerType change to {lastTimerType}!!");
}
}
else
{
gradientCooldown -= Time.deltaTime;
}
}
}
if ((Object)(object)followObject != (Object)null)
{
if (currentlyVisible)
{
((Component)this).transform.position = followObject.transform.position + Vector3.up * verticalOffset;
if ((Object)(object)playerCam != (Object)null)
{
((Component)this).transform.LookAt(((Component)this).transform.position + ((Component)playerCam).transform.rotation * Vector3.forward, ((Component)playerCam).transform.rotation * Vector3.up);
}
}
}
else
{
Logger.LogDebug((object)"null followObject. death.");
DisableSelf();
}
}
private IEnumerator GetLocalPlayerCamOnDelay()
{
yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)GameManager.Singleton != (Object)null && (Object)(object)GameManager.Singleton.localPlayerObject != (Object)null));
if ((Object)(object)GameManager.Singleton.localWormScript != (Object)null)
{
Logger.LogDebug((object)"local player likely worm, timers should not be visible");
DisableSelf();
}
else
{
SetPlayerCam(GameManager.Singleton.localPlayerObject.GetComponent<PlayerGrabber>().GetPrivateField<Camera>("playerCam"));
}
}
public void ApplyAssets()
{
arrowImage.sprite = VTAssetsCollection.arrowSprite;
circleFillImage.sprite = VTAssetsCollection.gripFullSprite;
circleBorderImage.sprite = VTAssetsCollection.gripBorderSprite;
barFillImage.sprite = VTAssetsCollection.sprintHealthSprite;
barBackerImage.sprite = VTAssetsCollection.sprintHealthSprite;
((TMP_Text)textContainer).font = VTAssetsCollection.turncoatFont;
Image[] array = allImages;
for (int i = 0; i < array.Length; i++)
{
((Graphic)array[i]).material = VTAssetsCollection.materialUI;
}
}
public void DisableSelf()
{
Logger.LogDebug((object)("DisableSelf() on " + ((Object)this).name));
if (Object.op_Implicit((Object)(object)TimersManager.Singleton))
{
TimersManager.Singleton.RemoveTimer(this);
}
Object.Destroy((Object)(object)((Component)this).gameObject);
}
private float GetCurrentTimerPercentage()
{
return timerCurrent / timerMax;
}
public virtual void RetrieveTimerCurrent()
{
}
public void SetVisibility(bool visible)
{
currentlyVisible = visible;
Logger.LogDebug((object)$"{((Object)this).name} currentlyVisible? {currentlyVisible}");
if (!visible)
{
((Behaviour)textContainer).enabled = visible;
Image[] array = allImages;
for (int i = 0; i < array.Length; i++)
{
((Behaviour)array[i]).enabled = visible;
}
}
else
{
gradientCooldown = 0f;
((Behaviour)textContainer).enabled = timerType == TimerType.Text;
((Behaviour)circleBorderImage).enabled = timerType == TimerType.Circle;
((Behaviour)circleFillImage).enabled = timerType == TimerType.Circle;
((Behaviour)barBackerImage).enabled = timerType == TimerType.Bar;
((Behaviour)barFillImage).enabled = timerType == TimerType.Bar;
((Behaviour)arrowImage).enabled = showArrow;
SetStartingColor();
SetArrowOffset();
}
}
public void SetFollowObject(GameObject gObject)
{
followObject = gObject;
}
public void SetPlayerCam(Camera pCam)
{
playerCam = pCam;
}
public void SetTimerType(TimerType tType)
{
timerType = tType;
}
private void SetStartingColor()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: 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_0034: Unknown result type (might be due to invalid IL or missing references)
Image[] array = allImages;
for (int i = 0; i < array.Length; i++)
{
((Graphic)array[i]).color = Color.op_Implicit(primaryColor);
}
((Graphic)textContainer).color = Color.op_Implicit(primaryColor);
KeepBarBackerOpacity();
}
public void SetImagesColor(Vector4 cPrimary, Vector4 cSecondary)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
primaryColor = cPrimary;
secondaryColor = cSecondary;
SetStartingColor();
}
public void SetBackerOpacity(int bOpacity)
{
backerOpacity = (float)bOpacity / 100f;
}
private void KeepBarBackerOpacity()
{
//IL_000c: 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_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: 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_0052: Unknown result type (might be due to invalid IL or missing references)
((Graphic)barBackerImage).color = Color.op_Implicit(new Vector4(((Graphic)barBackerImage).color.r, ((Graphic)barBackerImage).color.g, ((Graphic)barBackerImage).color.b, ((Graphic)barBackerImage).color.a * backerOpacity));
}
private void SetArrowOffset()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
Transform child = ((Component)arrowImage).transform.GetChild(0);
float num = -1f;
num = (showArrow ? 75f : 0f);
child.localPosition = new Vector3(child.localPosition.x, num, child.localPosition.z);
}
public void SetVerticalOffset(float vOffset)
{
verticalOffset = vOffset;
}
public void SetSize(Vector3 cSize)
{
//IL_000c: 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_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.localScale = new Vector3(((Component)this).transform.localScale.x * cSize.x, ((Component)this).transform.localScale.y * cSize.y, ((Component)this).transform.localScale.z * cSize.z);
}
public void SetTextDecimals(int tDecimals)
{
textDecimals = tDecimals;
}
public void SetMinuteNotation(bool mNotation)
{
minuteNotation = mNotation;
}
public void SetShowArrow(bool sArrow)
{
showArrow = sArrow;
}
public void SetGradientInterval(float gInterval)
{
gradientInterval = gInterval;
}
public void SetCheckEveryXFrames(int cFrames)
{
checkEveryXFrames = cFrames;
framesWaited = checkEveryXFrames;
}
public void SetTimerMax(float tMax)
{
timerMax = tMax;
}
public void SetTimerCurrent(float tCurrent)
{
timerCurrent = tCurrent;
}
}
public class VTConfigs
{
private static ManualLogSource Logger;
public static ConfigEntry<bool> dynamiteTimer;
public static ConfigEntry<TimerType> dynamiteType;
public static ConfigEntry<Vector4> dynamiteColorPrimary;
public static ConfigEntry<Vector4> dynamiteColorSecondary;
public static ConfigEntry<Vector3> dynamiteSize;
public static ConfigEntry<float> dynamiteVertical;
public static ConfigEntry<bool> dynamiteArrow;
public static ConfigEntry<int> dynamiteDecimals;
public static ConfigEntry<bool> dynamiteMinuteNotation;
public static ConfigEntry<int> dynamiteBackerOpacity;
public static ConfigEntry<float> dynamiteColorInterval;
public static ConfigEntry<int> dynamiteFrames;
public static ConfigEntry<bool> tumbleweedTimer;
public static ConfigEntry<TimerType> tumbleweedType;
public static ConfigEntry<Vector4> tumbleweedColorPrimary;
public static ConfigEntry<Vector4> tumbleweedColorSecondary;
public static ConfigEntry<Vector3> tumbleweedSize;
public static ConfigEntry<float> tumbleweedVertical;
public static ConfigEntry<bool> tumbleweedArrow;
public static ConfigEntry<int> tumbleweedDecimals;
public static ConfigEntry<bool> tumbleweedMinuteNotation;
public static ConfigEntry<int> tumbleweedBackerOpacity;
public static ConfigEntry<float> tumbleweedColorInterval;
public static ConfigEntry<int> tumbleweedFrames;
public static ConfigEntry<bool> sunTimer;
public static ConfigEntry<TimerType> sunType;
public static ConfigEntry<Vector4> sunColorPrimary;
public static ConfigEntry<Vector4> sunColorSecondary;
public static ConfigEntry<Vector3> sunSize;
public static ConfigEntry<float> sunVertical;
public static ConfigEntry<bool> sunArrow;
public static ConfigEntry<int> sunDecimals;
public static ConfigEntry<bool> sunMinuteNotation;
public static ConfigEntry<int> sunBackerOpacity;
public static ConfigEntry<float> sunColorInterval;
public static ConfigEntry<int> sunFrames;
public static ConfigEntry<bool> infinistaminaTimer;
public static ConfigEntry<TimerType> infinistaminaType;
public static ConfigEntry<Vector4> infinistaminaColorPrimary;
public static ConfigEntry<Vector4> infinistaminaColorSecondary;
public static ConfigEntry<Vector3> infinistaminaSize;
public static ConfigEntry<float> infinistaminaVertical;
public static ConfigEntry<bool> infinistaminaArrow;
public static ConfigEntry<int> infinistaminaDecimals;
public static ConfigEntry<bool> infinistaminaMinuteNotation;
public static ConfigEntry<int> infinistaminaBackerOpacity;
public static ConfigEntry<float> infinistaminaColorInterval;
public static ConfigEntry<int> infinistaminaFrames;
public static ConfigEntry<bool> leverTimer;
public static ConfigEntry<TimerType> leverType;
public static ConfigEntry<Vector4> leverColorPrimary;
public static ConfigEntry<Vector4> leverColorSecondary;
public static ConfigEntry<Vector3> leverSize;
public static ConfigEntry<float> leverVertical;
public static ConfigEntry<bool> leverArrow;
public static ConfigEntry<int> leverDecimals;
public static ConfigEntry<bool> leverMinuteNotation;
public static ConfigEntry<int> leverBackerOpacity;
public static ConfigEntry<float> leverColorInterval;
public static ConfigEntry<int> leverFrames;
public VTConfigs(ConfigFile cfg)
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: 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_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Expected O, but got Unknown
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Expected O, but got Unknown
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Expected O, but got Unknown
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
//IL_02f6: Expected O, but got Unknown
//IL_0335: Unknown result type (might be due to invalid IL or missing references)
//IL_033f: Expected O, but got Unknown
//IL_0381: Unknown result type (might be due to invalid IL or missing references)
//IL_038b: Expected O, but got Unknown
//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
//IL_0418: Unknown result type (might be due to invalid IL or missing references)
//IL_0446: Unknown result type (might be due to invalid IL or missing references)
//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
//IL_04bb: Expected O, but got Unknown
//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0504: Expected O, but got Unknown
//IL_0547: Unknown result type (might be due to invalid IL or missing references)
//IL_0551: Expected O, but got Unknown
//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
//IL_05de: Unknown result type (might be due to invalid IL or missing references)
//IL_060c: Unknown result type (might be due to invalid IL or missing references)
//IL_0677: Unknown result type (might be due to invalid IL or missing references)
//IL_0681: Expected O, but got Unknown
//IL_06c0: Unknown result type (might be due to invalid IL or missing references)
//IL_06ca: Expected O, but got Unknown
//IL_070c: Unknown result type (might be due to invalid IL or missing references)
//IL_0716: Expected O, but got Unknown
//IL_0770: Unknown result type (might be due to invalid IL or missing references)
//IL_07a3: Unknown result type (might be due to invalid IL or missing references)
//IL_07d1: Unknown result type (might be due to invalid IL or missing references)
//IL_083c: Unknown result type (might be due to invalid IL or missing references)
//IL_0846: Expected O, but got Unknown
//IL_0885: Unknown result type (might be due to invalid IL or missing references)
//IL_088f: Expected O, but got Unknown
//IL_08d1: Unknown result type (might be due to invalid IL or missing references)
//IL_08db: Expected O, but got Unknown
dynamiteTimer = cfg.Bind<bool>("Dynamite", "Display Timer", true, "Enable a visible timer on dynamite.");
dynamiteType = cfg.Bind<TimerType>("Dynamite", "Timer Type", TimerType.Bar, "Set how the timer will be visualized.");
dynamiteColorPrimary = cfg.Bind<Vector4>("Dynamite", "Starting Color Timer", new Vector4(1f, 1f, 1f, 1f), "Set the color of the timer at its beginning.\nx = Red.\ny = Green.\nz = Blue.\nw = Opacity.");
dynamiteColorSecondary = cfg.Bind<Vector4>("Dynamite", "Ending Color Timer", new Vector4(1f, 0f, 0f, 1f), "Set the color of the timer at its end.\nx = Red.\ny = Green.\nz = Blue.\nw = Opacity.");
dynamiteSize = cfg.Bind<Vector3>("Dynamite", "Size of Timer", new Vector3(1f, 1f, 1f), "Set how large the timer will be.");
dynamiteVertical = cfg.Bind<float>("Dynamite", "Height of Timer", 0.75f, "Set how high above the dynamite the timer will be displayed.");
dynamiteArrow = cfg.Bind<bool>("Dynamite", "Arrow below Timer", true, "Show an arrow pointing from the timer to the dynamite the timer is on.");
dynamiteDecimals = cfg.Bind<int>("Dynamite", "Decimals of Timer", 1, new ConfigDescription("If [Timer Type] is set to Text, set how many decimals are behind the comma.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 4), Array.Empty<object>()));
dynamiteMinuteNotation = cfg.Bind<bool>("Dynamite", "Timer Minute Notation", false, "If [Timer Type] is set to Text, set whether time will be displayed in Minutes:Seconds or only in seconds.");
dynamiteBackerOpacity = cfg.Bind<int>("Dynamite", "Bar Opacity Timer", 25, new ConfigDescription("If [Timer Type] is set to Bar, set how opaque the background of the visible timer is.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
dynamiteColorInterval = cfg.Bind<float>("Dynamite", "Interval Recolor Timer", 0.1f, "If [Starting Color Timer] and [Ending Color Timer] are different values, set how often the color should update, in seconds.\nHigher values look less fluid but could result in better performance.");
dynamiteFrames = cfg.Bind<int>("Dynamite", "Check Timer per X Frames", 1, new ConfigDescription("Set per how many frames the timer should read out its in-game values.\nSetting this to 1 checks every frame. Higher values look less fluid but could result in better performance.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 60), Array.Empty<object>()));
tumbleweedTimer = cfg.Bind<bool>("Tumbleweed", "Display Timer", true, "Enable a visible timer on tumbleweed.");
tumbleweedType = cfg.Bind<TimerType>("Tumbleweed", "Timer Type", TimerType.Circle, "Set how the timer will be visualized.");
tumbleweedColorPrimary = cfg.Bind<Vector4>("Tumbleweed", "Starting Color Timer", new Vector4(1f, 1f, 1f, 1f), "Set the color of the timer at its beginning.\nx = Red.\ny = Green.\nz = Blue.\nw = Opacity.");
tumbleweedColorSecondary = cfg.Bind<Vector4>("Tumbleweed", "Ending Color Timer", new Vector4(0f, 0f, 0f, 1f), "Set the color of the timer at its end.\nx = Red.\ny = Green.\nz = Blue.\nw = Opacity.");
tumbleweedSize = cfg.Bind<Vector3>("Tumbleweed", "Size of Timer", new Vector3(1f, 1f, 1f), "Set how large the timer will be.");
tumbleweedVertical = cfg.Bind<float>("Tumbleweed", "Height of Timer", 1f, "Set how high above the tumbleweed the timer will be displayed.");
tumbleweedArrow = cfg.Bind<bool>("Tumbleweed", "Arrow below Timer", true, "Show an arrow pointing from the timer to the tumbleweed the timer is on.");
tumbleweedDecimals = cfg.Bind<int>("Tumbleweed", "Decimals of Timer", 0, new ConfigDescription("If [Timer Type] is set to Text, set how many decimals are behind the comma.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 4), Array.Empty<object>()));
tumbleweedMinuteNotation = cfg.Bind<bool>("Tumbleweed", "Timer Minute Notation", true, "If [Timer Type] is set to Text, set whether time will be displayed in Minutes:Seconds or only in seconds.");
tumbleweedBackerOpacity = cfg.Bind<int>("Tumbleweed", "Bar Opacity Timer", 25, new ConfigDescription("If [Timer Type] is set to Bar, set how opaque the background of the visible timer is.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
tumbleweedColorInterval = cfg.Bind<float>("Tumbleweed", "Interval Recolor Timer", 1f, "If [Starting Color Timer] and [Ending Color Timer] are different values, set how often the color should update, in seconds.\nHigher values look less fluid but could result in better performance.");
tumbleweedFrames = cfg.Bind<int>("Tumbleweed", "Check Timer per X Frames", 1, new ConfigDescription("Set per how many frames the timer should read out its in-game values.\nSetting this to 1 checks every frame. Higher values look less fluid but could result in better performance.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 60), Array.Empty<object>()));
sunTimer = cfg.Bind<bool>("Sun", "Display Timer", false, "Enable a visible timer on the sun.");
sunType = cfg.Bind<TimerType>("Sun", "Timer Type", TimerType.Text, "Set how the timer will be visualized.");
sunColorPrimary = cfg.Bind<Vector4>("Sun", "Starting Color Timer", new Vector4(1f, 1f, 0f, 1f), "Set the color of the timer at its beginning.\nx = Red.\ny = Green.\nz = Blue.\nw = Opacity.");
sunColorSecondary = cfg.Bind<Vector4>("Sun", "Ending Color Timer", new Vector4(1f, 0f, 1f, 1f), "Set the color of the timer at its end.\nx = Red.\ny = Green.\nz = Blue.\nw = Opacity.");
sunSize = cfg.Bind<Vector3>("Sun", "Size of Timer", new Vector3(120f, 120f, 120f), "Set how large the timer will be.");
sunVertical = cfg.Bind<float>("Sun", "Height of Timer", 90f, "Set how high above the sun the timer will be displayed.");
sunArrow = cfg.Bind<bool>("Sun", "Arrow below Timer", false, "Show an arrow pointing from the timer to the sun.");
sunDecimals = cfg.Bind<int>("Sun", "Decimals of Timer", 0, new ConfigDescription("If [Timer Type] is set to Text, set how many decimals are behind the comma.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 4), Array.Empty<object>()));
sunMinuteNotation = cfg.Bind<bool>("Sun", "Timer Minute Notation", true, "If [Timer Type] is set to Text, set whether time will be displayed in Minutes:Seconds or only in seconds.");
sunBackerOpacity = cfg.Bind<int>("Sun", "Bar Opacity Timer", 25, new ConfigDescription("If [Timer Type] is set to Bar, set how opaque the background of the visible timer is.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
sunColorInterval = cfg.Bind<float>("Sun", "Interval Recolor Timer", 60f, "If [Starting Color Timer] and [Ending Color Timer] are different values, set how often the color should update, in seconds.\nHigher values look less fluid but could result in better performance.");
sunFrames = cfg.Bind<int>("Sun", "Check Timer per X Frames", 30, new ConfigDescription("Set per how many frames the timer should read out its in-game values.\nSetting this to 1 checks every frame. Higher values look less fluid but could result in better performance.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 60), Array.Empty<object>()));
infinistaminaTimer = cfg.Bind<bool>("Infinite Stamina", "Display Timer", true, "Enable a visible timer on players with the infinite-stamina boost.");
infinistaminaType = cfg.Bind<TimerType>("Infinite Stamina", "Timer Type", TimerType.Bar, "Set how the timer will be visualized.");
infinistaminaColorPrimary = cfg.Bind<Vector4>("Infinite Stamina", "Starting Color Timer", new Vector4(0f, 1f, 1f, 1f), "Set the color of the timer at its beginning.\nx = Red.\ny = Green.\nz = Blue.\nw = Opacity.");
infinistaminaColorSecondary = cfg.Bind<Vector4>("Infinite Stamina", "Ending Color Timer", new Vector4(0f, 1f, 1f, 0f), "Set the color of the timer at its end.\nx = Red.\ny = Green.\nz = Blue.\nw = Opacity.");
infinistaminaSize = cfg.Bind<Vector3>("Infinite Stamina", "Size of Timer", new Vector3(1f, 1f, 1f), "Set how large the timer will be.");
infinistaminaVertical = cfg.Bind<float>("Infinite Stamina", "Height of Timer", 1.75f, "Set how high above the player the timer will be displayed.");
infinistaminaArrow = cfg.Bind<bool>("Infinite Stamina", "Arrow below Timer", false, "Show an arrow pointing from the timer to the player.");
infinistaminaDecimals = cfg.Bind<int>("Infinite Stamina", "Decimals of Timer", 1, new ConfigDescription("If [Timer Type] is set to Text, set how many decimals are behind the comma.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 4), Array.Empty<object>()));
infinistaminaMinuteNotation = cfg.Bind<bool>("Infinite Stamina", "Timer Minute Notation", false, "If [Timer Type] is set to Text, set whether time will be displayed in Minutes:Seconds or only in seconds.");
infinistaminaBackerOpacity = cfg.Bind<int>("Infinite Stamina", "Bar Opacity Timer", 25, new ConfigDescription("If [Timer Type] is set to Bar, set how opaque the background of the visible timer is.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
infinistaminaColorInterval = cfg.Bind<float>("Infinite Stamina", "Interval Recolor Timer", 0.25f, "If [Starting Color Timer] and [Ending Color Timer] are different values, set how often the color should update, in seconds.\nHigher values look less fluid but could result in better performance.");
infinistaminaFrames = cfg.Bind<int>("Infinite Stamina", "Check Timer per X Frames", 1, new ConfigDescription("Set per how many frames the timer should read out its in-game values.\nSetting this to 1 checks every frame. Higher values look less fluid but could result in better performance.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 60), Array.Empty<object>()));
leverTimer = cfg.Bind<bool>("Train Lever", "Display Timer", true, "Enable a visible timer on the train lever while the train's horn disabled it.");
leverType = cfg.Bind<TimerType>("Train Lever", "Timer Type", TimerType.Circle, "Set how the timer will be visualized.");
leverColorPrimary = cfg.Bind<Vector4>("Train Lever", "Starting Color Timer", new Vector4(1f, 0f, 0f, 1f), "Set the color of the timer at its beginning.\nx = Red.\ny = Green.\nz = Blue.\nw = Opacity.");
leverColorSecondary = cfg.Bind<Vector4>("Train Lever", "Ending Color Timer", new Vector4(0f, 1f, 0f, 0.5f), "Set the color of the timer at its end.\nx = Red.\ny = Green.\nz = Blue.\nw = Opacity.");
leverSize = cfg.Bind<Vector3>("Train Lever", "Size of Timer", new Vector3(0.5f, 0.5f, 0.5f), "Set how large the timer will be.");
leverVertical = cfg.Bind<float>("Train Lever", "Height of Timer", -0.33f, "Set how high above the train lever the timer will be displayed.");
leverArrow = cfg.Bind<bool>("Train Lever", "Arrow below Timer", false, "Show an arrow pointing from the timer to the train lever.");
leverDecimals = cfg.Bind<int>("Train Lever", "Decimals of Timer", 2, new ConfigDescription("If [Timer Type] is set to Text, set how many decimals are behind the comma.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 4), Array.Empty<object>()));
leverMinuteNotation = cfg.Bind<bool>("Train Lever", "Timer Minute Notation", false, "If [Timer Type] is set to Text, set whether time will be displayed in Minutes:Seconds or only in seconds.");
leverBackerOpacity = cfg.Bind<int>("Train Lever", "Bar Opacity Timer", 25, new ConfigDescription("If [Timer Type] is set to Bar, set how opaque the background of the visible timer is.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
leverColorInterval = cfg.Bind<float>("Train Lever", "Interval Recolor Timer", 0.33f, "If [Starting Color Timer] and [Ending Color Timer] are different values, set how often the color should update, in seconds.\nHigher values look less fluid but could result in better performance.");
leverFrames = cfg.Bind<int>("Train Lever", "Check Timer per X Frames", 1, new ConfigDescription("Set per how many frames the timer should read out its in-game values.\nSetting this to 1 checks every frame. Higher values look less fluid but could result in better performance.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 60), Array.Empty<object>()));
}
public static void GetLogger(ManualLogSource PluginLogger)
{
Logger = PluginLogger;
}
public static void DisplayConfigs()
{
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_027b: Unknown result type (might be due to invalid IL or missing references)
//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
//IL_041a: Unknown result type (might be due to invalid IL or missing references)
//IL_043d: Unknown result type (might be due to invalid IL or missing references)
//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
//IL_077b: Unknown result type (might be due to invalid IL or missing references)
//IL_079e: Unknown result type (might be due to invalid IL or missing references)
//IL_07c1: Unknown result type (might be due to invalid IL or missing references)
Logger.LogInfo((object)"\n\nCategory: Dynamite");
Logger.LogInfo((object)$"Config [Display Timer] is set to {dynamiteTimer.Value}.");
if (dynamiteTimer.Value)
{
Logger.LogInfo((object)$"Config [Timer Type] is set to {dynamiteType.Value}");
Logger.LogInfo((object)$"Config [Start Color Timer] is set to {dynamiteColorPrimary.Value}");
Logger.LogInfo((object)$"Config [Ending Color Timer] is set to {dynamiteColorSecondary.Value}");
Logger.LogInfo((object)$"Config [Size of Timer] is set to {dynamiteSize.Value}");
Logger.LogInfo((object)$"Config [Height of Timer] is set to {dynamiteVertical.Value}");
Logger.LogInfo((object)$"Config [Arrow below Timer] is set to {dynamiteArrow.Value}");
Logger.LogInfo((object)$"Config [Decimals of Timer] is set to {dynamiteDecimals.Value}");
Logger.LogInfo((object)$"Config [Timer Minute Notation] is set to {dynamiteMinuteNotation.Value}");
Logger.LogInfo((object)$"Config [Bar Opacity Timer] is set to {dynamiteBackerOpacity.Value}");
Logger.LogInfo((object)$"Config [Interval Recolor Timer] is set to {dynamiteColorInterval.Value}");
Logger.LogInfo((object)$"Config [Check Timer per X Frames] is set to {dynamiteFrames.Value}");
}
Logger.LogInfo((object)"\n\nCategory: Tumbleweed");
Logger.LogInfo((object)$"Config [Display Timer] is set to {tumbleweedTimer.Value}.");
if (tumbleweedTimer.Value)
{
Logger.LogInfo((object)$"Config [Timer Type] is set to {tumbleweedType.Value}");
Logger.LogInfo((object)$"Config [Start Color Timer] is set to {tumbleweedColorPrimary.Value}");
Logger.LogInfo((object)$"Config [Ending Color Timer] is set to {tumbleweedColorSecondary.Value}");
Logger.LogInfo((object)$"Config [Size of Timer] is set to {tumbleweedSize.Value}");
Logger.LogInfo((object)$"Config [Height of Timer] is set to {tumbleweedVertical.Value}");
Logger.LogInfo((object)$"Config [Arrow below Timer] is set to {tumbleweedArrow.Value}");
Logger.LogInfo((object)$"Config [Decimals of Timer] is set to {tumbleweedDecimals.Value}");
Logger.LogInfo((object)$"Config [Timer Minute Notation] is set to {tumbleweedMinuteNotation.Value}");
Logger.LogInfo((object)$"Config [Bar Opacity Timer] is set to {tumbleweedBackerOpacity.Value}");
Logger.LogInfo((object)$"Config [Interval Recolor Timer] is set to {tumbleweedColorInterval.Value}");
Logger.LogInfo((object)$"Config [Check Timer per X Frames] is set to {tumbleweedFrames.Value}");
}
Logger.LogInfo((object)"\n\nCategory: Sun");
Logger.LogInfo((object)$"Config [Display Timer] is set to {sunTimer.Value}.");
if (sunTimer.Value)
{
Logger.LogInfo((object)$"Config [Timer Type] is set to {sunType.Value}");
Logger.LogInfo((object)$"Config [Start Color Timer] is set to {sunColorPrimary.Value}");
Logger.LogInfo((object)$"Config [Ending Color Timer] is set to {sunColorSecondary.Value}");
Logger.LogInfo((object)$"Config [Size of Timer] is set to {sunSize.Value}");
Logger.LogInfo((object)$"Config [Height of Timer] is set to {sunVertical.Value}");
Logger.LogInfo((object)$"Config [Arrow below Timer] is set to {sunArrow.Value}");
Logger.LogInfo((object)$"Config [Decimals of Timer] is set to {sunDecimals.Value}");
Logger.LogInfo((object)$"Config [Timer Minute Notation] is set to {sunMinuteNotation.Value}");
Logger.LogInfo((object)$"Config [Bar Opacity Timer] is set to {sunBackerOpacity.Value}");
Logger.LogInfo((object)$"Config [Interval Recolor Timer] is set to {sunColorInterval.Value}");
Logger.LogInfo((object)$"Config [Check Timer per X Frames] is set to {sunFrames.Value}");
}
Logger.LogInfo((object)"\n\nCategory: Infinite Stamina");
Logger.LogInfo((object)$"Config [Display Timer] is set to {infinistaminaTimer.Value}.");
if (infinistaminaTimer.Value)
{
Logger.LogInfo((object)$"Config [Timer Type] is set to {infinistaminaType.Value}");
Logger.LogInfo((object)$"Config [Start Color Timer] is set to {infinistaminaColorPrimary.Value}");
Logger.LogInfo((object)$"Config [Ending Color Timer] is set to {infinistaminaColorSecondary.Value}");
Logger.LogInfo((object)$"Config [Size of Timer] is set to {infinistaminaSize.Value}");
Logger.LogInfo((object)$"Config [Height of Timer] is set to {infinistaminaVertical.Value}");
Logger.LogInfo((object)$"Config [Arrow below Timer] is set to {infinistaminaArrow.Value}");
Logger.LogInfo((object)$"Config [Decimals of Timer] is set to {infinistaminaDecimals.Value}");
Logger.LogInfo((object)$"Config [Timer Minute Notation] is set to {infinistaminaMinuteNotation.Value}");
Logger.LogInfo((object)$"Config [Bar Opacity Timer] is set to {infinistaminaBackerOpacity.Value}");
Logger.LogInfo((object)$"Config [Interval Recolor Timer] is set to {infinistaminaColorInterval.Value}");
Logger.LogInfo((object)$"Config [Check Timer per X Frames] is set to {infinistaminaFrames.Value}");
}
Logger.LogInfo((object)"\n\nCategory: Train Lever");
Logger.LogInfo((object)$"Config [Display Timer] is set to {leverTimer.Value}.");
if (leverTimer.Value)
{
Logger.LogInfo((object)$"Config [Timer Type] is set to {leverType.Value}");
Logger.LogInfo((object)$"Config [Start Color Timer] is set to {leverColorPrimary.Value}");
Logger.LogInfo((object)$"Config [Ending Color Timer] is set to {leverColorSecondary.Value}");
Logger.LogInfo((object)$"Config [Size of Timer] is set to {leverSize.Value}");
Logger.LogInfo((object)$"Config [Height of Timer] is set to {leverVertical.Value}");
Logger.LogInfo((object)$"Config [Arrow below Timer] is set to {leverArrow.Value}");
Logger.LogInfo((object)$"Config [Decimals of Timer] is set to {leverDecimals.Value}");
Logger.LogInfo((object)$"Config [Timer Minute Notation] is set to {leverMinuteNotation.Value}");
Logger.LogInfo((object)$"Config [Bar Opacity Timer] is set to {leverBackerOpacity.Value}");
Logger.LogInfo((object)$"Config [Interval Recolor Timer] is set to {leverColorInterval.Value}");
Logger.LogInfo((object)$"Config [Check Timer per X Frames] is set to {leverFrames.Value}");
}
Logger.LogInfo((object)"\n\n");
}
}
public class VTHarmonyPatches
{
[HarmonyPatch(typeof(HudManager))]
public class HudManagerPatch
{
[HarmonyPostfix]
[HarmonyPatch("Awake")]
public static void AwakePostfix(HudManager __instance)
{
VTAssetsCollection.GetAssetsHudManager(__instance);
}
[HarmonyPostfix]
[HarmonyPatch("ShowSunHasSetWarningToPardner")]
public static void ShowSunHasSetWarningToPardnerPostfix()
{
Logger.LogDebug((object)"sunset warning");
if (!VTConfigs.sunTimer.Value || !Object.op_Implicit((Object)(object)TimersManager.Singleton))
{
return;
}
SunTimer sunTimer = null;
foreach (VisibleTimerBase allTimer in TimersManager.Singleton.allTimers)
{
if (Object.op_Implicit((Object)(object)allTimer) && allTimer is SunTimer)
{
sunTimer = allTimer as SunTimer;
break;
}
}
if ((Object)(object)sunTimer != (Object)null)
{
sunTimer.SetVisibility(visible: false);
}
}
}
[HarmonyPatch(typeof(LootManager))]
public class LootManagerPatch
{
[HarmonyPostfix]
[HarmonyPatch("Awake")]
public static void AwakePostfix(LootManager __instance)
{
if (VTConfigs.dynamiteTimer.Value)
{
Logger.LogDebug((object)"adding timer to dynamite");
((Component)__instance.dynamitePrefab.GetComponentInChildren<Dynamite_DummyHandler>()).gameObject.AddComponent<VTComponentContainer>().script = (MonoBehaviour)(object)__instance.dynamitePrefab.GetComponent<Dynamite>();
}
}
}
[HarmonyPatch(typeof(ObjectiveHandler))]
public class ObjectiveHandlerPatch
{
[HarmonyPostfix]
[HarmonyPatch("Awake")]
public static void AwakePostfix(ObjectiveHandler __instance)
{
if (VTConfigs.tumbleweedTimer.Value)
{
Logger.LogDebug((object)"adding timer to tumbleweed");
((Component)__instance.tumbleweed_Prefab.GetComponentInChildren<Tumbleweed_DummyHandler>()).gameObject.AddComponent<VTComponentContainer>().script = (MonoBehaviour)(object)__instance.tumbleweed_Prefab.GetComponent<Tumbleweed>();
((Component)__instance.winterTumbleweed_Prefab.GetComponentInChildren<Tumbleweed_DummyHandler>()).gameObject.AddComponent<VTComponentContainer>().script = (MonoBehaviour)(object)__instance.winterTumbleweed_Prefab.GetComponent<Tumbleweed>();
}
}
}
[HarmonyPatch(typeof(Dynamite))]
public class DynamitePatch
{
[HarmonyPostfix]
[HarmonyPatch("ShowFuseParticles")]
public static void ShowFuseParticlesPostfix(Dynamite __instance)
{
Logger.LogDebug((object)"light DYNAMITE on MAIN");
if (!VTConfigs.dynamiteTimer.Value || !Object.op_Implicit((Object)(object)TimersManager.Singleton))
{
return;
}
Dynamite_DummyHandler componentInChildren = ((Component)__instance).GetComponentInChildren<Dynamite_DummyHandler>();
if ((Object)(object)componentInChildren == (Object)null)
{
Logger.LogError((object)$"failed to find dummy on #{((NetworkBehaviour)__instance).NetworkObjectId}");
return;
}
DynamiteTimer dynamiteTimer = null;
foreach (VisibleTimerBase allTimer in TimersManager.Singleton.allTimers)
{
if (Object.op_Implicit((Object)(object)allTimer) && (Object)(object)allTimer.followObject == (Object)(object)((Component)componentInChildren).gameObject && allTimer is DynamiteTimer)
{
dynamiteTimer = allTimer as DynamiteTimer;
break;
}
}
if ((Object)(object)dynamiteTimer != (Object)null)
{
dynamiteTimer.StartTimer(useMaxTime: true);
}
}
}
[HarmonyPatch(typeof(Dynamite_DummyHandler))]
public class Dynamite_DummyHandlerPatch
{
[HarmonyPostfix]
[HarmonyPatch("Start")]
public static void StartPostfix(Dynamite_DummyHandler __instance)
{
if (VTConfigs.dynamiteTimer.Value)
{
Object.Instantiate<GameObject>(VTAssetsCollection.dynamiteVisibleTimer, ((Component)__instance).transform);
}
}
[HarmonyPostfix]
[HarmonyPatch("LightDummyFuse")]
public static void LightDummyFusePostfix(Dynamite_DummyHandler __instance)
{
Logger.LogDebug((object)"light DYNAMITE on DUMMY (Ingnition)");
if (!VTConfigs.dynamiteTimer.Value || !Object.op_Implicit((Object)(object)TimersManager.Singleton))
{
return;
}
DynamiteTimer dynamiteTimer = null;
foreach (VisibleTimerBase allTimer in TimersManager.Singleton.allTimers)
{
if (Object.op_Implicit((Object)(object)allTimer) && (Object)(object)allTimer.followObject == (Object)(object)((Component)__instance).gameObject && allTimer is DynamiteTimer)
{
dynamiteTimer = allTimer as DynamiteTimer;
break;
}
}
if ((Object)(object)dynamiteTimer != (Object)null)
{
dynamiteTimer.StartTimer(useMaxTime: true);
}
}
[HarmonyPostfix]
[HarmonyPatch("OnPickUpValidated")]
public static void OnPickUpValidatedPostfix(Dynamite_DummyHandler __instance)
{
Logger.LogDebug((object)"light DYNAMITE on DUMMY (PickUp)");
if (!VTConfigs.dynamiteTimer.Value || !Object.op_Implicit((Object)(object)TimersManager.Singleton))
{
return;
}
DynamiteTimer dynamiteTimer = null;
foreach (VisibleTimerBase allTimer in TimersManager.Singleton.allTimers)
{
if (Object.op_Implicit((Object)(object)allTimer) && (Object)(object)allTimer.followObject == (Object)(object)((Component)__instance).gameObject && allTimer is DynamiteTimer)
{
dynamiteTimer = allTimer as DynamiteTimer;
break;
}
}
if ((Object)(object)dynamiteTimer != (Object)null)
{
dynamiteTimer.StartTimer(useMaxTime: false, fromPickUp: true);
}
}
}
[HarmonyPatch(typeof(Tumbleweed))]
public class TumbleweedPatch
{
[HarmonyPostfix]
[HarmonyPatch("ShowFireParticles")]
public static void ShowFireParticlesPostfix(Tumbleweed __instance)
{
Logger.LogDebug((object)"light TUMBLEWEED on MAIN");
if (!VTConfigs.tumbleweedTimer.Value || !Object.op_Implicit((Object)(object)TimersManager.Singleton))
{
return;
}
Tumbleweed_DummyHandler componentInChildren = ((Component)__instance).GetComponentInChildren<Tumbleweed_DummyHandler>();
if ((Object)(object)componentInChildren == (Object)null)
{
Logger.LogError((object)$"failed to find dummy on #{((NetworkBehaviour)__instance).NetworkObjectId}");
return;
}
TumbleweedTimer tumbleweedTimer = null;
foreach (VisibleTimerBase allTimer in TimersManager.Singleton.allTimers)
{
if (Object.op_Implicit((Object)(object)allTimer) && (Object)(object)allTimer.followObject == (Object)(object)((Component)componentInChildren).gameObject && allTimer is TumbleweedTimer)
{
tumbleweedTimer = allTimer as TumbleweedTimer;
break;
}
}
if ((Object)(object)tumbleweedTimer != (Object)null)
{
tumbleweedTimer.StartTimer(useMaxTime: true);
}
}
}
[HarmonyPatch(typeof(Tumbleweed_DummyHandler))]
public class Tumbleweed_DummyHandlerPatch
{
[HarmonyPostfix]
[HarmonyPatch("Start")]
public static void StartPostfix(Tumbleweed_DummyHandler __instance)
{
if (VTConfigs.tumbleweedTimer.Value)
{
Object.Instantiate<GameObject>(VTAssetsCollection.tumbleweedVisibleTimer, ((Component)__instance).transform);
}
}
[HarmonyPostfix]
[HarmonyPatch("LightDummyFuse")]
public static void LightDummyFusePostfix(Tumbleweed_DummyHandler __instance)
{
Logger.LogDebug((object)"light TUMBLEWEED on DUMMY (Ignition)");
if (!VTConfigs.tumbleweedTimer.Value || !Object.op_Implicit((Object)(object)TimersManager.Singleton))
{
return;
}
TumbleweedTimer tumbleweedTimer = null;
foreach (VisibleTimerBase allTimer in TimersManager.Singleton.allTimers)
{
if (Object.op_Implicit((Object)(object)allTimer) && (Object)(object)allTimer.followObject == (Object)(object)((Component)__instance).gameObject && allTimer is TumbleweedTimer)
{
tumbleweedTimer = allTimer as TumbleweedTimer;
break;
}
}
if ((Object)(object)tumbleweedTimer != (Object)null)
{
tumbleweedTimer.StartTimer(useMaxTime: true);
}
}
[HarmonyPostfix]
[HarmonyPatch("OnPickUpValidated")]
public static void OnPickUpValidatedPostfix(Tumbleweed_DummyHandler __instance)
{
Logger.LogDebug((object)"light TUMBLEWEED on DUMMY (PickUp)");
if (!VTConfigs.tumbleweedTimer.Value || !Object.op_Implicit((Object)(object)TimersManager.Singleton))
{
return;
}
TumbleweedTimer tumbleweedTimer = null;
foreach (VisibleTimerBase allTimer in TimersManager.Singleton.allTimers)
{
if (Object.op_Implicit((Object)(object)allTimer) && (Object)(object)allTimer.followObject == (Object)(object)((Component)__instance).gameObject && allTimer is TumbleweedTimer)
{
tumbleweedTimer = allTimer as TumbleweedTimer;
break;
}
}
if ((Object)(object)tumbleweedTimer != (Object)null)
{
tumbleweedTimer.StartTimer(useMaxTime: false, fromPickUp: true);
}
}
}
[HarmonyPatch(typeof(TimeOfDayManager))]
public class TimeOfDayManagerPatch
{
[HarmonyPostfix]
[HarmonyPatch("Awake")]
public static void AwakePostfix(TimeOfDayManager __instance)
{
if (VTConfigs.sunTimer.Value)
{
Logger.LogDebug((object)"adding timer to sun");
Object.Instantiate<GameObject>(VTAssetsCollection.sunVisibleTimer, __instance.GetPrivateField<GameObject>("sunObject").transform);
}
}
[HarmonyPostfix]
[HarmonyPatch("SetSundownTimerFromMatchSettings")]
public static void SetSundownTimerFromMatchSettingsPostfix()
{
if (!VTConfigs.sunTimer.Value || !Object.op_Implicit((Object)(object)TimersManager.Singleton))
{
return;
}
SunTimer sunTimer = null;
foreach (VisibleTimerBase allTimer in TimersManager.Singleton.allTimers)
{
if (Object.op_Implicit((Object)(object)allTimer) && allTimer is SunTimer)
{
sunTimer = allTimer as SunTimer;
break;
}
}
if ((Object)(object)sunTimer != (Object)null)
{
sunTimer.SetNewMaxTimer();
}
}
}
[HarmonyPatch(typeof(StatusEffectsHandler))]
public class StatusEffectsHandlerPatch
{
[HarmonyPostfix]
[HarmonyPatch("Awake")]
public static void AwakePostfix(StatusEffectsHandler __instance)
{
if (VTConfigs.infinistaminaTimer.Value)
{
Logger.LogDebug((object)"adding timer to status effect handler");
Object.Instantiate<GameObject>(VTAssetsCollection.staminaVisibleTimer, ((Component)__instance).transform);
}
}
[HarmonyPostfix]
[HarmonyPatch("AddParticleEffect_Local")]
public static void AddParticleEffect_LocalPostfix(StatusEffectsHandler __instance, int _particleEnum)
{
if (!VTConfigs.infinistaminaTimer.Value || _particleEnum != 3 || !Object.op_Implicit((Object)(object)TimersManager.Singleton))
{
return;
}
InfinistaminaTimer infinistaminaTimer = null;
foreach (VisibleTimerBase allTimer in TimersManager.Singleton.allTimers)
{
if (Object.op_Implicit((Object)(object)allTimer) && (Object)(object)allTimer.followObject == (Object)(object)((Component)__instance).gameObject && allTimer is InfinistaminaTimer)
{
infinistaminaTimer = allTimer as InfinistaminaTimer;
break;
}
}
if ((Object)(object)infinistaminaTimer != (Object)null)
{
infinistaminaTimer.StartTimer();
}
}
[HarmonyPostfix]
[HarmonyPatch("RemoveParticleEffect_Local")]
public static void RemoveParticleEffect_LocalPostfix(StatusEffectsHandler __instance, int _particleEnum)
{
if (!VTConfigs.infinistaminaTimer.Value || _particleEnum != 3 || !Object.op_Implicit((Object)(object)TimersManager.Singleton))
{
return;
}
InfinistaminaTimer infinistaminaTimer = null;
foreach (VisibleTimerBase allTimer in TimersManager.Singleton.allTimers)
{
if (Object.op_Implicit((Object)(object)allTimer) && (Object)(object)allTimer.followObject == (Object)(object)((Component)__instance).gameObject && allTimer is InfinistaminaTimer)
{
infinistaminaTimer = allTimer as InfinistaminaTimer;
break;
}
}
if ((Object)(object)infinistaminaTimer != (Object)null)
{
infinistaminaTimer.SetVisibility(visible: false);
}
}
}
[HarmonyPatch(typeof(StatusEffect))]
public class StatusEffectPatch
{
[HarmonyPostfix]
[HarmonyPatch("RefreshDuration")]
public static void RefreshDurationPostfix(StatusEffect __instance)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Invalid comparison between Unknown and I4
if (!VTConfigs.infinistaminaTimer.Value || (int)__instance.particleType != 3 || !Object.op_Implicit((Object)(object)__instance.statusEffectsHandlerScript) || !Object.op_Implicit((Object)(object)TimersManager.Singleton))
{
return;
}
InfinistaminaTimer infinistaminaTimer = null;
foreach (VisibleTimerBase allTimer in TimersManager.Singleton.allTimers)
{
if (Object.op_Implicit((Object)(object)allTimer) && (Object)(object)allTimer.followObject == (Object)(object)((Component)__instance.statusEffectsHandlerScript.GetPrivateField<Player>("ourPlayer")).gameObject && allTimer is InfinistaminaTimer)
{
infinistaminaTimer = allTimer as InfinistaminaTimer;
break;
}
}
if ((Object)(object)infinistaminaTimer != (Object)null)
{
infinistaminaTimer.StartTimer();
}
}
}
[HarmonyPatch(typeof(GameManager))]
public class GameManagerPatch
{
[HarmonyPostfix]
[HarmonyPatch("Awake")]
public static void AwakePostfix(GameManager __instance)
{
Logger.LogDebug((object)("!!adding TimersManager to " + ((Object)((Component)__instance).gameObject).name));
((Component)__instance).gameObject.AddComponent<TimersManager>();
if (VTConfigs.leverTimer.Value)
{
Logger.LogDebug((object)"adding timer to train lever");
Object.Instantiate<GameObject>(VTAssetsCollection.leverVisibleTimer, __instance.GetPrivateField<GameObject>("trainLeverImage_CannotUse").transform);
}
}
}
[HarmonyPatch(typeof(TrainHornManager))]
public class TrainHornManagerPatch
{
[HarmonyPostfix]
[HarmonyPatch("ActivateTrainHorn_Locally")]
public static void ActivateTrainHorn_LocallyPostfix()
{
if (!VTConfigs.leverTimer.Value || !Object.op_Implicit((Object)(object)TimersManager.Singleton))
{
return;
}
Logger.LogDebug((object)"trying to start TrainLever VisibleTimer");
GameObject privateField = GameManager.Singleton.GetPrivateField<GameObject>("trainLeverImage_CannotUse");
LeverTimer leverTimer = null;
foreach (VisibleTimerBase allTimer in TimersManager.Singleton.allTimers)
{
if (Object.op_Implicit((Object)(object)allTimer) && (Object)(object)allTimer.followObject == (Object)(object)privateField && allTimer is LeverTimer)
{
leverTimer = allTimer as LeverTimer;
break;
}
}
if ((Object)(object)leverTimer != (Object)null)
{
leverTimer.StartTimer();
}
}
}
private static ManualLogSource Logger;
public static void GetLogger(ManualLogSource PluginLogger)
{
Logger = PluginLogger;
}
}
[BepInPlugin("local.SimonTendo.LTOWVisibleTimersMod", "LTOWVisibleTimersMod", "1.1.0")]
public class VTPlugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
public static VTConfigs MyConfig { get; internal set; }
private void Awake()
{
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin LTOWVisibleTimersMod is loaded!");
AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "visibletimersbundle"));
if ((Object)(object)val == (Object)null)
{
Logger.LogError((object)"Failed to load AssetBundle");
return;
}
Logger.LogDebug((object)"Successfully loaded AssetBundle");
VTAssetsCollection.GetAssetsAssetBundle(val);
new Harmony("LTOWVisibleTimersMod").PatchAll();
MyConfig = new VTConfigs(((BaseUnityPlugin)this).Config);
SendLoggers();
VTConfigs.DisplayConfigs();
}
private static void SendLoggers()
{
VTConfigs.GetLogger(Logger);
VTHarmonyPatches.GetLogger(Logger);
VisibleTimerBase.GetLogger(Logger);
TimerHUDComponents.GetLogger(Logger);
TimersManager.GetLogger(Logger);
}
}
public static class VTPrivateAccesser
{
public static T GetPrivateField<T>(this object obj, string name)
{
BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic;
return (T)obj.GetType().GetField(name, bindingAttr).GetValue(obj);
}
public static FieldInfo SetPrivateValue<T>(this object obj, string name)
{
BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic;
return obj.GetType().GetField(name, bindingAttr);
}
}
[CompilerGenerated]
[EditorBrowsable(EditorBrowsableState.Never)]
[GeneratedCode("Unity.MonoScriptGenerator.MonoScriptInfoGenerator", null)]
internal class UnitySourceGeneratedAssemblyMonoScriptTypes_v1
{
private struct MonoScriptData
{
public byte[] FilePathsData;
public byte[] TypesData;
public int TotalTypes;
public int TotalFiles;
public bool IsEditorOnly;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static MonoScriptData Get()
{
MonoScriptData result = default(MonoScriptData);
result.FilePathsData = new byte[1080]
{
0, 0, 0, 1, 0, 0, 0, 73, 92, 65,
115, 115, 101, 116, 115, 92, 76, 84, 79, 87,
86, 105, 115, 105, 98, 108, 101, 84, 105, 109,
101, 114, 115, 77, 111, 100, 92, 83, 99, 114,
105, 112, 116, 115, 92, 68, 97, 116, 97, 67,
111, 110, 116, 97, 105, 110, 101, 114, 115, 92,
84, 105, 109, 101, 114, 72, 85, 68, 67, 111,
109, 112, 111, 110, 101, 110, 116, 115, 46, 99,
115, 0, 0, 0, 1, 0, 0, 0, 68, 92,
65, 115, 115, 101, 116, 115, 92, 76, 84, 79,
87, 86, 105, 115, 105, 98, 108, 101, 84, 105,
109, 101, 114, 115, 77, 111, 100, 92, 83, 99,
114, 105, 112, 116, 115, 92, 68, 97, 116, 97,
67, 111, 110, 116, 97, 105, 110, 101, 114, 115,
92, 84, 105, 109, 101, 114, 115, 77, 97, 110,
97, 103, 101, 114, 46, 99, 115, 0, 0, 0,
1, 0, 0, 0, 73, 92, 65, 115, 115, 101,
116, 115, 92, 76, 84, 79, 87, 86, 105, 115,
105, 98, 108, 101, 84, 105, 109, 101, 114, 115,
77, 111, 100, 92, 83, 99, 114, 105, 112, 116,
115, 92, 68, 97, 116, 97, 67, 111, 110, 116,
97, 105, 110, 101, 114, 115, 92, 86, 84, 65,
115, 115, 101, 116, 115, 67, 111, 108, 108, 101,
99, 116, 105, 111, 110, 46, 99, 115, 0, 0,
0, 1, 0, 0, 0, 75, 92, 65, 115, 115,
101, 116, 115, 92, 76, 84, 79, 87, 86, 105,
115, 105, 98, 108, 101, 84, 105, 109, 101, 114,
115, 77, 111, 100, 92, 83, 99, 114, 105, 112,
116, 115, 92, 68, 97, 116, 97, 67, 111, 110,
116, 97, 105, 110, 101, 114, 115, 92, 86, 84,
67, 111, 109, 112, 111, 110, 101, 110, 116, 67,
111, 110, 116, 97, 105, 110, 101, 114, 46, 99,
115, 0, 0, 0, 1, 0, 0, 0, 63, 92,
65, 115, 115, 101, 116, 115, 92, 76, 84, 79,
87, 86, 105, 115, 105, 98, 108, 101, 84, 105,
109, 101, 114, 115, 77, 111, 100, 92, 83, 99,
114, 105, 112, 116, 115, 92, 86, 105, 115, 105,
98, 108, 101, 84, 105, 109, 101, 114, 92, 66,
97, 115, 105, 99, 84, 105, 109, 101, 114, 46,
99, 115, 0, 0, 0, 1, 0, 0, 0, 66,
92, 65, 115, 115, 101, 116, 115, 92, 76, 84,
79, 87, 86, 105, 115, 105, 98, 108, 101, 84,
105, 109, 101, 114, 115, 77, 111, 100, 92, 83,
99, 114, 105, 112, 116, 115, 92, 86, 105, 115,
105, 98, 108, 101, 84, 105, 109, 101, 114, 92,
68, 121, 110, 97, 109, 105, 116, 101, 84, 105,
109, 101, 114, 46, 99, 115, 0, 0, 0, 1,
0, 0, 0, 71, 92, 65, 115, 115, 101, 116,
115, 92, 76, 84, 79, 87, 86, 105, 115, 105,
98, 108, 101, 84, 105, 109, 101, 114, 115, 77,
111, 100, 92, 83, 99, 114, 105, 112, 116, 115,
92, 86, 105, 115, 105, 98, 108, 101, 84, 105,
109, 101, 114, 92, 73, 110, 102, 105, 110, 105,
115, 116, 97, 109, 105, 110, 97, 84, 105, 109,
101, 114, 46, 99, 115, 0, 0, 0, 1, 0,
0, 0, 63, 92, 65, 115, 115, 101, 116, 115,
92, 76, 84, 79, 87, 86, 105, 115, 105, 98,
108, 101, 84, 105, 109, 101, 114, 115, 77, 111,
100, 92, 83, 99, 114, 105, 112, 116, 115, 92,
86, 105, 115, 105, 98, 108, 101, 84, 105, 109,
101, 114, 92, 76, 101, 118, 101, 114, 84, 105,
109, 101, 114, 46, 99, 115, 0, 0, 0, 1,
0, 0, 0, 61, 92, 65, 115, 115, 101, 116,
115, 92, 76, 84, 79, 87, 86, 105, 115, 105,
98, 108, 101, 84, 105, 109, 101, 114, 115, 77,
111, 100, 92, 83, 99, 114, 105, 112, 116, 115,
92, 86, 105, 115, 105, 98, 108, 101, 84, 105,
109, 101, 114, 92, 83, 117, 110, 84, 105, 109,
101, 114, 46, 99, 115, 0, 0, 0, 1, 0,
0, 0, 68, 92, 65, 115, 115, 101, 116, 115,
92, 76, 84, 79, 87, 86, 105, 115, 105, 98,
108, 101, 84, 105, 109, 101, 114, 115, 77, 111,
100, 92, 83, 99, 114, 105, 112, 116, 115, 92,
86, 105, 115, 105, 98, 108, 101, 84, 105, 109,
101, 114, 92, 84, 117, 109, 98, 108, 101, 119,
101, 101, 100, 84, 105, 109, 101, 114, 46, 99,
115, 0, 0, 0, 1, 0, 0, 0, 69, 92,
65, 115, 115, 101, 116, 115, 92, 76, 84, 79,
87, 86, 105, 115, 105, 98, 108, 101, 84, 105,
109, 101, 114, 115, 77, 111, 100, 92, 83, 99,
114, 105, 112, 116, 115, 92, 86, 105, 115, 105,
98, 108, 101, 84, 105, 109, 101, 114, 92, 86,
105, 115, 105, 98, 108, 101, 84, 105, 109, 101,
114, 66, 97, 115, 101, 46, 99, 115, 0, 0,
0, 1, 0, 0, 0, 49, 92, 65, 115, 115,
101, 116, 115, 92, 76, 84, 79, 87, 86, 105,
115, 105, 98, 108, 101, 84, 105, 109, 101, 114,
115, 77, 111, 100, 92, 83, 99, 114, 105, 112,
116, 115, 92, 86, 84, 67, 111, 110, 102, 105,
103, 115, 46, 99, 115, 0, 0, 0, 13, 0,
0, 0, 56, 92, 65, 115, 115, 101, 116, 115,
92, 76, 84, 79, 87, 86, 105, 115, 105, 98,
108, 101, 84, 105, 109, 101, 114, 115, 77, 111,
100, 92, 83, 99, 114, 105, 112, 116, 115, 92,
86, 84, 72, 97, 114, 109, 111, 110, 121, 80,
97, 116, 99, 104, 101, 115, 46, 99, 115, 0,
0, 0, 1, 0, 0, 0, 48, 92, 65, 115,
115, 101, 116, 115, 92, 76, 84, 79, 87, 86,
105, 115, 105, 98, 108, 101, 84, 105, 109, 101,
114, 115, 77, 111, 100, 92, 83, 99, 114, 105,
112, 116, 115, 92, 86, 84, 80, 108, 117, 103,
105, 110, 46, 99, 115, 0, 0, 0, 1, 0,
0, 0, 57, 92, 65, 115, 115, 101, 116, 115,
92, 76, 84, 79, 87, 86, 105, 115, 105, 98,
108, 101, 84, 105, 109, 101, 114, 115, 77, 111,
100, 92, 83, 99, 114, 105, 112, 116, 115, 92,
86, 84, 80, 114, 105, 118, 97, 116, 101, 65,
99, 99, 101, 115, 115, 101, 114, 46, 99, 115
};
result.TypesData = new byte[797]
{
0, 0, 0, 0, 19, 124, 84, 105, 109, 101,
114, 72, 85, 68, 67, 111, 109, 112, 111, 110,
101, 110, 116, 115, 0, 0, 0, 0, 14, 124,
84, 105, 109, 101, 114, 115, 77, 97, 110, 97,
103, 101, 114, 0, 0, 0, 0, 19, 124, 86,
84, 65, 115, 115, 101, 116, 115, 67, 111, 108,
108, 101, 99, 116, 105, 111, 110, 0, 0, 0,
0, 21, 124, 86, 84, 67, 111, 109, 112, 111,
110, 101, 110, 116, 67, 111, 110, 116, 97, 105,
110, 101, 114, 0, 0, 0, 0, 11, 124, 66,
97, 115, 105, 99, 84, 105, 109, 101, 114, 0,
0, 0, 0, 14, 124, 68, 121, 110, 97, 109,
105, 116, 101, 84, 105, 109, 101, 114, 0, 0,
0, 0, 19, 124, 73, 110, 102, 105, 110, 105,
115, 116, 97, 109, 105, 110, 97, 84, 105, 109,
101, 114, 0, 0, 0, 0, 11, 124, 76, 101,
118, 101, 114, 84, 105, 109, 101, 114, 0, 0,
0, 0, 9, 124, 83, 117, 110, 84, 105, 109,
101, 114, 0, 0, 0, 0, 16, 124, 84, 117,
109, 98, 108, 101, 119, 101, 101, 100, 84, 105,
109, 101, 114, 0, 0, 0, 0, 17, 124, 86,
105, 115, 105, 98, 108, 101, 84, 105, 109, 101,
114, 66, 97, 115, 101, 0, 0, 0, 0, 10,
124, 86, 84, 67, 111, 110, 102, 105, 103, 115,
0, 0, 0, 0, 17, 124, 86, 84, 72, 97,
114, 109, 111, 110, 121, 80, 97, 116, 99, 104,
101, 115, 0, 0, 0, 0, 32, 86, 84, 72,
97, 114, 109, 111, 110, 121, 80, 97, 116, 99,
104, 101, 115, 124, 72, 117, 100, 77, 97, 110,
97, 103, 101, 114, 80, 97, 116, 99, 104, 0,
0, 0, 0, 33, 86, 84, 72, 97, 114, 109,
111, 110, 121, 80, 97, 116, 99, 104, 101, 115,
124, 76, 111, 111, 116, 77, 97, 110, 97, 103,
101, 114, 80, 97, 116, 99, 104, 0, 0, 0,
0, 38, 86, 84, 72, 97, 114, 109, 111, 110,
121, 80, 97, 116, 99, 104, 101, 115, 124, 79,
98, 106, 101, 99, 116, 105, 118, 101, 72, 97,
110, 100, 108, 101, 114, 80, 97, 116, 99, 104,
0, 0, 0, 0, 30, 86, 84, 72, 97, 114,
109, 111, 110, 121, 80, 97, 116, 99, 104, 101,
115, 124, 68, 121, 110, 97, 109, 105, 116, 101,
80, 97, 116, 99, 104, 0, 0, 0, 0, 43,
86, 84, 72, 97, 114, 109, 111, 110, 121, 80,
97, 116, 99, 104, 101, 115, 124, 68, 121, 110,
97, 109, 105, 116, 101, 95, 68, 117, 109, 109,
121, 72, 97, 110, 100, 108, 101, 114, 80, 97,
116, 99, 104, 0, 0, 0, 0, 32, 86, 84,
72, 97, 114, 109, 111, 110, 121, 80, 97, 116,
99, 104, 101, 115, 124, 84, 117, 109, 98, 108,
101, 119, 101, 101, 100, 80, 97, 116, 99, 104,
0, 0, 0, 0, 45, 86, 84, 72, 97, 114,
109, 111, 110, 121, 80, 97, 116, 99, 104, 101,
115, 124, 84, 117, 109, 98, 108, 101, 119, 101,
101, 100, 95, 68, 117, 109, 109, 121, 72, 97,
110, 100, 108, 101, 114, 80, 97, 116, 99, 104,
0, 0, 0, 0, 38, 86, 84, 72, 97, 114,
109, 111, 110, 121, 80, 97, 116, 99, 104, 101,
115, 124, 84, 105, 109, 101, 79, 102, 68, 97,
121, 77, 97, 110, 97, 103, 101, 114, 80, 97,
116, 99, 104, 0, 0, 0, 0, 42, 86, 84,
72, 97, 114, 109, 111, 110, 121, 80, 97, 116,
99, 104, 101, 115, 124, 83, 116, 97, 116, 117,
115, 69, 102, 102, 101, 99, 116, 115, 72, 97,
110, 100, 108, 101, 114, 80, 97, 116, 99, 104,
0, 0, 0, 0, 34, 86, 84, 72, 97, 114,
109, 111, 110, 121, 80, 97, 116, 99, 104, 101,
115, 124, 83, 116, 97, 116, 117, 115, 69, 102,
102, 101, 99, 116, 80, 97, 116, 99, 104, 0,
0, 0, 0, 33, 86, 84, 72, 97, 114, 109,
111, 110, 121, 80, 97, 116, 99, 104, 101, 115,
124, 71, 97, 109, 101, 77, 97, 110, 97, 103,
101, 114, 80, 97, 116, 99, 104, 0, 0, 0,
0, 38, 86, 84, 72, 97, 114, 109, 111, 110,
121, 80, 97, 116, 99, 104, 101, 115, 124, 84,
114, 97, 105, 110, 72, 111, 114, 110, 77, 97,
110, 97, 103, 101, 114, 80, 97, 116, 99, 104,
0, 0, 0, 0, 9, 124, 86, 84, 80, 108,
117, 103, 105, 110, 0, 0, 0, 0, 18, 124,
86, 84, 80, 114, 105, 118, 97, 116, 101, 65,
99, 99, 101, 115, 115, 101, 114
};
result.TotalFiles = 15;
result.TotalTypes = 27;
result.IsEditorOnly = false;
return result;
}
}