diff options
author | Meji <alvaromegias_46@hotmail.com> | 2021-10-16 12:15:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-16 12:15:03 +0200 |
commit | 11cc5c0d3bd46b5e68bb549625ef9ca7294deb21 (patch) | |
tree | b36f19d80b39158bf4a0cadf38a9398beb08194a /src | |
parent | d07102a3dabcdde28f1bb2d504a338f705eb3141 (diff) |
Core/BattlePets: Misc fixes (#27057)
* Rename WorldPackets::BattlePet::BattlePet::CollarID to WorldPackets::BattlePet::BattlePet::DisplayID
* Use the DisplayID field to store the model of the battle pet. If the species has BattlePetSpeciesFlags::RandomDisplay, nothing is stored. Otherwise a random model is chosen from those available
* Stored DisplayID in ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID when caging the battle pet (previously the CreatureID was being stored)
* Modified SendPlaySpellVisual function to allow sending Target and TargetPosition at the same time
* Added SpellVisual when uncaging
Diffstat (limited to 'src')
-rw-r--r-- | src/server/database/Database/Implementation/LoginDatabase.cpp | 4 | ||||
-rw-r--r-- | src/server/game/BattlePets/BattlePetMgr.cpp | 45 | ||||
-rw-r--r-- | src/server/game/BattlePets/BattlePetMgr.h | 6 | ||||
-rw-r--r-- | src/server/game/Entities/Object/Object.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 7 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.h | 2 | ||||
-rw-r--r-- | src/server/game/Handlers/ItemHandler.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Server/Packets/BattlePetPackets.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Server/Packets/BattlePetPackets.h | 2 | ||||
-rw-r--r-- | src/server/game/Server/Packets/SpellPackets.h | 4 | ||||
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 19 |
12 files changed, 54 insertions, 45 deletions
diff --git a/src/server/database/Database/Implementation/LoginDatabase.cpp b/src/server/database/Database/Implementation/LoginDatabase.cpp index 8d3c46af3d2..26399cae226 100644 --- a/src/server/database/Database/Implementation/LoginDatabase.cpp +++ b/src/server/database/Database/Implementation/LoginDatabase.cpp @@ -155,8 +155,8 @@ void LoginDatabaseConnection::DoPrepareStatements() PrepareStatement(LOGIN_REP_ACCOUNT_TOYS, "REPLACE INTO battlenet_account_toys (accountId, itemId, isFavourite, hasFanfare) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC); // Battle Pets - PrepareStatement(LOGIN_SEL_BATTLE_PETS, "SELECT bp.guid, bp.species, bp.breed, bp.level, bp.exp, bp.health, bp.quality, bp.flags, bp.name, dn.genitive, dn.dative, dn.accusative, dn.instrumental, dn.prepositional FROM battle_pets bp LEFT JOIN battle_pet_declinedname dn ON bp.guid = dn.guid WHERE bp.battlenetAccountId = ?", CONNECTION_ASYNC); - PrepareStatement(LOGIN_INS_BATTLE_PETS, "INSERT INTO battle_pets (guid, battlenetAccountId, species, breed, level, exp, health, quality, flags, name) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); + PrepareStatement(LOGIN_SEL_BATTLE_PETS, "SELECT bp.guid, bp.species, bp.breed, bp.displayId, bp.level, bp.exp, bp.health, bp.quality, bp.flags, bp.name, dn.genitive, dn.dative, dn.accusative, dn.instrumental, dn.prepositional FROM battle_pets bp LEFT JOIN battle_pet_declinedname dn ON bp.guid = dn.guid WHERE bp.battlenetAccountId = ?", CONNECTION_ASYNC); + PrepareStatement(LOGIN_INS_BATTLE_PETS, "INSERT INTO battle_pets (guid, battlenetAccountId, species, breed, displayId, level, exp, health, quality, flags, name) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(LOGIN_DEL_BATTLE_PETS, "DELETE FROM battle_pets WHERE battlenetAccountId = ? AND guid = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_UPD_BATTLE_PETS, "UPDATE battle_pets SET level = ?, exp = ?, health = ?, quality = ?, flags = ?, name = ? WHERE battlenetAccountId = ? AND guid = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_SEL_BATTLE_PET_SLOTS, "SELECT id, battlePetGuid, locked FROM battle_pet_slots WHERE battlenetAccountId = ?", CONNECTION_ASYNC); diff --git a/src/server/game/BattlePets/BattlePetMgr.cpp b/src/server/game/BattlePets/BattlePetMgr.cpp index e660cf336c3..a5a0f3685f6 100644 --- a/src/server/game/BattlePets/BattlePetMgr.cpp +++ b/src/server/game/BattlePets/BattlePetMgr.cpp @@ -185,6 +185,16 @@ BattlePetBreedQuality BattlePetMgr::GetDefaultPetQuality(uint32 species) return BattlePetBreedQuality(itr->second); } +uint32 BattlePetMgr::SelectPetDisplay(BattlePetSpeciesEntry const* speciesEntry) +{ + if (CreatureTemplate const* creatureTemplate = sObjectMgr->GetCreatureTemplate(speciesEntry->CreatureID)) + if (!speciesEntry->GetFlags().HasFlag(BattlePetSpeciesFlags::RandomDisplay)) + if (CreatureModel const* creatureModel = creatureTemplate->GetRandomValidModel()) + return creatureModel->CreatureDisplayID; + + return 0; +} + BattlePetMgr::BattlePetMgr(WorldSession* owner) { _owner = owner; @@ -217,12 +227,13 @@ void BattlePetMgr::LoadFromDB(PreparedQueryResult pets, PreparedQueryResult slot pet.PacketInfo.Guid = ObjectGuid::Create<HighGuid::BattlePet>(fields[0].GetUInt64()); pet.PacketInfo.Species = species; pet.PacketInfo.Breed = fields[2].GetUInt16(); - pet.PacketInfo.Level = fields[3].GetUInt16(); - pet.PacketInfo.Exp = fields[4].GetUInt16(); - pet.PacketInfo.Health = fields[5].GetUInt32(); - pet.PacketInfo.Quality = fields[6].GetUInt8(); - pet.PacketInfo.Flags = fields[7].GetUInt16(); - pet.PacketInfo.Name = fields[8].GetString(); + pet.PacketInfo.DisplayID = fields[3].GetUInt32(); + pet.PacketInfo.Level = fields[4].GetUInt16(); + pet.PacketInfo.Exp = fields[5].GetUInt16(); + pet.PacketInfo.Health = fields[6].GetUInt32(); + pet.PacketInfo.Quality = fields[7].GetUInt8(); + pet.PacketInfo.Flags = fields[8].GetUInt16(); + pet.PacketInfo.Name = fields[9].GetString(); pet.PacketInfo.CreatureID = speciesEntry->CreatureID; if (!fields[9].IsNull()) @@ -270,12 +281,13 @@ void BattlePetMgr::SaveToDB(LoginDatabaseTransaction& trans) stmt->setUInt32(1, _owner->GetBattlenetAccountId()); stmt->setUInt32(2, itr->second.PacketInfo.Species); stmt->setUInt16(3, itr->second.PacketInfo.Breed); - stmt->setUInt16(4, itr->second.PacketInfo.Level); - stmt->setUInt16(5, itr->second.PacketInfo.Exp); - stmt->setUInt32(6, itr->second.PacketInfo.Health); - stmt->setUInt8(7, itr->second.PacketInfo.Quality); - stmt->setUInt16(8, itr->second.PacketInfo.Flags); - stmt->setString(9, itr->second.PacketInfo.Name); + stmt->setUInt32(4, itr->second.PacketInfo.DisplayID); + stmt->setUInt16(5, itr->second.PacketInfo.Level); + stmt->setUInt16(6, itr->second.PacketInfo.Exp); + stmt->setUInt32(7, itr->second.PacketInfo.Health); + stmt->setUInt8(8, itr->second.PacketInfo.Quality); + stmt->setUInt16(9, itr->second.PacketInfo.Flags); + stmt->setString(10, itr->second.PacketInfo.Name); trans->Append(stmt); if (itr->second.DeclinedName) @@ -360,7 +372,7 @@ BattlePetMgr::BattlePet* BattlePetMgr::GetPet(ObjectGuid guid) return Trinity::Containers::MapGetValuePtr(_pets, guid.GetCounter()); } -void BattlePetMgr::AddPet(uint32 species, uint32 creatureId, uint16 breed, BattlePetBreedQuality quality, uint16 level /*= 1*/) +void BattlePetMgr::AddPet(uint32 species, uint32 display, uint16 breed, BattlePetBreedQuality quality, uint16 level /*= 1*/) { BattlePetSpeciesEntry const* battlePetSpecies = sBattlePetSpeciesStore.LookupEntry(species); if (!battlePetSpecies) // should never happen @@ -372,7 +384,8 @@ void BattlePetMgr::AddPet(uint32 species, uint32 creatureId, uint16 breed, Battl BattlePet pet; pet.PacketInfo.Guid = ObjectGuid::Create<HighGuid::BattlePet>(sObjectMgr->GetGenerator<HighGuid::BattlePet>().Generate()); pet.PacketInfo.Species = species; - pet.PacketInfo.CreatureID = creatureId; + pet.PacketInfo.CreatureID = battlePetSpecies->CreatureID; + pet.PacketInfo.DisplayID = display; pet.PacketInfo.Level = level; pet.PacketInfo.Exp = 0; pet.PacketInfo.Flags = 0; @@ -520,7 +533,7 @@ void BattlePetMgr::CageBattlePet(ObjectGuid guid) item->SetModifier(ITEM_MODIFIER_BATTLE_PET_SPECIES_ID, pet->PacketInfo.Species); item->SetModifier(ITEM_MODIFIER_BATTLE_PET_BREED_DATA, pet->PacketInfo.Breed | (pet->PacketInfo.Quality << 24)); item->SetModifier(ITEM_MODIFIER_BATTLE_PET_LEVEL, pet->PacketInfo.Level); - item->SetModifier(ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID, pet->PacketInfo.CreatureID); + item->SetModifier(ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID, pet->PacketInfo.DisplayID); _owner->GetPlayer()->SendNewItem(item, 1, true, false); @@ -565,8 +578,6 @@ void BattlePetMgr::SummonPet(ObjectGuid guid) _owner->GetPlayer()->SetSummonedBattlePetGUID(guid); _owner->GetPlayer()->SetCurrentBattlePetBreedQuality(pet->PacketInfo.Quality); _owner->GetPlayer()->CastSpell(_owner->GetPlayer(), speciesEntry->SummonSpellID ? speciesEntry->SummonSpellID : uint32(DEFAULT_SUMMON_BATTLE_PET_SPELL)); - - // TODO: set pet level, quality... update fields } void BattlePetMgr::DismissPet() diff --git a/src/server/game/BattlePets/BattlePetMgr.h b/src/server/game/BattlePets/BattlePetMgr.h index 275d591b59b..ab006635aa0 100644 --- a/src/server/game/BattlePets/BattlePetMgr.h +++ b/src/server/game/BattlePets/BattlePetMgr.h @@ -30,7 +30,8 @@ enum BattlePetMisc MAX_PET_BATTLE_SLOTS = 3, DEFAULT_MAX_BATTLE_PETS_PER_SPECIES = 3, BATTLE_PET_CAGE_ITEM_ID = 82800, - DEFAULT_SUMMON_BATTLE_PET_SPELL = 118301 + DEFAULT_SUMMON_BATTLE_PET_SPELL = 118301, + SPELL_VISUAL_UNCAGE_PET = 222 }; enum class BattlePetBreedQuality : uint8 @@ -137,12 +138,13 @@ public: static uint16 RollPetBreed(uint32 species); static BattlePetBreedQuality GetDefaultPetQuality(uint32 species); + static uint32 SelectPetDisplay(BattlePetSpeciesEntry const* speciesEntry); void LoadFromDB(PreparedQueryResult pets, PreparedQueryResult slots); void SaveToDB(LoginDatabaseTransaction& trans); BattlePet* GetPet(ObjectGuid guid); - void AddPet(uint32 species, uint32 creatureId, uint16 breed, BattlePetBreedQuality quality, uint16 level = 1); + void AddPet(uint32 species, uint32 display, uint16 breed, BattlePetBreedQuality quality, uint16 level = 1); void RemovePet(ObjectGuid guid); void ClearFanfare(ObjectGuid guid); void ModifyName(ObjectGuid guid, std::string const& name, DeclinedName* declinedName); diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 3ea5484e0aa..aebafbe27d1 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -650,8 +650,8 @@ void Object::BuildMovementUpdate(ByteBuffer* data, CreateObjectBits flags) const // { // *data << ObjectGuid(Players[i].Pets[j].BattlePetGUID); // *data << int32(Players[i].Pets[j].SpeciesID); + // *data << int32(Players[i].Pets[j].CreatureID); // *data << int32(Players[i].Pets[j].DisplayID); - // *data << int32(Players[i].Pets[j].CollarID); // *data << int16(Players[i].Pets[j].Level); // *data << int16(Players[i].Pets[j].Xp); // *data << int32(Players[i].Pets[j].CurHealth); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index f5a9d9d356a..591f4e9d25c 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -3120,7 +3120,7 @@ bool Player::AddSpell(uint32 spellId, bool active, bool learning, bool dependent { if (entry->SummonSpellID == int32(spellId) && GetSession()->GetBattlePetMgr()->GetPetCount(entry->ID) == 0) { - GetSession()->GetBattlePetMgr()->AddPet(entry->ID, entry->CreatureID, BattlePetMgr::RollPetBreed(entry->ID), BattlePetMgr::GetDefaultPetQuality(entry->ID)); + GetSession()->GetBattlePetMgr()->AddPet(entry->ID, BattlePetMgr::SelectPetDisplay(entry), BattlePetMgr::RollPetBreed(entry->ID), BattlePetMgr::GetDefaultPetQuality(entry->ID)); UpdateCriteria(CriteriaType::UniquePetsOwned); break; } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 8e92e610c4e..f8baf13cdd1 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11380,11 +11380,12 @@ void Unit::SendCancelSpellVisual(uint32 id) SendMessageToSet(cancelSpellVisual.Write(), true); } -void Unit::SendPlaySpellVisual(ObjectGuid const& targetGuid, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime /*= false*/) +void Unit::SendPlaySpellVisual(Unit* target, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime /*= false*/) { WorldPackets::Spells::PlaySpellVisual playSpellVisual; playSpellVisual.Source = GetGUID(); - playSpellVisual.Target = targetGuid; // exclusive with TargetPosition + playSpellVisual.Target = target->GetGUID(); + playSpellVisual.TargetPosition = target->GetPosition(); playSpellVisual.SpellVisualID = spellVisualId; playSpellVisual.TravelSpeed = travelSpeed; playSpellVisual.MissReason = missReason; @@ -11397,7 +11398,7 @@ void Unit::SendPlaySpellVisual(Position const& targetPosition, float launchDelay { WorldPackets::Spells::PlaySpellVisual playSpellVisual; playSpellVisual.Source = GetGUID(); - playSpellVisual.TargetPosition = targetPosition; // exclusive with Target + playSpellVisual.TargetPosition = targetPosition; playSpellVisual.LaunchDelay = launchDelay; playSpellVisual.SpellVisualID = spellVisualId; playSpellVisual.TravelSpeed = travelSpeed; diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 146731191ef..95efb8fc925 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1157,7 +1157,7 @@ class TC_GAME_API Unit : public WorldObject void SendPlayOrphanSpellVisual(ObjectGuid const& target, uint32 spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false); void SendPlayOrphanSpellVisual(Position const& targetLocation, uint32 spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false); void SendCancelSpellVisual(uint32 id); - void SendPlaySpellVisual(ObjectGuid const& target, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime = false); + void SendPlaySpellVisual(Unit* target, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime = false); void SendPlaySpellVisual(Position const& targetPosition, float o, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime = false); void SendCancelSpellVisualKit(uint32 id); void SendPlaySpellVisualKit(uint32 id, uint32 type, uint32 duration) const; diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index 62be639a868..7e8e4e231e6 100644 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -1208,7 +1208,7 @@ void WorldSession::HandleUseCritterItem(WorldPackets::Item::UseCritterItem& useC if (BattlePetSpeciesEntry const* entry = sSpellMgr->GetBattlePetSpecies(uint32(spellToLearn))) { - GetBattlePetMgr()->AddPet(entry->ID, entry->CreatureID, BattlePetMgr::RollPetBreed(entry->ID), BattlePetMgr::GetDefaultPetQuality(entry->ID)); + GetBattlePetMgr()->AddPet(entry->ID, BattlePetMgr::SelectPetDisplay(entry), BattlePetMgr::RollPetBreed(entry->ID), BattlePetMgr::GetDefaultPetQuality(entry->ID)); _player->UpdateCriteria(CriteriaType::UniquePetsOwned); } diff --git a/src/server/game/Server/Packets/BattlePetPackets.cpp b/src/server/game/Server/Packets/BattlePetPackets.cpp index d1a7b9eebbf..bd210798e7f 100644 --- a/src/server/game/Server/Packets/BattlePetPackets.cpp +++ b/src/server/game/Server/Packets/BattlePetPackets.cpp @@ -33,7 +33,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::BattlePet::BattlePet cons data << pet.Guid; data << uint32(pet.Species); data << uint32(pet.CreatureID); - data << uint32(pet.CollarID); + data << uint32(pet.DisplayID); data << uint16(pet.Breed); data << uint16(pet.Level); data << uint16(pet.Exp); @@ -45,7 +45,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::BattlePet::BattlePet cons data << uint8(pet.Quality); data.WriteBits(pet.Name.size(), 7); data.WriteBit(pet.OwnerInfo.is_initialized()); - data.WriteBit(pet.Name.empty()); // NoRename + data.WriteBit(false); // NoRename data.FlushBits(); data.WriteString(pet.Name); diff --git a/src/server/game/Server/Packets/BattlePetPackets.h b/src/server/game/Server/Packets/BattlePetPackets.h index 3dce500d0cc..2ae7c9a99ce 100644 --- a/src/server/game/Server/Packets/BattlePetPackets.h +++ b/src/server/game/Server/Packets/BattlePetPackets.h @@ -39,7 +39,7 @@ namespace WorldPackets ObjectGuid Guid; uint32 Species = 0; uint32 CreatureID = 0; - uint32 CollarID = 0; + uint32 DisplayID = 0; uint16 Breed = 0; uint16 Level = 0; uint16 Exp = 0; diff --git a/src/server/game/Server/Packets/SpellPackets.h b/src/server/game/Server/Packets/SpellPackets.h index 349e62473dc..02d0a9bdb39 100644 --- a/src/server/game/Server/Packets/SpellPackets.h +++ b/src/server/game/Server/Packets/SpellPackets.h @@ -743,9 +743,9 @@ namespace WorldPackets WorldPacket const* Write() override; ObjectGuid Source; - ObjectGuid Target; // Exclusive with TargetPosition + ObjectGuid Target; ObjectGuid Transport; // Used when Target = Empty && (SpellVisual::Flags & 0x400) == 0 - TaggedPosition<Position::XYZ> TargetPosition; // Exclusive with Target + TaggedPosition<Position::XYZ> TargetPosition; // Overrides missile destination for SpellVisual::SpellVisualMissileSetID uint32 SpellVisualID = 0; float TravelSpeed = 0.0f; uint16 HitReason = 0; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 03f5dd2aa55..06ecc709000 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -5670,47 +5670,42 @@ void Spell::EffectUncageBattlePet() if (!m_CastItem || !m_caster || m_caster->GetTypeId() != TYPEID_PLAYER) return; - Player* plr = m_caster->ToPlayer(); - - // are we allowed to learn battle pets without it? - /*if (plr->HasPlayerFlag(PLAYER_FLAGS_PET_BATTLES_UNLOCKED)) - return; // send some error*/ - uint32 speciesId = m_CastItem->GetModifier(ITEM_MODIFIER_BATTLE_PET_SPECIES_ID); uint16 breed = m_CastItem->GetModifier(ITEM_MODIFIER_BATTLE_PET_BREED_DATA) & 0xFFFFFF; uint8 quality = (m_CastItem->GetModifier(ITEM_MODIFIER_BATTLE_PET_BREED_DATA) >> 24) & 0xFF; uint16 level = m_CastItem->GetModifier(ITEM_MODIFIER_BATTLE_PET_LEVEL); - uint32 creatureId = m_CastItem->GetModifier(ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID); + uint32 displayId = m_CastItem->GetModifier(ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID); BattlePetSpeciesEntry const* speciesEntry = sBattlePetSpeciesStore.LookupEntry(speciesId); if (!speciesEntry) return; + Player* plr = m_caster->ToPlayer(); BattlePetMgr* battlePetMgr = plr->GetSession()->GetBattlePetMgr(); if (!battlePetMgr) return; - // TODO: This means if you put your highest lvl pet into cage, you won't be able to uncage it again which is probably wrong. - // We will need to store maxLearnedLevel somewhere to avoid this behaviour. if (battlePetMgr->GetMaxPetLevel() < level) { - battlePetMgr->SendError(BATTLEPETRESULT_TOO_HIGH_LEVEL_TO_UNCAGE, creatureId); // or speciesEntry.CreatureID + battlePetMgr->SendError(BATTLEPETRESULT_TOO_HIGH_LEVEL_TO_UNCAGE, speciesEntry->CreatureID); SendCastResult(SPELL_FAILED_CANT_ADD_BATTLE_PET); return; } if (battlePetMgr->HasMaxPetCount(speciesEntry)) { - battlePetMgr->SendError(BATTLEPETRESULT_CANT_HAVE_MORE_PETS_OF_THAT_TYPE, creatureId); // or speciesEntry.CreatureID + battlePetMgr->SendError(BATTLEPETRESULT_CANT_HAVE_MORE_PETS_OF_THAT_TYPE, speciesEntry->CreatureID); SendCastResult(SPELL_FAILED_CANT_ADD_BATTLE_PET); return; } - battlePetMgr->AddPet(speciesId, creatureId, breed, BattlePetBreedQuality(quality), level); + battlePetMgr->AddPet(speciesId, displayId, breed, BattlePetBreedQuality(quality), level); if (!plr->HasSpell(speciesEntry->SummonSpellID)) plr->LearnSpell(speciesEntry->SummonSpellID, false); + plr->SendPlaySpellVisual(plr, SPELL_VISUAL_UNCAGE_PET, 0, 0, 0.f, false); + plr->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true); m_CastItem = nullptr; } |