using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using Mirror;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.SceneManagement;
using UnityEngine.UIElements;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("StonewardsDailyQuestTracker")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d01f069679fe7de43d228c8f206a0f77a3339685")]
[assembly: AssemblyProduct("StonewardsDailyQuestTracker")]
[assembly: AssemblyTitle("StonewardsDailyQuestTracker")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace StonewardsDailyQuestTracker
{
internal sealed class CurrencyHudAnchor
{
private const float RetrySeconds = 8f;
private const int MaxAttemptsPerScene = 2;
private const int MaxVisitedElements = 3500;
private readonly ManualLogSource _log;
private TextElement _currencyLabel;
private VisualElement _badge;
private float _nextProbe;
private int _lastWidth;
private int _lastHeight;
private bool _loggedFailure;
private int _attemptCount;
public CurrencyHudAnchor(ManualLogSource log)
{
_log = log;
}
public void Reset()
{
_currencyLabel = null;
_badge = null;
_nextProbe = 0f;
_lastWidth = 0;
_lastHeight = 0;
_loggedFailure = false;
_attemptCount = 0;
}
public void RefreshIfNeeded()
{
if (Screen.width != _lastWidth || Screen.height != _lastHeight)
{
_lastWidth = Screen.width;
_lastHeight = Screen.height;
if (_currencyLabel == null || ((VisualElement)_currencyLabel).panel == null)
{
_nextProbe = 0f;
}
}
if (_currencyLabel == null || ((VisualElement)_currencyLabel).panel == null)
{
_currencyLabel = null;
_badge = null;
if (_attemptCount < 2 && !(Time.unscaledTime < _nextProbe))
{
_nextProbe = Time.unscaledTime + 8f;
_attemptCount++;
Discover();
}
}
}
public bool TryGetPanelRoot(out VisualElement root)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
root = null;
if (_currencyLabel == null || ((VisualElement)_currencyLabel).panel == null)
{
return false;
}
root = ((VisualElement)_currencyLabel).panel.visualTree;
if (root != null && root.panel != null)
{
Rect worldBound = root.worldBound;
if (((Rect)(ref worldBound)).width > 1f)
{
worldBound = root.worldBound;
return ((Rect)(ref worldBound)).height > 1f;
}
}
return false;
}
public bool TryGetBadgeBounds(out Rect bounds)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
bounds = default(Rect);
if (_currencyLabel == null || ((VisualElement)_currencyLabel).panel == null)
{
return false;
}
try
{
if (!IsVisible((VisualElement)(object)_currencyLabel))
{
return false;
}
return TryScreenBounds((VisualElement)((_badge != null && _badge.panel == ((VisualElement)_currencyLabel).panel) ? ((object)_badge) : ((object)_currencyLabel)), out bounds) && ((Rect)(ref bounds)).width > 1f && ((Rect)(ref bounds)).height > 1f;
}
catch (Exception)
{
_currencyLabel = null;
_badge = null;
return false;
}
}
private void Discover()
{
//IL_0041: 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)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
try
{
UIDocument[] array = Resources.FindObjectsOfTypeAll<UIDocument>();
int num = 3500;
float num2 = float.NegativeInfinity;
TextElement val = null;
VisualElement val2 = null;
UIDocument[] array2 = array;
foreach (UIDocument val3 in array2)
{
if (num <= 0)
{
break;
}
if ((Object)(object)val3 == (Object)null)
{
continue;
}
Scene scene = ((Component)val3).gameObject.scene;
if (!((Scene)(ref scene)).IsValid() || !((Component)val3).gameObject.activeInHierarchy)
{
continue;
}
VisualElement rootVisualElement = val3.rootVisualElement;
if (rootVisualElement == null || rootVisualElement.panel == null)
{
continue;
}
Stack<VisualElement> stack = new Stack<VisualElement>();
stack.Push(rootVisualElement);
while (stack.Count != 0 && num-- > 0)
{
VisualElement val4 = stack.Pop();
TextElement val5 = (TextElement)(object)((val4 is TextElement) ? val4 : null);
if (val5 != null && HasCurrencyNumber(val5.text) && IsVisible((VisualElement)(object)val5) && TryScreenBounds((VisualElement)(object)val5, out var rect) && ((Rect)(ref rect)).xMin > (float)Screen.width * 0.63f && ((Rect)(ref rect)).yMin >= 0f && ((Rect)(ref rect)).yMax < (float)Screen.height * 0.23f)
{
float num3 = ((Rect)(ref rect)).xMax / (float)Screen.width * 2f - ((Rect)(ref rect)).yMin / (float)Screen.height;
if (CurrencyKeywordNearby((VisualElement)(object)val5))
{
num3 += 4f;
}
if (val5.text.Trim().Length >= 4)
{
num3 += 0.2f;
}
if (num3 > num2)
{
num2 = num3;
val = val5;
val2 = FindCompactBadge((VisualElement)(object)val5, rect);
}
}
for (int num4 = val4.childCount - 1; num4 >= 0; num4--)
{
stack.Push(val4.ElementAt(num4));
}
}
}
if (val != null)
{
_currencyLabel = val;
_badge = (VisualElement)(((object)val2) ?? ((object)val));
_loggedFailure = false;
_log.LogInfo((object)"Currency HUD label located. Daily quest panel will follow the badge's live screen position.");
}
else if (!_loggedFailure)
{
_loggedFailure = true;
_log.LogWarning((object)"Currency HUD label not located. Using manual top-right offsets until the native currency UI can be identified.");
}
}
catch (Exception ex)
{
if (!_loggedFailure)
{
_loggedFailure = true;
_log.LogWarning((object)("Currency HUD anchor discovery failed: " + ex.Message));
}
}
}
private static bool HasCurrencyNumber(string text)
{
if (string.IsNullOrWhiteSpace(text))
{
return false;
}
int num = 0;
foreach (char c in text)
{
if (c >= '0' && c <= '9')
{
num++;
}
else if (!char.IsWhiteSpace(c) && c != ',' && c != '.' && c != '\u00a0')
{
return false;
}
}
if (num >= 2)
{
return num <= 9;
}
return false;
}
private static bool CurrencyKeywordNearby(VisualElement element)
{
int num = 0;
VisualElement val = element;
while (val != null && num++ < 4)
{
if (HasCurrencyKeyword(val.name))
{
return true;
}
foreach (string @class in val.GetClasses())
{
if (HasCurrencyKeyword(@class))
{
return true;
}
}
val = val.parent;
}
return false;
}
private static bool HasCurrencyKeyword(string value)
{
if (string.IsNullOrEmpty(value))
{
return false;
}
string text = value.ToLowerInvariant();
if (!text.Contains("currency") && !text.Contains("money") && !text.Contains("coin") && !text.Contains("gold"))
{
return text.Contains("metacurrency");
}
return true;
}
private static VisualElement FindCompactBadge(VisualElement label, Rect textBounds)
{
VisualElement result = label;
int num = 0;
VisualElement parent = label.parent;
Rect rect;
while (parent != null && num++ < 5 && TryScreenBounds(parent, out rect) && !(((Rect)(ref rect)).width > 390f) && !(((Rect)(ref rect)).height > 110f) && !(((Rect)(ref rect)).width < ((Rect)(ref textBounds)).width) && !(((Rect)(ref rect)).height < ((Rect)(ref textBounds)).height))
{
result = parent;
parent = parent.parent;
}
return result;
}
private static bool IsVisible(VisualElement element)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Invalid comparison between Unknown and I4
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Invalid comparison between Unknown and I4
for (VisualElement val = element; val != null; val = val.parent)
{
if ((int)val.resolvedStyle.display == 1 || (int)val.resolvedStyle.visibility == 1 || val.resolvedStyle.opacity <= 0.01f)
{
return false;
}
}
return element.panel != null;
}
private static bool TryScreenBounds(VisualElement element, out Rect rect)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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_002b: 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_00be: Unknown result type (might be due to invalid IL or missing references)
rect = default(Rect);
if (element == null || element.panel == null)
{
return false;
}
Rect worldBound = element.panel.visualTree.worldBound;
Rect worldBound2 = element.worldBound;
if (((Rect)(ref worldBound)).width <= 0f || ((Rect)(ref worldBound)).height <= 0f || ((Rect)(ref worldBound2)).width <= 0f || ((Rect)(ref worldBound2)).height <= 0f)
{
return false;
}
float num = (float)Screen.width / ((Rect)(ref worldBound)).width;
float num2 = (float)Screen.height / ((Rect)(ref worldBound)).height;
rect = new Rect((((Rect)(ref worldBound2)).xMin - ((Rect)(ref worldBound)).xMin) * num, (((Rect)(ref worldBound2)).yMin - ((Rect)(ref worldBound)).yMin) * num2, ((Rect)(ref worldBound2)).width * num, ((Rect)(ref worldBound2)).height * num2);
if (((Rect)(ref rect)).xMin >= -1f && ((Rect)(ref rect)).yMin >= -1f && ((Rect)(ref rect)).xMax <= (float)Screen.width + 1f)
{
return ((Rect)(ref rect)).yMax <= (float)Screen.height + 1f;
}
return false;
}
}
internal sealed class DailyQuestReader
{
private const BindingFlags Flags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
private static readonly Assembly GameAssembly = typeof(FirstPersonController).Assembly;
private static readonly Type ManagerType = GameAssembly.GetType("QuestManager");
private static readonly Type MissionType = GameAssembly.GetType("RuntimeMission");
private static readonly Type QuestType = GameAssembly.GetType("QuestSO");
private static readonly FieldInfo ManagerInstance = ManagerType?.GetField("Instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
private static readonly PropertyInfo SelectedDaily = ManagerType?.GetProperty("CurrentDailyQuests", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
private static readonly FieldInfo RuntimeMissions = ManagerType?.GetField("runtimeMissions", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
private static readonly FieldInfo DailyQuestCount = ManagerType?.GetField("DAILY_QUESTS_COUNT", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
private static readonly MethodInfo IsQuestCompleted = ((ManagerType != null && QuestType != null) ? ManagerType.GetMethod("IsQuestCompleted", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { QuestType }, null) : null);
private static readonly FieldInfo MissionQuest = MissionType?.GetField("QuestSO", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
private static readonly FieldInfo MissionTypeField = MissionType?.GetField("missionType", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
private static readonly FieldInfo MissionCurrent = MissionType?.GetField("currentValue", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
private static readonly FieldInfo MissionTarget = MissionType?.GetField("target", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
private static readonly FieldInfo MissionReached = MissionType?.GetField("targetAlreadyReached", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
private static readonly PropertyInfo MissionDescription = MissionType?.GetProperty("Description", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
private static readonly PropertyInfo MissionTitle = MissionType?.GetProperty("Title", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
private static readonly FieldInfo QuestId = QuestType?.GetField("ID", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
private readonly ManualLogSource _log;
private bool _reported;
private readonly List<QuestView> _empty = new List<QuestView>(0);
public int TotalDailyQuests { get; private set; }
public bool HasSeenDailyQuests { get; private set; }
public DailyQuestReader(ManualLogSource log)
{
_log = log;
if (ManagerInstance == null || SelectedDaily == null || RuntimeMissions == null || MissionQuest == null || MissionTypeField == null || MissionCurrent == null || MissionTarget == null)
{
_log.LogError((object)"Stonewards daily quest API fields missing. Please capture F9 diagnostics for the installed game version.");
}
else
{
_log.LogInfo((object)"Daily quest API bound: QuestManager.CurrentDailyQuests + runtimeMissions (currentValue / target / missionType).");
}
}
public void ResetSession()
{
_reported = false;
TotalDailyQuests = 0;
HasSeenDailyQuests = false;
}
public List<QuestView> ReadDailyQuests()
{
if (ManagerInstance == null || SelectedDaily == null || RuntimeMissions == null || MissionQuest == null || MissionTypeField == null || MissionCurrent == null || MissionTarget == null)
{
return _empty;
}
object obj = Get(ManagerInstance, null);
if (obj == null)
{
return _empty;
}
IList list = Get(SelectedDaily, obj) as IList;
IList list2 = Get(RuntimeMissions, obj) as IList;
if (list == null || list2 == null)
{
WarnOnce("Daily quest selection or runtime missions are not initialized yet.");
return _empty;
}
if (Get(DailyQuestCount, null) is int num && num > 0 && num <= 64)
{
TotalDailyQuests = Math.Max(num, list.Count);
}
else
{
TotalDailyQuests = Math.Max(TotalDailyQuests, list.Count);
}
List<QuestView> list3 = new List<QuestView>(list.Count);
bool flag = default(bool);
for (int i = 0; i < list.Count; i++)
{
object obj2 = list[i];
if (obj2 == null)
{
continue;
}
string text = Get(QuestId, obj2) as string;
object obj3 = null;
foreach (object item in list2)
{
if (item == null)
{
continue;
}
object obj4 = Get(MissionTypeField, item);
if (obj4 != null && string.Equals(obj4.ToString(), "DAILY", StringComparison.OrdinalIgnoreCase))
{
object obj5 = Get(MissionQuest, item);
if (obj5 == obj2)
{
obj3 = item;
break;
}
if (obj5 != null && !string.IsNullOrEmpty(text) && string.Equals(Get(QuestId, obj5) as string, text, StringComparison.Ordinal))
{
obj3 = item;
break;
}
}
}
if (obj3 == null)
{
continue;
}
object obj6 = Get(MissionCurrent, obj3);
object obj7 = Get(MissionTarget, obj3);
if (obj6 is float num2 && obj7 is float num3 && !float.IsNaN(num2) && !float.IsNaN(num3) && !(num3 <= 0f))
{
object obj8 = Get(MissionReached, obj3);
int num4;
if (obj8 is bool)
{
flag = (bool)obj8;
num4 = 1;
}
else
{
num4 = 0;
}
bool flag2 = (byte)((uint)num4 & (flag ? 1u : 0u)) != 0;
bool flag3 = false;
if (QuestType != null && QuestType.IsInstanceOfType(obj2) && IsQuestCompleted != null)
{
flag3 = GetCompleted(obj, obj2);
}
bool completed = flag3 || flag2 || num2 >= num3;
string text2 = Get(MissionDescription, obj3) as string;
if (string.IsNullOrWhiteSpace(text2))
{
text2 = Get(MissionTitle, obj3) as string;
}
if (string.IsNullOrWhiteSpace(text2))
{
text2 = text ?? "Daily quest";
}
list3.Add(new QuestView
{
Id = (text ?? text2),
Title = text2,
Progress = Mathf.Max(0, Mathf.RoundToInt(num2)),
Target = Mathf.Max(1, Mathf.RoundToInt(num3)),
Completed = completed
});
}
}
if (list3.Count > 0)
{
HasSeenDailyQuests = true;
_reported = false;
}
else if (!HasSeenDailyQuests)
{
WarnOnce("No selected daily quests matched live DAILY runtime missions. Try opening Missions / Daily and press F9 if this persists.");
}
return list3;
}
private bool GetCompleted(object manager, object quest)
{
try
{
object obj = IsQuestCompleted.Invoke(manager, new object[1] { quest });
bool flag = default(bool);
int num;
if (obj is bool)
{
flag = (bool)obj;
num = 1;
}
else
{
num = 0;
}
return (byte)((uint)num & (flag ? 1u : 0u)) != 0;
}
catch (Exception)
{
return false;
}
}
private void WarnOnce(string message)
{
if (!_reported)
{
_reported = true;
_log.LogWarning((object)message);
}
}
private static object Get(FieldInfo field, object instance)
{
if (field == null)
{
return null;
}
try
{
return field.GetValue(instance);
}
catch (Exception)
{
return null;
}
}
private static object Get(PropertyInfo property, object instance)
{
if (property == null)
{
return null;
}
try
{
return property.GetValue(instance, null);
}
catch (Exception)
{
return null;
}
}
}
[BepInPlugin("community.stonewards.dailyquesttracker", "Stonewards Daily Quest Tracker", "0.1.2")]
public sealed class DailyQuestTrackerPlugin : BaseUnityPlugin
{
public const string Guid = "community.stonewards.dailyquesttracker";
public const string Name = "Stonewards Daily Quest Tracker";
public const string Version = "0.1.2";
private ConfigEntry<bool> _enabled;
private ConfigEntry<CompletedQuestMode> _completedQuestMode;
private ConfigEntry<bool> _showMissingDataNotice;
private ConfigEntry<PanelCorner> _corner;
private ConfigEntry<int> _xOffset;
private ConfigEntry<int> _yOffset;
private ConfigEntry<float> _scale;
private ConfigEntry<float> _readabilityScale;
private ConfigEntry<bool> _autoScaleToResolution;
private ConfigEntry<bool> _anchorToCurrencyHud;
private ConfigEntry<bool> _renderBehindGameUi;
private ConfigEntry<int> _currencyGap;
private ConfigEntry<float> _refresh;
private ConfigEntry<Key> _toggleKey;
private ConfigEntry<Key> _diagnosticKey;
private DailyQuestReader _reader;
private QuestHud _hud;
private CurrencyHudAnchor _currencyAnchor;
private NativeHudLayer _nativeHudLayer;
private List<QuestView> _quests = new List<QuestView>();
private float _nextUpdate;
private float _nextError;
private bool _visible = true;
private bool _wasConnected;
private float _lastDiagnosticTime = -100f;
private float _statusUntil;
private string _diagnosticStatus = "";
private static readonly FieldInfo InventoryRoot = typeof(InventoryScreen).GetField("inventoryScreen", BindingFlags.Instance | BindingFlags.NonPublic);
private static readonly FieldInfo LoadingInstance = typeof(LoadingScreen).GetField("Instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
private static readonly FieldInfo LoadingElement = typeof(LoadingScreen).GetField("_loadingScreenElement", BindingFlags.Instance | BindingFlags.NonPublic);
private void Awake()
{
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Expected O, but got Unknown
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Expected O, but got Unknown
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Expected O, but got Unknown
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Expected O, but got Unknown
_enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable Daily Quest Tracker.");
_completedQuestMode = ((BaseUnityPlugin)this).Config.Bind<CompletedQuestMode>("General", "CompletedQuestMode", CompletedQuestMode.Hide, "Hide completed daily quests (Hide), or keep them at the bottom with a green checkmark (Mark). The old HideCompleted setting is ignored.");
_showMissingDataNotice = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowMissingQuestData", true, "Show a compact warning if the game has not initialized active daily quests.");
_corner = ((BaseUnityPlugin)this).Config.Bind<PanelCorner>("Appearance", "Anchor", PanelCorner.TopRight, "Panel screen corner.");
_xOffset = ((BaseUnityPlugin)this).Config.Bind<int>("Appearance", "HorizontalOffset", 18, "Horizontal edge inset in actual pixels.");
_yOffset = ((BaseUnityPlugin)this).Config.Bind<int>("Appearance", "VerticalOffset", 240, "Vertical edge inset in actual pixels. Top-right default avoids the gold and Bell Control panels.");
_scale = ((BaseUnityPlugin)this).Config.Bind<float>("Appearance", "Scale", 1f, new ConfigDescription("Manual HUD size multiplier (0.65 - 1.8).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.65f, 1.8f), Array.Empty<object>()));
_readabilityScale = ((BaseUnityPlugin)this).Config.Bind<float>("Appearance", "ReadabilityScale", 1.12f, new ConfigDescription("Extra HUD enlargement, like PartyHUD (1.0 - 1.4).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 1.4f), Array.Empty<object>()));
_autoScaleToResolution = ((BaseUnityPlugin)this).Config.Bind<bool>("Appearance", "AutoScaleToResolution", true, "Maintain the same HUD-to-screen proportions using 1920x1080 as a reference. Disable for a fixed physical-pixel panel size.");
_anchorToCurrencyHud = ((BaseUnityPlugin)this).Config.Bind<bool>("Appearance", "AnchorToCurrencyHud", true, "When Anchor is TopRight, place the panel below the live coin HUD position. Falls back to manual offsets if the native currency badge is not found.");
_currencyGap = ((BaseUnityPlugin)this).Config.Bind<int>("Appearance", "CurrencyGap", 10, new ConfigDescription("Gap below the coin HUD in physical screen pixels.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 50), Array.Empty<object>()));
_renderBehindGameUi = ((BaseUnityPlugin)this).Config.Bind<bool>("Appearance", "RenderBehindGameUI", true, "Draw the quest HUD inside the game's native UI Toolkit panel, beneath notifications. Set false to restore the original OnGUI rendering if needed.");
_refresh = ((BaseUnityPlugin)this).Config.Bind<float>("General", "RefreshSeconds", 1.25f, new ConfigDescription("How often to read actual quest progress (unscaled seconds).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.3f, 5f), Array.Empty<object>()));
_toggleKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Hotkeys", "TogglePanel", (Key)99, "Toggle quest panel.");
_diagnosticKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Hotkeys", "DumpQuestDiagnostics", (Key)102, "Write quest-system field names to BepInEx/config/StonewardsDailyQuestTracker-diagnostic.txt.");
_reader = new DailyQuestReader(((BaseUnityPlugin)this).Logger);
_hud = new QuestHud();
_currencyAnchor = new CurrencyHudAnchor(((BaseUnityPlugin)this).Logger);
_nativeHudLayer = new NativeHudLayer(((BaseUnityPlugin)this).Logger);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Daily Quest Tracker v0.1.2 loaded. Active missions: QuestManager runtime state. F6: panel, F9: diagnostic.");
}
private void OnEnable()
{
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnDisable()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
if (_nativeHudLayer != null)
{
_nativeHudLayer.Detach();
}
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (_reader != null)
{
_reader.ResetSession();
}
if (_currencyAnchor != null)
{
_currencyAnchor.Reset();
}
if (_nativeHudLayer != null)
{
_nativeHudLayer.Detach();
}
_quests.Clear();
_nextUpdate = 0f;
}
private void TryExportDiagnostics(string trigger)
{
if (!(Time.unscaledTime - _lastDiagnosticTime < 0.35f))
{
_lastDiagnosticTime = Time.unscaledTime;
try
{
string text = QuestDiagnostics.Export(trigger);
_diagnosticStatus = "QUEST DIAGNOSTICS SAVED - BepInEx/config";
((BaseUnityPlugin)this).Logger.LogInfo((object)("Quest diagnostics written to: " + text));
}
catch (Exception ex)
{
_diagnosticStatus = "QUEST DIAGNOSTICS FAILED - CHECK LOG";
((BaseUnityPlugin)this).Logger.LogError((object)("Quest diagnostic export failed: " + ex));
}
_statusUntil = Time.unscaledTime + 6f;
}
}
private void Update()
{
//IL_0010: 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_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
try
{
Keyboard current = Keyboard.current;
if (current != null)
{
if (current[_toggleKey.Value] != null && ((ButtonControl)current[_toggleKey.Value]).wasPressedThisFrame)
{
_visible = !_visible;
}
if (current[_diagnosticKey.Value] != null && ((ButtonControl)current[_diagnosticKey.Value]).wasPressedThisFrame)
{
TryExportDiagnostics("F9 hotkey");
}
}
if (!NetworkClient.active)
{
if (_wasConnected)
{
_reader.ResetSession();
_currencyAnchor.Reset();
_quests.Clear();
}
_wasConnected = false;
_nativeHudLayer.Detach();
return;
}
if (!_wasConnected)
{
_reader.ResetSession();
_currencyAnchor.Reset();
_wasConnected = true;
_nextUpdate = 0f;
}
if ((_anchorToCurrencyHud.Value && _corner.Value == PanelCorner.TopRight) || _renderBehindGameUi.Value)
{
_currencyAnchor.RefreshIfNeeded();
}
if (_renderBehindGameUi.Value && _currencyAnchor.TryGetPanelRoot(out var root))
{
_nativeHudLayer.Attach(root);
}
else
{
_nativeHudLayer.Detach();
}
if (Time.unscaledTime >= _nextUpdate)
{
_nextUpdate = Time.unscaledTime + _refresh.Value;
_quests = _reader.ReadDailyQuests();
}
if (_nativeHudLayer.Attached)
{
Rect bounds;
Rect? currencyBadge = ((_anchorToCurrencyHud.Value && _corner.Value == PanelCorner.TopRight && _currencyAnchor.TryGetBadgeBounds(out bounds)) ? new Rect?(bounds) : ((Rect?)null));
_nativeHudLayer.Sync(_quests, _enabled.Value && _visible && !IsBlocked(), _corner.Value, _xOffset.Value, _yOffset.Value, _scale.Value, _readabilityScale.Value, _autoScaleToResolution.Value, _completedQuestMode.Value, _showMissingDataNotice.Value, currencyBadge, _currencyGap.Value, _reader.TotalDailyQuests, _reader.HasSeenDailyQuests);
}
}
catch (Exception ex)
{
if (Time.unscaledTime >= _nextError)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)("Quest update failed (will retry): " + ex));
_nextError = Time.unscaledTime + 15f;
}
}
}
private void OnGUI()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Invalid comparison between Unknown and I4
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Invalid comparison between Unknown and I4
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Invalid comparison between Unknown and I4
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Invalid comparison between Unknown and I4
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
if (Event.current == null)
{
return;
}
if ((int)Event.current.type == 4 && (int)_diagnosticKey.Value == 102 && (int)Event.current.keyCode == 290)
{
TryExportDiagnostics("F9 IMGUI fallback");
}
if ((int)Event.current.type == 7)
{
if (Time.unscaledTime < _statusUntil)
{
Color color = GUI.color;
GUI.color = new Color(0.08f, 0.1f, 0.14f, 0.93f);
GUI.DrawTexture(new Rect(18f, (float)(Screen.height - 72), 448f, 44f), (Texture)(object)Texture2D.whiteTexture);
GUI.color = Color.white;
GUI.Label(new Rect(29f, (float)(Screen.height - 67), 423f, 35f), _diagnosticStatus);
GUI.color = color;
}
if (!_nativeHudLayer.IsDrawing)
{
DrawHud(1f, 1f);
}
}
}
private void DrawHud(float unitsPerPixelX, float unitsPerPixelY, float originScreenX = 0f, float originScreenY = 0f)
{
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
if (_enabled.Value && _visible && NetworkClient.active && !IsBlocked() && (_quests.Count != 0 || _showMissingDataNotice.Value || _reader.HasSeenDailyQuests))
{
Rect bounds;
Rect? currencyBadge = ((_anchorToCurrencyHud.Value && _corner.Value == PanelCorner.TopRight && _currencyAnchor.TryGetBadgeBounds(out bounds)) ? new Rect?(bounds) : ((Rect?)null));
_hud.Draw(_quests, _corner.Value, _xOffset.Value, _yOffset.Value, _scale.Value, _readabilityScale.Value, _autoScaleToResolution.Value, _completedQuestMode.Value, _showMissingDataNotice.Value, currencyBadge, _currencyGap.Value, _reader.TotalDailyQuests, _reader.HasSeenDailyQuests, unitsPerPixelX, unitsPerPixelY, originScreenX, originScreenY);
}
}
private static bool IsBlocked()
{
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Invalid comparison between Unknown and I4
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Invalid comparison between Unknown and I4
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Invalid comparison between Unknown and I4
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Invalid comparison between Unknown and I4
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Invalid comparison between Unknown and I4
try
{
if (LoadingInstance != null && LoadingElement != null)
{
object value = LoadingInstance.GetValue(null);
VisualElement val = (VisualElement)((value == null) ? null : /*isinst with value type is only supported in some contexts*/);
if (val != null && val.panel != null)
{
bool flag = true;
for (VisualElement val2 = val; val2 != null; val2 = val2.parent)
{
if ((int)val2.resolvedStyle.display == 1 || (int)val2.resolvedStyle.visibility == 1 || val2.resolvedStyle.opacity <= 0.01f)
{
flag = false;
}
}
if (flag)
{
return true;
}
}
}
ShopMenu instance = ShopMenu.Instance;
if ((Object)(object)instance != (Object)null && ((BaseMenu)instance).IsOpen)
{
return true;
}
CharacterSelectionScreen instance2 = CharacterSelectionScreen.Instance;
if ((Object)(object)instance2 != (Object)null && ((BaseMenu)instance2).IsOpen)
{
return true;
}
GlobalMissionMenu instance3 = GlobalMissionMenu.Instance;
if ((Object)(object)instance3 != (Object)null && ((BaseMenu)instance3).IsOpen)
{
return true;
}
RogueLikeUpgradeMenu instance4 = RogueLikeUpgradeMenu.Instance;
if ((Object)(object)instance4 != (Object)null && ((BaseMenu)instance4).IsOpen)
{
return true;
}
InventoryScreen instance5 = InventoryScreen.Instance;
if ((Object)(object)instance5 != (Object)null && InventoryRoot != null)
{
object? value2 = InventoryRoot.GetValue(instance5);
VisualElement val3 = (VisualElement)((value2 is VisualElement) ? value2 : null);
if (val3 != null && val3.panel != null && (int)val3.resolvedStyle.display != 1)
{
return true;
}
}
InputManager instance6 = InputManager.Instance;
return (Object)(object)instance6 != (Object)null && (int)instance6.CurrentInputState != 2 && (int)instance6.CurrentInputState != 4;
}
catch
{
return false;
}
}
}
internal enum PanelCorner
{
TopRight,
TopLeft,
BottomRight,
BottomLeft
}
internal enum CompletedQuestMode
{
Hide,
Mark
}
internal sealed class QuestView
{
public string Id;
public string Title;
public int? Progress;
public int? Target;
public bool Completed;
}
internal sealed class NativeHudLayer
{
private const float Width = 310f;
private const float HeaderHeight = 32f;
private const float ItemHeight = 30f;
private const float FooterHeight = 18f;
private const float EdgeMargin = 8f;
private const int MaxRows = 5;
private const float ReferenceWidth = 1920f;
private const float ReferenceHeight = 1080f;
private const float PanelSizeBoost = 0.95f;
private const float RetrySeconds = 5f;
private static readonly Color GoldFrame = new Color(0.72f, 0.64f, 0.48f, 1f);
private static readonly Color MainFill = new Color(0.07450981f, 0.09019608f, 0.1254902f, 0.96f);
private static readonly Color HeaderFill = new Color(0.29803923f, 0.18039216f, 16f / 85f, 1f);
private static readonly Color GoldText = new Color(0.98f, 0.79f, 0.51f, 1f);
private static readonly Color PrimaryText = new Color(0.98f, 0.9f, 0.76f, 1f);
private static readonly Color SuccessText = new Color(0.47f, 0.87f, 0.56f, 1f);
private static readonly Color RowDivider = new Color(0.71f, 0.63f, 0.48f, 0.27f);
private readonly ManualLogSource _log;
private VisualElement _panelRoot;
private VisualElement _parent;
private VisualElement _notificationBranch;
private VisualElement _panel;
private readonly VisualElement[] _backgroundPieces = (VisualElement[])(object)new VisualElement[2];
private readonly VisualElement[] _headerPieces = (VisualElement[])(object)new VisualElement[2];
private readonly VisualElement[] _framePieces = (VisualElement[])(object)new VisualElement[12];
private VisualElement _headerDivider;
private VisualElement _headerAccent;
private Label _heading;
private Label _count;
private Label _empty;
private Label _footer;
private readonly VisualElement[] _bars = (VisualElement[])(object)new VisualElement[5];
private readonly Label[] _ticks = (Label[])(object)new Label[5];
private readonly Label[] _titles = (Label[])(object)new Label[5];
private readonly Label[] _counters = (Label[])(object)new Label[5];
private readonly VisualElement[] _dividers = (VisualElement[])(object)new VisualElement[5];
private readonly bool[] _completedRows = new bool[5];
private Font _font;
private Font _checkFont;
private float _nextSearch;
private bool _reportedFailure;
private float _previousX = float.NaN;
private float _previousY = float.NaN;
private float _previousSx = float.NaN;
private float _previousSy = float.NaN;
private float _previousHeight = float.NaN;
private List<QuestView> _previousQuests;
private CompletedQuestMode _previousMode;
private int _previousTotal = -1;
private bool _previousHasSeen;
public bool Attached
{
get
{
if (_panel != null && _parent != null && _panelRoot != null && _notificationBranch != null && _panel.parent == _parent && _notificationBranch.parent == _parent && _panel.panel != null)
{
return _panel.panel == _panelRoot.panel;
}
return false;
}
}
public bool IsDrawing
{
get
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Invalid comparison between Unknown and I4
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
if (Attached && (int)_panel.resolvedStyle.display != 1)
{
Rect worldBound = _panel.worldBound;
if (((Rect)(ref worldBound)).width > 2f)
{
worldBound = _panel.worldBound;
return ((Rect)(ref worldBound)).height > 2f;
}
}
return false;
}
}
public NativeHudLayer(ManualLogSource log)
{
_log = log;
}
public void Attach(VisualElement root)
{
//IL_0079: 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_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
if (root == null || root.panel == null)
{
Detach();
}
else
{
if (Attached && _panelRoot == root)
{
return;
}
if (_panel != null)
{
Detach();
}
if (Time.unscaledTime < _nextSearch)
{
return;
}
try
{
VisualElement val = UQueryExtensions.Q<VisualElement>(root, "QuestNotificationHolder", (string)null);
if (val == null || val.panel != root.panel)
{
Retry("QuestNotificationHolder unavailable.");
return;
}
VisualElement val2 = val;
VisualElement parent = val.parent;
Rect worldBound = root.worldBound;
while (parent != null && !CoversViewport(parent.worldBound, worldBound))
{
val2 = parent;
parent = parent.parent;
}
if (parent == null)
{
Retry("No screen-sized ancestor for QuestNotificationHolder.");
return;
}
InitializeStyles();
BuildPanel();
parent.Add(_panel);
val2.BringToFront();
_panelRoot = root;
_parent = parent;
_notificationBranch = val2;
_previousQuests = null;
_previousHeight = float.NaN;
_previousX = float.NaN;
_reportedFailure = false;
_log.LogInfo((object)("Native quest HUD inserted before notification branch '" + val2.name + "'. No IMGUIContainer is used."));
}
catch (Exception ex)
{
Detach();
Retry("Native quest HUD failed: " + ex.Message);
}
}
}
private void Retry(string reason)
{
_nextSearch = Time.unscaledTime + 5f;
if (!_reportedFailure)
{
_reportedFailure = true;
_log.LogWarning((object)(reason + " Using legacy OnGUI HUD."));
}
}
private static bool CoversViewport(Rect candidate, Rect viewport)
{
if (((Rect)(ref candidate)).width >= ((Rect)(ref viewport)).width * 0.92f && ((Rect)(ref candidate)).height >= ((Rect)(ref viewport)).height * 0.92f && ((Rect)(ref candidate)).xMin <= ((Rect)(ref viewport)).xMin + ((Rect)(ref viewport)).width * 0.04f && ((Rect)(ref candidate)).yMin <= ((Rect)(ref viewport)).yMin + ((Rect)(ref viewport)).height * 0.04f && ((Rect)(ref candidate)).xMax >= ((Rect)(ref viewport)).xMax - ((Rect)(ref viewport)).width * 0.04f)
{
return ((Rect)(ref candidate)).yMax >= ((Rect)(ref viewport)).yMax - ((Rect)(ref viewport)).height * 0.04f;
}
return false;
}
public void Sync(List<QuestView> quests, bool visible, PanelCorner anchor, int horizontalInset, int verticalInset, float requestedScale, float readabilityScale, bool autoScaleToResolution, CompletedQuestMode completedMode, bool showStatus, Rect? currencyBadge, int currencyGap, int totalDailyQuests, bool hasSeenDailyQuests)
{
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Invalid comparison between Unknown and I4
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_033d: Unknown result type (might be due to invalid IL or missing references)
//IL_0342: Unknown result type (might be due to invalid IL or missing references)
//IL_034a: Unknown result type (might be due to invalid IL or missing references)
//IL_034f: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
if (!Attached)
{
return;
}
int num = 0;
for (int i = 0; i < quests.Count; i++)
{
if (!quests[i].Completed)
{
num++;
}
}
int num2 = ((completedMode == CompletedQuestMode.Hide) ? num : quests.Count);
bool flag = num2 == 0;
if (!visible || (flag && quests.Count == 0 && !showStatus && !hasSeenDailyQuests))
{
_panel.style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)1);
return;
}
if ((int)_panel.resolvedStyle.display == 1)
{
_panel.style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)0);
}
int num3 = Math.Min(num2, 5);
int num4 = Math.Max(0, num2 - num3);
float num5 = 32f + (flag ? 39f : ((float)num3 * 30f + 5f)) + ((num4 > 0) ? 18f : 0f);
float num6 = Mathf.Clamp(requestedScale * Mathf.Clamp(readabilityScale, 1f, 1.4f) * 0.95f, 0.55f, 1.8f);
float num7 = (autoScaleToResolution ? Mathf.Min((float)Screen.width / 1920f, (float)Screen.height / 1080f) : 1f);
float num8 = num6 * num7;
num8 = Mathf.Min(new float[3]
{
num8,
((float)Screen.width - 16f) / 310f,
((float)Screen.height - 16f) / num5
});
Rect value;
int num9;
if (anchor == PanelCorner.TopRight && currencyBadge.HasValue)
{
value = currencyBadge.Value;
if (((Rect)(ref value)).yMax >= 0f)
{
value = currencyBadge.Value;
num9 = ((((Rect)(ref value)).yMax < (float)Screen.height - 60f) ? 1 : 0);
goto IL_01bc;
}
}
num9 = 0;
goto IL_01bc;
IL_01bc:
bool flag2 = (byte)num9 != 0;
float num10;
if (!flag2)
{
num10 = 0f;
}
else
{
value = currencyBadge.Value;
num10 = ((Rect)(ref value)).yMax;
}
float num11 = num10;
float num12 = Mathf.Max(0, currencyGap);
if (flag2)
{
float num13 = (float)Screen.height - 8f - num11 - num12;
if (num13 >= 48f)
{
num8 = Mathf.Min(num8, num13 / num5);
}
else
{
flag2 = false;
}
}
if (autoScaleToResolution && !flag2)
{
float num14 = (float)Screen.height - Mathf.Max(8f, (float)verticalInset) - 8f;
if (num14 >= 72f)
{
num8 = Mathf.Min(num8, num14 / num5);
}
}
if (!(num8 <= 0f))
{
float num15 = 310f * num8;
float num16 = num5 * num8;
bool num17 = anchor == PanelCorner.TopRight || anchor == PanelCorner.BottomRight;
bool flag3 = anchor == PanelCorner.BottomRight || anchor == PanelCorner.BottomLeft;
float num18 = (num17 ? ((float)Screen.width - Mathf.Max(8f, (float)horizontalInset) - num15) : Mathf.Max(8f, (float)horizontalInset));
float num19 = (flag3 ? ((float)Screen.height - Mathf.Max(8f, (float)verticalInset) - num16) : Mathf.Max(8f, (float)verticalInset));
if (flag2)
{
value = currencyBadge.Value;
num18 = ((Rect)(ref value)).xMax - num15;
num19 = num11 + num12;
}
num18 = Mathf.Clamp(num18, 8f, (float)Screen.width - num15 - 8f);
num19 = Mathf.Clamp(num19, 8f, (float)Screen.height - num16 - 8f);
Rect worldBound = _panelRoot.worldBound;
Rect worldBound2 = _parent.worldBound;
float num20 = ((Rect)(ref worldBound)).width / (float)Screen.width;
float num21 = ((Rect)(ref worldBound)).height / (float)Screen.height;
float num22 = num18 * num20 - (((Rect)(ref worldBound2)).xMin - ((Rect)(ref worldBound)).xMin);
float num23 = num19 * num21 - (((Rect)(ref worldBound2)).yMin - ((Rect)(ref worldBound)).yMin);
float num24 = num8 * num20;
float num25 = num8 * num21;
if (Different(num22, _previousX) || Different(num23, _previousY))
{
_panel.style.left = StyleLength.op_Implicit(num22);
_panel.style.top = StyleLength.op_Implicit(num23);
_previousX = num22;
_previousY = num23;
}
bool flag4 = Different(num24, _previousSx) || Different(num25, _previousSy) || Different(num5, _previousHeight);
if (flag4)
{
Layout(num24, num25, num5, num3, num4);
_previousSx = num24;
_previousSy = num25;
_previousHeight = num5;
}
int num26 = Math.Max(quests.Count, totalDailyQuests);
if (_previousQuests != quests || _previousMode != completedMode || _previousTotal != num26 || _previousHasSeen != hasSeenDailyQuests || flag4)
{
Populate(quests, completedMode, num, num26, num3, num4, flag, hasSeenDailyQuests);
_previousQuests = quests;
_previousMode = completedMode;
_previousTotal = num26;
_previousHasSeen = hasSeenDailyQuests;
}
}
}
private static bool Different(float a, float b)
{
if (!float.IsNaN(b))
{
return Mathf.Abs(a - b) > 0.01f;
}
return true;
}
private void InitializeStyles()
{
if ((Object)(object)_font != (Object)null)
{
return;
}
Font[] array = Resources.FindObjectsOfTypeAll<Font>();
foreach (Font val in array)
{
if (!((Object)(object)val == (Object)null))
{
if (((Object)val).name == "Jersey10-Regular")
{
_font = val;
break;
}
if ((Object)(object)_font == (Object)null && ((Object)val).name == "Jersey10-Regular2")
{
_font = val;
}
}
}
try
{
_checkFont = Resources.GetBuiltinResource<Font>("Arial.ttf");
}
catch (Exception)
{
}
if ((Object)(object)_font == (Object)null)
{
_font = _checkFont;
}
}
private void BuildPanel()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
_panel = new VisualElement
{
name = "StonewardsDailyQuestTracker"
};
_panel.pickingMode = (PickingMode)1;
_panel.style.position = StyleEnum<Position>.op_Implicit((Position)1);
_panel.style.backgroundColor = StyleColor.op_Implicit(Color.clear);
_panel.style.overflow = StyleEnum<Overflow>.op_Implicit((Overflow)1);
for (int i = 0; i < _backgroundPieces.Length; i++)
{
_backgroundPieces[i] = MakeRect(_panel, MainFill);
}
for (int j = 0; j < _headerPieces.Length; j++)
{
_headerPieces[j] = MakeRect(_panel, HeaderFill);
}
for (int k = 0; k < _framePieces.Length; k++)
{
_framePieces[k] = MakeRect(_panel, GoldFrame);
}
_headerDivider = MakeRect(_panel, GoldFrame);
_headerAccent = MakeRect(_panel, GoldText);
_heading = MakeLabel(_panel, GoldText, (TextAnchor)3);
_count = MakeLabel(_panel, GoldText, (TextAnchor)5);
_empty = MakeLabel(_panel, PrimaryText, (TextAnchor)4);
_footer = MakeLabel(_panel, GoldText, (TextAnchor)4);
((TextElement)_heading).text = "DAILY QUESTS";
for (int l = 0; l < 5; l++)
{
_bars[l] = MakeRect(_panel, GoldText);
_ticks[l] = MakeLabel(_panel, SuccessText, (TextAnchor)3, _checkFont);
((TextElement)_ticks[l]).text = "✔";
_titles[l] = MakeLabel(_panel, PrimaryText, (TextAnchor)3);
_counters[l] = MakeLabel(_panel, GoldText, (TextAnchor)5);
_dividers[l] = MakeRect(_panel, RowDivider);
}
}
private static VisualElement MakeRect(VisualElement parent, Color color)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
VisualElement val = new VisualElement
{
pickingMode = (PickingMode)1
};
val.style.position = StyleEnum<Position>.op_Implicit((Position)1);
val.style.backgroundColor = StyleColor.op_Implicit(color);
parent.Add(val);
return val;
}
private Label MakeLabel(VisualElement parent, Color color, TextAnchor anchor, Font font = null)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
Label val = new Label
{
pickingMode = (PickingMode)1
};
((VisualElement)val).style.position = StyleEnum<Position>.op_Implicit((Position)1);
((VisualElement)val).style.color = StyleColor.op_Implicit(color);
((VisualElement)val).style.unityTextAlign = StyleEnum<TextAnchor>.op_Implicit(anchor);
((VisualElement)val).style.whiteSpace = StyleEnum<WhiteSpace>.op_Implicit((WhiteSpace)1);
((VisualElement)val).style.overflow = StyleEnum<Overflow>.op_Implicit((Overflow)1);
if ((Object)(object)font != (Object)null || (Object)(object)_font != (Object)null)
{
((VisualElement)val).style.unityFont = StyleFont.op_Implicit(font ?? _font);
}
parent.Add((VisualElement)(object)val);
return val;
}
private static void SetRect(VisualElement element, float x, float y, float width, float height, float sx, float sy)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: 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_005b: Unknown result type (might be due to invalid IL or missing references)
element.style.left = StyleLength.op_Implicit(x * sx);
element.style.top = StyleLength.op_Implicit(y * sy);
element.style.width = StyleLength.op_Implicit(Mathf.Max(0f, width * sx));
element.style.height = StyleLength.op_Implicit(Mathf.Max(0f, height * sy));
}
private static void SetFont(Label label, float points, float sy)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
((VisualElement)label).style.fontSize = StyleLength.op_Implicit(Mathf.Max(9f, points * sy));
}
private void Layout(float sx, float sy, float height, int rows, int overflow)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
_panel.style.width = StyleLength.op_Implicit(310f * sx);
_panel.style.height = StyleLength.op_Implicit(height * sy);
SetRect(_backgroundPieces[0], 7f, 0f, 296f, height, sx, sy);
SetRect(_backgroundPieces[1], 0f, 7f, 310f, height - 14f, sx, sy);
SetRect(_headerPieces[0], 7f, 2f, 296f, 30f, sx, sy);
SetRect(_headerPieces[1], 2f, 7f, 306f, 25f, sx, sy);
SetRect(_framePieces[0], 8f, 0f, 294f, 2f, sx, sy);
SetRect(_framePieces[1], 5f, 2f, 3f, 2f, sx, sy);
SetRect(_framePieces[2], 2f, 5f, 3f, 2f, sx, sy);
SetRect(_framePieces[3], 302f, 2f, 3f, 2f, sx, sy);
SetRect(_framePieces[4], 305f, 5f, 3f, 2f, sx, sy);
SetRect(_framePieces[5], 0f, 7f, 2f, height - 14f, sx, sy);
SetRect(_framePieces[6], 308f, 7f, 2f, height - 14f, sx, sy);
SetRect(_framePieces[7], 8f, height - 2f, 294f, 2f, sx, sy);
SetRect(_framePieces[8], 5f, height - 4f, 3f, 2f, sx, sy);
SetRect(_framePieces[9], 2f, height - 7f, 3f, 2f, sx, sy);
SetRect(_framePieces[10], 302f, height - 4f, 3f, 2f, sx, sy);
SetRect(_framePieces[11], 305f, height - 7f, 3f, 2f, sx, sy);
SetRect(_headerDivider, 2f, 31f, 306f, 1f, sx, sy);
SetRect(_headerAccent, 10f, 28f, 46f, 1f, sx, sy);
SetRect((VisualElement)(object)_heading, 13f, 3f, 178f, 26f, sx, sy);
SetRect((VisualElement)(object)_count, 190f, 3f, 105f, 26f, sx, sy);
SetRect((VisualElement)(object)_empty, 13f, 37f, 284f, 30f, sx, sy);
SetRect((VisualElement)(object)_footer, 13f, 35f + (float)rows * 30f, 284f, 16f, sx, sy);
SetFont(_heading, 18f, sy);
SetFont(_count, 16f, sy);
SetFont(_empty, 15f, sy);
SetFont(_footer, 13f, sy);
for (int i = 0; i < 5; i++)
{
float num = 35f + (float)i * 30f;
SetRect(_bars[i], 8f, num + 6f, 2f, 17f, sx, sy);
SetRect((VisualElement)(object)_ticks[i], 7f, num + 2f, 24f, 24f, sx, sy);
SetRect((VisualElement)(object)_titles[i], 16f, num + 1f, 219f, 24f, sx, sy);
SetRect((VisualElement)(object)_counters[i], 240f, num + 1f, 57f, 24f, sx, sy);
SetRect(_dividers[i], 11f, num + 30f - 2f, 288f, 1f, sx, sy);
SetFont(_ticks[i], 19f, sy);
SetFont(_titles[i], 17f, sy);
SetFont(_counters[i], 16f, sy);
}
}
private void Populate(List<QuestView> quests, CompletedQuestMode mode, int remaining, int total, int rows, int overflow, bool empty, bool hasSeenDailyQuests)
{
//IL_004e: 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_02cc: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_02f7: 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_0317: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0337: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_0357: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
((TextElement)_count).text = ((quests.Count == 0 && !hasSeenDailyQuests) ? "—" : (remaining + "/" + total + " LEFT"));
((VisualElement)_empty).style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)(!empty));
((TextElement)_empty).text = ((quests.Count == 0 && !hasSeenDailyQuests) ? "QUEST PROGRESS NOT DETECTED" : "ALL QUESTS COMPLETED");
((VisualElement)_footer).style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)(overflow <= 0));
((TextElement)_footer).text = "+ " + overflow + " MORE QUESTS";
int num = 0;
for (int i = 0; i < ((mode != CompletedQuestMode.Mark) ? 1 : 2); i++)
{
for (int j = 0; j < quests.Count; j++)
{
if (num >= 5)
{
break;
}
QuestView questView = quests[j];
if (questView.Completed == (i == 1))
{
bool completed = questView.Completed;
_completedRows[num] = completed;
_bars[num].style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)(completed ? 1 : 0));
((VisualElement)_ticks[num]).style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)(!completed));
((VisualElement)_titles[num]).style.color = StyleColor.op_Implicit(completed ? SuccessText : PrimaryText);
((VisualElement)_counters[num]).style.color = StyleColor.op_Implicit(completed ? SuccessText : GoldText);
((TextElement)_titles[num]).text = questView.Title ?? "Daily quest";
((TextElement)_counters[num]).text = ((questView.Progress.HasValue && questView.Target.HasValue) ? (Math.Min(questView.Progress.Value, questView.Target.Value) + "/" + questView.Target.Value) : (completed ? "DONE" : "—"));
((VisualElement)_titles[num]).style.left = StyleLength.op_Implicit((completed ? 33f : 16f) * _previousSx);
((VisualElement)_titles[num]).style.width = StyleLength.op_Implicit((completed ? 202f : 219f) * _previousSx);
num++;
}
}
}
for (int k = 0; k < 5; k++)
{
bool flag = k < num;
_bars[k].style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)((!flag || _completedRows[k]) ? 1 : 0));
((VisualElement)_ticks[k]).style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)((!flag || !_completedRows[k]) ? 1 : 0));
((VisualElement)_titles[k]).style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)(!flag));
((VisualElement)_counters[k]).style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)(!flag));
_dividers[k].style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)(!flag));
}
}
public void Detach()
{
if (_panel != null)
{
try
{
_panel.RemoveFromHierarchy();
}
catch (Exception)
{
}
}
_panel = null;
_panelRoot = null;
_parent = null;
_notificationBranch = null;
_previousQuests = null;
_previousX = float.NaN;
_previousY = float.NaN;
_previousSx = float.NaN;
_previousSy = float.NaN;
_previousHeight = float.NaN;
}
}
internal static class QuestDiagnostics
{
private sealed class ReferenceComparer : IEqualityComparer<object>
{
public static readonly ReferenceComparer Instance = new ReferenceComparer();
public new bool Equals(object x, object y)
{
return x == y;
}
public int GetHashCode(object obj)
{
return RuntimeHelpers.GetHashCode(obj);
}
}
private const BindingFlags Flags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
private const int Limit = 230000;
private static readonly string ReportName = "StonewardsDailyQuestTracker-diagnostic.txt";
public static string Export(string trigger)
{
string configPath = Paths.ConfigPath;
Directory.CreateDirectory(configPath);
string text = Path.Combine(configPath, ReportName);
StringBuilder stringBuilder = new StringBuilder(36000);
stringBuilder.AppendLine("Stonewards Daily Quest Tracker - API report v0.1.2");
stringBuilder.AppendLine("Triggered by: " + trigger);
stringBuilder.AppendLine("Timestamp (UTC): " + DateTime.UtcNow.ToString("O", CultureInfo.InvariantCulture));
stringBuilder.AppendLine("BepInEx config directory: " + configPath);
stringBuilder.AppendLine("GlobalMissionMenu.Instance: " + (((Object)(object)GlobalMissionMenu.Instance != (Object)null) ? "available" : "missing"));
stringBuilder.AppendLine("GlobalMissionMenu.IsOpen: " + ((Object)(object)GlobalMissionMenu.Instance != (Object)null && ((BaseMenu)GlobalMissionMenu.Instance).IsOpen));
stringBuilder.AppendLine("This diagnostic contains runtime quest values and UI labels. Review before sharing.");
stringBuilder.AppendLine();
AppendNotificationUi(stringBuilder);
AppendGameTypes(stringBuilder);
AppendMissionMenu(stringBuilder);
File.WriteAllText(text, stringBuilder.ToString(), Encoding.UTF8);
return text;
}
private static void AppendNotificationUi(StringBuilder output)
{
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
//IL_03cc: Invalid comparison between Unknown and I4
//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
//IL_03de: Invalid comparison between Unknown and I4
output.AppendLine("=== NOTIFICATION UI / OVERLAY LAYER SNAPSHOT ===");
try
{
Assembly assembly = typeof(FirstPersonController).Assembly;
string[] array = new string[2] { "NotificationHolder", "UINotification" };
Scene scene;
foreach (string text in array)
{
Type type = assembly.GetType(text);
if (type == null)
{
output.AppendLine("Game type missing: " + text);
continue;
}
output.AppendLine("GAME TYPE " + type.FullName + " derives from " + ((type.BaseType == null) ? "?" : type.BaseType.FullName));
foreach (FieldInfo item in GetAllFields(type).Take(45))
{
output.AppendLine(" FIELD " + item.FieldType.Name + " " + item.Name);
}
if (!typeof(Object).IsAssignableFrom(type))
{
continue;
}
Object[] array2 = Resources.FindObjectsOfTypeAll(type);
output.AppendLine(" LOADED INSTANCES " + array2.Length);
int num = 0;
Object[] array3 = array2;
foreach (Object obj in array3)
{
Component val = (Component)(object)((obj is Component) ? obj : null);
if ((Object)(object)val == (Object)null)
{
continue;
}
scene = val.gameObject.scene;
if (((Scene)(ref scene)).IsValid() && val.gameObject.activeInHierarchy)
{
output.AppendLine(" LIVE " + ((Object)val.gameObject).name + " hierarchy=" + DescribeParents(val.transform));
RectTransform component = val.GetComponent<RectTransform>();
if ((Object)(object)component != (Object)null)
{
Vector3[] array4 = (Vector3[])(object)new Vector3[4];
component.GetWorldCorners(array4);
output.AppendLine(" RECT corners=" + ((object)Unsafe.As<Vector3, Vector3>(ref array4[0])/*cast due to .constrained prefix*/).ToString() + " / " + ((object)Unsafe.As<Vector3, Vector3>(ref array4[2])/*cast due to .constrained prefix*/).ToString());
}
if (++num >= 12)
{
break;
}
}
}
}
UIDocument[] array5 = Resources.FindObjectsOfTypeAll<UIDocument>();
output.AppendLine("LOADED UI DOCUMENTS " + array5.Length);
int num2 = 4500;
int num3 = 0;
UIDocument[] array6 = array5;
foreach (UIDocument val2 in array6)
{
if (num2 <= 0 || num3 >= 220 || output.Length >= 230000)
{
break;
}
if ((Object)(object)val2 == (Object)null)
{
continue;
}
scene = ((Component)val2).gameObject.scene;
if (!((Scene)(ref scene)).IsValid() || !((Component)val2).gameObject.activeInHierarchy)
{
continue;
}
VisualElement rootVisualElement = val2.rootVisualElement;
if (rootVisualElement == null || rootVisualElement.panel == null)
{
continue;
}
string text2 = (((Object)(object)val2.panelSettings == (Object)null) ? "none" : val2.panelSettings.sortingOrder.ToString(CultureInfo.InvariantCulture));
output.AppendLine("DOCUMENT " + ((Object)((Component)val2).gameObject).name + " sorting=" + text2 + " root=" + SafeString(rootVisualElement.name));
Stack<KeyValuePair<VisualElement, int>> stack = new Stack<KeyValuePair<VisualElement, int>>();
stack.Push(new KeyValuePair<VisualElement, int>(rootVisualElement, 0));
while (stack.Count > 0 && num2-- > 0 && num3 < 220 && output.Length < 230000)
{
KeyValuePair<VisualElement, int> keyValuePair = stack.Pop();
VisualElement key = keyValuePair.Key;
if (key != null && (int)key.resolvedStyle.display != 1 && (int)key.resolvedStyle.visibility != 1 && !(key.resolvedStyle.opacity <= 0.01f))
{
string text3 = key.name ?? "";
string text4 = string.Join(",", key.GetClasses().Take(8).ToArray());
VisualElement obj2 = ((key is TextElement) ? key : null);
string value = ((obj2 != null) ? ((TextElement)obj2).text : null) ?? "";
bool num4 = HasToken(text3 + " " + text4, "notification", "toast", "popup", "banner", "reward", "achievement", "alert");
Rect bounds;
bool screenBounds = GetScreenBounds(rootVisualElement, key, out bounds);
bool flag = screenBounds && ((Rect)(ref bounds)).xMax >= (float)Screen.width * 0.72f && ((Rect)(ref bounds)).yMin < (float)Screen.height * 0.42f && ((Rect)(ref bounds)).yMax >= 0f && ((Rect)(ref bounds)).width > 8f && ((Rect)(ref bounds)).width < (float)Screen.width * 0.85f && ((Rect)(ref bounds)).height > 6f && ((Rect)(ref bounds)).height < (float)Screen.height * 0.5f;
if (num4 || flag)
{
string text5 = (screenBounds ? (((Rect)(ref bounds)).x.ToString("F0", CultureInfo.InvariantCulture) + "," + ((Rect)(ref bounds)).y.ToString("F0", CultureInfo.InvariantCulture) + "," + ((Rect)(ref bounds)).width.ToString("F0", CultureInfo.InvariantCulture) + "," + ((Rect)(ref bounds)).height.ToString("F0", CultureInfo.InvariantCulture)) : "?");
output.AppendLine(" UI depth=" + keyValuePair.Value + " type=" + ((object)key).GetType().Name + " name=" + SafeString(text3) + " classes=" + SafeString(text4) + " rect=" + text5 + " text=" + SafeString(value));
num3++;
}
for (int num5 = key.childCount - 1; num5 >= 0; num5--)
{
stack.Push(new KeyValuePair<VisualElement, int>(key.ElementAt(num5), keyValuePair.Value + 1));
}
}
}
}
output.AppendLine("UI nodes recorded: " + num3);
}
catch (Exception ex)
{
output.AppendLine("Notification UI snapshot failed: " + ex);
}
output.AppendLine();
}
private static bool GetScreenBounds(VisualElement root, VisualElement element, out Rect bounds)
{
//IL_0001: 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_000d: 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_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
bounds = default(Rect);
Rect worldBound = root.worldBound;
Rect worldBound2 = element.worldBound;
if (((Rect)(ref worldBound)).width <= 0f || ((Rect)(ref worldBound)).height <= 0f || ((Rect)(ref worldBound2)).width <= 0f || ((Rect)(ref worldBound2)).height <= 0f)
{
return false;
}
float num = (float)Screen.width / ((Rect)(ref worldBound)).width;
float num2 = (float)Screen.height / ((Rect)(ref worldBound)).height;
bounds = new Rect((((Rect)(ref worldBound2)).xMin - ((Rect)(ref worldBound)).xMin) * num, (((Rect)(ref worldBound2)).yMin - ((Rect)(ref worldBound)).yMin) * num2, ((Rect)(ref worldBound2)).width * num, ((Rect)(ref worldBound2)).height * num2);
if (!float.IsNaN(((Rect)(ref bounds)).x))
{
return !float.IsNaN(((Rect)(ref bounds)).y);
}
return false;
}
private static string DescribeParents(Transform child)
{
List<string> list = new List<string>(6);
int num = 0;
while ((Object)(object)child != (Object)null && num < 7)
{
list.Add(((Object)child).name);
num++;
child = child.parent;
}
return string.Join(" <- ", list.ToArray());
}
private static void AppendGameTypes(StringBuilder output)
{
output.AppendLine("=== Quest/Mission-related game types ===");
Type[] source;
try
{
source = typeof(FirstPersonController).Assembly.GetTypes();
}
catch (ReflectionTypeLoadException ex)
{
source = ex.Types.Where((Type type) => type != null).ToArray();
}
foreach (Type item in from type in source
where type != null && (Matches(type.Name) || ContainsDailyMember(type))
orderby type.Name
select type)
{
if (output.Length >= 230000)
{
break;
}
output.AppendLine("TYPE: " + item.FullName + " : " + ((item.BaseType == null) ? "<none>" : item.BaseType.Name));
FieldInfo[] fields;
PropertyInfo[] properties;
MethodInfo[] methods;
try
{
fields = item.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
properties = item.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
methods = item.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
}
catch (Exception ex2)
{
output.AppendLine(" Reflection error: " + ex2.GetType().Name);
continue;
}
foreach (FieldInfo item2 in fields.Take(90))
{
output.AppendLine(" FIELD " + (item2.IsStatic ? "static " : "") + DescribeType(item2.FieldType) + " " + item2.Name);
}
foreach (PropertyInfo item3 in properties.Take(60))
{
if (item3.GetIndexParameters().Length == 0)
{
output.AppendLine(" PROPERTY " + DescribeType(item3.PropertyType) + " " + item3.Name);
}
}
foreach (MethodInfo item4 in methods.Where((MethodInfo m) => HasToken(m.Name, "daily", "quest", "mission", "progress", "refresh", "complete", "load", "save", "update")).Take(45))
{
string text;
try
{
text = string.Join(", ", from p in item4.GetParameters()
select DescribeType(p.ParameterType) + " " + p.Name);
}
catch
{
text = "?";
}
output.AppendLine(" METHOD " + DescribeType(item4.ReturnType) + " " + item4.Name + "(" + text + ")");
}
if (HasToken(item.Name, "manager", "tracker", "system", "progress", "controller") && !typeof(ScriptableObject).IsAssignableFrom(item))
{
int num = 0;
FieldInfo[] array = fields;
foreach (FieldInfo fieldInfo in array)
{
if (!fieldInfo.IsStatic || !HasToken(fieldInfo.Name, "instance", "daily", "quest", "mission", "progress", "active", "current", "player") || HasToken(fieldInfo.Name, "database", "definition", "template"))
{
continue;
}
object obj2 = SafeGet(fieldInfo, null);
if (obj2 != null)
{
output.AppendLine(" STATIC STATE " + fieldInfo.Name);
DumpObject(output, " " + item.Name + "." + fieldInfo.Name, obj2, 0, new HashSet<object>(ReferenceComparer.Instance), 0);
if (++num >= 4 || output.Length >= 230000)
{
break;
}
}
}
}
output.AppendLine();
}
}
private static void AppendMissionMenu(StringBuilder output)
{
output.AppendLine("=== Live GlobalMissionMenu data ===");
GlobalMissionMenu instance = GlobalMissionMenu.Instance;
if ((Object)(object)instance == (Object)null)
{
output.AppendLine("No GlobalMissionMenu instance. Open Missions -> Daily and try again.");
return;
}
HashSet<object> visited = new HashSet<object>(ReferenceComparer.Instance);
DumpObject(output, "GlobalMissionMenu", instance, 0, visited, 0);
output.AppendLine();
output.AppendLine("=== UI Toolkit mission labels ===");
List<VisualElement> list = new List<VisualElement>();
foreach (FieldInfo allField in GetAllFields(((object)instance).GetType()))
{
if (!allField.IsStatic)
{
object obj = SafeGet(allField, instance);
VisualElement val = (VisualElement)((obj is VisualElement) ? obj : null);
if (val != null && !list.Contains(val))
{
list.Add(val);
}
UIDocument val2 = (UIDocument)((obj is UIDocument) ? obj : null);
if ((Object)(object)val2 != (Object)null && val2.rootVisualElement != null && !list.Contains(val2.rootVisualElement))
{
list.Add(val2.rootVisualElement);
}
}
}
if (list.Count == 0)
{
output.AppendLine("No direct VisualElement/UIDocument fields found on GlobalMissionMenu.");
}
int total = 0;
foreach (VisualElement item in list.Take(5))
{
DumpVisualTree(output, item, 0, ref total);
}
}
private static void DumpObject(StringBuilder output, string path, object value, int depth, HashSet<object> visited, int nodes)
{
if (value == null || depth > 3 || nodes > 80 || output.Length >= 230000)
{
return;
}
Type type = value.GetType();
output.AppendLine(path + " : " + DescribeType(type));
if (IsSimple(type))
{
output.AppendLine(" VALUE = " + SafeString(value));
}
else
{
if (!type.IsValueType && !visited.Add(value))
{
return;
}
if (value is IEnumerable enumerable && !(value is string))
{
try
{
int num = 0;
foreach (object item in enumerable)
{
if (num >= 12)
{
output.AppendLine(" [remaining entries omitted]");
break;
}
DumpObject(output, path + "[" + num + "]", item, depth + 1, visited, nodes + num + 1);
num++;
}
return;
}
catch (Exception ex)
{
output.AppendLine(" Enumeration error: " + ex.GetType().Name);
return;
}
}
int num2 = 0;
foreach (FieldInfo allField in GetAllFields(type))
{
if (allField.IsStatic || ++num2 > 55)
{
continue;
}
object obj = SafeGet(allField, value);
if (obj == null)
{
continue;
}
string text = path + "." + allField.Name;
Type type2 = obj.GetType();
if (IsSimple(type2))
{
output.AppendLine(" " + text + " = " + SafeString(obj));
}
else if (obj is Object && !(obj is ScriptableObject) && !(obj is VisualElement) && !(obj is GlobalMissionMenu))
{
output.AppendLine(" " + text + " : " + DescribeType(type2));
}
else if (obj is VisualElement)
{
TextElement val = (TextElement)((obj is TextElement) ? obj : null);
output.AppendLine(" " + text + " : VisualElement (" + ((val == null) ? "" : ("text=" + SafeString(val.text))) + ")");
}
else if (obj is ScriptableObject)
{
output.AppendLine(" " + text + " : ScriptableObject " + DescribeType(type2));
}
else
{
if (IsRelevant(allField.Name, type2) && depth < 3)
{
DumpObject(output, text, obj, depth + 1, visited, nodes + num2);
}
else
{
output.AppendLine(" " + text + " : " + DescribeType(type2));
}
if (output.Length >= 230000)
{
break;
}
}
}
}
}
private static void DumpVisualTree(StringBuilder output, VisualElement element, int depth, ref int total)
{
if (element == null || depth > 8 || ++total > 300 || output.Length >= 230000)
{
return;
}
TextElement val = (TextElement)(object)((element is TextElement) ? element : null);
ProgressBar val2 = (ProgressBar)(object)((element is ProgressBar) ? element : null);
string text = ((val == null) ? "" : (" text=" + SafeString(val.text)));
string text2 = ((val2 == null) ? "" : (" progress=" + ((AbstractProgressBar)val2).value.ToString(CultureInfo.InvariantCulture) + " low=" + ((AbstractProgressBar)val2).lowValue.ToString(CultureInfo.InvariantCulture) + " high=" + ((AbstractProgressBar)val2).highValue.ToString(CultureInfo.InvariantCulture)));
output.AppendLine(new string(' ', depth * 2) + DescribeType(((object)element).GetType()) + " name=" + SafeString(element.name) + text + text2);
int num = Math.Min(element.childCount, 60);
for (int i = 0; i < num; i++)
{
if (total >= 300)
{
break;
}
if (output.Length >= 230000)
{
break;
}
DumpVisualTree(output, element.ElementAt(i), depth + 1, ref total);
}
}
private static IEnumerable<FieldInfo> GetAllFields(Type type)
{
int depth = 0;
while (type != null && depth++ < 7)
{
FieldInfo[] array;
try
{
array = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
}
catch
{
array = new FieldInfo[0];
}
FieldInfo[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
yield return array2[i];
}
type = type.BaseType;
}
}
private static object SafeGet(FieldInfo field, object value)
{
try
{
return field.GetValue(value);
}
catch
{
return null;
}
}
private static bool ContainsDailyMember(Type type)
{
try
{
return type.GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).Any((FieldInfo f) => HasToken(f.Name, "dailyquest", "dailymission"));
}
catch
{
return false;
}
}
private static bool Matches(string name)
{
return HasToken(name, "quest", "mission", "daily");
}
private static bool IsRelevant(string name, Type type)
{
if (!HasToken(name, "quest", "mission", "daily", "progress", "active", "current", "entry", "entries", "task", "objective", "data", "list", "items") && !Matches(type.Name))
{
return typeof(IList).IsAssignableFrom(type);
}
return true;
}
private static bool IsSimple(Type type)
{
if (!type.IsPrimitive && !type.IsEnum && !(type == typeof(string)) && !(type == typeof(decimal)))
{
return type == typeof(DateTime);
}
return true;
}
private static bool HasToken(string value, params string[] tokens)
{
foreach (string value2 in tokens)
{
if (value != null && value.IndexOf(value2, StringComparison.OrdinalIgnoreCase) >= 0)
{
return true;
}
}
return false;
}
private static string DescribeType(Type type)
{
object obj;
if (!(type == null))
{
obj = type.FullName;
if (obj == null)
{
return type.Name;
}
}
else
{
obj = "?";
}
return (string)obj;
}
private static string SafeString(object value)
{
if (value == null)
{
return "<null>";
}
string text;
try
{
text = Convert.ToString(value, CultureInfo.InvariantCulture);
}
catch
{
return "<format-error>";
}
if (text == null)
{
return "<null>";
}
text = text.Replace("\r", " ").Replace("\n", " ");
if (text.Length <= 150)
{
return text;
}
return text.Substring(0, 150) + "...";
}
}
internal sealed class QuestHud
{
private const float Width = 310f;
private const float HeaderHeight = 32f;
private const float ItemHeight = 30f;
private const float FooterHeight = 18f;
private const int MaxVisible = 5;
private const float ReferenceWidth = 1920f;
private const float ReferenceHeight = 1080f;
private const float EdgeMargin = 8f;
private const float PanelSizeBoost = 0.95f;
private static readonly Color GoldFrame = new Color(0.72f, 0.64f, 0.48f, 1f);
private static readonly Color MainFill = new Color(0.07450981f, 0.09019608f, 0.1254902f, 0.96f);
private static readonly Color HeaderFill = new Color(0.29803923f, 0.18039216f, 16f / 85f, 1f);
private static readonly Color GoldText = new Color(0.98f, 0.79f, 0.51f, 1f);
private static readonly Color PrimaryText = new Color(0.98f, 0.9f, 0.76f, 1f);
private static readonly Color SecondaryText = new Color(0.76f, 0.76f, 0.73f, 1f);
private static readonly Color Success = new Color(0.47f, 0.87f, 0.56f, 1f);
private static readonly Color RowDivider = new Color(0.71f, 0.63f, 0.48f, 0.27f);
private GUIStyle _heading;
private GUIStyle _rowTitle;
private GUIStyle _rowDone;
private GUIStyle _rowCounter;
private GUIStyle _rowCounterDone;
private GUIStyle _subtle;
private GUIStyle _emptyTitle;
private Font _font;
private readonly Dictionary<string, string> _fittedLabels = new Dictionary<string, string>(StringComparer.Ordinal);
private readonly Dictionary<string, string> _fittedCompletedLabels = new Dictionary<string, string>(StringComparer.Ordinal);
public void Draw(List<QuestView> quests, PanelCorner anchor, int horizontalInset, int verticalInset, float requestedScale, float readabilityScale, bool autoScaleToResolution, CompletedQuestMode completedMode, bool showStatus, Rect? currencyBadge, int currencyGap, int totalDailyQuests, bool hasSeenDailyQuests, float unitsPerPixelX = 1f, float unitsPerPixelY = 1f, float originScreenX = 0f, float originScreenY = 0f)
{
//IL_0513: Unknown result type (might be due to invalid IL or missing references)
//IL_051a: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0303: Unknown result type (might be due to invalid IL or missing references)
//IL_0308: Unknown result type (might be due to invalid IL or missing references)
//IL_030a: Unknown result type (might be due to invalid IL or missing references)
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_02af: Unknown result type (might be due to invalid IL or missing references)
//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_0328: Unknown result type (might be due to invalid IL or missing references)
//IL_032d: Unknown result type (might be due to invalid IL or missing references)
//IL_0341: Unknown result type (might be due to invalid IL or missing references)
//IL_0346: Unknown result type (might be due to invalid IL or missing references)
//IL_034b: Unknown result type (might be due to invalid IL or missing references)
//IL_0371: Unknown result type (might be due to invalid IL or missing references)
//IL_039a: Unknown result type (might be due to invalid IL or missing references)
//IL_0403: Unknown result type (might be due to invalid IL or missing references)
//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
if (_heading == null)
{
InitializeStyles();
}
int num = 0;
for (int i = 0; i < quests.Count; i++)
{
if (!quests[i].Completed)
{
num++;
}
}
int num2 = ((completedMode == CompletedQuestMode.Hide) ? num : quests.Count);
int num3 = Math.Max(quests.Count, totalDailyQuests);
bool flag = num2 == 0;
if (flag && quests.Count == 0 && !showStatus && !hasSeenDailyQuests)
{
return;
}
int num4 = Math.Min(num2, 5);
int num5 = Math.Max(0, num2 - num4);
float num6 = 32f + (flag ? 39f : ((float)num4 * 30f + 5f)) + ((num5 > 0) ? 18f : 0f);
float num7 = Mathf.Clamp(requestedScale * Mathf.Clamp(readabilityScale, 1f, 1.4f) * 0.95f, 0.55f, 1.8f);
float num8 = (autoScaleToResolution ? Mathf.Min((float)Screen.width / 1920f, (float)Screen.height / 1080f) : 1f);
float num9 = num7 * num8;
num9 = Mathf.Min(new float[3]
{
num9,
((float)Screen.width - 16f) / 310f,
((float)Screen.height - 16f) / num6
});
Rect value;
int num10;
if (anchor == PanelCorner.TopRight && currencyBadge.HasValue)
{
value = currencyBadge.Value;
if (((Rect)(ref value)).yMax >= 0f)
{
value = currencyBadge.Value;
num10 = ((((Rect)(ref value)).yMax < (float)Screen.height - 60f) ? 1 : 0);
goto IL_018a;
}
}
num10 = 0;
goto IL_018a;
IL_018a:
bool flag2 = (byte)num10 != 0;
float num11;
if (!flag2)
{
num11 = 0f;
}
else
{
value = currencyBadge.Value;
num11 = ((Rect)(ref value)).yMax;
}
float num12 = num11;
float num13 = Mathf.Max(0, currencyGap);
if (flag2)
{
float num14 = (float)Screen.height - 8f - num12 - num13;
if (num14 >= 48f)
{
num9 = Mathf.Min(num9, num14 / num6);
}
else
{
flag2 = false;
}
}
if (autoScaleToResolution && !flag2)
{
float num15 = (float)Screen.height - Mathf.Max(8f, (float)verticalInset) - 8f;
if (num15 >= 72f)
{
num9 = Mathf.Min(num9, num15 / num6);
}
}
if (num9 <= 0f)
{
return;
}
float num16 = 310f * num9;
float num17 = num6 * num9;
bool num18 = anchor == PanelCorner.TopRight || anchor == PanelCorner.BottomRight;
bool flag3 = anchor == PanelCorner.BottomRight || anchor == PanelCorner.BottomLeft;
float num19 = (num18 ? ((float)Screen.width - Mathf.Max(8f, (float)horizontalInset) - num16) : Mathf.Max(8f, (float)horizontalInset));
float num20 = (flag3 ? ((float)Screen.height - Mathf.Max(8f, (float)verticalInset) - num17) : Mathf.Max(8f, (float)verticalInset));
if (flag2)
{
value = currencyBadge.Value;
num19 = ((Rect)(ref value)).xMax - num16;
num20 = num12 + num13;
}
num19 = Mathf.Clamp(num19, 8f, (float)Screen.width - num16 - 8f);
num20 = Mathf.Clamp(num20, 8f, (float)Screen.height - num17 - 8f);
Matrix4x4 matrix = GUI.matrix;
Color color = GUI.color;
try
{
GUI.matrix = matrix * Matrix4x4.TRS(new Vector3((num19 - originScreenX) * unitsPerPixelX, (num20 - originScreenY) * unitsPerPixelY, 0f), Quaternion.identity, new Vector3(num9 * unitsPerPixelX, num9 * unitsPerPixelY, 1f));
DrawBackground(num6);
GUI.Label(new Rect(13f, 3f, 178f, 26f), "DAILY QUESTS", _heading);
GUI.Label(new Rect(190f, 3f, 105f, 26f), (quests.Count == 0 && !hasSeenDailyQuests) ? "—" : (num + "/" + num3 + " LEFT"), _rowCounter);
if (flag)
{
bool flag4 = quests.Count == 0 && !hasSeenDailyQuests;
GUI.Label(new Rect(13f, 37f, 284f, 30f), flag4 ? "QUEST PROGRESS NOT DETECTED" : "ALL QUESTS COMPLETED", _emptyTitle);
return;
}
int num21 = 0;
for (int j = 0; j < quests.Count; j++)
{
if (num21 >= 5)
{
break;
}
QuestView questView = quests[j];
if (!questView.Completed)
{
DrawRow(questView, 35f + (float)num21 * 30f);
num21++;
}
}
if (completedMode == CompletedQuestMode.Mark)
{
for (int k = 0; k < quests.Count; k++)
{
if (num21 >= 5)
{
break;
}
QuestView questView2 = quests[k];
if (questView2.Completed)
{
DrawRow(questView2, 35f + (float)num21 * 30f);
num21++;
}
}
}
if (num5 > 0)
{
float num22 = 35f + (float)num4 * 30f;
GUI.Label(new Rect(13f, num22, 284f, 16f), "+ " + num5 + " MORE QUESTS", _subtle);
}
}
finally
{
GUI.matrix = matrix;
GUI.color = color;
}
}
private void DrawBackground(float height)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: 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_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
DrawRect(7f, 0f, 296f, height, MainFill);
DrawRect(0f, 7f, 310f, height - 14f, MainFill);
DrawRect(7f, 2f, 296f, 30f, HeaderFill);
DrawRect(2f, 7f, 306f, 25f, HeaderFill);
DrawFrame(310f, height);
DrawRect(2f, 31f, 306f, 1f, GoldFrame);
DrawRect(10f, 28f, 46f, 1f, GoldText);
}
private void DrawRow(QuestView q, float y)
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
float num = (q.Completed ? 33f : 16f);
float num2 = 240f - num - 5f;
if (q.Completed)
{
DrawTick(7f, y + 7f);
}
else
{
DrawRect(8f, y + 6f, 2f, 17f, GoldText);
}
GUIStyle val = (q.Completed ? _rowDone : _rowTitle);
GUI.Label(new Rect(num, y + 1f, num2, 24f), FitText(q.Title, num2, val, q.Completed), val);
string text = ((q.Progress.HasValue && q.Target.HasValue) ? (Math.Min(q.Progress.Value, q.Target.Value) + "/" + q.Target.Value) : (q.Completed ? "DONE" : "—"));
GUI.Label(new Rect(240f, y + 1f, 57f, 24f), text, q.Completed ? _rowCounterDone : _rowCounter);
DrawRect(11f, y + 30f - 2f, 288f, 1f, RowDivider);
}
private static void DrawTick(float x, float y)
{
//IL_0012: 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)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
DrawRect(x, y + 6f, 3f, 3f, Success);
DrawRect(x + 3f, y + 9f, 3f, 3f, Success);
DrawRect(x + 6f, y + 12f, 3f, 3f, Success);
DrawRect(x + 9f, y + 9f, 3f, 3f, Success);
DrawRect(x + 12f, y + 6f, 3f, 3f, Success);
DrawRect(x + 15f, y + 3f, 3f, 3f, Success);
DrawRect(x + 18f, y, 3f, 3f, Success);
}
private string FitText(string value, float availableWidth, GUIStyle style, bool completed)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
if (string.IsNullOrEmpty(value))
{
return "Daily quest";
}
Dictionary<string, string> dictionary = (completed ? _fittedCompletedLabels : _fittedLabels);
if (dictionary.TryGetValue(value, out var value2))
{
return value2;
}
if (style.CalcSize(new GUIContent(value)).x <= availableWidth)
{
dictionary[value] = value;
return value;
}
int num = 0;
int num2 = value.Length;
while (num < num2)
{
int num3 = (num + num2 + 1) / 2;
string text = value.Substring(0, num3) + "…";
if (style.CalcSize(new GUIContent(text)).x <= availableWidth)
{
num = num3;
}
else
{
num2 = num3 - 1;
}
}
return dictionary[value] = value.Substring(0, num) + "…";
}
private void InitializeStyles()
{
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
Font[] array = Resources.FindObjectsOfTypeAll<Font>();
foreach (Font val in array)
{
if (!((Object)(object)val == (Object)null))
{
if (((Object)val).name == "Jersey10-Regular")
{
_font = val;
break;
}
if ((Object)(object)_font == (Object)null && ((Object)val).name == "Jersey10-Regular2")
{
_font = val;
}
}
}
if ((Object)(object)_font == (Object)null)
{
try
{
_font = Resources.GetBuiltinResource<Font>("Arial.ttf");
}
catch (Exception)
{
}
}
_heading = MakeStyle(18, GoldText, (TextAnchor)3);
_rowTitle = MakeStyle(17, PrimaryText, (TextAnchor)3);
_rowDone = MakeStyle(17, Success, (TextAnchor)3);
_rowCounter = MakeStyle(16, GoldText, (TextAnchor)5);
_rowCounterDone = MakeStyle(16, Success, (TextAnchor)5);
_subtle = MakeStyle(13, SecondaryText, (TextAnchor)4);
_emptyTitle = MakeStyle(15, PrimaryText, (TextAnchor)4);
}
private GUIStyle MakeStyle(int fontSize, Color color, TextAnchor alignment)
{
//IL_000a: 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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Expected O, but got Unknown
//IL_0083: Expected O, but got Unknown
GUIStyle val = new GUIStyle(GUI.skin.label)
{
font = _font,
fontSize = fontSize,
fontStyle = (FontStyle)((!((Object)(object)_font != (Object)null) || !((Object)_font).name.StartsWith("Jersey10", StringComparison.OrdinalIgnoreCase)) ? 1 : 0)
};
val.normal.textColor = color;
val.alignment = alignment;
val.wordWrap = false;
val.clipping = (TextClipping)1;
val.padding = new RectOffset(0, 0, 0, 0);
return val;
}
private static void DrawRect(float x, float y, float w, float h, Color color)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
Color color2 = GUI.color;
GUI.color = color;
GUI.DrawTexture(new Rect(x, y, Mathf.Max(0f, w), Mathf.Max(0f, h)), (Texture)(object)Texture2D.whiteTexture);
GUI.color = color2;
}
private static void DrawFrame(float width, float height)
{
//IL_0016: 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)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
DrawRect(8f, 0f, width - 16f, 2f, GoldFrame);
DrawRect(5f, 2f, 3f, 2f, GoldFrame);
DrawRect(2f, 5f, 3f, 2f, GoldFrame);
DrawRect(width - 8f, 2f, 3f, 2f, GoldFrame);
DrawRect(width - 5f, 5f, 3f, 2f, GoldFrame);
DrawRect(0f, 7f, 2f, height - 14f, GoldFrame);
DrawRect(width - 2f, 7f, 2f, height - 14f, GoldFrame);
DrawRect(8f, height - 2f, width - 16f, 2f, GoldFrame);
DrawRect(5f, height - 4f, 3f, 2f, GoldFrame);
DrawRect(2f, height - 7f, 3f, 2f, GoldFrame);
DrawRect(width - 8f, height - 4f, 3f, 2f, GoldFrame);
DrawRect(width - 5f, height - 7f, 3f, 2f, GoldFrame);
}
}
}