Merge pull request #472 from KinglyKrab/master

Adds IsBlind() and IsFeared() functionality to Perl and Lua.
This commit is contained in:
Akkadius 2015-12-14 14:11:26 -06:00
commit 2fb63d4d26
4 changed files with 70 additions and 1 deletions

View File

@ -1,6 +1,9 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 12/07/2016 ==
== 12/14/2015 ==
Kinglykrab: Added IsBlind() and IsFeared() functionality to Perl and Lua.
- Note: Both methods are Mob methods and may be used on NPCs or PCs.
== 12/07/2015 ==
Uleat: Command aliases are no longer handled through the command_add() function.
- To add a command alias, edit the database table `command_settings` - here, you will find three columns: `command`, `access` and `aliases`
- Adding command aliases require that the command contain an entry in `command_settings`.`command`

View File

@ -1871,6 +1871,16 @@ void Lua_Mob::SetPseudoRoot(bool in) {
self->SetPseudoRoot(in);
}
bool Lua_Mob::IsFeared() {
Lua_Safe_Call_Bool();
return self->IsFeared();
}
bool Lua_Mob::IsBlind() {
Lua_Safe_Call_Bool();
return self->IsBlind();
}
luabind::scope lua_register_mob() {
return luabind::class_<Lua_Mob, Lua_Entity>("Mob")
.def(luabind::constructor<>())
@ -2156,6 +2166,8 @@ luabind::scope lua_register_mob() {
.def("WearChange", (void(Lua_Mob::*)(int,int,uint32))&Lua_Mob::WearChange)
.def("DoKnockback", (void(Lua_Mob::*)(Lua_Mob,uint32,uint32))&Lua_Mob::DoKnockback)
.def("RemoveNimbusEffect", (void(Lua_Mob::*)(int))&Lua_Mob::RemoveNimbusEffect)
.def("IsFeared", (bool(Lua_Mob::*)(void))&Lua_Mob::IsFeared)
.def("IsBlind", (bool(Lua_Mob::*)(void))&Lua_Mob::IsBlind)
.def("IsRunning", (bool(Lua_Mob::*)(void))&Lua_Mob::IsRunning)
.def("SetRunning", (void(Lua_Mob::*)(bool))&Lua_Mob::SetRunning)
.def("SetBodyType", (void(Lua_Mob::*)(int,bool))&Lua_Mob::SetBodyType)

View File

@ -40,6 +40,8 @@ public:
void SetLevel(int level, bool command);
void SendWearChange(int material_slot);
bool IsMoving();
bool IsFeared();
bool IsBlind();
void GotoBind();
void Gate();
bool Attack(Lua_Mob other);

View File

@ -8440,6 +8440,56 @@ XS(XS_Mob_CanClassEquipItem)
XSRETURN(1);
}
XS(XS_Mob_IsFeared);
XS(XS_Mob_IsFeared) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Mob::IsFeared(THIS)");
{
Mob* THIS;
bool RETVAL;
if (sv_derived_from(ST(0), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Mob*, tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Mob");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsFeared();
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
XS(XS_Mob_IsBlind);
XS(XS_Mob_IsBlind) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Mob::IsBlind(THIS)");
{
Mob* THIS;
bool RETVAL;
if (sv_derived_from(ST(0), "Mob")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Mob*, tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Mob");
if (THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->IsBlind();
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
#ifdef __cplusplus
extern "C"
#endif
@ -8751,6 +8801,8 @@ XS(boot_Mob)
newXSproto(strcpy(buf, "ClearSpecialAbilities"), XS_Mob_ClearSpecialAbilities, file, "$");
newXSproto(strcpy(buf, "ProcessSpecialAbilities"), XS_Mob_ProcessSpecialAbilities, file, "$$");
newXSproto(strcpy(buf, "CanClassEquipItem"), XS_Mob_CanClassEquipItem, file, "$$");
newXSproto(strcpy(buf, "IsFeared"), XS_Mob_IsFeared, file, "$");
newXSproto(strcpy(buf, "IsBlind"), XS_Mob_IsBlind, file, "$");
XSRETURN_YES;
}