Decompiled source of StoreOrganizer v0.7.0
plugins/StoreOrganizer.dll
Decompiled 41 minutes ago
The result has been truncated due to the large size, download it to view full contents!
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.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using System.Xml.Serialization; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using HarmonyLib; using HutongGames.PlayMaker; using Mirror; using StarterAssets; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyCompany("luizherber")] [assembly: AssemblyMetadata("Author", "luizherber")] [assembly: AssemblyVersion("0.0.0.0")] namespace StoreOrganizer; internal static class BoxTrip { internal static int LoadSize(int remaining, int boxCapacity, int sourceQuantity, int destinationRoom) { return Math.Max(0, Math.Min(Math.Min(remaining, boxCapacity), Math.Min(sourceQuantity, destinationRoom))); } internal static bool Conserved(int originalSource, int originalDestination, int source, int destination, int box) { if (source >= 0 && source <= originalSource && destination >= originalDestination && box >= 0) { return (long)source + (long)destination + box == (long)originalSource + (long)originalDestination; } return false; } } internal sealed class Product { public int Id; public int Category; public int Equipment; public string Name; public string Brand; public bool Available; public bool Stackable; public float X; public float Y; public float Z; public float? Price; } internal sealed class Slot { public string Id; public string Fixture; public string Sector; public int Index; public int Equipment; public int ProductId; public int Quantity; public int Priority; public int DesiredProduct = -1; public bool MapOnly; public string MapSource; public int MapQuantity; public bool Locked; public bool InScope = true; public bool IsDepot; public int BoxCapacity; public float Length; public float Width; public float Height; public float MinimumVolume; public int[] Categories = Array.Empty<int>(); public int Capacity(Product product) { if (product.Equipment != Equipment || !(Length > 0f) || !(Width > 0f) || !(Height > 0f) || !(product.X > 0f) || !(product.Y > 0f) || !(product.Z > 0f) || product.X * product.Y * product.Z < MinimumVolume) { return 0; } return Axis(Length, product.X) * Axis(Width, product.Z) * ((!product.Stackable) ? 1 : Axis(Height, product.Y)); } private static int Axis(float shelf, float item) { return (int)Math.Max(1.0, Math.Min(100.0, Math.Floor(shelf / (item * 1.1f)))); } public bool MatchesCategory(Product product) { if (product.Category >= 0) { return Categories.Contains(product.Category); } return false; } public bool Accepts(Product product) { if (MatchesCategory(product)) { if (DesiredProduct >= 0) { return DesiredProduct == product.Id; } return true; } return false; } public bool CanPlace(Product product, int currentId, int currentQuantity, bool swapSupport = false) { bool num; if (!swapSupport) { num = Accepts(product); } else { if (DesiredProduct < 0) { goto IL_0029; } num = DesiredProduct == product.Id; } if (num) { goto IL_0029; } goto IL_0058; IL_0029: if (Capacity(product) > currentQuantity) { if (currentId != product.Id) { if (currentQuantity == 0) { if (currentId >= 0) { return DesiredProduct == product.Id; } return true; } return false; } return true; } goto IL_0058; IL_0058: return false; } } internal enum MovePurpose { Standard, SwapBuffer, SwapTarget, SwapReturn, Depot } internal sealed class Move { public Slot From; public Slot To; public Product Product; public MovePurpose Purpose; public bool EndsSwap; public bool MapRequest; public int Quantity; public bool UsesSwapSupport { get { if (Purpose != MovePurpose.SwapBuffer) { return Purpose == MovePurpose.SwapReturn; } return true; } } internal void RecordConfirmedUnit() { From.Quantity--; if (From.Quantity == 0) { From.ProductId = -1; } To.ProductId = Product.Id; To.Quantity++; } } internal sealed class Plan { public string Fingerprint; public readonly List<Move> Moves = new List<Move>(); public readonly List<string> Issues = new List<string>(); } internal static class Planner { public static Plan Create(IReadOnlyList<Slot> slots, IReadOnlyDictionary<int, Product> products) { Slot[] array = slots.OrderBy<Slot, string>((Slot s) => s.Id, StringComparer.Ordinal).ToArray(); Plan plan = new Plan { Fingerprint = Fingerprint(array, products) }; if (array.Any((Slot s) => string.IsNullOrWhiteSpace(s.Id) || s.Quantity < 0 || (s.Quantity > 0 && s.ProductId < 0)) || array.Select((Slot s) => s.Id).Distinct<string>(StringComparer.Ordinal).Count() != array.Length) { plan.Issues.Add(InterfaceLanguage.T("Inventário inválido ou IDs de slot duplicados. Atualize a leitura.", "Invalid inventory or duplicate slot IDs. Refresh the inventory.")); return plan; } Dictionary<string, int> current = array.ToDictionary<Slot, string, int>((Slot s) => s.Id, (Slot s) => s.Quantity, StringComparer.Ordinal); Dictionary<string, int> dictionary = array.ToDictionary<Slot, string, int>((Slot s) => s.Id, (Slot s) => s.ProductId, StringComparer.Ordinal); Dictionary<string, Slot> dictionary2 = array.ToDictionary<Slot, string>((Slot slot) => slot.Id, StringComparer.Ordinal); foreach (Slot item in array.Where((Slot slot) => slot.MapQuantity > 0)) { if (!products.TryGetValue(item.DesiredProduct, out var value) || !value.Available || item.Locked || item.IsDepot || string.IsNullOrEmpty(item.MapSource) || !dictionary2.TryGetValue(item.MapSource, out var value2) || value2 == item || value2.Locked || value2.IsDepot || dictionary[value2.Id] != value.Id || current[value2.Id] < item.MapQuantity || !item.CanPlace(value, dictionary[item.Id], current[item.Id]) || (long)current[item.Id] + (long)item.MapQuantity > item.Capacity(value)) { plan.Issues.Add(InterfaceLanguage.T($"{item.Fixture} [{item.Index + 1}] · pedido do mapa pendente: confira a origem, o estoque e o espaço no destino.", $"{item.Fixture} [{item.Index + 1}] · pending map request: check the source, stock and destination capacity.")); continue; } AddMove(value2, item, value, item.MapQuantity, current, dictionary, plan.Moves); plan.Moves[plan.Moves.Count - 1].MapRequest = true; } HashSet<Slot> usedForReturn = new HashSet<Slot>(); HashSet<Slot> usedForBuffer = new HashSet<Slot>(); Dictionary<(int Category, int Equipment), List<Slot>> destinations = new Dictionary<(int, int), List<Slot>>(); foreach (Slot item2 in array.Where((Slot s) => s.InScope && !s.IsDepot && !s.Locked && !s.MapOnly)) { foreach (int item3 in item2.Categories.Distinct()) { (int, int) key = (item3, item2.Equipment); if (!destinations.TryGetValue(key, out var value3)) { destinations.Add(key, value3 = new List<Slot>()); } value3.Add(item2); } } List<Slot> list = array.Where((Slot s) => s.InScope && !s.Locked && !s.MapOnly && s.DesiredProduct >= 0).ToList(); Dictionary<Slot, string> dictionary3 = new Dictionary<Slot, string>(); int count; do { count = list.Count; Slot[] array2 = list.ToArray(); foreach (Slot target in array2) { int wanted = target.DesiredProduct; if (!products.TryGetValue(wanted, out var desired) || !desired.Available || !target.Accepts(desired) || target.Capacity(desired) == 0) { plan.Issues.Add(InterfaceLanguage.T($"{target.Fixture} [{target.Index + 1}] · escolha indisponível ou incompatível.", $"{target.Fixture} [{target.Index + 1}] · selection unavailable or incompatible.")); list.Remove(target); continue; } if (dictionary[target.Id] == wanted && current[target.Id] > 0) { list.Remove(target); continue; } List<Move> list2 = new List<Move>(); Dictionary<string, int> quantities = new Dictionary<string, int>(current, StringComparer.Ordinal); Dictionary<string, int> ids = new Dictionary<string, int>(dictionary, StringComparer.Ordinal); if (quantities[target.Id] > 0) { if (!products.TryGetValue(ids[target.Id], out var value4) || !value4.Available || !TrySwap(array, target, desired, value4, quantities, ids, list2, out var donor)) { dictionary3[target] = InterfaceLanguage.T($"{target.Fixture} [{target.Index + 1}] · troca pendente: confira a capacidade dos slots de apoio e o espaço em caixas do mesmo produto no depósito.", $"{target.Fixture} [{target.Index + 1}] · swap pending: check temporary slot capacity and space in storage boxes for this product."); continue; } usedForReturn.Add(donor); foreach (Move item4 in list2.Where((Move move) => move.Purpose == MovePurpose.SwapBuffer)) { usedForBuffer.Add(item4.To); } current = quantities; dictionary = ids; plan.Moves.AddRange(list2); list.Remove(target); continue; } int num2 = target.Capacity(desired); foreach (Slot item5 in (from s in array where s.InScope && !s.IsDepot && s != target && !s.Locked && !usedForReturn.Contains(s) && s.DesiredProduct != wanted && ids[s.Id] == wanted && quantities[s.Id] > 0 orderby s.Accepts(desired), quantities[s.Id] descending select s).ThenBy<Slot, string>((Slot s) => s.Id, StringComparer.Ordinal)) { int num3 = Math.Min(quantities[item5.Id], num2 - quantities[target.Id]); if (num3 == 0) { break; } AddMove(item5, target, desired, num3, quantities, ids, list2); } if (quantities[target.Id] == 0) { dictionary3[target] = InterfaceLanguage.T($"{target.Fixture} [{target.Index + 1}] · {desired.Name} sem estoque disponível no escopo. Troca pendente.", $"{target.Fixture} [{target.Index + 1}] · {desired.Name} is out of stock in this scope. Swap pending."); continue; } current = quantities; dictionary = ids; plan.Moves.AddRange(list2); list.Remove(target); } } while (list.Count > 0 && list.Count < count); foreach (Slot item6 in list) { plan.Issues.Add(dictionary3[item6]); } foreach (Slot item7 in array.Where((Slot s) => s.InScope && !s.IsDepot && !s.Locked && !usedForReturn.Contains(s) && s.DesiredProduct < 0 && current[s.Id] > 0)) { if (!products.TryGetValue(dictionary[item7.Id], out var value5) || !value5.Available || value5.Category < 0) { plan.Issues.Add(item7.Id + InterfaceLanguage.T(" · produto sem categoria, desconhecido ou bloqueado.", " · product uncategorized, unknown or locked.")); } else if (!item7.Accepts(value5)) { int num4 = Distribute(item7, value5, from slot in Candidates(value5) where !usedForBuffer.Contains(slot) select slot, current, dictionary, plan.Moves); if (num4 > 0) { plan.Issues.Add(InterfaceLanguage.T($"{item7.Id} · {num4} un. de {value5.Name} permanecem na origem por falta de destino.", $"{item7.Id} · {num4} units of {value5.Name} remain at the source because there is no destination.")); } } } return plan; IEnumerable<Slot> Candidates(Product product) { if (!destinations.TryGetValue((product.Category, product.Equipment), out var value6)) { return Array.Empty<Slot>(); } return value6; } } private static bool TrySwap(Slot[] slots, Slot target, Product desired, Product previous, Dictionary<string, int> quantities, Dictionary<string, int> ids, List<Move> moves, out Slot donor) { int outgoing = quantities[target.Id]; int targetCapacity = target.Capacity(desired); var array = (from s in slots where s != target && !s.IsDepot && !s.Locked && s.DesiredProduct < 0 && quantities[s.Id] == 0 && ids[s.Id] < 0 && s.Capacity(previous) > 0 select new { Slot = s, Capacity = s.Capacity(previous) } into b orderby b.Capacity descending select b).ThenBy(b => b.Slot.Id, StringComparer.Ordinal).ToArray(); long bufferSpace = array.Sum(b => (long)b.Capacity); Slot[] array2 = DepotBoxes(slots, previous.Id, quantities, ids).ToArray(); Slot[] array3 = DepotBoxes(slots, desired.Id, quantities, ids).ToArray(); long oldSpace = array2.Sum((Slot s) => (long)s.BoxCapacity - (long)quantities[s.Id]); long newSpace = array3.Sum((Slot s) => (long)s.BoxCapacity - (long)quantities[s.Id]); donor = (from s in slots where s.InScope && !s.IsDepot && s != target && !s.Locked && (s.DesiredProduct < 0 || s.DesiredProduct == previous.Id) && ids[s.Id] == desired.Id && quantities[s.Id] > 0 && s.Capacity(previous) > 0 && Math.Min(outgoing, s.Capacity(previous)) <= bufferSpace && outgoing - Math.Min(outgoing, s.Capacity(previous)) <= oldSpace && quantities[s.Id] - Math.Min(quantities[s.Id], targetCapacity) <= newSpace orderby (long)Math.Max(0, outgoing - s.Capacity(previous)) + (long)Math.Max(0, quantities[s.Id] - targetCapacity), s.DesiredProduct == previous.Id descending, quantities[s.Id] descending select s).ThenBy<Slot, string>((Slot s) => s.Id, StringComparer.Ordinal).FirstOrDefault(); if (donor == null) { return false; } int num = Math.Min(outgoing, donor.Capacity(previous)); int num2 = num; var array4 = array; foreach (var anon in array4) { int num4 = Math.Min(anon.Capacity, num2); if (num4 == 0) { break; } AddMove(target, anon.Slot, previous, num4, quantities, ids, moves, MovePurpose.SwapBuffer); num2 -= num4; } int count = moves.Count; StoreExcess(target, previous, outgoing - num, array2, quantities, ids, moves); int num5 = Math.Min(quantities[donor.Id], targetCapacity); StoreExcess(donor, desired, quantities[donor.Id] - num5, array3, quantities, ids, moves); AddMove(donor, target, desired, num5, quantities, ids, moves, MovePurpose.SwapTarget); for (int num6 = 0; num6 < count; num6++) { Slot to = moves[num6].To; AddMove(to, donor, previous, quantities[to.Id], quantities, ids, moves, MovePurpose.SwapReturn); } moves[moves.Count - 1].EndsSwap = true; return true; } private static IEnumerable<Slot> DepotBoxes(Slot[] slots, int productId, Dictionary<string, int> quantities, Dictionary<string, int> ids) { return (from s in slots where s.IsDepot && !s.Locked && ids[s.Id] == productId && quantities[s.Id] >= 0 && quantities[s.Id] < s.BoxCapacity orderby quantities[s.Id] descending select s).ThenBy<Slot, string>((Slot s) => s.Id, StringComparer.Ordinal); } private static void StoreExcess(Slot from, Product product, int amount, IEnumerable<Slot> boxes, Dictionary<string, int> quantities, Dictionary<string, int> ids, List<Move> moves) { foreach (Slot box in boxes) { int num = Math.Min(box.BoxCapacity - quantities[box.Id], amount); if (num == 0) { break; } AddMove(from, box, product, num, quantities, ids, moves, MovePurpose.Depot); amount -= num; } } private static int Distribute(Slot source, Product product, IEnumerable<Slot> eligible, Dictionary<string, int> quantities, Dictionary<string, int> ids, List<Move> moves) { foreach (var item in (from slot in eligible where slot != source && slot.CanPlace(product, ids[slot.Id], quantities[slot.Id]) select new { Slot = slot, Room = slot.Capacity(product) - quantities[slot.Id] } into x orderby x.Slot.DesiredProduct == product.Id descending, x.Slot.Priority descending, ids[x.Slot.Id] == product.Id descending, x.Room descending select x).ThenBy(x => x.Slot.Id, StringComparer.Ordinal)) { int num = Math.Min(item.Room, quantities[source.Id]); if (num == 0) { break; } AddMove(source, item.Slot, product, num, quantities, ids, moves); } return quantities[source.Id]; } private static void AddMove(Slot source, Slot target, Product product, int amount, Dictionary<string, int> quantities, Dictionary<string, int> ids, List<Move> moves, MovePurpose purpose = MovePurpose.Standard) { moves.Add(new Move { From = source, To = target, Product = product, Quantity = amount, Purpose = purpose }); quantities[source.Id] -= amount; if (quantities[source.Id] == 0) { ids[source.Id] = -1; } quantities[target.Id] += amount; ids[target.Id] = product.Id; } private static string Fingerprint(IEnumerable<Slot> slots, IReadOnlyDictionary<int, Product> products) { StringBuilder stringBuilder = new StringBuilder(); foreach (Slot slot in slots) { stringBuilder.AppendFormat(CultureInfo.InvariantCulture, "{0}:{1}:{2}:{3}:{4}:{5}:{6:R}:{7:R}:{8:R}:{9:R}:{10}:{11}:{12}:{13}:{14}:{15}:{16}:{17}\n", slot.Id, slot.ProductId, slot.Quantity, slot.Equipment, slot.Locked, slot.Priority, slot.Length, slot.Width, slot.Height, slot.MinimumVolume, string.Join(",", from i in slot.Categories.Distinct() orderby i select i), slot.DesiredProduct, slot.InScope, slot.IsDepot, slot.BoxCapacity, slot.MapOnly, slot.MapSource, slot.MapQuantity); } foreach (Product item in products.Values.OrderBy((Product p) => p.Id)) { stringBuilder.AppendFormat(CultureInfo.InvariantCulture, "{0}:{1}:{2}:{3}:{4}:{5:R}:{6:R}:{7:R}:{8:R}\n", item.Id, item.Category, item.Equipment, item.Available, item.Stackable, item.X, item.Y, item.Z, item.Price); } using SHA256 sHA = SHA256.Create(); return BitConverter.ToString(sHA.ComputeHash(Encoding.UTF8.GetBytes(stringBuilder.ToString()))); } } internal static class EmployeeFence { private const string Owner = "com.storeorganizer.supermarkettogether.pilot"; private static readonly MethodInfo Target = AccessTools.DeclaredMethod(typeof(NPC_Manager), "FixedUpdate", Type.EmptyTypes, (Type[])null); private static Harmony harmony; private static NPC_Manager manager; private static float expires; internal static void Install() { //IL_001a: 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_0046: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown if (!(Target == null) && harmony == null) { Harmony val = new Harmony("com.storeorganizer.supermarkettogether.pilot"); HarmonyMethod val2 = new HarmonyMethod(AccessTools.DeclaredMethod(typeof(EmployeeFence), "AllowTick", (Type[])null, (Type[])null)) { priority = 800 }; val.Patch((MethodBase)Target, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony = val; } } internal static bool Available() { if (harmony == null || Target == null) { return false; } Patches patchInfo = Harmony.GetPatchInfo((MethodBase)Target); if (patchInfo != null && patchInfo.Prefixes.Any((Patch p) => p.owner == "com.storeorganizer.supermarkettogether.pilot")) { return patchInfo.Owners.All((string owner) => owner == "com.storeorganizer.supermarkettogether.pilot"); } return false; } internal static bool TryAcquire(NPC_Manager npc) { if (!Object.op_Implicit((Object)(object)npc) || Object.op_Implicit((Object)(object)manager) || !Available()) { return false; } expires = Time.realtimeSinceStartup + 3.5f; manager = npc; return true; } internal static bool Renew(NPC_Manager npc) { if (!IsHeld(npc) || !Available()) { return false; } expires = Time.realtimeSinceStartup + 3.5f; return true; } internal static bool IsHeld(NPC_Manager npc) { if (Object.op_Implicit((Object)(object)manager) && (Object)(object)manager == (Object)(object)npc) { return Time.realtimeSinceStartup < expires; } return false; } internal static void Release() { manager = null; } internal static void Uninstall() { Release(); Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } harmony = null; } private static bool AllowTick(NPC_Manager __instance) { if (Object.op_Implicit((Object)(object)manager) && !((Object)(object)__instance != (Object)(object)manager)) { return Time.realtimeSinceStartup >= expires; } return true; } } internal sealed class Fixture { public Data_Container Container; public uint Id; public int Number; public string Locator; public string Description; public int[] Stock; public bool IsDepot; } internal sealed class Snapshot { public readonly List<Fixture> Fixtures = new List<Fixture>(); public readonly List<Fixture> Depot = new List<Fixture>(); public readonly Dictionary<int, Product> Products = new Dictionary<int, Product>(); public readonly SortedDictionary<int, string> Categories = new SortedDictionary<int, string>(); public readonly List<string> Issues = new List<string>(); } internal static class GameReader { public static bool InStore { get { if (Object.op_Implicit((Object)(object)GameData.Instance) && Object.op_Implicit((Object)(object)NPC_Manager.Instance) && Object.op_Implicit((Object)(object)NPC_Manager.Instance.shelvesOBJ) && Object.op_Implicit((Object)(object)ProductListing.Instance)) { return NetworkClient.active; } return false; } } public static string SaveName() { if (!NetworkServer.active || !InStore) { return null; } FsmVariables globalVariables = FsmVariables.GlobalVariables; object value; if (globalVariables == null) { value = null; } else { FsmString fsmString = globalVariables.GetFsmString("CurrentFilename"); value = ((fsmString != null) ? fsmString.Value : null); } return NoteIdentity.SaveSlot((string)value, Application.persistentDataPath); } public static bool IsTyping() { FsmVariables globalVariables = FsmVariables.GlobalVariables; if (globalVariables != null) { FsmBool obj = globalVariables.FindFsmBool("InChat"); if (((obj != null) ? new bool?(obj.Value) : ((bool?)null)) == true) { return true; } } GameObject val = (Object.op_Implicit((Object)(object)EventSystem.current) ? EventSystem.current.currentSelectedGameObject : null); if (!Object.op_Implicit((Object)(object)val)) { return false; } TMP_InputField componentInParent = val.GetComponentInParent<TMP_InputField>(); InputField componentInParent2 = val.GetComponentInParent<InputField>(); if (!Object.op_Implicit((Object)(object)componentInParent) || !componentInParent.isFocused) { if (Object.op_Implicit((Object)(object)componentInParent2)) { return componentInParent2.isFocused; } return false; } return true; } public static bool CanUseCursor() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (InStore && Cursor.visible && (int)Cursor.lockState == 0) { return !IsTyping(); } return false; } public static FsmBool GameplayInputGate() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 if ((int)Cursor.lockState != 1 || IsTyping()) { return null; } FirstPersonController instance = FirstPersonController.Instance; FsmVariables globalVariables = FsmVariables.GlobalVariables; FsmBool val = ((globalVariables != null) ? globalVariables.FindFsmBool("InOptions") : null); if (!Object.op_Implicit((Object)(object)instance) || !instance.allowPlayerInput || val == null || val.Value) { return null; } return val; } public static Snapshot Read() { //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_052a: Expected O, but got Unknown Snapshot snapshot = new Snapshot(); if (!InStore) { return snapshot; } ProductListing instance = ProductListing.Instance; HashSet<int> hashSet = new HashSet<int>(instance.availableProducts ?? new List<int>()); ProductData[] array = instance.productsData ?? Array.Empty<ProductData>(); for (int i = 0; i < array.Length; i++) { ProductData val = array[i]; if (val == null) { continue; } if (val.productID != i) { snapshot.Issues.Add(InterfaceLanguage.T($"Catálogo inconsistente no índice {i} (ID {val.productID}).", $"Catalog mismatch at index {i} (ID {val.productID}).")); continue; } int productTier = val.productTier; int num = ((instance.productGroups != null && productTier >= 0 && productTier < instance.productGroups.Length) ? instance.productGroups[productTier] : (-1)); if (num >= 0 && !snapshot.Categories.ContainsKey(num)) { snapshot.Categories.Add(num, Translate("productGroup" + num, InterfaceLanguage.T("Categoria ", "Category ") + num)); } snapshot.Products.Add(i, new Product { Id = i, Name = Translate("product" + i, InterfaceLanguage.T("Produto #", "Product #") + i), Brand = val.productBrand, Category = num, Equipment = val.productContainerClass, Available = hashSet.Contains(i), Stackable = val.isStackable, X = val.colliderSize.x, Y = val.colliderSize.y, Z = val.colliderSize.z, Price = ((instance.productPlayerPricing != null && i < instance.productPlayerPricing.Length) ? new float?(instance.productPlayerPricing[i]) : ((float?)null)) }); } Transform transform = NPC_Manager.Instance.shelvesOBJ.transform; HashSet<int> hashSet2 = new HashSet<int>(snapshot.Products.Values.Select((Product p) => p.Equipment)); List<Fixture> list = new List<Fixture>(); for (int num2 = 0; num2 < transform.childCount; num2++) { Data_Container component = ((Component)transform.GetChild(num2)).GetComponent<Data_Container>(); if (Object.op_Implicit((Object)(object)component) && ((Behaviour)component).isActiveAndEnabled && component.containerClass != 69 && component.containerClass != 99 && hashSet2.Contains(component.containerClass)) { if (((NetworkBehaviour)component).netId == 0 || component.productInfoArray == null || component.productInfoArray.Length == 0 || component.productInfoArray.Length % 2 != 0) { snapshot.Issues.Add(InterfaceLanguage.T($"Expositor {num2 + 1} indisponível ou com slots inválidos.", $"Fixture {num2 + 1} unavailable or has invalid slots.")); continue; } string locator = Locator(component); list.Add(new Fixture { Container = component, Id = ((NetworkBehaviour)component).netId, Number = num2 + 1, Locator = locator, Description = InterfaceLanguage.T($"{num2 + 1:D2} · {Translate(component.buildableTag, ((Object)((Component)component).gameObject).name)} (tipo {component.containerClass})", $"{num2 + 1:D2} · {Translate(component.buildableTag, ((Object)((Component)component).gameObject).name)} (type {component.containerClass})"), Stock = (int[])component.productInfoArray.Clone() }); } } foreach (IGrouping<uint, Fixture> item in from f in list group f by f.Id into g orderby g.Min((Fixture f) => f.Number) select g) { if (item.Count() == 1) { snapshot.Fixtures.Add(item.First()); } else { snapshot.Issues.Add(InterfaceLanguage.T($"ID de rede duplicado {item.Key}. Expositores ignorados.", $"Duplicate network ID {item.Key}. Fixtures skipped.")); } } GameObject storageOBJ = NPC_Manager.Instance.storageOBJ; if (Object.op_Implicit((Object)(object)storageOBJ)) { foreach (Transform item2 in storageOBJ.transform) { Transform val2 = item2; Data_Container shelf = ((Component)val2).GetComponent<Data_Container>(); if (Object.op_Implicit((Object)(object)shelf) && ((Behaviour)shelf).isActiveAndEnabled && ((NetworkBehaviour)shelf).netId != 0 && shelf.containerClass == 69 && shelf.productInfoArray != null && shelf.productInfoArray.Length % 2 == 0 && Object.op_Implicit((Object)(object)((Component)shelf).transform.Find("BoxContainer")) && !snapshot.Fixtures.Any((Fixture f) => f.Id == ((NetworkBehaviour)shelf).netId) && !snapshot.Depot.Any((Fixture f) => f.Id == ((NetworkBehaviour)shelf).netId)) { snapshot.Depot.Add(new Fixture { Container = shelf, Id = ((NetworkBehaviour)shelf).netId, IsDepot = true, Description = InterfaceLanguage.T($"Depósito · estante {val2.GetSiblingIndex() + 1}", $"Storage · shelf {val2.GetSiblingIndex() + 1}"), Stock = (int[])shelf.productInfoArray.Clone() }); } } } return snapshot; } internal static bool HasStorageBox(Data_Container shelf, int index) { Transform val = ((Component)shelf).transform.Find("BoxContainer"); if (Object.op_Implicit((Object)(object)val) && index >= 0 && index < val.childCount) { return val.GetChild(index).childCount > 0; } return false; } public static string Locator(Data_Container shelf) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_0048: 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_006a: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)shelf).transform.position; return string.Format(CultureInfo.InvariantCulture, "{0}/{1} · {2:F2}, {3:F2}, {4:F2} · {5:F1}°", shelf.containerClass, shelf.containerID, position.x, position.y, position.z, ((Component)shelf).transform.eulerAngles.y); } public static string Translate(string key, string fallback) { LocalizationManager instance = LocalizationManager.instance; if (!Object.op_Implicit((Object)(object)instance) || string.IsNullOrEmpty(key) || instance.LocalizationDictionary == null) { return fallback; } if (!instance.LocalizationDictionary.TryGetValue(key, out var value) || string.IsNullOrEmpty(value)) { return fallback; } return value; } public static Data_Container Aim() { //IL_0014: 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) Camera main = Camera.main; RaycastHit val = default(RaycastHit); if (!Object.op_Implicit((Object)(object)main) || !Physics.Raycast(((Component)main).transform.position, ((Component)main).transform.forward, ref val, 8f)) { return null; } return ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<Data_Container>(); } } internal static class InterfaceLanguage { internal const string Portuguese = "pt-BR"; internal const string English = "en"; internal static bool UseEnglish { get; set; } internal static string T(string portuguese, string english) { if (!UseEnglish) { return portuguese; } return english; } } public sealed class Sector { public string Name = ""; public int Priority; public int Color; public List<int> Categories = new List<int>(); } public sealed class SlotPreference { public int Slot; public int ProductId; public bool MapOnly; } public sealed class FixtureNote { public string Locator = ""; public string Name = ""; public string Sector = ""; public bool Excluded; public bool HideLabel; public bool Archived; public List<int> LockedSlots = new List<int>(); public List<SlotPreference> SlotPreferences = new List<SlotPreference>(); public List<int> Categories = new List<int>(); } public sealed class StoreNotes { public int Schema = 1; public List<Sector> Sectors = new List<Sector>(); public List<FixtureNote> Fixtures = new List<FixtureNote>(); } internal static class FixtureLinks { internal static Dictionary<string, FixtureNote> Restorable(IEnumerable<FixtureNote> notes, IEnumerable<string> liveLocators) { HashSet<string> unique = new HashSet<string>(from @group in liveLocators.GroupBy<string, string>((string value) => value, StringComparer.Ordinal) where @group.Count() == 1 select @group.Key, StringComparer.Ordinal); Dictionary<string, FixtureNote> dictionary = new Dictionary<string, FixtureNote>(StringComparer.Ordinal); foreach (IGrouping<string, FixtureNote> item in notes.Where((FixtureNote note) => !note.Archived && !string.IsNullOrWhiteSpace(note.Locator) && unique.Contains(note.Locator)).GroupBy<FixtureNote, string>((FixtureNote note) => note.Locator, StringComparer.Ordinal)) { FixtureNote[] array = item.ToArray(); if (array.Length == 1) { dictionary.Add(item.Key, array[0]); } } return dictionary; } internal static void Confirm(IEnumerable<FixtureNote> notes, FixtureNote note, string locator) { note.Locator = locator; foreach (FixtureNote note2 in notes) { if (string.Equals(note2.Locator, locator, StringComparison.Ordinal)) { note2.Archived = note2 != note; } } } } internal static class NoteIdentity { private static readonly Regex StoreSlot = new Regex("^StoreFile[0-9]+(?:\\.es3)?$", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); internal static string SaveSlot(string value, string directory) { if (string.IsNullOrWhiteSpace(value)) { return null; } value = value.Trim(); string fileName = Path.GetFileName(value); if (!StoreSlot.IsMatch(fileName)) { return null; } if (value != fileName) { if (!Path.IsPathRooted(value)) { return null; } if (!string.Equals(Path.GetDirectoryName(Path.GetFullPath(value)), Path.GetFullPath(directory).TrimEnd(Path.DirectorySeparatorChar), StringComparison.OrdinalIgnoreCase)) { return null; } } return Path.GetFileNameWithoutExtension(fileName) + ".es3"; } } internal sealed class NotesFile { private static readonly XmlSerializer Serializer = new XmlSerializer(typeof(StoreNotes)); private readonly string path; public bool IsDraft { get; } public string DraftId { get { if (!IsDraft) { return ""; } return Path.GetFileNameWithoutExtension(path); } } public NotesFile(string directory, string saveName) { if (string.IsNullOrWhiteSpace(saveName)) { throw new ArgumentException("saveName"); } using SHA256 sHA = SHA256.Create(); path = Path.Combine(directory, BitConverter.ToString(sHA.ComputeHash(Encoding.UTF8.GetBytes(saveName.ToUpperInvariant()))).Replace("-", "") + ".xml"); } private NotesFile(string draftPath) { path = draftPath; IsDraft = true; } public static NotesFile NewDraft(string directory) { return new NotesFile(Path.Combine(directory, "rascunho-" + Guid.NewGuid().ToString("N") + ".xml")); } public static IEnumerable<NotesFile> FindDrafts(string directory) { if (!Directory.Exists(directory)) { yield break; } foreach (string item in from p in (from p in Directory.GetFiles(directory, "rascunho-*.xml*") select (!p.EndsWith(".bak", StringComparison.OrdinalIgnoreCase)) ? p : p.Substring(0, p.Length - 4)).Distinct<string>(StringComparer.OrdinalIgnoreCase) orderby File.GetLastWriteTimeUtc(File.Exists(p) ? p : (p + ".bak")) descending select p) { string fileName = Path.GetFileName(item); if (fileName.EndsWith(".xml", StringComparison.OrdinalIgnoreCase) && Guid.TryParseExact(Path.GetFileNameWithoutExtension(fileName).Substring("rascunho-".Length), "N", out var _)) { yield return new NotesFile(item); } } } public StoreNotes Load() { if (!File.Exists(path) && !File.Exists(path + ".bak")) { return new StoreNotes(); } try { return Read(path); } catch (Exception ex) when (ex is InvalidOperationException || ex is IOException) { if (!File.Exists(path + ".bak")) { throw; } return Read(path + ".bak"); } } private static StoreNotes Read(string source) { using FileStream fileStream = File.OpenRead(source); StoreNotes storeNotes = (StoreNotes)Serializer.Deserialize((Stream)fileStream); if (storeNotes.Schema != 1) { throw new NotSupportedException("Versão de metadados incompatível."); } if (storeNotes.Sectors.Any((Sector s) => string.IsNullOrEmpty(s.Name)) || storeNotes.Sectors.GroupBy<Sector, string>((Sector s) => s.Name, StringComparer.OrdinalIgnoreCase).Any((IGrouping<string, Sector> g) => g.Count() > 1)) { throw new IOException("Corredores duplicados ou inválidos."); } return storeNotes; } public void Save(StoreNotes notes) { Directory.CreateDirectory(Path.GetDirectoryName(path)); string sourceFileName = path + "." + Guid.NewGuid().ToString("N") + ".tmp"; try { using (FileStream fileStream = new FileStream(sourceFileName, FileMode.CreateNew, FileAccess.Write, FileShare.None)) { Serializer.Serialize((Stream)fileStream, (object)notes); fileStream.Flush(flushToDisk: true); } if (File.Exists(path)) { File.Replace(sourceFileName, path, path + ".bak"); } else { File.Move(sourceFileName, path); } } finally { if (File.Exists(sourceFileName)) { File.Delete(sourceFileName); } } } } internal enum PilotState { Original, InBox, Delivered, WaitingForLabel, Unexpected } internal static class PilotObservation { internal static PilotState Classify(int product, int originalSource, int originalDestinationId, int originalDestination, int sourceId, int source, int destinationId, int destination, int boxId, int box, bool depotDispatched = false) { if (sourceId != product) { return PilotState.Unexpected; } bool flag = destination == originalDestination && destinationId == originalDestinationId; if (source == originalSource && flag && box == 0) { return PilotState.Original; } if (source != originalSource - 1) { return PilotState.Unexpected; } if (flag && box == 1 && boxId == product) { return PilotState.InBox; } if (depotDispatched && flag && box == 0) { return PilotState.WaitingForLabel; } if (destination != originalDestination + 1 || box != 0) { return PilotState.Unexpected; } if (destinationId == product) { return PilotState.Delivered; } if (destinationId != originalDestinationId) { return PilotState.Unexpected; } return PilotState.WaitingForLabel; } } [BepInPlugin("com.storeorganizer.supermarkettogether", "StoreOrganizer", "0.7.0")] public sealed class Plugin : BaseUnityPlugin { private sealed class MapRequest { internal Data_Container Source; internal Data_Container Target; internal string SourceId; internal int Quantity; } private const int MapTab = 6; private const int UnexposedTab = 7; private int stockProduct = -1; private uint stockFixture; private string stockQuery = ""; private static readonly string[] Tabs = new string[8] { "Visão geral", "Corredores", "Estantes", "Produtos", "Reorganização", "Configurações", "Mapa", "Sem exposição" }; private static readonly string[] EnglishTabs = new string[8] { "Overview", "Aisles", "Fixtures", "Products", "Reorganization", "Settings", "Map", "Off display" }; private static readonly string[] EnglishScopes = new string[3] { "Entire store", "Aisle", "Selected" }; private readonly StoreMapPanel mapPanel = new StoreMapPanel(); private MapSnapshot map = new MapSnapshot(); private float nextMapRead; private uint mapEditorFixture; private bool mapCategoriesOpen; private GUIStyle mapEditorLabel; private int mapPickerSlot = -1; private int mapProductChoice = -1; private string mapProductSearch = ""; private GUIStyle mapProductLabel; private bool designatingSlot; private readonly Dictionary<string, MapRequest> mapRequests = new Dictionary<string, MapRequest>(StringComparer.Ordinal); private GUIStyle tabStyle; private Texture2D tabNormal; private Texture2D tabSelected; private static readonly string[] Scopes = new string[3] { "Loja inteira", "Corredor", "Selecionadas" }; private static readonly Color[] Colors = (Color[])(object)new Color[4] { new Color(0.47f, 0.94f, 0.83f), new Color(0.98f, 0.8f, 0.44f), new Color(0.62f, 0.78f, 1f), new Color(1f, 0.62f, 0.76f) }; private static readonly KeyCode[] Reserved; private readonly HashSet<uint> selected = new HashSet<uint>(); private readonly Dictionary<uint, FixtureNote> attached = new Dictionary<uint, FixtureNote>(); private Snapshot snapshot = new Snapshot(); private StoreNotes notes = new StoreNotes(); private NotesFile file; private float nextNotesSave; private List<(NotesFile File, StoreNotes Notes)> drafts; private bool reviewLinks; private bool restoreLinks; private ConfigEntry<KeyboardShortcut> shortcut; private ConfigEntry<bool> labels; private ConfigEntry<string> language; private static readonly string[] LanguageChoices; private ConfigEntry<int> labelSize; private Rect bounds = new Rect(18f, 48f, 1140f, 680f); private Vector2 scroll; private bool open; private bool resize; private bool dirty; private bool aiming; private bool inspected; private int scene; private int tab; private int scope; private int categoryFilter = -1; private int equipmentFilter = -1; private float nextAim; private float nextShortcutCheck; private float nextLabelRead; private bool shortcutAllowed; private Vector2 resizeDelta; private string save; private string message = ""; private string newSector = ""; private string search = ""; private string shortcutText = ""; private NPC_Manager manager; private GameData game; private Data_Container aimed; private uint highlight; private uint editFixture; private uint pickerFixture; private int pickerSlot = -1; private string pickerSearch = ""; private Sector sector; private Sector filterSector; private FixtureNote reattach; private Plan plan; private int transferChoice = -1; private int requestedMove = -1; private Plan requestedPlan; private bool pilotRunning; private bool pilotLocked; private bool stopBatch; private int batchGeneration; private string batchStatus = ""; private FsmBool inputGate; private FirstPersonController controlledPlayer; private CursorLockMode previousLock; private bool previousVisibility; private bool previousPlayerInput; private Texture2D panelTexture; private GUIStyle panelStyle; private string localNoteName = ""; private GUIStyle labelStyle; private readonly GUIContent labelContent = new GUIContent(); private static string NotesDirectory => Path.Combine(Paths.ConfigPath, "StoreOrganizer"); private bool CanEditNotes { get { if (NetworkServer.active) { return GameReader.InStore; } return false; } } private unsafe void Awake() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_00e6: 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_00ee: 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) language = ((BaseUnityPlugin)this).Config.Bind<string>("Interface", "Language", "pt-BR", new ConfigDescription("StoreOrganizer interface language", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[2] { "pt-BR", "en" }), Array.Empty<object>())); InterfaceLanguage.UseEnglish = language.Value == "en"; shortcut = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Interface", "Atalho", KeyboardShortcut.Empty, "Atalho opcional na loja. Nenhum por padrão."); labels = ((BaseUnityPlugin)this).Config.Bind<bool>("Etiquetas", "Visiveis", true, "Mostrar etiquetas dos expositores vinculados."); labelSize = ((BaseUnityPlugin)this).Config.Bind<int>("Etiquetas", "Tamanho", 15, new ConfigDescription("Tamanho das etiquetas", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 26), Array.Empty<object>())); KeyboardShortcut value = shortcut.Value; object obj; if ((int)((KeyboardShortcut)(ref value)).MainKey != 0) { value = shortcut.Value; obj = ((object)(*(KeyboardShortcut*)(&value))/*cast due to .constrained prefix*/).ToString(); } else { obj = ""; } shortcutText = (string)obj; try { EmployeeFence.Install(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)ex); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"StoreOrganizer 0.7.0 · luizherber"); } private void BeginSession(int activeScene, string saveName) { PersistNotes(announce: false); Close(); dirty = (aiming = (inspected = false)); nextLabelRead = Time.realtimeSinceStartup + 1f; aimed = null; highlight = (editFixture = (pickerFixture = 0u)); pickerSlot = -1; scene = activeScene; manager = NPC_Manager.Instance; game = GameData.Instance; save = saveName; snapshot = new Snapshot(); map = new MapSnapshot(); mapPanel.Reset(); stockProduct = -1; stockFixture = 0u; stockQuery = ""; mapEditorFixture = 0u; mapPickerSlot = (mapProductChoice = -1); designatingSlot = false; mapRequests.Clear(); mapCategoriesOpen = false; nextMapRead = 0f; selected.Clear(); attached.Clear(); sector = (filterSector = null); reattach = null; plan = null; transferChoice = (requestedMove = -1); requestedPlan = null; batchGeneration++; stopBatch = (pilotRunning = (pilotLocked = false)); file = null; localNoteName = ""; drafts = null; reviewLinks = false; restoreLinks = true; notes = new StoreNotes(); message = ""; if (!CanEditNotes) { return; } if (save == null) { file = NotesFile.NewDraft(NotesDirectory); return; } try { NotesFile notesFile = new NotesFile(NotesDirectory, save); notes = notesFile.Load(); file = notesFile; } catch (Exception ex) { file = NotesFile.NewDraft(NotesDirectory); message = InterfaceLanguage.T("Não foi possível abrir o cadastro do save. As novas edições vão para um rascunho local.", "Could not open the save’s layout. New edits will go to a local draft."); ((BaseUnityPlugin)this).Logger.LogWarning((object)ex); } } private void Update() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Invalid comparison between Unknown and I4 //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) if (!GameReader.InStore) { if (inspected || open || Object.op_Implicit((Object)(object)manager)) { BeginSession(-1, null); } return; } Scene activeScene = SceneManager.GetActiveScene(); int handle = ((Scene)(ref activeScene)).handle; string text = GameReader.SaveName(); if (scene != handle || (Object)(object)manager != (Object)(object)NPC_Manager.Instance || (Object)(object)game != (Object)(object)GameData.Instance || save != text) { BeginSession(handle, text); } if (!open && !pilotRunning && labels.Value && !inspected && notes.Fixtures.Count > 0 && Time.realtimeSinceStartup >= nextLabelRead) { nextLabelRead = Time.realtimeSinceStartup + 2f; Refresh(); } if (dirty && Time.realtimeSinceStartup >= nextNotesSave) { PersistNotes(announce: false); } if (requestedPlan != null) { StartRequestedTransfer(); } if (open && tab == 6 && !pilotRunning && Time.realtimeSinceStartup >= nextMapRead) { Refresh(); } if (open && !GameReader.CanUseCursor()) { Close(); } if (!open && aiming && (int)Cursor.lockState == 1 && Time.unscaledTime >= nextAim) { nextAim = Time.unscaledTime + 0.1f; aimed = GameReader.Aim(); } KeyboardShortcut value = shortcut.Value; if ((int)((KeyboardShortcut)(ref value)).MainKey == 0) { return; } if (Time.unscaledTime >= nextShortcutCheck) { nextShortcutCheck = Time.unscaledTime + 1f; shortcutAllowed = UsableShortcut(shortcut.Value); } if (!shortcutAllowed) { return; } value = shortcut.Value; if (!((KeyboardShortcut)(ref value)).IsDown() || GameReader.IsTyping()) { return; } if (open) { if (GUIUtility.keyboardControl == 0) { Close(); } return; } if (GameReader.CanUseCursor()) { Open(); return; } FsmBool val = GameReader.GameplayInputGate(); if (val != null) { Open(val); } } private bool UsableShortcut(KeyboardShortcut value) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected I4, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00f8: 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) KeyCode[] array = ((KeyboardShortcut)(ref value)).Modifiers.Concat((IEnumerable<KeyCode>)(object)new KeyCode[1] { (KeyCode)(int)((KeyboardShortcut)(ref value)).MainKey }).ToArray(); if ((int)((KeyboardShortcut)(ref value)).MainKey == 0 || array.Any(((IEnumerable<KeyCode>)Reserved).Contains<KeyCode>)) { return false; } foreach (PluginInfo value3 in Chainloader.PluginInfos.Values) { if (!Object.op_Implicit((Object)(object)value3.Instance) || (Object)(object)value3.Instance == (Object)(object)this) { continue; } foreach (ConfigDefinition key in value3.Instance.Config.Keys) { ConfigEntryBase val = value3.Instance.Config[key]; if (val.BoxedValue is KeyCode value2 && array.Contains(value2)) { return false; } if (val.BoxedValue is KeyboardShortcut val2 && (array.Contains(((KeyboardShortcut)(ref val2)).MainKey) || ((KeyboardShortcut)(ref val2)).Modifiers.Any(((IEnumerable<KeyCode>)array).Contains<KeyCode>))) { return false; } } } return true; } private void Open(FsmBool gate = null) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) Refresh(); if (gate != null) { inputGate = gate; controlledPlayer = FirstPersonController.Instance; previousLock = Cursor.lockState; previousVisibility = Cursor.visible; previousPlayerInput = controlledPlayer.allowPlayerInput; inputGate.Value = true; controlledPlayer.allowPlayerInput = false; Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } open = true; } private void Close() { //IL_0080: 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) if (!open) { return; } open = (resize = false); if (pilotRunning) { stopBatch = true; } GUIUtility.keyboardControl = 0; if (inputGate == null) { return; } bool value = inputGate.Value; if (value) { inputGate.Value = false; } inputGate = null; if (value && !GameReader.IsTyping()) { if (Object.op_Implicit((Object)(object)controlledPlayer)) { controlledPlayer.allowPlayerInput = previousPlayerInput; } if ((int)Cursor.lockState == 0 && Cursor.visible) { Cursor.lockState = previousLock; Cursor.visible = previousVisibility; } } } private void OnDestroy() { EmployeeFence.Uninstall(); } private void OnDisable() { PersistNotes(announce: false); Close(); EmployeeFence.Release(); if (Object.op_Implicit((Object)(object)panelTexture)) { Object.Destroy((Object)(object)panelTexture); } if (Object.op_Implicit((Object)(object)tabNormal)) { Object.Destroy((Object)(object)tabNormal); } if (Object.op_Implicit((Object)(object)tabSelected)) { Object.Destroy((Object)(object)tabSelected); } tabStyle = null; panelTexture = null; panelStyle = null; } private GUIStyle OpaquePanel() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0070: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_0090: Expected O, but got Unknown //IL_011a: Unknown result type (might be due to invalid IL or missing references) if (panelStyle != null) { return panelStyle; } panelTexture = new Texture2D(1, 1, (TextureFormat)4, false) { hideFlags = (HideFlags)61 }; panelTexture.SetPixel(0, 0, Color32.op_Implicit(new Color32((byte)24, (byte)32, (byte)43, byte.MaxValue))); panelTexture.Apply(false, true); panelStyle = new GUIStyle(GUI.skin.window) { border = new RectOffset(), fontSize = 15, padding = new RectOffset(14, 14, 20, 16) }; GUIStyleState[] array = (GUIStyleState[])(object)new GUIStyleState[8] { panelStyle.normal, panelStyle.active, panelStyle.focused, panelStyle.hover, panelStyle.onNormal, panelStyle.onActive, panelStyle.onFocused, panelStyle.onHover }; foreach (GUIStyleState obj in array) { obj.background = panelTexture; obj.textColor = Color.white; } return panelStyle; } private bool Live(Fixture fixture) { if (!Object.op_Implicit((Object)(object)fixture.Container) || ((NetworkBehaviour)fixture.Container).netId != fixture.Id || !Object.op_Implicit((Object)(object)manager)) { return false; } GameObject val = (fixture.IsDepot ? manager.storageOBJ : manager.shelvesOBJ); if (Object.op_Implicit((Object)(object)val)) { return (Object)(object)((Component)fixture.Container).transform.parent == (Object)(object)val.transform; } return false; } private void Refresh() { Snapshot snapshot = GameReader.Read(); Dictionary<uint, Fixture> dictionary = snapshot.Fixtures.ToDictionary((Fixture f) => f.Id); foreach (Fixture fixture in this.snapshot.Fixtures) { if (!dictionary.TryGetValue(fixture.Id, out var value) || !((Object)(object)fixture.Container == (Object)(object)value.Container)) { attached.Remove(fixture.Id); selected.Remove(fixture.Id); if (highlight == fixture.Id) { highlight = 0u; } if (editFixture == fixture.Id) { editFixture = 0u; } } } this.snapshot = snapshot; if (restoreLinks && CanEditNotes && this.snapshot.Fixtures.Count > 0) { restoreLinks = false; Dictionary<string, FixtureNote> dictionary2 = FixtureLinks.Restorable(notes.Fixtures, snapshot.Fixtures.Select((Fixture f) => f.Locator)); foreach (Fixture fixture2 in snapshot.Fixtures) { if (!attached.ContainsKey(fixture2.Id) && dictionary2.TryGetValue(fixture2.Locator, out var value2) && !attached.ContainsValue(value2)) { attached.Add(fixture2.Id, value2); } } } inspected = snapshot.Fixtures.Count > 0; if (tab == 6) { map = StoreMapReader.Read(snapshot); nextMapRead = Time.realtimeSinceStartup + 0.8f; } } private void OnGUI() { //IL_01cb: 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) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Expected O, but got Unknown //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) if (!GameReader.InStore) { return; } if (!open) { if ((int)Event.current.type == 7) { DrawLabels(); } if (GameReader.CanUseCursor() && GUI.Button(new Rect((float)Mathf.Max(5, Screen.width - 186), 12f, 174f, 29f), "StoreOrganizer")) { Open(); } } else if (GameReader.CanUseCursor()) { float num = Mathf.Max(300, Screen.width - 12); float num2 = Mathf.Max(230, Screen.height - 12); ((Rect)(ref bounds)).width = Mathf.Clamp(((Rect)(ref bounds)).width, Mathf.Min(540f, num), num); ((Rect)(ref bounds)).height = Mathf.Clamp(((Rect)(ref bounds)).height, Mathf.Min(300f, num2), num2); ((Rect)(ref bounds)).x = Mathf.Clamp(((Rect)(ref bounds)).x, 0f, Mathf.Max(0f, (float)Screen.width - ((Rect)(ref bounds)).width)); ((Rect)(ref bounds)).y = Mathf.Clamp(((Rect)(ref bounds)).y, 0f, Mathf.Max(0f, (float)Screen.height - ((Rect)(ref bounds)).height)); resizeDelta = Vector2.zero; Color color = GUI.color; Color backgroundColor = GUI.backgroundColor; Color contentColor = GUI.contentColor; int depth = GUI.depth; try { GUI.color = (GUI.backgroundColor = (GUI.contentColor = Color.white)); GUI.depth = -100; bounds = GUI.ModalWindow(14650938, bounds, new WindowFunction(DrawWindow), "StoreOrganizer", OpaquePanel()); } finally { GUI.color = color; GUI.backgroundColor = backgroundColor; GUI.contentColor = contentColor; GUI.depth = depth; } ref Rect reference = ref bounds; ((Rect)(ref reference)).size = ((Rect)(ref reference)).size + resizeDelta; } } private void DrawWindow(int windowId) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0039: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0282: 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_02d7: Invalid comparison between Unknown and I4 //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Invalid comparison between Unknown and I4 //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) if ((int)Event.current.type == 7) { GUI.DrawTexture(new Rect(1f, 19f, ((Rect)(ref bounds)).width - 2f, ((Rect)(ref bounds)).height - 20f), (Texture)(object)panelTexture, (ScaleMode)0, false); } GUILayout.Space(10f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button(InterfaceLanguage.T("Atualizar inventário", "Refresh inventory"), Array.Empty<GUILayoutOption>())) { Refresh(); } if (file != null && GUILayout.Button(dirty ? InterfaceLanguage.T("Salvar cadastro", "Save layout") : InterfaceLanguage.T("Cadastro salvo", "Layout saved"), Array.Empty<GUILayoutOption>()) && dirty) { PersistNotes(announce: true); } GUILayout.FlexibleSpace(); if (GUILayout.Button(InterfaceLanguage.T("Fechar", "Close"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) })) { Close(); } GUILayout.EndHorizontal(); DrawTabs(); if (!string.IsNullOrEmpty(message)) { GUILayout.Label(message, Array.Empty<GUILayoutOption>()); } scroll = GUILayout.BeginScrollView(scroll, Array.Empty<GUILayoutOption>()); switch (tab) { case 0: Overview(); break; case 1: Corridors(); break; case 2: Fixtures(); break; case 3: Products(); break; case 4: Reorganize(); break; case 5: Settings(); break; case 7: DrawUnexposedStock(); break; case 6: mapPanel.Draw(map, snapshot, attached, notes.Sectors, CategoryName, CanEditNotes ? new Action<Fixture, float>(DrawMapEditor) : null, CanEditNotes ? new Action<Fixture, int, float>(DrawMapEmptySlot) : null, ((Rect)(ref bounds)).width - 42f, ((Rect)(ref bounds)).height); break; } GUILayout.EndScrollView(); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref bounds)).width - 24f, ((Rect)(ref bounds)).height - 23f, 22f, 22f); GUI.Label(val, "◢"); Event current = Event.current; if ((int)current.type == 0 && current.button == 0 && ((Rect)(ref val)).Contains(current.mousePosition)) { resize = true; current.Use(); } if (resize && (int)current.type == 3) { resizeDelta = current.delta; current.Use(); } if ((int)current.rawType == 1) { resize = false; } GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref bounds)).width - 26f, 19f)); } private void DrawMapEditor(Fixture fixture, float width) { //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: 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_01e7: Expected O, but got Unknown //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: 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_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0332: 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_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) if (!CanEditNotes || !Live(fixture)) { return; } if (mapEditorFixture != fixture.Id) { mapEditorFixture = fixture.Id; mapCategoriesOpen = false; mapPickerSlot = (mapProductChoice = -1); } attached.TryGetValue(fixture.Id, out var note); if (note == null && notes.Fixtures.Any((FixtureNote candidate) => !candidate.Archived && candidate.Locator == fixture.Locator)) { GUILayout.Label(InterfaceLanguage.T("Confirme o cadastro pendente desta estante na aba Estantes.", "Confirm this shelf’s pending layout in the Fixtures tab."), Array.Empty<GUILayoutOption>()); return; } GUILayout.Space(6f); GUILayout.Label(InterfaceLanguage.T("Nome personalizado", "Custom name"), Array.Empty<GUILayoutOption>()); string text = note?.Name ?? ""; string text2 = Text("mapNome" + fixture.Id, text); if (text2 != text) { note = NoteFor(fixture); note.Name = text2; Changed(); } Sector sector = notes.Sectors.Find((Sector sector2) => sector2.Name == note?.Sector); int[] array = StoreMapOrder.AssignedCategories(note?.Categories, sector?.Categories); string obj = ((array.Length == 0) ? InterfaceLanguage.T("Sem categoria", "No category") : string.Join(", ", array.Select(CategoryName))); if (mapEditorLabel == null) { mapEditorLabel = new GUIStyle(GUI.skin.label) { wordWrap = true }; } Color textColor = GUI.skin.label.normal.textColor; mapEditorLabel.normal.textColor = ((array.Length == 1) ? StoreMapPanel.CategoryColor(array[0]) : textColor); GUILayout.Label(obj, mapEditorLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width - 12f) }); if (array.Length != 0) { FixtureNote fixtureNote = note; if (fixtureNote == null || fixtureNote.Categories.Count == 0) { GUILayout.Label(InterfaceLanguage.T("Categorias herdadas do corredor", "Categories inherited from the aisle"), Array.Empty<GUILayoutOption>()); } } if (GUILayout.Button(mapCategoriesOpen ? InterfaceLanguage.T("Fechar categorias", "Close categories") : InterfaceLanguage.T("Definir categorias", "Set categories"), Array.Empty<GUILayoutOption>())) { mapCategoriesOpen = !mapCategoriesOpen; } if (!mapCategoriesOpen) { return; } foreach (KeyValuePair<int, string> category in snapshot.Categories) { bool flag = note?.Categories.Contains(category.Key) ?? false; Color val = StoreMapPanel.CategoryColor(category.Key); GUIStyleState normal = mapEditorLabel.normal; Color textColor2 = (mapEditorLabel.onNormal.textColor = val); normal.textColor = textColor2; GUIStyleState hover = mapEditorLabel.hover; textColor2 = (mapEditorLabel.onHover.textColor = val); hover.textColor = textColor2; GUIStyleState active = mapEditorLabel.active; textColor2 = (mapEditorLabel.onActive.textColor = val); active.textColor = textColor2; string text3 = (flag ? "✓ " : "○ ") + category.Value; GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); bool flag2 = GUILayout.Toggle(flag, text3, mapEditorLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width - 16f) }); GUILayout.EndHorizontal(); if (flag2 != flag) { note = NoteFor(fixture); if (flag2) { note.Categories.Add(category.Key); } else { note.Categories.Remove(category.Key); } Changed(); } } mapEditorLabel.normal.textColor = textColor; } private void DrawMapEmptySlot(Fixture fixture, int index, float width) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown if (!Live(fixture) || pilotRunning || pilotLocked) { return; } if (designatingSlot) { if (mapPickerSlot == index) { GUILayout.Label(InterfaceLanguage.T("Aguardando confirmação do jogo.", "Waiting for confirmation from the game."), Array.Empty<GUILayoutOption>()); } return; } if (mapProductLabel == null) { mapProductLabel = new GUIStyle(GUI.skin.label) { wordWrap = true }; } attached.TryGetValue(fixture.Id, out var value); if (value == null && notes.Fixtures.Any((FixtureNote candidate) => !candidate.Archived && candidate.Locator == fixture.Locator)) { return; } Slot slot = MakeSlot(fixture, index); if (slot.Locked || slot.Categories.Length == 0) { return; } if (slot.ProductId >= 0 && snapshot.Products.TryGetValue(slot.ProductId, out var value2)) { GUILayout.Label(InterfaceLanguage.T("Reservado no jogo · ", "Assigned in game · ") + value2.Name, mapProductLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width) }); } if (slot.DesiredProduct >= 0 && slot.DesiredProduct != slot.ProductId && snapshot.Products.TryGetValue(slot.DesiredProduct, out var value3)) { GUILayout.Label(InterfaceLanguage.T("Escolhido · ", "Selected · ") + value3.Name, mapProductLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width) }); } if (mapRequests.TryGetValue(slot.Id, out var value4)) { GUILayout.Label(InterfaceLanguage.T($"{value4.Quantity} un. na lista de transferências", $"{value4.Quantity} units in the transfer list"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width) }); if (GUILayout.Button(InterfaceLanguage.T("Retirar da lista", "Remove from list"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width) })) { mapRequests.Remove(slot.Id); plan = null; } return; } if (GUILayout.Button((mapPickerSlot == index) ? InterfaceLanguage.T("Fechar seleção", "Close selection") : InterfaceLanguage.T("Escolher produto", "Choose product"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width) })) { mapPickerSlot = ((mapPickerSlot == index) ? (-1) : index); mapProductChoice = -1; mapProductSearch = ""; } if (mapPickerSlot != index) { return; } if (mapProductChoice < 0) { mapProductSearch = Text("mapProduto" + fixture.Id + "/" + index, mapProductSearch); { foreach (Product item in from item in snapshot.Products.Values where item.Available && slot.MatchesCategory(item) && slot.Capacity(item) > 0 && (string.IsNullOrWhiteSpace(mapProductSearch) || ProductMatches(item, mapProductSearch)) orderby item.Name, item.Brand, item.Id select item) { if (GUILayout.Button(item.Name + " · " + item.Brand, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width) })) { mapProductChoice = item.Id; } } return; } } if (!snapshot.Products.TryGetValue(mapProductChoice, out var value5) || !value5.Available || !slot.MatchesCategory(value5) || slot.Capacity(value5) <= 0) { mapProductChoice = -1; return; } GUILayout.Label(value5.Name, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width) }); bool flag = false; foreach (Fixture item2 in snapshot.Fixtures.Where(Live)) { for (int num = 0; num < item2.Stock.Length / 2; num++) { int num2 = item2.Stock[num * 2 + 1]; if (item2.Stock[num * 2] != value5.Id || num2 <= 0) { continue; } flag = true; Slot slot2 = MakeSlot(item2, num); int num3 = Math.Min(num2, slot.Capacity(value5)); attached.TryGetValue(item2.Id, out var value6); string arg = (string.IsNullOrWhiteSpace(value6?.Name) ? item2.Description : value6.Name); GUILayout.Label(InterfaceLanguage.T($"Em exposição · {arg} [{num + 1}] · {num2} un.", $"On display · {arg} [{num + 1}] · {num2} units"), mapProductLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width) }); if (slot2.Locked) { GUILayout.Label(InterfaceLanguage.T("Origem fixada ou excluída.", "Source locked or excluded."), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width) }); } else { if (!GUILayout.Button(InterfaceLanguage.T($"Adicionar transferência · {num3} un.", $"Add transfer · {num3} units"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width) })) { continue; } if (SaveMapProduct(fixture, index, value5)) { mapRequests[slot.Id] = new MapRequest { Source = item2.Container, Target = fixture.Container, SourceId = slot2.Id, Quantity = num3 }; plan = Simulate(); transferChoice = -1; message = (plan.Moves.Any((Move move) => move.MapRequest && move.To.Id == slot.Id) ? InterfaceLanguage.T("Transferência adicionada à prévia em Reorganização.", "Transfer added to the Reorganization preview.") : InterfaceLanguage.T("Pedido pendente. Confira a origem e o destino em Reorganização.", "Request pending. Check the source and destination in Reorganization.")); } return; } } } if (!flag) { GUILayout.Label(InterfaceLanguage.T("Produto ainda sem exposição na loja.", "Product is currently off display."), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width) }); if (GUILayout.Button(InterfaceLanguage.T("Designar para reposição", "Assign for restocking"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width) })) { DesignateEmptySlot(fixture, index, value5); } } else if (GUILayout.Button(InterfaceLanguage.T("Manter escolha sem transferir", "Keep selection without transferring"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width) })) { SaveMapProduct(fixture, index, value5); } if (GUILayout.Button(InterfaceLanguage.T("Voltar aos produtos", "Back to products"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width) })) { mapProductChoice = -1; } } private void DesignateEmptySlot(Fixture fixture, int index, Product product, bool requireDepotStock = false) { if (designatingSlot || pilotRunning || pilotLocked || !CanEditNotes || !Live(fixture)) { return; } Slot slot = MakeSlot(fixture, index); if (slot.Locked || slot.Quantity != 0 || !product.Available || !slot.MatchesCategory(product) || slot.Capacity(product) <= 0) { return; } designatingSlot = true; int generation = batchGeneration; ((MonoBehaviour)this).StartCoroutine(ShelfDesignation.Apply(fixture, index, product.Id, delegate(bool success, string detail) { if (generation == batchGeneration) { designatingSlot = false; if (success) { SaveMapProduct(fixture, index, product); } Refresh(); message = detail; } }, delegate(Exception error) { ((BaseUnityPlugin)this).Logger.LogWarning((object)error); }, requireDepotStock)); } private bool SaveMapProduct(Fixture fixture, int index, Product product) { if (!CanEditNotes || !Live(fixture) || fixture.Container.productInfoArray == null || index * 2 + 1 >= fixture.Container.productInfoArray.Length || fixture.Container.productInfoArray[index * 2 + 1] != 0) { message = InterfaceLanguage.T("A posição deixou de estar vazia. Atualize o mapa.", "The slot is no longer empty. Refresh the map."); return false; } Slot slot = MakeSlot(fixture, index); if (slot.Locked || !product.Available || !slot.MatchesCategory(product) || slot.Capacity(product) == 0) { return false; } FixtureNote fixtureNote = NoteFor(fixture); fixtureNote.SlotPreferences.RemoveAll((SlotPreference preference) => preference.Slot == index); fixtureNote.SlotPreferences.Add(new SlotPreference { Slot = index, ProductId = product.Id, MapOnly = true }); mapProductChoice = (mapPickerSlot = -1); Changed(); return true; } private void DrawUnexposedStock() { //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Expected O, but got Unknown GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(InterfaceLanguage.T("Produtos no depósito sem exposição", "Products in storage and off display"), Array.Empty<GUILayoutOption>()); GUILayout.FlexibleSpace(); if (GUILayout.Button(InterfaceLanguage.T("Atualizar lista", "Refresh list"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) })) { Refresh(); } GUILayout.EndHorizontal(); Dictionary<int, long> dictionary = UnexposedStock.Find(snapshot.Fixtures.Select((Fixture f) => f.Stock), snapshot.Depot.Select((Fixture f) => f.Stock)); GUILayout.Label(InterfaceLanguage.T($"{dictionary.Count} produto(s) · {dictionary.Values.Sum()} un. no depósito", $"{dictionary.Count} product(s) · {dictionary.Values.Sum()} units in storage"), Array.Empty<GUILayoutOption>()); GUILayout.Label(InterfaceLanguage.T("Buscar produto", "Search products"), Array.Empty<GUILayoutOption>()); stockQuery = Text("estoqueSemExposicaoBusca", stockQuery); if (dictionary.Count == 0) { GUILayout.Label(InterfaceLanguage.T("Nenhum produto armazenado sem exposição na área de vendas.", "All products in storage are already on display."), Array.Empty<GUILayoutOption>()); return; } bool flag = ((Rect)(ref bounds)).width >= 805f; if (flag) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); } GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { flag ? GUILayout.Width(((Rect)(ref bounds)).width * 0.43f) : GUILayout.ExpandWidth(true) }); if (mapProductLabel == null) { mapProductLabel = new GUIStyle(GUI.skin.label) { wordWrap = true }; } Product value3; foreach (KeyValuePair<int, long> item in from pair in dictionary orderby (!snapshot.Products.TryGetValue(pair.Key, out value3)) ? "" : value3.Name, pair.Key select pair) { if (!snapshot.Products.TryGetValue(item.Key, out var value)) { if (string.IsNullOrWhiteSpace(stockQuery) || item.Key.ToString().Contains(stockQuery)) { GUILayout.Label(InterfaceLanguage.T($"Produto #{item.Key} · {item.Value} un.", $"Product #{item.Key} · {item.Value} units"), Array.Empty<GUILayoutOption>()); } } else if ((string.IsNullOrWhiteSpace(stockQuery) || ProductMatches(value, stockQuery)) && GUILayout.Toggle(stockProduct == item.Key, InterfaceLanguage.T($"{value.Name} · {value.Brand} · {item.Value} un.", $"{value.Name} · {value.Brand} · {item.Value} units"), GUI.skin.button, Array.Empty<GUILayoutOption>()) && stockProduct != item.Key) { stockProduct = item.Key; stockFixture = 0u; } } GUILayout.EndVertical(); if (flag) { GUILayout.Space(12f); } GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (dictionary.ContainsKey(stockProduct) && snapshot.Products.TryGetValue(stockProduct, out var value2)) { DrawUnexposedDestination(value2); } else { GUILayout.Label(InterfaceLanguage.T("Selecione um produto para definir onde ele será exposto.", "Select a product and choose where to display it."), Array.Empty<GUILayoutOption>()); } GUILayout.EndVertical(); if (flag) { GUILayout.EndHorizontal(); } } private void DrawUnexposedDestination(Product product) { GUILayout.Label(product.Name + " · " + CategoryName(product.Category), Array.Empty<GUILayoutOption>()); if (!CanEditNotes || !product.Available) { GUILayout.Label(InterfaceLanguage.T("A designação exige o anfitrião e um produto desbloqueado.", "Only the host can assign unlocked products."), Array.Empty<GUILayoutOption>()); return; } if (pilotRunning || pilotLocked || designatingSlot) { GUILayout.Label(InterfaceLanguage.T("Aguarde a operação em andamento ou confira o resultado em Reorganização.", "Wait for the current operation or check the result in Reorganization."), Array.Empty<GUILayoutOption>()); return; } (Fixture, FixtureNote, int[])[] array = (from entry in snapshot.Fixtures.Where(Live).Select(delegate(Fixture f) { attached.TryGetValue(f.Id, out var value2); int[] item3 = ((value2 == null && notes.Fixtures.Any((FixtureNote candidate) => !candidate.Archived && candidate.Locator == f.Locator)) ? Array.Empty<int>() : (from i in Enumerable.Range(0, f.Stock.Length / 2) where f.Stock[i * 2 + 1] == 0 select i).Where(delegate(int i) { Slot slot = MakeSlot(f, i); return !slot.Locked && !mapRequests.ContainsKey(slot.Id) && slot.MatchesCategory(product) && slot.Capacity(product) > 0; }).ToArray()); return (Fixture: f, Note: value2, Slots: item3); }) where entry.Slots.Length != 0 select entry).ToArray(); if (array.Length == 0) { GUILayout.Label(InterfaceLanguage.T("Nenhum expositor compatível com a categoria possui posição vazia.", "No fixture in a compatible category has an empty slot."), mapProductLabel, Array.Empty<GUILayoutOption>()); return; } GUILayout.Label(InterfaceLanguage.T("Expositor e posição", "Fixture and slot"), Array.Empty<GUILayoutOption>()); (Fixture, FixtureNote, int[])[] array2 = array; for (int num = 0; num < array2.Length; num++) { (Fixture, FixtureNote, int[]) tuple = array2[num]; Fixture item = tuple.Item1; string arg = (string.IsNullOrWhiteSpace(tuple.Item2?.Name) ? item.Description : tuple.Item2.Name); if (GUILayout.Toggle(stockFixture == item.Id, InterfaceLanguage.T($"{arg} · {tuple.Item3.Length} posição(ões)", $"{arg} · {tuple.Item3.Length} slot(s)"), GUI.skin.button, Array.Empty<GUILayoutOption>())) { stockFixture = item.Id; } if (stockFixture != item.Id) { continue; } int[] item2 = tuple.Item3; foreach (int num3 in item2) { int num4 = item.Stock[num3 * 2]; Product value; string arg2 = ((num4 >= 0 && snapshot.Products.TryGetValue(num4, out value)) ? (InterfaceLanguage.T(" · etiqueta ", " · label ") + value.Name) : ""); if (GUILayout.Button(InterfaceLanguage.T($"Designar posição {num3 + 1}{arg2}", $"Assign slot {num3 + 1}{arg2}"), Array.Empty<GUILayoutOption>())) { DesignateEmptySlot(item, num3, product, requireDepotStock: true); } } } } private void DrawTabs() { //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_0037: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_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_006c: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00f1: 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_015c: 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_01ed: Unknown result type (might be due to invalid IL or missing references) if (tabStyle == null) { tabNormal = TabTexture(Color32.op_Implicit(new Color32((byte)35, (byte)47, (byte)62, byte.MaxValue))); tabSelected = TabTexture(Color32.op_Implicit(new Color32((byte)47, (byte)86, (byte)121, byte.MaxValue))); tabStyle = new GUIStyle(GUIStyle.none) { alignment = (TextAnchor)4, padding = new RectOffset(8, 8, 5, 5), fontSize = 13, fixedHeight = 29f, stretchWidth = true }; GUIStyleState[] array = (GUIStyleState[])(object)new GUIStyleState[4] { tabStyle.normal, tabStyle.hover, tabStyle.active, tabStyle.focused }; foreach (GUIStyleState obj in array) { obj.background = tabNormal; obj.textColor = Color32.op_Implicit(new Color32((byte)201, (byte)215, (byte)230, byte.MaxValue)); } array = (GUIStyleState[])(object)new GUIStyleState[4] { tabStyle.onNormal, tabStyle.onHover, tabStyle.onActive, tabStyle.onFocused }; foreach (GUIStyleState obj2 in array) { obj2.background = tabSelected; obj2.textColor = Color.white; } } int num = ((((Rect)(ref bounds)).width >= 955f) ? Tabs.Length : 4); for (int j = 0; j < Tabs.Length; j += num) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); for (int k = j; k < Math.Min(j + num, Tabs.Length); k++) { if (GUILayout.Toggle(k == tab, (InterfaceLanguage.UseEnglish ? EnglishTabs : Tabs)[k], tabStyle, Array.Empty<GUILayoutOption>()) && k != tab) { tab = k; scroll = Vector2.zero; GUI.FocusControl((string)null); if (tab == 6 || tab == 7) { Refresh(); } } } GUILayout.EndHorizontal(); } GUILayout.Space(5f); } private static Texture2D TabTexture(Color color) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false) { hideFlags = (HideFlags)61 }; val.SetPixel(0, 0, color); val.Apply(false, true); return val; } private void Overview() { GUILayout.Label((save == null) ? InterfaceLanguage.T("Sessão sem save local identificado.", "No local save identified for this session.") : (InterfaceLanguage.T("Save local · ", "Local save · ") + save), Array.Empty<GUILayoutOption>()); GUILayout.Label(InterfaceLanguage.T($"{snapshot.Fixtures.Count} expositores · {snapshot.Products.Values.Count((Product p) => p.Available)} produtos desbloqueados · {notes.Sectors.Count} corredores", $"{snapshot.Fixtures.Count} fixtures · {snapshot.Products.Values.Count((Product p) => p.Available)} unlocked products · {notes.Sectors.Count} aisles"), Array.Empty<GUILayoutOption>()); GUILayout.Label(InterfaceLanguage.T("Cadastre corredores e categorias, vincule as estantes e simule na aba Reorganização.", "Create aisles, assign categories, link fixtures and generate a preview in Reorganization."), Array.Empty<GUILayoutOption>()); GUILayout.Label(InterfaceLanguage.T("A prévia permite executar movimentos individuais ou o lote completo.", "Run individual moves or the full batch from the preview."), Array.Empty<GUILayoutOption>()); foreach (string issue in snapshot.Issues) { GUILayout.Label(issue, Array.Empty<GUILayoutOption>()); } } private string Text(string control, string value, int max = 80) { GUI.SetNextControlName(control); return GUILayout.TextField(value, max, Array.Empty<GUILayoutOption>()); } private void Corridors() { if (CanEditNotes) { NotesFile notesFile = file; if (notesFile != null && notesFile.IsDraft) { GUILayout.Label(InterfaceLanguage.T("As edições são salvas automaticamente como rascunho. Use Recuperar rascunhos para reabrir um cadastro.", "Edits are saved automatically as a draft. Use Recover drafts to reopen a layout."), Array.Empty<GUILayoutOption>()); } GUILayout.Label(InterfaceLanguage.T("Nome do novo corredor", "New aisle name"), Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); newSector = Text("corredor", newSector); if (GUILayout.Button(InterfaceLanguage.T("Criar corredor", "Create aisle"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(130f) })) { if (!ValidName(newSector)) { message = InterfaceLanguage.T("Digite um nome de corredor novo.", "Enter a new aisle name."); } else { sector = new Sector { Name = newSector.Trim() }; notes.Sectors.Add(sector); newSector = ""; Changed(); message = InterfaceLanguage.T("Corredor criado.", "Aisle created."); } } GUILayout.EndHorizontal(); LocalNotes(); Drafts(); } else { GUILayout.Label(InterfaceLanguage.T("Somente o anfitrião pode criar e editar corredores.", "Only the host can create and edit aisles."), Array.Empty<GUILayoutOption>()); } foreach (Sector sector in notes.Sectors) { if (GUILayout.Toggle(this.sector == sector, sector.Name, GUI.skin.button, Array.Empty<GUILayoutOption>())) { this.sector = sector; } } if (!CanEditNotes || this.sector == null) { return; } GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button(InterfaceLanguage.T("Renomear com o texto acima", "Rename using the text above"), Array.Empty<GUILayoutOption>()) && ValidName(newSector)) { foreach (FixtureNote item in notes.Fixtures.Where((FixtureNote f) => f.Sector == this.sector.Name)) { item.Sector = newSector.Trim(); } this.sector.Name = newSector.Trim(); newSector = ""; Changed(); } if (GUILayout.Button(InterfaceLanguage.T("Excluir corredor", "Delete aisle"), Array.Empty<GUILayoutOption>())) { foreach (FixtureNote item2 in notes.Fixtures.Where((FixtureNote f) => f.Sector == this.sector.Name)) { item2.Sector = ""; } notes.Sectors.Remove(this.sector); if (filterSector == this.sector) { filterSector = null; } this.sector = null; Changed(); } GUILayout.EndHorizontal(); if (this.sector == null) { return; } int num = Slider(InterfaceLanguage.T("Prioridade", "Priority"), this.sector.Priority, 0, 10); int num2 = Slider(InterfaceLanguage.T("Cor", "Color"), this.sector.Color, 0, Colors.Length - 1); if (num != this.sector.Priority || num2 != this.sector.Color) { this.sector.Priority = num; this.sector.Color = num2; Changed(); } Categories(this.sector.Categories); GUILayout.Label(InterfaceLanguage.T($"{selected.Count} expositores selecionados", $"{selected.Count} fixtures selected"), Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button(InterfaceLanguage.T("Vincular selecionados", "Link selected fixtures"), Array.Empty<GUILayoutOption>())) { foreach (Fixture item3 in snapshot.Fixtures.Where((Fixture f) => selected.Contains(f.Id) && Live(f))) { NoteFor(item3).Sector = this.sector.Name; Changed(); } } if (GUILayout.Button(InterfaceLanguage.T("Desagrupar selecionados", "Unlink selected fixtures"), Array.Empty<GUILayoutOption>())) { foreach (uint item4 in selected) { if (attached.TryGetValue(item4, out var value)) { value.Sector = ""; Changed(); } } } GUILayout.EndHorizontal(); } private void LocalNotes() { if (save != null || (file != null && !file.IsDraft)) { return; } GUILayout.Label(InterfaceLanguage.T("Nome do cadastro local", "Local layout name"), Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); localNoteName = Text("cadastroLocal", localNoteName); if (GUILayout.Button(InterfaceLanguage.T("Salvar ou abrir cadastro local", "Save or open local layout"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(175f) })) { try { string text = localNoteName.Trim(); if (text.Length == 0) { message = InterfaceLanguage.T("Digite um nome para o cadastro local.", "Enter a name for the local layout."); } else { NotesFile notesFile = new NotesFile(NotesDirectory, "local/" + text); StoreNotes storeNotes = notesFile.Load(); bool flag = notes.Sectors.Count > 0 || notes.Fixtures.Count > 0; if (flag && (storeNotes.Sectors.Count > 0 || storeNotes.Fixtures.Count > 0)) { message = InterfaceLanguage.T("Esse cadastro já existe. Use outro nome para manter o rascunho atual.", "This layout already exists. Use another name to keep the current draft."); } else { if (flag) { notesFile.Save(notes); } else { notes = storeNotes; attached.Clear(); restoreLinks = true; sector = (filterSector = null); reattach = null; plan = null; Refresh(); } file = notesFile; dirty = false; message = InterfaceLanguage.T("Cadastro local em uso · ", "Local layout in use · ") + text; } } } catch (Exception ex) { message = InterfaceLanguage.T("Falha ao abrir ou salvar o cadastro local. O rascunho foi mantido.", "Could not open or save the local layout. The draft was kept."); ((BaseUnityPlugin)this).Logger.LogWarning((object)ex); } } GUILayout.EndHorizontal(); } private void Drafts() { if (GUILayout.Button(InterfaceLanguage.T("Recuperar rascunhos", "Recover drafts"), Array.Empty<GUILayoutOption>())) { drafts = new List<(NotesFile, StoreNotes)>(); try { foreach (NotesFile item in NotesFile.FindDrafts(NotesDirectory)) { if (!(item.DraftId == file?.DraftId)) { try { drafts.Add((item, item.Load())); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)ex); } } } if (drafts.Count == 0) { message = InterfaceLanguage.T("Nenhum outro rascunho encontrado neste perfil.", "No other drafts found in this profile."); } } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogWarning((object)ex2); message = InterfaceLanguage.T("Falha ao listar os rascunhos.", "Could not list drafts."); } } if (drafts == null) { return; } foreach (var draft in drafts) { string arg = string.Join(", ", from s in draft.Notes.Sectors.Take(4) select s.Name); if (GUILayout.Button(InterfaceLanguage.T($"Abrir rascunho · {arg} · {draft.Notes.Fixtures.Count} expositores · {draft.File.DraftId.Substring(9, 6)}", $"Open draft · {arg} · {draft.Notes.Fixtures.Count} fixtures · {draft.File.DraftId.Substring(9, 6)}"), Array.Empty<GUILayoutOption>())) { if (PersistNotes(announce: false)) { notes = draft.Notes; (file, _) = draft; attached.Clear(); sector = (filterSector = null); reattach = null; plan = null; drafts = null; restoreLinks = true; Refresh(); message = InterfaceLanguage.T("Rascunho aberto. Confira os vínculos na aba Estantes.", "Draft opened. Check links in the Fixtures tab."); } break; } } } private bool ValidName(string name) { if (!string.IsNullOrWhiteSpace(name)) { return !notes.Sectors.Any((Sector s) => string.Equals(s.Name, name.Trim(), StringComparison.OrdinalIgnoreCase)); } return false; } private void Changed() { dirty = true; nextNotesSave = Time.realtimeSinceStartup + 0.5f; if (plan != null) { plan = null; message = InterfaceLanguage.T("O cadastro mudou. Gere uma nova prévia.", "The layout changed. Generate a new preview."); } } private bool PersistNotes(bool announce) { if (!dirty) { return true; } if (file == null) { return false; } try { foreach (Fixture item in snapshot.Fixtures.Where(Live)) { if (attached.TryGetValue(item.Id, out var value)) { value.Locator = GameReader.Locator(item.Container); } } file.Save(notes); dirty = false; if (announce) { message = InterfaceLanguage.T("Cadastro salvo.", "Layout saved."); } return true; } catch (Exception ex) { nextNotesSave = Time.realtimeSinceStartup + 5f; message = InterfaceLanguage.T("Falha ao salvar o cadastro. As alterações continuam abertas.", "Could not save the layout. Your changes are still open."); ((BaseUnityPlugin)this).Logger.LogWarning((object)ex); return false; } } private void Categories(List<int> categories) { foreach (KeyValuePair<int, string> category in snapshot.Categories) { bool flag = categories.Contains(category.Key); if (GUILayout.Toggle(flag, category.Value, Array.Empty<GUILayoutOption>()) != flag) { if (flag) { categories.Remove(category.Key); } else { categories.Add(category.Key); } Changed(); } } } private FixtureNote NoteFor(Fixture fixture) { if (attached.TryGetValue(fixture.Id, out var value)) { return value; } value = new FixtureNote { Locator = fixture.Locator }; attached.Add(fixture.Id, value); notes.Fixtures.Add(value); return value; } private void Filters(bool equipment, bool corridor) { GUILayout.Label(InterfaceLanguage.T("Pesquisar", "Search"), Array.Empty<GUILayoutOption>()); search = Text("pesquisa", search); Cycle(InterfaceLanguage.T("Categoria", "Category"), snapshot.Categories.Keys, ref categoryFilter, CategoryName); if (equipment) { Cycle(InterfaceLanguage.T("Equipamento", "Equipment"), from i in (from f in snapshot.Fixtures.Where(Live) select f.Container.containerClass).Distinct() orderby i select i, ref equipmentFilter, (int i) => InterfaceLanguage.T("Tipo ", "Type ") + i); } if (corridor && GUILayout.Button(InterfaceLanguage.T("Corredor · ", "Aisle · ") + (filterSector?.Name ?? InterfaceLanguage.T("Todos", "All")), Array.Empty<GUILayoutOption>())) { int num = notes.Sectors.IndexOf(filterSector); filterSector = ((num + 1 < notes.Sectors.Count) ? notes.Sectors[num + 1] : null); } } private static void Cycle(string label, IEnumerable<int> choices, ref int current, Func<int, string> display) { if (GUILayout.Button(label + " · " + ((current < 0) ? InterfaceLanguage.T("Todos", "All") : display(current)), Array.Empty<GUILayoutOption>())) { List<int> list = choices.ToList(); int num = list.IndexOf(current) + 1; current = ((num < list.Count) ? list[num] : (-1)); } } private string CategoryName(int id) { if (!snapshot.Categories.TryGetValue(id, out var value)) { return InterfaceLanguage.T("Sem categoria", "No category"); } return value; } private bool Matches(string value) { if (!string.IsNullOrEmpty(search)) { if (!string.IsNullOrEmpty(value)) { return CultureInfo.CurrentCulture.CompareInfo.IndexOf(value, search, CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace) >= 0; } return false; } return true; } private void Fixtures() { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button(aiming ? InterfaceLanguage.T("Cancelar mira", "Cancel aiming") : InterfaceLanguage.T("Selecionar pela mira", "Select by aiming"), Array.Empty<GUILayoutOption>())) { aiming = !aiming; aimed = null; message = (aiming ? InterfaceLanguage.T("Feche o menu do jogo, mire no expositor e reabra o painel para selecionar.", "Close the game menu, aim at a fixture, then reopen the panel to select it.") : ""); if (aiming) { Close(); } } if (aiming && Object.op_Implicit((Object)(object)aimed) && GUILayout.Button(InterfaceLanguage.T("Selecionar expositor mirado", "Select targeted fixture"), Array.Empty<GUILayoutOption>())) { Fixture fixture = snapshot.Fixtures.Find((Fixture f) => (Object)(object)f.Container == (Object)(object)aimed && Live(f)); if (fixture != null) { selected.Add(fixture.Id); highlight = (editFixture = fixture.Id); message = ""; } else { message = InterfaceLanguage.T("O objeto mirado está fora do inventário da área de vendas.", "The targeted object is outside the sales floor inventory."); } aiming = false; } if (GUILayout.Button(InterfaceLanguage.T("Limpar seleção", "Clear selection"), Array.Empty<GUILayoutOption>())) { selected.Clear(); } GUILayout.EndHorizontal(); Filters(equipment: true, corridor: true); foreach (Fixture item in snapshot.Fixtures.Where(Live)) { attached.TryGetValue(item.Id, out var note); if ((equipmentFilter >= 0 && item.Container.containerClass != equipmentFilter) || (filterSector != null