mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-25 16:30:15 +00:00
feat: add CastPetAction, TogglePetAutocast, PetDismiss, IsPetAttackActive
Complete the pet action bar interaction: - CastPetAction(index) — cast the pet spell at the given bar slot by sending the packed action via sendPetAction - TogglePetAutocast(index) — toggle autocast for the pet spell at the given slot via togglePetSpellAutocast - PetDismiss() — send dismiss pet command - IsPetAttackActive() — whether pet is currently in attack mode Together with the previous pet bar functions (HasPetUI, GetPetActionInfo, PetAttack, PetFollow, PetWait, PetPassiveMode, PetDefensiveMode), this completes the pet action bar system for hunters/warlocks/DKs.
This commit is contained in:
parent
3f3ed22f78
commit
ee6551b286
1 changed files with 32 additions and 0 deletions
|
|
@ -5118,6 +5118,38 @@ void LuaEngine::registerCoreAPI() {
|
|||
gh->sendPetAction(0x00000007 | (0u << 16), 0); // REACT_PASSIVE
|
||||
return 0;
|
||||
}},
|
||||
{"CastPetAction", [](lua_State* L) -> int {
|
||||
auto* gh = getGameHandler(L);
|
||||
int index = static_cast<int>(luaL_checknumber(L, 1));
|
||||
if (!gh || !gh->hasPet() || index < 1 || index > game::GameHandler::PET_ACTION_BAR_SLOTS) return 0;
|
||||
uint32_t packed = gh->getPetActionSlot(index - 1);
|
||||
uint32_t spellId = packed & 0x00FFFFFF;
|
||||
if (spellId != 0) {
|
||||
uint64_t target = gh->hasTarget() ? gh->getTargetGuid() : gh->getPetGuid();
|
||||
gh->sendPetAction(packed, target);
|
||||
}
|
||||
return 0;
|
||||
}},
|
||||
{"TogglePetAutocast", [](lua_State* L) -> int {
|
||||
auto* gh = getGameHandler(L);
|
||||
int index = static_cast<int>(luaL_checknumber(L, 1));
|
||||
if (!gh || !gh->hasPet() || index < 1 || index > game::GameHandler::PET_ACTION_BAR_SLOTS) return 0;
|
||||
uint32_t packed = gh->getPetActionSlot(index - 1);
|
||||
uint32_t spellId = packed & 0x00FFFFFF;
|
||||
if (spellId != 0) gh->togglePetSpellAutocast(spellId);
|
||||
return 0;
|
||||
}},
|
||||
{"PetDismiss", [](lua_State* L) -> int {
|
||||
auto* gh = getGameHandler(L);
|
||||
if (gh && gh->hasPet())
|
||||
gh->sendPetAction(0x00000007 | (3u << 24), 0); // CMD_DISMISS
|
||||
return 0;
|
||||
}},
|
||||
{"IsPetAttackActive", [](lua_State* L) -> int {
|
||||
auto* gh = getGameHandler(L);
|
||||
lua_pushboolean(L, gh && gh->getPetCommand() == 2 ? 1 : 0); // 2=attack
|
||||
return 1;
|
||||
}},
|
||||
{"PetDefensiveMode", [](lua_State* L) -> int {
|
||||
auto* gh = getGameHandler(L);
|
||||
if (gh && gh->hasPet())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue