using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Gameplay.Scripting;
using ProjectM.UI;
using StunShared.UI;
using Stunlock.Core;
using Stunlock.Localization;
using TMPro;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : System.Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(/*Could not decode attribute arguments.*/)]
internal sealed class RefSafetyRulesAttribute : System.Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace VBloodTracker
{
[BepInPlugin("com.zeeCameLsnake.VBloodTracker", "V Blood Tracker", "1.0.16")]
public class VBloodTrackerPlugin : BasePlugin
{
public const string PluginGUID = "com.zeeCameLsnake.VBloodTracker";
public const string PluginName = "V Blood Tracker";
public const string PluginVersion = "1.0.16";
internal static ManualLogSource Log;
private Harmony _harmony;
public static ConfigEntry<bool> ConfigEnabled;
public static ConfigEntry<bool> ConfigShowDirection;
public static ConfigEntry<bool> ConfigShowDistanceName;
public static ConfigEntry<bool> ConfigShowDistanceMeters;
public static ConfigEntry<float> ConfigUpdateInterval;
public static ConfigEntry<string> ConfigTrailInterval;
private static readonly string[] FallbackDirections = new string[8] { "East", "Northeast", "North", "Northwest", "West", "Southwest", "South", "Southeast" };
private static readonly AssetGuid[] DirectionGuids = (AssetGuid[])(object)new AssetGuid[8]
{
AssetGuid.FromString("19b982f5-8a72-4e75-8e6b-c26c6a61ae96"),
AssetGuid.FromString("aeec7bf8-2061-4990-9dc5-0a6d68115bf2"),
AssetGuid.FromString("8f8f1e30-e859-49ea-9e4f-bbaad904a975"),
AssetGuid.FromString("12d0059b-1635-4d4b-922b-590c283a16ec"),
AssetGuid.FromString("339a1213-32df-4813-bd45-295d2a9a4630"),
AssetGuid.FromString("51a06466-3ae3-44d4-b7a4-ba291d676826"),
AssetGuid.FromString("32f1c213-3d23-4aa5-a9eb-641024d01ea4"),
AssetGuid.FromString("5d4db6b9-1c0d-4d4b-a51d-d512923a88c6")
};
private static readonly AssetGuid DistanceTemplateGuid = AssetGuid.FromString("dcf341fd-c000-4d4f-9335-ec1e1a2b760a");
private const float ConfigCheckInterval = 1f;
private static ConfigFile _config;
private static System.DateTime _configWriteTime;
private static float _lastConfigCheckTime = 0f;
private static float _lastComputeTime = 0f;
private static AchievementsParent _cachedParent = null;
private static Entity _localCharacter = Entity.Null;
internal static string DisplayText = null;
internal static System.IntPtr ActiveTextPtr = System.IntPtr.Zero;
private static bool _isApplying = false;
public override void Load()
{
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Expected O, but got Unknown
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Expected O, but got Unknown
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Expected O, but got Unknown
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Expected O, but got Unknown
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Expected O, but got Unknown
Log = ((BasePlugin)this).Log;
_config = ((BasePlugin)this).Config;
ConfigEnabled = ((BasePlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable or disable V Blood Tracker.");
ConfigShowDirection = ((BasePlugin)this).Config.Bind<bool>("General", "ShowDirection", true, "Show cardinal direction towards the tracked V Blood on the HUD (e.g. 'Northeast').");
ConfigShowDistanceName = ((BasePlugin)this).Config.Bind<bool>("General", "ShowDistanceName", true, "Show distance description category (e.g. 'Very Far Away').");
ConfigShowDistanceMeters = ((BasePlugin)this).Config.Bind<bool>("General", "ShowDistanceMeters", true, "Show exact distance in meters (e.g. '(1250m)').");
ConfigUpdateInterval = ((BasePlugin)this).Config.Bind<float>("General", "UpdateInterval", 0.1f, "How often (in seconds) distance and direction are recalculated.");
ConfigTrailInterval = ((BasePlugin)this).Config.Bind<string>("Blood Trail", "TrailInterval", "Vanilla", new ConfigDescription("How often the floating blood trail towards the tracked V Blood appears. 'Vanilla' = game default, 'Off' = no trail, '1'-'10' = seconds between trails, 'Permanent' = a new trail every 0.5 seconds. Changes in this file apply while the game is running.", (AcceptableValueBase)(object)new AcceptableValueList<string>(BloodTrailController.GetOptions()), System.Array.Empty<object>()));
try
{
_configWriteTime = File.GetLastWriteTimeUtc(((BasePlugin)this).Config.ConfigFilePath);
}
catch
{
}
bool flag = default(bool);
try
{
ClassInjector.RegisterTypeInIl2Cpp<VBloodTrackerBehaviour>();
((BasePlugin)this).AddComponent<VBloodTrackerBehaviour>();
}
catch (System.Exception ex)
{
ManualLogSource log = Log;
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(43, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to register VBloodTrackerBehaviour: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<System.Exception>(ex);
}
log.LogError(val);
}
try
{
_harmony = new Harmony("com.zeeCameLsnake.VBloodTracker");
_harmony.PatchAll();
}
catch (System.Exception ex2)
{
ManualLogSource log2 = Log;
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(23, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Harmony patch warning: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex2.Message);
}
log2.LogWarning(val2);
}
ManualLogSource log3 = Log;
BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(23, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("V Blood Tracker");
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" v");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("1.0.16");
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" loaded successfully.");
}
log3.LogInfo(val3);
}
public override bool Unload()
{
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
return true;
}
public static World GetClientWorld()
{
try
{
List<World> s_AllWorlds = World.s_AllWorlds;
if (s_AllWorlds != null)
{
for (int i = 0; i < s_AllWorlds.Count; i++)
{
World val = s_AllWorlds[i];
if (val != null && val.Name.StartsWith("Client"))
{
return val;
}
}
}
}
catch
{
}
return null;
}
public static string GetLocalizedDirection(CardinalDirection direction)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Expected I4, but got Unknown
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
int num = (int)direction;
if (num >= 0 && num < DirectionGuids.Length)
{
try
{
string text = Localization.Get(DirectionGuids[num], false);
if (!string.IsNullOrEmpty(text))
{
return text;
}
}
catch
{
}
return FallbackDirections[num];
}
return "Unknown";
}
internal static bool IsTrackingDistanceEntry(AchievementEntry entry)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Invalid comparison between Unknown and I4
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Invalid comparison between Unknown and I4
if ((Object)(object)entry == (Object)null || (Object)(object)entry.Text_Distance == (Object)null)
{
return false;
}
try
{
AchievementEntryType entryType = entry.Achievement.EntryType;
return (int)entryType == 2 || (int)entryType == 3;
}
catch
{
return false;
}
}
internal static void ApplyText(LocalizedText textComp)
{
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Expected O, but got Unknown
if (_isApplying || (Object)(object)textComp == (Object)null || DisplayText == null)
{
return;
}
TextMeshProUGUI val = textComp.Text;
if ((Object)(object)val == (Object)null)
{
val = ((Component)textComp).GetComponent<TextMeshProUGUI>();
}
if ((Object)(object)val != (Object)null && ((TMP_Text)val).text == DisplayText)
{
return;
}
_isApplying = true;
try
{
textComp.ForceSet(DisplayText);
if ((Object)(object)val != (Object)null && ((TMP_Text)val).text != DisplayText)
{
((TMP_Text)val).text = DisplayText;
}
}
catch (System.Exception ex)
{
ManualLogSource log = Log;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(18, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("ApplyText failed: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
}
log.LogWarning(val2);
}
finally
{
_isApplying = false;
}
}
private static void CheckConfigReload()
{
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Expected O, but got Unknown
if (Time.time - _lastConfigCheckTime < 1f)
{
return;
}
_lastConfigCheckTime = Time.time;
try
{
System.DateTime lastWriteTimeUtc = File.GetLastWriteTimeUtc(_config.ConfigFilePath);
if (!(lastWriteTimeUtc == _configWriteTime))
{
_config.Reload();
_configWriteTime = File.GetLastWriteTimeUtc(_config.ConfigFilePath);
Log.LogInfo((object)"Config file changed, settings reloaded.");
}
}
catch (System.Exception ex)
{
ManualLogSource log = Log;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(22, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Config reload failed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
log.LogWarning(val);
}
}
internal static void OnFrameUpdate()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Expected O, but got Unknown
CheckConfigReload();
World clientWorld = GetClientWorld();
bool flag = default(bool);
if (clientWorld != null)
{
try
{
BloodTrailController.Update(clientWorld);
}
catch (System.Exception ex)
{
ManualLogSource log = Log;
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(27, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Blood trail update failed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
log.LogWarning(val);
}
}
if (!ConfigEnabled.Value)
{
DisplayText = null;
ActiveTextPtr = System.IntPtr.Zero;
return;
}
if ((Object)(object)_cachedParent == (Object)null)
{
_cachedParent = Object.FindObjectOfType<AchievementsParent>();
if ((Object)(object)_cachedParent == (Object)null)
{
return;
}
}
if (Time.time - _lastComputeTime >= ConfigUpdateInterval.Value)
{
_lastComputeTime = Time.time;
try
{
ComputeDisplayText();
}
catch (System.Exception ex2)
{
DisplayText = null;
ManualLogSource log2 = Log;
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(16, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Compute failed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex2.Message);
}
log2.LogWarning(val);
}
}
EnforceText();
}
private static void EnforceText()
{
ActiveTextPtr = System.IntPtr.Zero;
if (DisplayText == null)
{
return;
}
List<AchievementEntry> achievementEntries = _cachedParent.AchievementEntries;
if (achievementEntries == null)
{
return;
}
for (int i = 0; i < achievementEntries.Count; i++)
{
AchievementEntry val = achievementEntries[i];
if (IsTrackingDistanceEntry(val) && ((Component)val.Text_Distance).gameObject.activeInHierarchy)
{
ActiveTextPtr = ((Il2CppObjectBase)val.Text_Distance).Pointer;
ApplyText(val.Text_Distance);
}
}
}
private static bool TryGetPlayerPosition(World clientWorld, out float2 position)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: 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_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: 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)
position = float2.zero;
EntityManager entityManager = clientWorld.EntityManager;
if ((_localCharacter == Entity.Null || !((EntityManager)(ref entityManager)).Exists(_localCharacter)) && !ConsoleShared.TryGetLocalCharacterInCurrentWorld(ref _localCharacter, clientWorld))
{
return false;
}
if (!((EntityManager)(ref entityManager)).HasComponent<LocalToWorld>(_localCharacter))
{
return false;
}
LocalToWorld componentData = ((EntityManager)(ref entityManager)).GetComponentData<LocalToWorld>(_localCharacter);
float3 position2 = ((LocalToWorld)(ref componentData)).Position;
position = new float2(position2.x, position2.z);
return true;
}
private static void ComputeDisplayText()
{
//IL_0039: 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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: 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_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: 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_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
World clientWorld = GetClientWorld();
if (clientWorld == null || !TryGetPlayerPosition(clientWorld, out var position))
{
DisplayText = null;
return;
}
AchievementState state = _cachedParent._State;
if (state == null || state.TrackVBloodSource == PrefabGUID.Empty)
{
DisplayText = null;
return;
}
PrefabGUID trackVBloodSource = state.TrackVBloodSource;
int distance;
CardinalDirection direction;
if (TryGetLiveTargetPosition(state, out var position2) || TryGetServerTargetPosition(clientWorld, trackVBloodSource, out position2))
{
distance = (int)math.round(math.distance(position, position2));
direction = UIHelper.GetDirection(position, position2);
}
else if (!TryGetMenuValues(clientWorld, trackVBloodSource, out distance, out direction))
{
DisplayText = null;
return;
}
DisplayText = FormatText(distance, direction);
}
private static bool TryGetLiveTargetPosition(AchievementState state, out float2 position)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: 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)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
float3 trackVBloodPosition = state.TrackVBloodPosition;
position = new float2(trackVBloodPosition.x, trackVBloodPosition.z);
return !((float3)(ref trackVBloodPosition)).Equals(float3.zero);
}
private static bool TryGetServerTargetPosition(World clientWorld, PrefabGUID trackedGuid, out float2 position)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: 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_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
position = float2.zero;
GetVBloodsPositionResponseSystem val = null;
try
{
val = clientWorld.GetExistingSystemManaged<GetVBloodsPositionResponseSystem>();
}
catch
{
}
if (val == null || val._Positions == null)
{
return false;
}
List<VBloodPosition> positions = val._Positions;
for (int i = 0; i < positions.Count; i++)
{
VBloodPosition val2 = positions[i];
if (val2.UnitPrefabGuid == trackedGuid)
{
position = val2.Position;
return true;
}
}
return false;
}
private static bool TryGetMenuValues(World clientWorld, PrefabGUID trackedGuid, out int distance, out CardinalDirection direction)
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: 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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Expected I4, but got Unknown
distance = 0;
direction = (CardinalDirection)0;
VBloodTrackingMenuMapperSystem val = null;
try
{
val = clientWorld.GetExistingSystemManaged<VBloodTrackingMenuMapperSystem>();
}
catch
{
}
if (val == null || val._VBloods == null)
{
return false;
}
List<VBloodTrackingEntry> vBloods = val._VBloods;
for (int i = 0; i < vBloods.Count; i++)
{
VBloodTrackingEntry val2 = vBloods[i];
if (val2.PrefabGuid == trackedGuid)
{
distance = val2.Distance;
direction = (CardinalDirection)(int)val2.Direction;
return true;
}
}
return false;
}
private static string FormatText(int distance, CardinalDirection direction)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
string text = (ConfigShowDirection.Value ? GetLocalizedDirection(direction) : null);
string text2 = null;
if (ConfigShowDistanceName.Value && (Object)(object)_cachedParent.DistanceSettings != (Object)null)
{
try
{
LocalizationKey distanceNameKey = _cachedParent.DistanceSettings.GetDistanceNameKey(distance);
text2 = Localization.Get(distanceNameKey, false);
}
catch
{
}
}
string text3 = ((!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text2)) ? (text + ", " + text2) : (string.IsNullOrEmpty(text) ? (text2 ?? string.Empty) : text));
if (ConfigShowDistanceMeters.Value && distance > 0)
{
text3 = (string.IsNullOrEmpty(text3) ? $"{distance}m" : $"{text3} ({distance}m)");
}
try
{
string text4 = Localization.Get(DistanceTemplateGuid, false);
if (!string.IsNullOrEmpty(text4) && text4.Contains("{distance}"))
{
return text4.Replace("{distance}", text3);
}
}
catch
{
}
return text3;
}
}
internal static class BloodTrailController
{
public const string Vanilla = "Vanilla";
public const string Off = "Off";
public const string Permanent = "Permanent";
private const float CheckInterval = 0.5f;
private const float OffInterval = 1000000f;
private const float PermanentInterval = 0.5f;
private static float _lastCheckTime = 0f;
private static System.IntPtr _queryWorldPtr = System.IntPtr.Zero;
private static EntityQuery _query;
private static readonly HashSet<long> _seenEntities = new HashSet<long>();
private static float _vanillaInterval = -1f;
public static string[] GetOptions()
{
List<string> obj = new List<string>();
obj.Add("Vanilla");
obj.Add("Off");
List<string> val = obj;
for (int i = 1; i <= 10; i++)
{
val.Add(i.ToString());
}
val.Add("Permanent");
return val.ToArray();
}
public static void Update(World clientWorld)
{
//IL_0027: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: 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)
if (Time.time - _lastCheckTime < 0.5f)
{
return;
}
_lastCheckTime = Time.time;
EntityManager entityManager = clientWorld.EntityManager;
if (_queryWorldPtr != ((Il2CppObjectBase)clientWorld).Pointer)
{
_query = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadWrite<Script_BloodAltar_TrackVBloodUnit_Client>() });
_queryWorldPtr = ((Il2CppObjectBase)clientWorld).Pointer;
_seenEntities.Clear();
}
NativeArray<Entity> val = ((EntityQuery)(ref _query)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
try
{
for (int i = 0; i < val.Length; i++)
{
ProcessEntity(entityManager, val[i]);
}
}
finally
{
val.Dispose();
}
}
private static void ProcessEntity(EntityManager em, Entity entity)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: 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)
//IL_000a: 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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
Script_BloodAltar_TrackVBloodUnit_Client componentData = ((EntityManager)(ref em)).GetComponentData<Script_BloodAltar_TrackVBloodUnit_Client>(entity);
long num = ((long)entity.Index << 32) | (uint)entity.Version;
if (_seenEntities.Add(num))
{
_vanillaInterval = componentData.TimeBetweenTracks;
}
float targetInterval = GetTargetInterval();
if (!(targetInterval < 0f) && !(math.abs(componentData.TimeBetweenTracks - targetInterval) < 0.001f))
{
componentData.TimeBetweenTracks = targetInterval;
((EntityManager)(ref em)).SetComponentData<Script_BloodAltar_TrackVBloodUnit_Client>(entity, componentData);
}
}
private static float GetTargetInterval()
{
if (!VBloodTrackerPlugin.ConfigEnabled.Value)
{
return _vanillaInterval;
}
string value = VBloodTrackerPlugin.ConfigTrailInterval.Value;
string text = value;
string text2 = text;
if (!(text2 == "Vanilla"))
{
if (!(text2 == "Off"))
{
if (text2 == "Permanent")
{
return 0.5f;
}
int num = default(int);
return (int.TryParse(value, ref num) && num > 0) ? ((float)num) : (-1f);
}
return 1000000f;
}
return _vanillaInterval;
}
}
[HarmonyPatch(typeof(AchievementsParent), "TryFillEntry")]
public static class AchievementsParentTryFillEntryPatch
{
public static void Postfix(AchievementEntry __0)
{
if (VBloodTrackerPlugin.DisplayText != null && VBloodTrackerPlugin.IsTrackingDistanceEntry(__0))
{
VBloodTrackerPlugin.ApplyText(__0.Text_Distance);
}
}
}
[HarmonyPatch(typeof(LocalizedText), "UpdateText")]
public static class LocalizedTextUpdateTextPatch
{
public static void Postfix(LocalizedText __instance)
{
if (!(VBloodTrackerPlugin.ActiveTextPtr == System.IntPtr.Zero) && VBloodTrackerPlugin.DisplayText != null && !((Object)(object)__instance == (Object)null) && !(((Il2CppObjectBase)__instance).Pointer != VBloodTrackerPlugin.ActiveTextPtr))
{
VBloodTrackerPlugin.ApplyText(__instance);
}
}
}
public class VBloodTrackerBehaviour : MonoBehaviour
{
public VBloodTrackerBehaviour(System.IntPtr ptr)
: base(ptr)
{
}
public VBloodTrackerBehaviour()
: base(ClassInjector.DerivedConstructorPointer<VBloodTrackerBehaviour>())
{
ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this);
}
private void LateUpdate()
{
VBloodTrackerPlugin.OnFrameUpdate();
}
}
}