mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +00:00
Add minimap coordinate tooltip and play time warning display
Hovering over the minimap now shows a tooltip with the player's WoW canonical coordinates (X=North, Y=West) and a hint about Ctrl+click pinging. SMSG_PLAY_TIME_WARNING is now parsed (type + minutes) and shown as both a chat message and a UIError overlay rather than silently dropped.
This commit is contained in:
parent
1bc3e6b677
commit
7a1f330655
2 changed files with 39 additions and 1 deletions
|
|
@ -6125,10 +6125,33 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
case Opcode::SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA:
|
||||
case Opcode::SMSG_RESET_RANGED_COMBAT_TIMER:
|
||||
case Opcode::SMSG_PROFILEDATA_RESPONSE:
|
||||
case Opcode::SMSG_PLAY_TIME_WARNING:
|
||||
packet.setReadPos(packet.getSize());
|
||||
break;
|
||||
|
||||
case Opcode::SMSG_PLAY_TIME_WARNING: {
|
||||
// uint32 type (0=normal, 1=heavy, 2=tired/restricted) + uint32 minutes played
|
||||
if (packet.getSize() - packet.getReadPos() >= 4) {
|
||||
uint32_t warnType = packet.readUInt32();
|
||||
uint32_t minutesPlayed = (packet.getSize() - packet.getReadPos() >= 4)
|
||||
? packet.readUInt32() : 0;
|
||||
const char* severity = (warnType >= 2) ? "[Tired] " : "[Play Time] ";
|
||||
char buf[128];
|
||||
if (minutesPlayed > 0) {
|
||||
uint32_t h = minutesPlayed / 60;
|
||||
uint32_t m = minutesPlayed % 60;
|
||||
if (h > 0)
|
||||
std::snprintf(buf, sizeof(buf), "%sYou have been playing for %uh %um.", severity, h, m);
|
||||
else
|
||||
std::snprintf(buf, sizeof(buf), "%sYou have been playing for %um.", severity, m);
|
||||
} else {
|
||||
std::snprintf(buf, sizeof(buf), "%sYou have been playing for a long time.", severity);
|
||||
}
|
||||
addSystemChatMessage(buf);
|
||||
addUIError(buf);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// ---- Item query multiple (same format as single, re-use handler) ----
|
||||
case Opcode::SMSG_ITEM_QUERY_MULTIPLE_RESPONSE:
|
||||
handleItemQueryResponse(packet);
|
||||
|
|
|
|||
|
|
@ -11656,6 +11656,21 @@ void GameScreen::renderMinimapMarkers(game::GameHandler& gameHandler) {
|
|||
}
|
||||
}
|
||||
|
||||
// Hover tooltip: show player's WoW coordinates (canonical X=North, Y=West)
|
||||
{
|
||||
ImVec2 mouse = ImGui::GetMousePos();
|
||||
float mdx = mouse.x - centerX;
|
||||
float mdy = mouse.y - centerY;
|
||||
if (mdx * mdx + mdy * mdy <= mapRadius * mapRadius) {
|
||||
glm::vec3 playerCanon = core::coords::renderToCanonical(playerRender);
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::TextColored(ImVec4(0.9f, 0.9f, 0.5f, 1.0f),
|
||||
"%.1f, %.1f", playerCanon.x, playerCanon.y);
|
||||
ImGui::TextDisabled("Ctrl+click to ping");
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
auto applyMuteState = [&]() {
|
||||
auto* activeRenderer = core::Application::getInstance().getRenderer();
|
||||
float masterScale = soundMuted_ ? 0.0f : static_cast<float>(pendingMasterVolume) / 100.0f;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue