Core/BattlePets: BattlePetError enum class (#27286)

This commit is contained in:
Meji
2021-11-19 14:01:22 +01:00
committed by GitHub
parent f97deb3316
commit 12cc779ab0
3 changed files with 11 additions and 21 deletions

View File

@@ -426,7 +426,7 @@ void BattlePetMgr::ClearFanfare(ObjectGuid guid)
if (!pet)
return;
pet->PacketInfo.Flags &= ~uint16(BattlePetDbFlags::FanfareNeeded);
pet->PacketInfo.Flags &= ~AsUnderlyingType(BattlePetDbFlags::FanfareNeeded);
if (pet->SaveInfo != BATTLE_PET_NEW)
pet->SaveInfo = BATTLE_PET_CHANGED;
@@ -620,7 +620,7 @@ void BattlePetMgr::SendUpdates(std::vector<std::reference_wrapper<BattlePet>> pe
void BattlePetMgr::SendError(BattlePetError error, uint32 creatureId)
{
WorldPackets::BattlePet::BattlePetError battlePetError;
battlePetError.Result = error;
battlePetError.Result = AsUnderlyingType(error);
battlePetError.CreatureID = creatureId;
_owner->SendPacket(battlePetError.Write());
}

View File

@@ -62,6 +62,13 @@ enum class BattlePetDbFlags : uint16
DEFINE_ENUM_FLAG(BattlePetDbFlags);
enum class BattlePetError : uint8
{
CantHaveMorePetsOfType = 3, // You can't have any more pets of that type.
CantHaveMorePets = 4, // You can't have any more pets.
TooHighLevelToUncage = 7 // This pet is too high level for you to uncage.
};
// 6.2.4
enum FlagsControlType
{
@@ -69,23 +76,6 @@ enum FlagsControlType
FLAGS_CONTROL_TYPE_REMOVE = 2
};
// 6.2.4
enum BattlePetError
{
BATTLEPETRESULT_CANT_HAVE_MORE_PETS_OF_THAT_TYPE = 3,
BATTLEPETRESULT_CANT_HAVE_MORE_PETS = 4,
BATTLEPETRESULT_TOO_HIGH_LEVEL_TO_UNCAGE = 7,
// TODO: find correct values if possible and needed (also wrong order)
BATTLEPETRESULT_DUPLICATE_CONVERTED_PET,
BATTLEPETRESULT_NEED_TO_UNLOCK,
BATTLEPETRESULT_BAD_PARAM,
BATTLEPETRESULT_LOCKED_PET_ALREADY_EXISTS,
BATTLEPETRESULT_OK,
BATTLEPETRESULT_UNCAPTURABLE,
BATTLEPETRESULT_CANT_INVALID_CHARACTER_GUID
};
// taken from BattlePetState.db2 - it seems to store some initial values for battle pets
// there are only values used in BattlePetSpeciesState.db2 and BattlePetBreedState.db2
// TODO: expand this enum if needed

View File

@@ -5658,14 +5658,14 @@ void Spell::EffectUncageBattlePet()
if (battlePetMgr->GetMaxPetLevel() < level)
{
battlePetMgr->SendError(BATTLEPETRESULT_TOO_HIGH_LEVEL_TO_UNCAGE, speciesEntry->CreatureID);
battlePetMgr->SendError(BattlePetError::TooHighLevelToUncage, speciesEntry->CreatureID);
SendCastResult(SPELL_FAILED_CANT_ADD_BATTLE_PET);
return;
}
if (battlePetMgr->HasMaxPetCount(speciesEntry))
{
battlePetMgr->SendError(BATTLEPETRESULT_CANT_HAVE_MORE_PETS_OF_THAT_TYPE, speciesEntry->CreatureID);
battlePetMgr->SendError(BattlePetError::CantHaveMorePetsOfType, speciesEntry->CreatureID);
SendCastResult(SPELL_FAILED_CANT_ADD_BATTLE_PET);
return;
}