mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 09:31:30 +00:00
[Quest API] Add mob SetPet and RemovePet quest apis (#1569)
Will be required for tutoriala script and other similar events
This commit is contained in:
parent
00a22ca12e
commit
fb98349bbd
@ -2194,6 +2194,16 @@ bool Lua_Mob::HasPet() {
|
||||
return self->HasPet();
|
||||
}
|
||||
|
||||
void Lua_Mob::RemovePet() {
|
||||
Lua_Safe_Call_Void();
|
||||
return self->SetPet(nullptr);
|
||||
}
|
||||
|
||||
void Lua_Mob::SetPet(Lua_Mob new_pet) {
|
||||
Lua_Safe_Call_Void();
|
||||
return self->SetPet(new_pet);
|
||||
}
|
||||
|
||||
bool Lua_Mob::IsSilenced() {
|
||||
Lua_Safe_Call_Bool();
|
||||
return self->IsSilenced();
|
||||
@ -2769,6 +2779,8 @@ luabind::scope lua_register_mob() {
|
||||
.def("HasOwner", (bool(Lua_Mob::*)(void))&Lua_Mob::HasOwner)
|
||||
.def("IsPet", (bool(Lua_Mob::*)(void))&Lua_Mob::IsPet)
|
||||
.def("HasPet", (bool(Lua_Mob::*)(void))&Lua_Mob::HasPet)
|
||||
.def("RemovePet", &Lua_Mob::RemovePet)
|
||||
.def("SetPet", &Lua_Mob::SetPet)
|
||||
.def("IsSilenced", (bool(Lua_Mob::*)(void))&Lua_Mob::IsSilenced)
|
||||
.def("IsAmnesiad", (bool(Lua_Mob::*)(void))&Lua_Mob::IsAmnesiad)
|
||||
.def("GetMeleeMitigation", (int32(Lua_Mob::*)(void))&Lua_Mob::GetMeleeMitigation)
|
||||
|
||||
@ -412,6 +412,8 @@ public:
|
||||
bool HasOwner();
|
||||
bool IsPet();
|
||||
bool HasPet();
|
||||
void RemovePet();
|
||||
void SetPet(Lua_Mob new_pet);
|
||||
bool IsSilenced();
|
||||
bool IsAmnesiad();
|
||||
int32 GetMeleeMitigation();
|
||||
|
||||
@ -5945,6 +5945,43 @@ XS(XS_Mob_HasPet) {
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS_Mob_RemovePet);
|
||||
XS(XS_Mob_RemovePet) {
|
||||
dXSARGS;
|
||||
if (items != 1) {
|
||||
Perl_croak(aTHX_ "Usage: Mob::RemovePet(THIS)"); // @categories Pet
|
||||
}
|
||||
|
||||
Mob* THIS;
|
||||
VALIDATE_THIS_IS_MOB;
|
||||
|
||||
THIS->SetPet(nullptr);
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Mob_SetPet);
|
||||
XS(XS_Mob_SetPet) {
|
||||
dXSARGS;
|
||||
if (items != 2) {
|
||||
Perl_croak(aTHX_ "Usage: Mob::SetPet(THIS, Mob* new_pet)"); // @categories Pet
|
||||
}
|
||||
|
||||
Mob* THIS;
|
||||
VALIDATE_THIS_IS_MOB;
|
||||
|
||||
Mob* new_pet = nullptr; // passing null or invalid new_pet removes pet
|
||||
if (sv_derived_from(ST(1), "Mob"))
|
||||
{
|
||||
IV tmp = SvIV((SV*)SvRV(ST(1)));
|
||||
new_pet = INT2PTR(Mob*, tmp);
|
||||
}
|
||||
|
||||
THIS->SetPet(new_pet);
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
XS(XS_Mob_IsSilenced);
|
||||
XS(XS_Mob_IsSilenced) {
|
||||
dXSARGS;
|
||||
@ -6673,6 +6710,8 @@ XS(boot_Mob) {
|
||||
newXSproto(strcpy(buf, "HasOwner"), XS_Mob_HasOwner, file, "$");
|
||||
newXSproto(strcpy(buf, "IsPet"), XS_Mob_IsPet, file, "$");
|
||||
newXSproto(strcpy(buf, "HasPet"), XS_Mob_HasPet, file, "$");
|
||||
newXSproto(strcpy(buf, "RemovePet"), XS_Mob_RemovePet, file, "$");
|
||||
newXSproto(strcpy(buf, "SetPet"), XS_Mob_SetPet, file, "$$");
|
||||
newXSproto(strcpy(buf, "IsSilenced"), XS_Mob_IsSilenced, file, "$");
|
||||
newXSproto(strcpy(buf, "IsAmnesiad"), XS_Mob_IsAmnesiad, file, "$");
|
||||
newXSproto(strcpy(buf, "GetMeleeMitigation"), XS_Mob_GetMeleeMitigation, file, "$");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user