[Quest API] Add IsHorse() to Perl and Lua. (#1264)

This commit is contained in:
Alex 2021-02-23 21:50:06 -05:00 committed by GitHub
parent 2346b0f6ab
commit 66d24ff419
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 6 deletions

View File

@ -2999,7 +2999,7 @@ void EntityList::Depop(bool StartSpawnTimer)
if (own && own->IsClient())
continue;
if (pnpc->IsHorse)
if (pnpc->IsHorse())
continue;
if (pnpc->IsFindable())

View File

@ -36,7 +36,7 @@ Horse::Horse(Client *_owner, uint16 spell_id, const glm::vec4& position)
strn0cpy(name, _owner->GetCleanName(), 55);
strcat(name,"`s_Mount00");
IsHorse = true;
is_horse = true;
owner = _owner;
}

View File

@ -2309,6 +2309,12 @@ void Lua_Mob::SetBucket(std::string bucket_name, std::string bucket_value, std::
self->SetBucket(bucket_name, bucket_value, expiration);
}
bool Lua_Mob::IsHorse()
{
Lua_Safe_Call_Bool();
return self->IsHorse();
}
luabind::scope lua_register_mob() {
return luabind::class_<Lua_Mob, Lua_Entity>("Mob")
.def(luabind::constructor<>())
@ -2706,7 +2712,8 @@ luabind::scope lua_register_mob() {
.def("GetBucketKey", (std::string(Lua_Mob::*)(void))&Lua_Mob::GetBucketKey)
.def("GetBucketRemaining", (std::string(Lua_Mob::*)(std::string))&Lua_Mob::GetBucketRemaining)
.def("SetBucket", (void(Lua_Mob::*)(std::string,std::string))&Lua_Mob::SetBucket)
.def("SetBucket", (void(Lua_Mob::*)(std::string,std::string,std::string))&Lua_Mob::SetBucket);
.def("SetBucket", (void(Lua_Mob::*)(std::string,std::string,std::string))&Lua_Mob::SetBucket)
.def("IsHorse", &Lua_Mob::IsHorse);
}
luabind::scope lua_register_special_abilities() {

View File

@ -433,6 +433,7 @@ public:
std::string GetBucketRemaining(std::string bucket_name);
void SetBucket(std::string bucket_name, std::string bucket_value);
void SetBucket(std::string bucket_name, std::string bucket_value, std::string expiration);
bool IsHorse();
};
#endif

View File

@ -313,7 +313,7 @@ Mob::Mob(
isgrouped = false;
israidgrouped = false;
IsHorse = false;
is_horse = false;
entity_id_being_looted = 0;
_appearance = eaStanding;

View File

@ -901,6 +901,7 @@ public:
inline void SetPetOwnerClient(bool value) { pet_owner_client = value; }
inline bool IsTempPet() const { return _IsTempPet; }
inline void SetTempPet(bool value) { _IsTempPet = value; }
inline bool IsHorse() { return is_horse; }
inline const bodyType GetBodyType() const { return bodytype; }
inline const bodyType GetOrigBodyType() const { return orig_bodytype; }
@ -1592,7 +1593,7 @@ protected:
std::unordered_map<uint32, std::pair<uint32, uint32>> aa_ranks;
Timer aa_timers[aaTimerMax];
bool IsHorse;
bool is_horse;
AuraMgr aura_mgr;
AuraMgr trap_mgr;

View File

@ -6179,6 +6179,21 @@ XS(XS_Mob_SetBucket) {
XSRETURN_EMPTY;
}
XS(XS_Mob_IsHorse);
XS(XS_Mob_IsHorse) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Mob::IsHorse(THIS)"); // @categories Script Utility
{
Mob *THIS;
bool RETVAL;
VALIDATE_THIS_IS_MOB;
RETVAL = THIS->IsHorse();
ST(0) = boolSV(RETVAL);
sv_2mortal(ST(0));
}
XSRETURN(1);
}
#ifdef __cplusplus
extern "C"
@ -6209,6 +6224,7 @@ XS(boot_Mob) {
newXSproto(strcpy(buf, "IsDoor"), XS_Mob_IsDoor, file, "$");
newXSproto(strcpy(buf, "IsTrap"), XS_Mob_IsTrap, file, "$");
newXSproto(strcpy(buf, "IsBeacon"), XS_Mob_IsBeacon, file, "$");
newXSproto(strcpy(buf, "IsHorse"), XS_Mob_IsHorse, file, "$");
newXSproto(strcpy(buf, "CastToClient"), XS_Mob_CastToClient, file, "$");
newXSproto(strcpy(buf, "CastToNPC"), XS_Mob_CastToNPC, file, "$");
newXSproto(strcpy(buf, "CastToMob"), XS_Mob_CastToMob, file, "$");