diff --git a/changelog.txt b/changelog.txt index 5d2345521..0e135c1db 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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` diff --git a/zone/lua_mob.cpp b/zone/lua_mob.cpp index 2f0712ec0..3963ec64c 100644 --- a/zone/lua_mob.cpp +++ b/zone/lua_mob.cpp @@ -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_("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) diff --git a/zone/lua_mob.h b/zone/lua_mob.h index 4f427aca5..3b98b4af3 100644 --- a/zone/lua_mob.h +++ b/zone/lua_mob.h @@ -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); diff --git a/zone/perl_mob.cpp b/zone/perl_mob.cpp index 323d22b36..adbdd0301 100644 --- a/zone/perl_mob.cpp +++ b/zone/perl_mob.cpp @@ -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; }