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
This commit is contained in:
@@ -265,6 +265,7 @@ CREATE TABLE `battle_pets` (
|
||||
`battlenetAccountId` int(10) NOT NULL,
|
||||
`species` int(10) NOT NULL,
|
||||
`breed` smallint(5) NOT NULL,
|
||||
`displayId` int(11) NOT NULL DEFAULT '0',
|
||||
`level` smallint(5) NOT NULL DEFAULT '1',
|
||||
`exp` smallint(5) NOT NULL DEFAULT '0',
|
||||
`health` int(10) NOT NULL DEFAULT '1',
|
||||
@@ -2458,7 +2459,8 @@ INSERT INTO `updates` VALUES
|
||||
('2021_10_07_00_auth.sql','45F2D92E28382F0CBE1F9B3A97693C0CC69E50BC','ARCHIVED','2021-10-07 10:32:05',0),
|
||||
('2021_10_13_00_auth.sql','220E63385CACCBCEC36C57717DE369F2FCABCAAF','ARCHIVED','2021-10-13 21:15:05',0),
|
||||
('2021_10_15_00_auth.sql','C8AA212AB2BB2DB5B3C2C9622A3874475AEFBD7B','ARCHIVED','2021-10-15 10:11:47',0),
|
||||
('2021_10_15_01_auth.sql','72A0437F0ADEC59FF9D6839DF845C473F693CA5B','RELEASED','2021-10-16 00:15:25',0);
|
||||
('2021_10_15_01_auth.sql','72A0437F0ADEC59FF9D6839DF845C473F693CA5B','RELEASED','2021-10-16 00:15:25',0),
|
||||
('2021_10_16_00_auth.sql','FDC45C7BEFBAFC9BCE6C77377B026A59AE52EE21','RELEASED','2021-10-16 11:24:39',0);
|
||||
/*!40000 ALTER TABLE `updates` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE `battle_pets` ADD `displayId` int(11) NOT NULL DEFAULT '0' AFTER `breed`;
|
||||
@@ -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);
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user