[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
2023-05-07 20:13:26 -04:00
committed by GitHub
parent 8814ab26cd
commit ce1de9997b
2 changed files with 17 additions and 10 deletions
+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 {