using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using IceBoxModLib.Config;
using IceBoxModLib.Localization;
using IceBoxModLib.Runtime;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Interaction.Dragging;
using Player;
using StockShelfBeacon.Configuration;
using StockShelfBeacon.Localization;
using StockShelfBeacon.Runtime;
using Store;
using UnityEngine;
using UnityEngine.Rendering;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("StockShelfBeacon")]
[assembly: AssemblyDescription("Stock Shelf Beacon mod for Roadside Research by Ice Box Studio")]
[assembly: AssemblyCompany("Ice Box Studio")]
[assembly: AssemblyProduct("StockShelfBeacon")]
[assembly: AssemblyCopyright("Copyright © 2026 Ice Box Studio All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("287d326b-ba55-445e-8137-7f36de08660c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace StockShelfBeacon
{
public static class PluginInfo
{
public const string PLUGIN_GUID = "IceBoxStudio.RoadsideResearch.StockShelfBeacon";
public const string PLUGIN_NAME = "StockShelfBeacon";
public const string PLUGIN_VERSION = "1.0.0";
}
[BepInPlugin("IceBoxStudio.RoadsideResearch.StockShelfBeacon", "StockShelfBeacon", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class StockShelfBeacon : BasePlugin
{
public static StockShelfBeacon _Instance;
private Harmony _harmony;
private bool patchesApplied;
public static StockShelfBeacon Instance => _Instance;
internal static ManualLogSource Log { get; private set; }
public override void Load()
{
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Expected O, but got Unknown
_Instance = this;
Log = ((BasePlugin)this).Log;
bool flag = default(bool);
try
{
Log.LogInfo((object)"=============================================");
ManualLogSource log = Log;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(1, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("StockShelfBeacon");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(LocalizationManager.Instance.GetLocalizedText("plugin.initializing"));
}
log.LogInfo(val);
ManualLogSource log2 = Log;
val = new BepInExInfoLogInterpolatedStringHandler(54, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(LocalizationManager.Instance.GetLocalizedText("plugin.author_prefix"));
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Ice Box Studio(https://steamcommunity.com/id/ibox666/)");
}
log2.LogInfo(val);
ConfigManager.Initialize(((BasePlugin)this).Config);
ShelfBeaconBootstrap.Initialize();
ApplyPatches();
ManualLogSource log3 = Log;
val = new BepInExInfoLogInterpolatedStringHandler(1, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("StockShelfBeacon");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(LocalizationManager.Instance.GetLocalizedText("plugin.initialized"));
}
log3.LogInfo(val);
Log.LogInfo((object)"=============================================");
}
catch (Exception ex)
{
ManualLogSource log4 = Log;
BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(9, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("StockShelfBeacon");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" 初始化错误: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("\n");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.StackTrace);
}
log4.LogError(val2);
}
}
private void ApplyPatches()
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
if (!patchesApplied)
{
try
{
_harmony = new Harmony("IceBoxStudio.RoadsideResearch.StockShelfBeacon");
_harmony.PatchAll();
patchesApplied = true;
return;
}
catch (Exception ex)
{
ManualLogSource log = Log;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(10, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("StockShelfBeacon");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" 应用补丁错误: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\n");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.StackTrace);
}
log.LogError(val);
return;
}
}
Log.LogInfo((object)LocalizationManager.Instance.GetLocalizedText("plugin.patches_skipped"));
}
}
}
namespace StockShelfBeacon.Runtime
{
public static class ShelfBeaconBootstrap
{
private const string SystemObjectName = "RoadsideResearch.StockShelfBeacon.System";
public static void Initialize()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
Il2CppTypeRegistry.RegisterType<ShelfBeaconSystem>();
Il2CppTypeRegistry.RegisterType<ShelfBeaconVisual>();
GameObject val = FindExistingSystemObject();
if ((Object)(object)val == (Object)null)
{
val = new GameObject("RoadsideResearch.StockShelfBeacon.System");
Object.DontDestroyOnLoad((Object)(object)val);
}
if ((Object)(object)val.GetComponent<ShelfBeaconSystem>() == (Object)null)
{
val.AddComponent<ShelfBeaconSystem>();
}
}
private static GameObject FindExistingSystemObject()
{
GameObject[] array = Il2CppArrayBase<GameObject>.op_Implicit(Resources.FindObjectsOfTypeAll<GameObject>());
foreach (GameObject val in array)
{
if ((Object)(object)val != (Object)null && ((Object)val).name == "RoadsideResearch.StockShelfBeacon.System")
{
return val;
}
}
return null;
}
}
public class ShelfBeaconSystem : MonoBehaviour
{
private const float RefreshInterval = 0.15f;
private const string VisualObjectName = "StockShelfBeacon.Visual";
private Dictionary<int, ShelfBeaconVisual> _activeVisuals;
private float _nextRefreshTime;
private IntPtr _lastTrackedItemPtr;
public ShelfBeaconSystem(IntPtr ptr)
: base(ptr)
{
}
private void Awake()
{
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
}
private void Update()
{
EnsureState();
if (!IsFeatureEnabled())
{
ResetTracking();
}
else if (!(Time.time < _nextRefreshTime))
{
_nextRefreshTime = Time.time + 0.15f;
Box heldBox = GetHeldBox();
IntPtr intPtr = IL2CPP.Il2CppObjectBaseToPtr((Il2CppObjectBase)(object)GetTrackedItem(heldBox));
if (intPtr == IntPtr.Zero)
{
ResetTracking();
return;
}
RefreshHighlights(intPtr);
_lastTrackedItemPtr = intPtr;
}
}
[HideFromIl2Cpp]
private void EnsureState()
{
if (_activeVisuals == null)
{
_activeVisuals = new Dictionary<int, ShelfBeaconVisual>();
}
}
[HideFromIl2Cpp]
private bool IsFeatureEnabled()
{
ConfigManager instance = ConfigManager.Instance;
if (instance != null && instance.EnableStockShelfBeacon != null)
{
return instance.EnableStockShelfBeacon.Value;
}
return false;
}
[HideFromIl2Cpp]
private Box GetHeldBox()
{
PlayerInfo localPlayer = PlayerInfo.LocalPlayer;
if ((Object)(object)localPlayer == (Object)null)
{
return null;
}
DragRigidbody dragRigidbody = localPlayer.DragRigidbody;
if ((Object)(object)dragRigidbody == (Object)null)
{
return null;
}
DraggableItem currentDraggable = dragRigidbody.CurrentDraggable;
if ((Object)(object)currentDraggable == (Object)null)
{
return null;
}
return ((Component)currentDraggable).GetComponent<Box>();
}
[HideFromIl2Cpp]
private Item GetTrackedItem(Box heldBox)
{
if ((Object)(object)heldBox == (Object)null)
{
return null;
}
if ((Object)(object)((ItemContainer)heldBox).Item != (Object)null)
{
return ((ItemContainer)heldBox).Item;
}
if ((Object)(object)heldBox.StoreEntry != (Object)null)
{
return heldBox.StoreEntry.Item;
}
return null;
}
[HideFromIl2Cpp]
private void ResetTracking()
{
_lastTrackedItemPtr = IntPtr.Zero;
ClearAllVisuals();
}
[HideFromIl2Cpp]
private void RefreshHighlights(IntPtr trackedItemPtr)
{
HashSet<int> targetShelfIds = new HashSet<int>();
bool shouldRefreshGeometry = trackedItemPtr != _lastTrackedItemPtr;
IEnumerable<Shelf> allShelves = StoreManager.GetAllShelves();
if (allShelves != null)
{
EnumerableExtensions.ForEach<Shelf>(allShelves, Action<Shelf>.op_Implicit((Action<Shelf>)delegate(Shelf shelf)
{
if (IsShelfMatch(shelf, trackedItemPtr))
{
int instanceID = ((Object)shelf).GetInstanceID();
targetShelfIds.Add(instanceID);
EnsureVisual(instanceID, shelf, shouldRefreshGeometry);
}
}));
}
RemoveUnusedVisuals(targetShelfIds);
}
[HideFromIl2Cpp]
private bool IsShelfMatch(Shelf shelf, IntPtr trackedItemPtr)
{
if ((Object)(object)shelf == (Object)null)
{
return false;
}
IntPtr intPtr = IL2CPP.Il2CppObjectBaseToPtr((Il2CppObjectBase)(object)((ItemContainer)shelf).Item);
if (intPtr != IntPtr.Zero)
{
return intPtr == trackedItemPtr;
}
return false;
}
[HideFromIl2Cpp]
private void EnsureVisual(int shelfId, Shelf shelf, bool shouldRefreshGeometry)
{
//IL_001e: 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)
if (!_activeVisuals.TryGetValue(shelfId, out var value) || (Object)(object)value == (Object)null)
{
GameObject val = new GameObject("StockShelfBeacon.Visual");
val.transform.SetParent(((Component)shelf).transform, false);
value = val.AddComponent<ShelfBeaconVisual>();
value.Bind(shelf);
_activeVisuals[shelfId] = value;
}
value.Refresh(shouldRefreshGeometry);
}
[HideFromIl2Cpp]
private void RemoveUnusedVisuals(HashSet<int> targetShelfIds)
{
if (_activeVisuals.Count == 0)
{
return;
}
List<int> list = new List<int>();
foreach (KeyValuePair<int, ShelfBeaconVisual> activeVisual in _activeVisuals)
{
if (!targetShelfIds.Contains(activeVisual.Key) || (Object)(object)activeVisual.Value == (Object)null)
{
list.Add(activeVisual.Key);
}
}
for (int i = 0; i < list.Count; i++)
{
int key = list[i];
ShelfBeaconVisual shelfBeaconVisual = _activeVisuals[key];
if ((Object)(object)shelfBeaconVisual != (Object)null)
{
Object.Destroy((Object)(object)((Component)shelfBeaconVisual).gameObject);
}
_activeVisuals.Remove(key);
}
}
[HideFromIl2Cpp]
private void ClearAllVisuals()
{
if (_activeVisuals == null || _activeVisuals.Count == 0)
{
return;
}
foreach (KeyValuePair<int, ShelfBeaconVisual> activeVisual in _activeVisuals)
{
if ((Object)(object)activeVisual.Value != (Object)null)
{
Object.Destroy((Object)(object)((Component)activeVisual.Value).gameObject);
}
}
_activeVisuals.Clear();
}
}
public class ShelfBeaconVisual : MonoBehaviour
{
private const float MarkerOffset = 0.05f;
private const float PulseSpeed = 2.6f;
private const float Padding = 0.05f;
private const float FrameWidth = 0.045f;
private const float PulseWidthBoost = 0.04f;
private const float PulseDepthBoost = 0.04f;
private const float ArrowWidth = 0.12f;
private const float ArrowHeight = 0.12f;
private const float ArrowBaseOffset = 0.2f;
private const float ArrowBounceSpeed = 3.5f;
private const float ArrowBounceAmount = 0.15f;
private const float ArrowLineWidth = 0.04f;
private Shelf _shelf;
private LineRenderer _frameRenderer;
private LineRenderer _arrowRenderer;
private Material _material;
private Vector3 _markerCenterCache;
private Vector3 _normalAxisCache;
private Vector3 _rightAxisCache;
private Vector3 _depthAxisCache;
public ShelfBeaconVisual(IntPtr ptr)
: base(ptr)
{
}
[HideFromIl2Cpp]
public void Bind(Shelf shelf)
{
_shelf = shelf;
EnsureRenderers();
UpdateGeometry();
}
[HideFromIl2Cpp]
public void Refresh(bool shouldRefreshGeometry)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_shelf == (Object)null))
{
if (shouldRefreshGeometry)
{
UpdateGeometry();
}
UpdateArrowRealtime();
Color val = ParseHexColor(ConfigManager.Instance.BeaconColorHex.Value);
float num = val.a * 0.68f + Mathf.PingPong(Time.time * 2.6f, 0.22f);
Color color = default(Color);
((Color)(ref color))..ctor(val.r, val.g, val.b, Mathf.Clamp01(num));
ApplyColor(color);
}
}
[HideFromIl2Cpp]
private Color ParseHexColor(string hex)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
if (string.IsNullOrEmpty(hex))
{
return new Color(0.18f, 0.92f, 1f, 1f);
}
hex = hex.Replace("#", "");
try
{
byte b = byte.MaxValue;
byte b2 = byte.MaxValue;
byte b3 = byte.MaxValue;
if (hex.Length >= 6)
{
byte num = byte.Parse(hex.Substring(0, 2), NumberStyles.HexNumber);
b = byte.Parse(hex.Substring(2, 2), NumberStyles.HexNumber);
b2 = byte.Parse(hex.Substring(4, 2), NumberStyles.HexNumber);
if (hex.Length >= 8)
{
b3 = byte.Parse(hex.Substring(6, 2), NumberStyles.HexNumber);
}
return new Color((float)(int)num / 255f, (float)(int)b / 255f, (float)(int)b2 / 255f, (float)(int)b3 / 255f);
}
}
catch (Exception)
{
}
return new Color(0.18f, 0.92f, 1f, 1f);
}
[HideFromIl2Cpp]
private void EnsureRenderers()
{
if (!((Object)(object)_frameRenderer != (Object)null) || !((Object)(object)_arrowRenderer != (Object)null))
{
_material = CreateMaterial();
_frameRenderer = CreateRenderer("Frame", 0.045f, 4, loop: true);
_arrowRenderer = CreateRenderer("Arrow", 0.04f, 3, loop: false);
}
}
[HideFromIl2Cpp]
private LineRenderer CreateRenderer(string rendererName, float width, int positionCount, bool loop)
{
//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)
GameObject val = new GameObject(rendererName);
val.transform.SetParent(((Component)this).transform, false);
LineRenderer val2 = val.AddComponent<LineRenderer>();
val2.useWorldSpace = true;
val2.alignment = (LineAlignment)0;
val2.textureMode = (LineTextureMode)0;
val2.numCapVertices = 6;
val2.numCornerVertices = 6;
val2.widthMultiplier = width;
((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0;
((Renderer)val2).receiveShadows = false;
val2.loop = loop;
val2.positionCount = positionCount;
if ((Object)(object)_material != (Object)null)
{
((Renderer)val2).material = _material;
}
return val2;
}
[HideFromIl2Cpp]
private Material CreateMaterial()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
Shader val = Shader.Find("Sprites/Default");
if ((Object)(object)val == (Object)null)
{
val = Shader.Find("Hidden/Internal-Colored");
}
if ((Object)(object)val == (Object)null)
{
return null;
}
return new Material(val);
}
[HideFromIl2Cpp]
private void UpdateGeometry()
{
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: 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_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_shelf == (Object)null || (Object)(object)_frameRenderer == (Object)null || (Object)(object)_arrowRenderer == (Object)null || !((Component)_shelf).gameObject.activeInHierarchy)
{
return;
}
Item item = ((ItemContainer)_shelf).Item;
if ((Object)(object)item == (Object)null)
{
return;
}
int num = default(int);
int num2 = default(int);
int num3 = ((ItemContainer)_shelf).CalculateCapacity(item, ref num, ref num2);
if (num3 <= 0)
{
return;
}
Transform transform = ((Component)_shelf).transform;
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(float.MaxValue, float.MaxValue, float.MaxValue);
Vector3 val2 = default(Vector3);
((Vector3)(ref val2))..ctor(float.MinValue, float.MinValue, float.MinValue);
try
{
for (int i = 0; i < num3; i++)
{
Vector3 itemPositionWorldSpace = ((ItemContainer)_shelf).GetItemPositionWorldSpace(i);
Vector3 val3 = transform.InverseTransformPoint(itemPositionWorldSpace);
val = Vector3.Min(val, val3);
val2 = Vector3.Max(val2, val3);
}
}
catch (Exception)
{
return;
}
if (val.x != float.MaxValue)
{
Vector3 shelfSize = item.ShelfSize;
val.x -= shelfSize.x * 0.5f + 0.05f;
val2.x += shelfSize.x * 0.5f + 0.05f;
val.z -= shelfSize.z * 0.5f + 0.05f;
val2.z += shelfSize.z * 0.5f + 0.05f;
Vector3 val4 = (val + val2) * 0.5f;
float num4 = (val2.x - val.x) * 0.5f;
float num5 = (val2.z - val.z) * 0.5f;
Vector3 val5 = transform.right;
_rightAxisCache = ((Vector3)(ref val5)).normalized;
val5 = transform.forward;
_depthAxisCache = ((Vector3)(ref val5)).normalized;
val5 = transform.up;
_normalAxisCache = ((Vector3)(ref val5)).normalized;
_markerCenterCache = transform.TransformPoint(val4) + _normalAxisCache * 0.05f;
float num6 = Mathf.PingPong(Time.time * 2.6f, 0.04f);
float num7 = Mathf.PingPong(Time.time * 2.6f, 0.04f);
SetRectangle(_frameRenderer, _markerCenterCache, _rightAxisCache, _depthAxisCache, num4 + num6, num5 + num7);
}
}
[HideFromIl2Cpp]
private void UpdateArrowRealtime()
{
//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_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: 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_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: 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_00d5: 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_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: 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)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: 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)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_arrowRenderer == (Object)null) && !(_markerCenterCache == Vector3.zero))
{
float num = Mathf.PingPong(Time.time * 3.5f, 0.15f);
Vector3 val = _markerCenterCache + _normalAxisCache * (0.2f + num);
Vector3 val2 = (((Object)(object)Camera.main != (Object)null) ? ((Component)Camera.main).transform.position : (val + _depthAxisCache)) - val;
Vector3 normalized = ((Vector3)(ref val2)).normalized;
val2 = Vector3.Cross(_normalAxisCache, normalized);
Vector3 val3 = ((Vector3)(ref val2)).normalized;
if (val3 == Vector3.zero)
{
val3 = _rightAxisCache;
}
Vector3 val4 = val + _normalAxisCache * 0.12f - val3 * 0.12f;
Vector3 val5 = val + _normalAxisCache * 0.12f + val3 * 0.12f;
_arrowRenderer.positionCount = 3;
_arrowRenderer.SetPosition(0, val4);
_arrowRenderer.SetPosition(1, val);
_arrowRenderer.SetPosition(2, val5);
}
}
[HideFromIl2Cpp]
private void SetRectangle(LineRenderer lineRenderer, Vector3 center, Vector3 rightAxis, Vector3 depthAxis, float halfWidth, float halfDepth)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: 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_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: 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_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)lineRenderer == (Object)null))
{
Vector3 val = rightAxis * halfWidth;
Vector3 val2 = depthAxis * halfDepth;
lineRenderer.SetPosition(0, center - val - val2);
lineRenderer.SetPosition(1, center - val + val2);
lineRenderer.SetPosition(2, center + val + val2);
lineRenderer.SetPosition(3, center + val - val2);
}
}
[HideFromIl2Cpp]
private void ApplyColor(Color color)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: 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_0060: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_frameRenderer != (Object)null)
{
_frameRenderer.startColor = color;
_frameRenderer.endColor = color;
}
if ((Object)(object)_arrowRenderer != (Object)null)
{
_arrowRenderer.startColor = color;
_arrowRenderer.endColor = color;
}
if ((Object)(object)_material != (Object)null)
{
_material.color = color;
}
}
}
}
namespace StockShelfBeacon.Localization
{
public static class LocalizationHelper
{
public static Dictionary<string, string> GetDefaultTranslations(string language)
{
Dictionary<string, string> dictionary = new Dictionary<string, string>();
switch (language)
{
case "简体中文":
dictionary.Add("plugin.initializing", "开始初始化...");
dictionary.Add("plugin.author_prefix", "作者:");
dictionary.Add("plugin.initialized", "初始化成功!");
dictionary.Add("plugin.patches_skipped", "补丁已应用,跳过...");
dictionary.Add("config.enable_stock_shelf_beacon.desc", "启用当玩家手持货箱时高亮显示对应货架");
dictionary.Add("config.beacon_color_hex.desc", "自定义高亮框的颜色(十六进制格式,例如 #RRGGBB 或 #RRGGBBAA)");
break;
case "繁體中文":
dictionary.Add("plugin.initializing", "開始初始化...");
dictionary.Add("plugin.author_prefix", "作者:");
dictionary.Add("plugin.initialized", "初始化成功!");
dictionary.Add("plugin.patches_skipped", "補丁已應用,跳過...");
dictionary.Add("config.enable_stock_shelf_beacon.desc", "啟用當玩家手持貨箱時高亮顯示對應貨架");
dictionary.Add("config.beacon_color_hex.desc", "自訂高亮框的顏色(十六進位格式,例如 #RRGGBB 或 #RRGGBBAA)");
break;
case "English":
dictionary.Add("plugin.initializing", "Initializing...");
dictionary.Add("plugin.author_prefix", "Author: ");
dictionary.Add("plugin.initialized", "Initialization successful!");
dictionary.Add("plugin.patches_skipped", "Patches already applied, skipping...");
dictionary.Add("config.enable_stock_shelf_beacon.desc", "Enable highlighting corresponding shelves when the player holds a stock box");
dictionary.Add("config.beacon_color_hex.desc", "Customize the color of the highlight frame (hex format, e.g., #RRGGBB or #RRGGBBAA)");
break;
case "日本語":
dictionary.Add("plugin.initializing", "初期化中...");
dictionary.Add("plugin.author_prefix", "作者:");
dictionary.Add("plugin.initialized", "初期化に成功しました!");
dictionary.Add("plugin.patches_skipped", "パッチは既に適用されています。スキップします...");
dictionary.Add("config.enable_stock_shelf_beacon.desc", "有効化して、プレイヤーが在庫箱を持っている間、対応する棚を強調表示する");
dictionary.Add("config.beacon_color_hex.desc", "ハイライト枠の色をカスタマイズする(16進数形式、例:#RRGGBB または #RRGGBBAA)");
break;
}
return dictionary;
}
}
public class LocalizationManager
{
private static LocalizationManager _instance;
private readonly ModLocalizationService _service;
public static readonly string[] SupportedLanguages = new string[4] { "简体中文", "繁體中文", "English", "日本語" };
public static LocalizationManager Instance => _instance ?? (_instance = new LocalizationManager());
private LocalizationManager()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
_service = new ModLocalizationService((IEnumerable<string>)SupportedLanguages, "English");
Initialize();
}
public void Initialize()
{
string[] supportedLanguages = SupportedLanguages;
foreach (string text in supportedLanguages)
{
Dictionary<string, string> defaultTranslations = LocalizationHelper.GetDefaultTranslations(text);
if (defaultTranslations != null && defaultTranslations.Count > 0)
{
_service.AddTranslations(text, defaultTranslations);
}
}
}
public string GetLocalizedText(string key, params object[] args)
{
return _service.GetText(key, args);
}
}
}
namespace StockShelfBeacon.Configuration
{
public class ConfigManager : ModConfigBase
{
private static ConfigManager _instance;
public ConfigEntry<bool> EnableStockShelfBeacon { get; private set; }
public ConfigEntry<string> BeaconColorHex { get; private set; }
public static ConfigManager Instance => _instance;
private ConfigManager(ConfigFile configFile)
: base(configFile)
{
InitializeDefaultConfigs();
}
public static void Initialize(ConfigFile configFile)
{
if (_instance == null)
{
_instance = new ConfigManager(configFile);
}
}
private void InitializeDefaultConfigs()
{
EnableStockShelfBeacon = ((ModConfigBase)this).RegisterBool("General", "EnableStockShelfBeacon", GetLocalizedDescription("config.enable_stock_shelf_beacon.desc"), true);
BeaconColorHex = ((ModConfigBase)this).RegisterString("Visuals", "BeaconColorHex", GetLocalizedDescription("config.beacon_color_hex.desc"), "#00FFFFFF");
}
private string GetLocalizedDescription(string key)
{
return LocalizationManager.Instance.GetLocalizedText(key);
}
}
}