mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-27 01:00:13 +00:00
feat: show socket gems and consolidate enchant name DBC cache in item tooltips
Extends OnlineItemInfo to track gem enchant IDs (socket slots 2-4) from item update fields; socket display now shows inserted gem name inline (e.g. "Red Socket: Bold Scarlet Ruby"). Consolidates redundant SpellItemEnchantment DBC loads into one shared static per tooltip variant.
This commit is contained in:
parent
167e710f92
commit
d7c377292e
3 changed files with 133 additions and 116 deletions
|
|
@ -11679,18 +11679,24 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem
|
|||
auto maxDurIt= block.fields.find(fieldIndex(UF::ITEM_FIELD_MAXDURABILITY));
|
||||
const uint16_t enchBase = (fieldIndex(UF::ITEM_FIELD_STACK_COUNT) != 0xFFFF)
|
||||
? static_cast<uint16_t>(fieldIndex(UF::ITEM_FIELD_STACK_COUNT) + 8u) : 0xFFFFu;
|
||||
auto permEnchIt = (enchBase != 0xFFFF) ? block.fields.find(enchBase) : block.fields.end();
|
||||
auto tempEnchIt = (enchBase != 0xFFFF) ? block.fields.find(enchBase + 3u) : block.fields.end();
|
||||
auto permEnchIt = (enchBase != 0xFFFF) ? block.fields.find(enchBase) : block.fields.end();
|
||||
auto tempEnchIt = (enchBase != 0xFFFF) ? block.fields.find(enchBase + 3u) : block.fields.end();
|
||||
auto sock1EnchIt = (enchBase != 0xFFFF) ? block.fields.find(enchBase + 6u) : block.fields.end();
|
||||
auto sock2EnchIt = (enchBase != 0xFFFF) ? block.fields.find(enchBase + 9u) : block.fields.end();
|
||||
auto sock3EnchIt = (enchBase != 0xFFFF) ? block.fields.find(enchBase + 12u) : block.fields.end();
|
||||
if (entryIt != block.fields.end() && entryIt->second != 0) {
|
||||
// Preserve existing info when doing partial updates
|
||||
OnlineItemInfo info = onlineItems_.count(block.guid)
|
||||
? onlineItems_[block.guid] : OnlineItemInfo{};
|
||||
info.entry = entryIt->second;
|
||||
if (stackIt != block.fields.end()) info.stackCount = stackIt->second;
|
||||
if (durIt != block.fields.end()) info.curDurability = durIt->second;
|
||||
if (maxDurIt != block.fields.end()) info.maxDurability = maxDurIt->second;
|
||||
if (permEnchIt != block.fields.end()) info.permanentEnchantId = permEnchIt->second;
|
||||
if (tempEnchIt != block.fields.end()) info.temporaryEnchantId = tempEnchIt->second;
|
||||
if (stackIt != block.fields.end()) info.stackCount = stackIt->second;
|
||||
if (durIt != block.fields.end()) info.curDurability = durIt->second;
|
||||
if (maxDurIt != block.fields.end()) info.maxDurability = maxDurIt->second;
|
||||
if (permEnchIt != block.fields.end()) info.permanentEnchantId = permEnchIt->second;
|
||||
if (tempEnchIt != block.fields.end()) info.temporaryEnchantId = tempEnchIt->second;
|
||||
if (sock1EnchIt != block.fields.end()) info.socketEnchantIds[0] = sock1EnchIt->second;
|
||||
if (sock2EnchIt != block.fields.end()) info.socketEnchantIds[1] = sock2EnchIt->second;
|
||||
if (sock3EnchIt != block.fields.end()) info.socketEnchantIds[2] = sock3EnchIt->second;
|
||||
bool isNew = (onlineItems_.find(block.guid) == onlineItems_.end());
|
||||
onlineItems_[block.guid] = info;
|
||||
if (isNew) newItemCreated = true;
|
||||
|
|
@ -12277,10 +12283,13 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem
|
|||
const uint16_t containerSlot1Field = fieldIndex(UF::CONTAINER_FIELD_SLOT_1);
|
||||
// ITEM_FIELD_ENCHANTMENT starts 8 fields after ITEM_FIELD_STACK_COUNT (fixed offset
|
||||
// across all expansions: +DURATION, +5×SPELL_CHARGES, +FLAGS = +8).
|
||||
// Slot 0 = permanent enchant (field +0), slot 1 = temp enchant (field +3).
|
||||
const uint16_t itemEnchBase = (itemStackField != 0xFFFF) ? (itemStackField + 8u) : 0xFFFF;
|
||||
// Slot 0 = permanent (field +0), slot 1 = temp (+3), slots 2-4 = sockets (+6,+9,+12).
|
||||
const uint16_t itemEnchBase = (itemStackField != 0xFFFF) ? (itemStackField + 8u) : 0xFFFF;
|
||||
const uint16_t itemPermEnchField = itemEnchBase;
|
||||
const uint16_t itemTempEnchField = (itemEnchBase != 0xFFFF) ? (itemEnchBase + 3u) : 0xFFFF;
|
||||
const uint16_t itemTempEnchField = (itemEnchBase != 0xFFFF) ? (itemEnchBase + 3u) : 0xFFFF;
|
||||
const uint16_t itemSock1EnchField= (itemEnchBase != 0xFFFF) ? (itemEnchBase + 6u) : 0xFFFF;
|
||||
const uint16_t itemSock2EnchField= (itemEnchBase != 0xFFFF) ? (itemEnchBase + 9u) : 0xFFFF;
|
||||
const uint16_t itemSock3EnchField= (itemEnchBase != 0xFFFF) ? (itemEnchBase + 12u) : 0xFFFF;
|
||||
|
||||
auto it = onlineItems_.find(block.guid);
|
||||
bool isItemInInventory = (it != onlineItems_.end());
|
||||
|
|
@ -12311,6 +12320,21 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem
|
|||
it->second.temporaryEnchantId = val;
|
||||
inventoryChanged = true;
|
||||
}
|
||||
} else if (isItemInInventory && itemSock1EnchField != 0xFFFF && key == itemSock1EnchField) {
|
||||
if (it->second.socketEnchantIds[0] != val) {
|
||||
it->second.socketEnchantIds[0] = val;
|
||||
inventoryChanged = true;
|
||||
}
|
||||
} else if (isItemInInventory && itemSock2EnchField != 0xFFFF && key == itemSock2EnchField) {
|
||||
if (it->second.socketEnchantIds[1] != val) {
|
||||
it->second.socketEnchantIds[1] = val;
|
||||
inventoryChanged = true;
|
||||
}
|
||||
} else if (isItemInInventory && itemSock3EnchField != 0xFFFF && key == itemSock3EnchField) {
|
||||
if (it->second.socketEnchantIds[2] != val) {
|
||||
it->second.socketEnchantIds[2] = val;
|
||||
inventoryChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Update container slot GUIDs on bag content changes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue