// Since some items don't stack, it's possible to have several of the target item in your inventory. The state // of each one is tracked and returned when the split becomes relevant. public ItemState[] GetItemStates(int baseId, int category) { ItemId id = new ItemId(baseId, category); // It's assumed that an item ID will only be queried if it was present in the list of saved splits // (although it may not have been acquired yet). if (!tracker.TryGetValue(id, out List <IntPtr> list) || list.Count == 0) { return(new ItemState[0]); } ItemState[] states = new ItemState[list.Count]; for (int i = 0; i < list.Count; i++) { IntPtr address = list[i]; int rawId = ComputeRawId(address); int count = MemoryTools.ReadByte(Handle, address + countOffset); int mods = 0; int reinforcement = 0; if (rawId / 10000 > 0) { ComputeUpgrades(rawId, out mods, out reinforcement); } states[i] = new ItemState(mods, reinforcement, count); } return(states); }
private int GetCategory(IntPtr address) { int value = MemoryTools.ReadByte(Handle, address - 0x1); return(Utilities.ToHex(value)); }