[Quest API] Add GetPet() to Perl (#3309)

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

# Notes
- This exists in Lua, but not Perl.
This commit is contained in:
Alex King authored and GitHub committed 2023-05-07 19:13:26 -05:00
1 parent 8814ab26cd
commit ce1de9997b
2 files changed
+17 -10

No files matched your search

+11 -10
View File
@@ -406,21 +406,22 @@ bool ZoneDatabase::GetPoweredPetEntry(const char *pet_type, int16 petpower, PetR
}
Mob* Mob::GetPet() {
if(GetPetID() == 0)
return(nullptr);
Mob* tmp = entity_list.GetMob(GetPetID());
if(tmp == nullptr) {
SetPetID(0);
return(nullptr);
if (!GetPetID()) {
return nullptr;
}
if(tmp->GetOwnerID() != GetID()) {
const auto m = entity_list.GetMob(GetPetID());
if (!m) {
SetPetID(0);
return(nullptr);
return nullptr;
}
return(tmp);
if (m->GetOwnerID() != GetID()) {
SetPetID(0);
return nullptr;
}
return m;
}
bool Mob::HasPet() const {