Auto-detect coinage and inventory fields

This commit is contained in:
Kelsi 2026-02-13 19:47:49 -08:00
parent 24d780e669
commit bf39c0b900
3 changed files with 80 additions and 2 deletions

View file

@ -1140,6 +1140,10 @@ private:
};
std::unordered_map<uint64_t, LocalLootState> localLootState_;
uint64_t playerMoneyCopper_ = 0;
// Some servers/custom clients shift update field indices. We can auto-detect coinage by correlating
// money-notify deltas with update-field diffs and then overriding UF::PLAYER_FIELD_COINAGE at runtime.
uint32_t pendingMoneyDelta_ = 0;
float pendingMoneyDeltaTimer_ = 0.0f;
// Gossip
bool gossipWindowOpen = false;

View file

@ -70,6 +70,9 @@ public:
/** Get the wire index for a logical field. Returns 0xFFFF if unknown. */
uint16_t index(UF field) const;
/** Override a wire index at runtime (used for auto-detecting custom field layouts). */
void setIndex(UF field, uint16_t idx) { fieldMap_[static_cast<uint16_t>(field)] = idx; }
/** Check if a field is mapped. */
bool hasField(UF field) const;