[Quest API] Add IsAutoAttackEnabled() to Perl/Lua (#2979)

# Perl
- Add `$client->IsAutoAttackEnabled()`.

# Lua
- Add `client:IsAutoAttackEnabled()`.

# Notes
- Allows operators to check if a client has auto attack enabled.
This commit is contained in:
Alex King 2023-02-23 03:31:35 -05:00 committed by GitHub
parent 9d4f231619
commit 0d72295cc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -3038,10 +3038,18 @@ void Lua_Client::UseAugmentContainer(int container_slot)
self->UseAugmentContainer(container_slot);
}
bool Lua_Client::IsAutoAttackEnabled()
{
Lua_Safe_Call_Bool();
return self->AutoAttackEnabled();
}
bool Lua_Client::IsAutoFireEnabled()
{
Lua_Safe_Call_Bool();
return self->AutoFireEnabled();
}
luabind::scope lua_register_client() {
@ -3302,6 +3310,7 @@ luabind::scope lua_register_client() {
.def("IncreaseSkill", (void(Lua_Client::*)(int))&Lua_Client::IncreaseSkill)
.def("IncreaseSkill", (void(Lua_Client::*)(int,int))&Lua_Client::IncreaseSkill)
.def("IncrementAA", (void(Lua_Client::*)(int))&Lua_Client::IncrementAA)
.def("IsAutoAttackEnabled", (bool(Lua_Client::*)(void))&Lua_Client::IsAutoAttackEnabled)
.def("IsAutoFireEnabled", (bool(Lua_Client::*)(void))&Lua_Client::IsAutoFireEnabled)
.def("IsCrouching", (bool(Lua_Client::*)(void))&Lua_Client::IsCrouching)
.def("IsDead", &Lua_Client::IsDead)

View File

@ -466,6 +466,7 @@ public:
void SetItemCooldown(uint32 item_id, uint32 in_time);
uint32 GetItemCooldown(uint32 item_id);
void UseAugmentContainer(int container_slot);
bool IsAutoAttackEnabled();
bool IsAutoFireEnabled();
void ApplySpell(int spell_id);

View File

@ -2897,6 +2897,11 @@ void Perl_Client_UseAugmentContainer(Client* self, int container_slot)
self->UseAugmentContainer(container_slot);
}
bool Perl_Client_IsAutoAttackEnabled(Client* self)
{
return self->AutoAttackEnabled();
}
bool Perl_Client_IsAutoFireEnabled(Client* self)
{
return self->AutoFireEnabled();
@ -3164,6 +3169,7 @@ void perl_register_client()
package.add("IncreaseSkill", (void(*)(Client*, int))&Perl_Client_IncreaseSkill);
package.add("IncreaseSkill", (void(*)(Client*, int, int))&Perl_Client_IncreaseSkill);
package.add("IncrementAA", &Perl_Client_IncrementAA);
package.add("IsAutoAttackEnabled", &Perl_Client_IsAutoAttackEnabled);
package.add("IsAutoFireEnabled", &Perl_Client_IsAutoFireEnabled);
package.add("IsBecomeNPC", &Perl_Client_IsBecomeNPC);
package.add("IsCrouching", &Perl_Client_IsCrouching);