|
| 1 | +// This file is part of ClassicAPI. |
| 2 | +// |
| 3 | +// ClassicAPI is free software: you can redistribute it and/or modify it under the terms |
| 4 | +// of the GNU General Public License as published by the Free Software Foundation, either |
| 5 | +// version 3 of the License, or (at your option) any later version. |
| 6 | +// |
| 7 | +// ClassicAPI is distributed in the hope that it will be useful, but WITHOUT ANY |
| 8 | +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 9 | +// PURPOSE. See the GNU General Public License for more details. |
| 10 | +// |
| 11 | +// You should have received a copy of the GNU General Public License along with |
| 12 | +// ClassicAPI. If not, see <https://www.gnu.org/licenses/>. |
| 13 | + |
| 14 | +#pragma once |
| 15 | + |
| 16 | +#include <cstdint> |
| 17 | + |
| 18 | +// Accessors for a `CGItem`'s two descriptor-like pointers (see the "Item |
| 19 | +// lookups" notes in CLAUDE.md). Every item module used to spell out the same |
| 20 | +// `*reinterpret_cast<const uint8_t *const *>(cgItem + OFF_...)` deref; these |
| 21 | +// name it once. |
| 22 | + |
| 23 | +namespace Item { |
| 24 | + |
| 25 | +// The item's **instance block** (`CGItem + 0x08` dereferenced): a `uint64` |
| 26 | +// item GUID at `+0x00` and the `uint32` itemID at `+0x0C`. This is the block |
| 27 | +// the canonical inventory→cache path reads the itemID from. Returns nullptr |
| 28 | +// for a null `cgItem`; the stored pointer itself may still be null (callers |
| 29 | +// null-check the result before reading fields). |
| 30 | +const uint8_t *InstanceBlock(const uint8_t *cgItem); |
| 31 | + |
| 32 | +// The item's **m_objectFields descriptor** (`CGItem + 0x114` dereferenced): |
| 33 | +// the UpdateField block holding stack count (`+0x20`), flags (`+0x3C`), |
| 34 | +// spell charges (`+0x28`), durability (`+0xA0`), enchantments, etc. Distinct |
| 35 | +// from the instance block. Returns nullptr for a null `cgItem`. |
| 36 | +const uint8_t *ObjectFields(const uint8_t *cgItem); |
| 37 | + |
| 38 | +} // namespace Item |
0 commit comments