mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-26 21:13:51 +00:00
feat: display gem socket slots and socket bonus in item tooltips
This commit is contained in:
parent
a90f2acd26
commit
0a2cd213dc
3 changed files with 52 additions and 0 deletions
|
|
@ -2930,6 +2930,26 @@ bool ItemQueryResponseParser::parse(network::Packet& packet, ItemQueryResponseDa
|
|||
data.startQuestId = packet.readUInt32(); // StartQuest
|
||||
}
|
||||
|
||||
// WotLK 3.3.5a: additional fields after StartQuest (read up to socket data)
|
||||
// LockID(4), Material(4), Sheath(4), RandomProperty(4), RandomSuffix(4),
|
||||
// Block(4), ItemSet(4), MaxDurability(4), Area(4), Map(4), BagFamily(4),
|
||||
// TotemCategory(4) = 48 bytes before sockets
|
||||
constexpr size_t kPreSocketSkip = 48;
|
||||
if (packet.getReadPos() + kPreSocketSkip + 28 <= packet.getSize()) {
|
||||
for (size_t i = 0; i < kPreSocketSkip / 4; ++i)
|
||||
packet.readUInt32();
|
||||
// 3 socket slots: socketColor (4 bytes each)
|
||||
data.socketColor[0] = packet.readUInt32();
|
||||
data.socketColor[1] = packet.readUInt32();
|
||||
data.socketColor[2] = packet.readUInt32();
|
||||
// 3 socket content (gem enchantment IDs — skip, not currently displayed)
|
||||
packet.readUInt32();
|
||||
packet.readUInt32();
|
||||
packet.readUInt32();
|
||||
// socketBonus (enchantmentId)
|
||||
data.socketBonus = packet.readUInt32();
|
||||
}
|
||||
|
||||
data.valid = !data.name.empty();
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2482,6 +2482,35 @@ void InventoryScreen::renderItemTooltip(const game::ItemQueryResponseData& info,
|
|||
}
|
||||
}
|
||||
|
||||
// Gem socket slots
|
||||
{
|
||||
static const struct { uint32_t mask; const char* label; ImVec4 col; } kSocketTypes[] = {
|
||||
{ 1, "Meta Socket", { 0.7f, 0.7f, 0.9f, 1.0f } },
|
||||
{ 2, "Red Socket", { 1.0f, 0.3f, 0.3f, 1.0f } },
|
||||
{ 4, "Yellow Socket", { 1.0f, 0.9f, 0.3f, 1.0f } },
|
||||
{ 8, "Blue Socket", { 0.3f, 0.6f, 1.0f, 1.0f } },
|
||||
};
|
||||
bool hasSocket = false;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (info.socketColor[i] == 0) continue;
|
||||
if (!hasSocket) { ImGui::Spacing(); hasSocket = true; }
|
||||
for (const auto& st : kSocketTypes) {
|
||||
if (info.socketColor[i] & st.mask) {
|
||||
ImGui::TextColored(st.col, "%s", st.label);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasSocket && info.socketBonus != 0 && gameHandler_) {
|
||||
// Socket bonus is an enchantment ID — show its name if known
|
||||
const std::string& bonusName = gameHandler_->getSpellName(info.socketBonus);
|
||||
if (!bonusName.empty())
|
||||
ImGui::TextColored(ImVec4(0.5f, 0.8f, 0.5f, 1.0f), "Socket Bonus: %s", bonusName.c_str());
|
||||
else
|
||||
ImGui::TextColored(ImVec4(0.5f, 0.8f, 0.5f, 1.0f), "Socket Bonus: (id %u)", info.socketBonus);
|
||||
}
|
||||
}
|
||||
|
||||
if (info.startQuestId != 0) {
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.82f, 0.0f, 1.0f), "Begins a Quest");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue