aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/BattlePets
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2021-06-07 15:37:34 +0200
committerShauren <shauren.trinity@gmail.com>2021-06-07 15:37:34 +0200
commitd0be92ec0ad0334c38b4073a7e24a571982b17da (patch)
tree7b3fecbd3345b28a7cfb7e40dfeacc2f50adc33a /src/server/game/BattlePets
parent626c8f5de12daac6b88989807eba65d3d7a061dd (diff)
Core/Achievements: Defined all modifier tree types and implemented many of them
Diffstat (limited to 'src/server/game/BattlePets')
-rw-r--r--src/server/game/BattlePets/BattlePetMgr.cpp10
-rw-r--r--src/server/game/BattlePets/BattlePetMgr.h5
2 files changed, 14 insertions, 1 deletions
diff --git a/src/server/game/BattlePets/BattlePetMgr.cpp b/src/server/game/BattlePets/BattlePetMgr.cpp
index fc02c8db8e8..5fd954f931f 100644
--- a/src/server/game/BattlePets/BattlePetMgr.cpp
+++ b/src/server/game/BattlePets/BattlePetMgr.cpp
@@ -359,6 +359,16 @@ uint8 BattlePetMgr::GetPetCount(uint32 species) const
}));
}
+uint32 BattlePetMgr::GetPetUniqueSpeciesCount() const
+{
+ std::set<uint32> speciesIds;
+ std::transform(_pets.begin(), _pets.end(), std::inserter(speciesIds, speciesIds.end()), [](std::pair<uint64 const, BattlePet> const& pet)
+ {
+ return pet.second.PacketInfo.Species;
+ });
+ return speciesIds.size();
+}
+
void BattlePetMgr::UnlockSlot(uint8 slot)
{
if (!_slots[slot].Locked)
diff --git a/src/server/game/BattlePets/BattlePetMgr.h b/src/server/game/BattlePets/BattlePetMgr.h
index edf0937ea76..49ed9edc23f 100644
--- a/src/server/game/BattlePets/BattlePetMgr.h
+++ b/src/server/game/BattlePets/BattlePetMgr.h
@@ -96,7 +96,7 @@ public:
void CalculateStats();
WorldPackets::BattlePet::BattlePet PacketInfo;
- BattlePetSaveInfo SaveInfo;
+ BattlePetSaveInfo SaveInfo = BATTLE_PET_UNCHANGED;
};
explicit BattlePetMgr(WorldSession* owner);
@@ -114,6 +114,7 @@ public:
void RemovePet(ObjectGuid guid);
uint8 GetPetCount(uint32 species) const;
+ uint32 GetPetUniqueSpeciesCount() const;
WorldPackets::BattlePet::BattlePetSlot* GetSlot(uint8 slot) { return slot < _slots.size() ? &_slots[slot] : nullptr; }
void UnlockSlot(uint8 slot);
@@ -134,6 +135,8 @@ public:
void SendUpdates(std::vector<std::reference_wrapper<BattlePet>> pets, bool petAdded);
void SendError(BattlePetError error, uint32 creatureId);
+ bool HasJournalLock() const { return true; }
+
private:
WorldSession* _owner;
uint16 _trapLevel = 0;