[Quest API] Add HasSpecialAbilities() to Perl/Lua (#2994)

* [Quest API] Add HasSpecialAbilities() to Perl/Lua

# Perl
- Add `$mob->HasSpecialAbilities()`.

# Lua
- Add `mob:HasSpecialAbilities()`

# Notes
- Allows operators to check if a mob has special abilities

* Move to NPC.

* Update lua_mob.cpp
This commit is contained in:
Alex King 2023-02-26 21:35:10 -05:00 committed by GitHub
parent ff4ccfa98f
commit 3448758c03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 0 deletions

View File

@ -767,6 +767,11 @@ void Lua_NPC::ScaleNPC(uint8 npc_level, bool override_special_abilities)
self->ScaleNPC(npc_level, true, override_special_abilities);
}
bool Lua_NPC::HasSpecialAbilities() {
Lua_Safe_Call_Bool();
return self->HasSpecialAbilities();
}
luabind::scope lua_register_npc() {
return luabind::class_<Lua_NPC, Lua_Mob>("NPC")
.def(luabind::constructor<>())

View File

@ -174,6 +174,7 @@ public:
void SetLDoNTrapDetected(bool is_detected);
void ScaleNPC(uint8 npc_level);
void ScaleNPC(uint8 npc_level, bool override_special_abilities);
bool HasSpecialAbilities();
};
#endif

View File

@ -765,6 +765,11 @@ void Perl_NPC_ScaleNPC(NPC* self, uint8 npc_level, bool override_special_abiliti
return self->ScaleNPC(npc_level, override_special_abilities);
}
bool Perl_NPC_HasSpecialAbilities(NPC* self) // @categories Script Utility
{
return self->HasSpecialAbilities();
}
void perl_register_npc()
{
perl::interpreter perl(PERL_GET_THX);
@ -852,6 +857,7 @@ void perl_register_npc()
package.add("GetSwarmTarget", &Perl_NPC_GetSwarmTarget);
package.add("GetWaypointMax", &Perl_NPC_GetWaypointMax);
package.add("HasAISpellEffect", &Perl_NPC_HasAISpellEffect);
package.add("HasSpecialAbilities", &Perl_NPC_HasSpecialAbilities);
package.add("HasItem", &Perl_NPC_HasItem);
package.add("IsAnimal", &Perl_NPC_IsAnimal);
package.add("IsGuarding", &Perl_NPC_IsGuarding);