feat: add right-click pet spell autocast toggle via CMSG_PET_SPELL_AUTOCAST

Right-clicking a castable pet ability (actionId > 6) in the pet action
bar now sends CMSG_PET_SPELL_AUTOCAST to toggle the spell's autocast
state. The local petAutocastSpells_ set is updated optimistically and
the tooltip shows the current state with a right-click hint.
This commit is contained in:
Kelsi 2026-03-18 05:08:10 -07:00
parent 586408516b
commit e7fe35c1f9
3 changed files with 28 additions and 2 deletions

View file

@ -3899,6 +3899,10 @@ void GameScreen::renderPetFrame(game::GameHandler& gameHandler) {
uint64_t targetGuid = (actionId > 5) ? gameHandler.getTargetGuid() : 0u;
gameHandler.sendPetAction(slotVal, targetGuid);
}
// Right-click toggles autocast for castable pet spells (actionId > 6)
if (actionId > 6 && ImGui::IsItemClicked(ImGuiMouseButton_Right)) {
gameHandler.togglePetSpellAutocast(actionId);
}
// Tooltip: rich spell info for pet spells, simple label for built-in commands
if (ImGui::IsItemHovered()) {
@ -3920,8 +3924,10 @@ void GameScreen::renderPetFrame(game::GameHandler& gameHandler) {
if (nm.empty()) nm = "Spell #" + std::to_string(actionId);
ImGui::Text("%s", nm.c_str());
}
if (autocastOn)
ImGui::TextColored(ImVec4(0.4f, 1.0f, 0.4f, 1.0f), "Autocast: On");
ImGui::TextColored(autocastOn
? ImVec4(0.4f, 1.0f, 0.4f, 1.0f)
: ImVec4(0.6f, 0.6f, 0.6f, 1.0f),
"Autocast: %s (right-click to toggle)", autocastOn ? "On" : "Off");
if (petOnCd) {
if (petCd >= 60.0f)
ImGui::TextColored(ImVec4(1.0f, 0.3f, 0.3f, 1.0f),