forked from jackalstomper/AutomataSpeedrunMod
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInventoryManager.hpp
More file actions
51 lines (38 loc) · 1.32 KB
/
InventoryManager.hpp
File metadata and controls
51 lines (38 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include <cstdint>
#include <vector>
#include "PointerIterator.hpp"
namespace AutomataMod {
class InventoryManager
{
public:
// Each slot is a 4 byte ID, followed by 4 bytes of ???, followed by a 4 byte count of that item
struct Item
{
uint32_t itemId;
uint32_t unknown;
uint32_t quantity;
void reset();
};
using Iterator = PointerIterator<Item>;
static const uint32_t SEVERED_CABLE_ID;
static const uint32_t DENTED_PLATE_ID;
static const uint32_t EMPTY_SLOT_ID;
static const uint32_t FISH_AROWANA_ID;
static const uint32_t FISH_BROKEN_FIREARM_ID;
static const uint32_t FISH_MACKEREL_ID;
private:
Item* const _firstSlot; // The memory address that the item table starts at
static const int MAX_SLOT_COUNT; // the total number of inventory slots the game supports
public:
InventoryManager(uint64_t itemTableRamStart);
// Returns the slot for the given index, or nullptr if not found
Iterator getItemSlotById(uint32_t itemId);
// Returns all items that match the given item ID range (inclusive)
std::vector<Iterator> getAllItemsByRange(uint32_t itemIdStart, uint32_t itemIdEnd);
void addItem(const Item& slot);
void removeItem(Iterator slot);
Iterator begin();
Iterator end();
};
} // namespace AutomataMod