Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
ActivePetBattle Struct Reference

#include <BattlePetBattleState.h>

Collaboration diagram for ActivePetBattle:

Public Member Functions

void ActivateAllyIncomingDamageReduction (uint32 amount, uint8 rounds)
void ActivateEnemyIncomingDamageReduction (uint32 amount, uint8 rounds)
void AdvanceRound ()
bool ApplyAbilityExchange (uint32 roundId, uint32 allyDamage, uint32 enemyDamage, ActivePetBattleTurn &allyTurn, ActivePetBattleTurn &enemyTurn)
bool ApplyAbilityExchange (uint32 roundId, uint32 allyDamage, uint32 enemyDamage, uint8 allyAbilitySlot, uint32 allyAbilityId, uint16 allyAbilityCooldown, ActivePetBattleTurn &allyTurn, ActivePetBattleTurn &enemyTurn)
ActivePetBattleTurn ApplyAbilityRound (uint32 roundId, uint32 damage)
ActivePetBattleTurn ApplyAbilityRound (uint32 roundId, uint32 damage, uint8 abilitySlot, uint32 abilityId, uint16 abilityCooldown)
uint32 ApplyAllyDamage (uint32 damage)
ActivePetBattleTurn ApplyEnemyAbilityRound (uint32 roundId, uint32 damage)
uint32 ApplyEnemyDamage (uint32 damage)
ActivePetBattleTurn ApplyForfeit (uint32 roundId)
ActivePetBattleTurn ApplySwapRound (uint32 roundId, uint8 newFrontPet)
ActivePetBattleTurn ApplyTrapRound (uint32 roundId, bool captured)
bool ApplyTrapRoundWithEnemyResponse (uint32 roundId, bool captured, uint32 enemyDamage, ActivePetBattleTurn &trapTurn, ActivePetBattleTurn &enemyTurn)
bool CanAcceptInput (uint32 roundId) const
bool CanTrap (bool canStoreBattlePet=true, bool enemyTameable=true) const
void Finish (uint8 winner)
BattlePetAchievementSource GetAchievementSource () const
uint16 GetAllyAbilityCooldown (uint8 petIndex, uint8 abilitySlot) const
bool GetAllyPetHealth (uint64 petId, uint32 &health) const
uint8 GetTrapStatus (bool canStoreBattlePet=true, bool enemyTameable=true) const
bool HasAllyPet (uint8 petIndex) const
bool IsActive () const
bool IsAllyPetAlive (uint8 petIndex) const
bool IsFinished () const
bool IsMatchmaking () const
bool IsPvP () const
bool SelectAllyFrontPet (uint8 frontPet)
bool SetAllyPet (uint8 petIndex, uint64 petId, uint32 maxHealth, uint32 health)
void StartPvp (uint64 opponentGuid, uint64 allyPetId, uint32 allyMaxHealth, uint32 allyHealth, uint64 enemyPetId, uint32 enemyMaxHealth, uint32 enemyHealth, uint16 enemySpecies=0, uint8 enemyLevel=0, uint8 enemyQuality=0, uint8 allyFrontPet=0, uint8 enemyFrontPet=3, BattlePetAchievementSource source=BATTLE_PET_ACHIEVEMENT_SOURCE_PVP_DUEL)
void StartWild (uint64 enemyGuid, uint64 allyPetId, uint32 allyMaxHealth, uint32 allyHealth, uint64 enemyPetId, uint32 enemyMaxHealth, uint32 enemyHealth, uint16 enemySpecies=0, uint8 enemyLevel=0, uint8 enemyQuality=0, uint8 enemyBreed=0, uint8 allyFrontPet=0)

Public Attributes

bool AchievementsApplied = false
uint8 AllyFrontPet = 0
uint32 AllyHealth = 0
uint32 AllyMaxHealth = 0
uint64 AllyPetID = 0
ActivePetBattlePetState AllyTeam [BATTLE_PET_MAX_ACTIVE_TEAM_PETS]
bool Captured = false
uint8 EnemyBreed = 0
uint8 EnemyFrontPet = 3
uint64 EnemyGUID = 0
uint32 EnemyHealth = 0
uint8 EnemyLevel = 0
uint32 EnemyMaxHealth = 0
uint64 EnemyPetID = 0
uint8 EnemyQuality = 0
uint16 EnemySpecies = 0
bool Finished = false
bool PvPBattle = false
bool RewardsApplied = false
uint32 RoundID = 0
BattlePetAchievementSource Source = BATTLE_PET_ACHIEVEMENT_SOURCE_WILD
uint8 TrapFailedAttempts = 0
bool WaitingForAllyFrontPet = false
uint8 Winner = PET_BATTLE_WINNER_NONE

Static Public Attributes

static constexpr uint8 BATTLE_PET_MAX_ACTIVE_TEAM_PETS = 3

Private Member Functions

uint32 ApplyDamage (uint32 &health, uint32 damage, uint8 winner)
bool CanAcceptRound (uint32 roundId) const
void ClearExpiredAllyCooldowns ()
ActivePetBattleTurn CreateTurn (uint32 roundId) const
void DecrementAllyCooldowns ()
void DecrementAuras ()
void FinishAcceptedRound (ActivePetBattleTurn &turn)
bool HasAliveAllyPetOtherThan (uint8 petIndex) const
bool IsAllyAbilityOnCooldown (uint8 petIndex, uint8 abilitySlot) const
bool IsEnemyHealthTrapEligible () const
void SnapshotAllyCooldowns (std::vector< ActivePetBattleCooldown > &cooldowns) const
void StartAllyAbilityCooldown (uint8 petIndex, uint8 abilitySlot, uint32 abilityId, uint16 cooldown)
void SyncActiveAllyPet ()

Static Private Member Functions

static void ActivateIncomingDamageReduction (ActivePetBattleAuraState &aura, uint32 amount, uint8 rounds)
static uint32 ApplyIncomingDamageReduction (ActivePetBattleAuraState const &aura, uint32 damage)
static void DecrementAura (ActivePetBattleAuraState &aura)
static bool IsValidAbilitySlot (uint8 abilitySlot)
static bool IsValidAllyPetIndex (uint8 petIndex)
static uint32 NormalizeHealth (uint32 health, uint32 maxHealth)

Private Attributes

ActivePetBattleAuraState AllyAura
ActivePetBattleCooldown AllyCooldowns [BATTLE_PET_MAX_ACTIVE_TEAM_PETS][BATTLE_PET_ABILITY_SLOT_COUNT]
ActivePetBattleAuraState EnemyAura

Detailed Description

Definition at line 81 of file BattlePetBattleState.h.

Member Function Documentation

◆ ActivateAllyIncomingDamageReduction()

void ActivePetBattle::ActivateAllyIncomingDamageReduction ( uint32 amount,
uint8 rounds )
inline

Definition at line 183 of file BattlePetBattleState.h.

References ActivateIncomingDamageReduction(), and AllyAura.

◆ ActivateEnemyIncomingDamageReduction()

void ActivePetBattle::ActivateEnemyIncomingDamageReduction ( uint32 amount,
uint8 rounds )
inline

Definition at line 188 of file BattlePetBattleState.h.

References ActivateIncomingDamageReduction(), and EnemyAura.

◆ ActivateIncomingDamageReduction()

void ActivePetBattle::ActivateIncomingDamageReduction ( ActivePetBattleAuraState & aura,
uint32 amount,
uint8 rounds )
inlinestaticprivate

◆ AdvanceRound()

void ActivePetBattle::AdvanceRound ( )
inline

Definition at line 438 of file BattlePetBattleState.h.

References Finished, IsActive(), and RoundID.

Referenced by FinishAcceptedRound().

◆ ApplyAbilityExchange() [1/2]

bool ActivePetBattle::ApplyAbilityExchange ( uint32 roundId,
uint32 allyDamage,
uint32 enemyDamage,
ActivePetBattleTurn & allyTurn,
ActivePetBattleTurn & enemyTurn )
inline

◆ ApplyAbilityExchange() [2/2]

◆ ApplyAbilityRound() [1/2]

ActivePetBattleTurn ActivePetBattle::ApplyAbilityRound ( uint32 roundId,
uint32 damage )
inline

Definition at line 193 of file BattlePetBattleState.h.

References ApplyAbilityRound(), and BATTLE_PET_ABILITY_SLOT_INVALID.

Referenced by ApplyAbilityRound().

◆ ApplyAbilityRound() [2/2]

◆ ApplyAllyDamage()

◆ ApplyDamage()

uint32 ActivePetBattle::ApplyDamage ( uint32 & health,
uint32 damage,
uint8 winner )
inlineprivate

Definition at line 693 of file BattlePetBattleState.h.

References Finish(), Finished, and IsActive().

Referenced by ApplyEnemyDamage().

◆ ApplyEnemyAbilityRound()

◆ ApplyEnemyDamage()

uint32 ActivePetBattle::ApplyEnemyDamage ( uint32 damage)
inline

◆ ApplyForfeit()

◆ ApplyIncomingDamageReduction()

uint32 ActivePetBattle::ApplyIncomingDamageReduction ( ActivePetBattleAuraState const & aura,
uint32 damage )
inlinestaticprivate

◆ ApplySwapRound()

◆ ApplyTrapRound()

◆ ApplyTrapRoundWithEnemyResponse()

◆ CanAcceptInput()

bool ActivePetBattle::CanAcceptInput ( uint32 roundId) const
inline

Definition at line 90 of file BattlePetBattleState.h.

References CanAcceptRound().

◆ CanAcceptRound()

bool ActivePetBattle::CanAcceptRound ( uint32 roundId) const
inlineprivate

◆ CanTrap()

bool ActivePetBattle::CanTrap ( bool canStoreBattlePet = true,
bool enemyTameable = true ) const
inline

◆ ClearExpiredAllyCooldowns()

void ActivePetBattle::ClearExpiredAllyCooldowns ( )
inlineprivate

◆ CreateTurn()

◆ DecrementAllyCooldowns()

void ActivePetBattle::DecrementAllyCooldowns ( )
inlineprivate

◆ DecrementAura()

void ActivePetBattle::DecrementAura ( ActivePetBattleAuraState & aura)
inlinestaticprivate

Definition at line 643 of file BattlePetBattleState.h.

References ActivePetBattleAuraState::Rounds.

Referenced by DecrementAuras().

◆ DecrementAuras()

void ActivePetBattle::DecrementAuras ( )
inlineprivate

Definition at line 653 of file BattlePetBattleState.h.

References AllyAura, DecrementAura(), and EnemyAura.

Referenced by FinishAcceptedRound().

◆ Finish()

void ActivePetBattle::Finish ( uint8 winner)
inline

◆ FinishAcceptedRound()

◆ GetAchievementSource()

BattlePetAchievementSource ActivePetBattle::GetAchievementSource ( ) const
inline

Definition at line 89 of file BattlePetBattleState.h.

References Source.

Referenced by battlepet_commandscript::HandleBattlePetDebugCommand().

◆ GetAllyAbilityCooldown()

uint16 ActivePetBattle::GetAllyAbilityCooldown ( uint8 petIndex,
uint8 abilitySlot ) const
inline

◆ GetAllyPetHealth()

bool ActivePetBattle::GetAllyPetHealth ( uint64 petId,
uint32 & health ) const
inline

Definition at line 475 of file BattlePetBattleState.h.

References AllyTeam, and BATTLE_PET_MAX_ACTIVE_TEAM_PETS.

◆ GetTrapStatus()

◆ HasAliveAllyPetOtherThan()

bool ActivePetBattle::HasAliveAllyPetOtherThan ( uint8 petIndex) const
inlineprivate

Definition at line 668 of file BattlePetBattleState.h.

References BATTLE_PET_MAX_ACTIVE_TEAM_PETS, and IsAllyPetAlive().

Referenced by ApplyAllyDamage().

◆ HasAllyPet()

bool ActivePetBattle::HasAllyPet ( uint8 petIndex) const
inline

Definition at line 465 of file BattlePetBattleState.h.

References AllyTeam, and IsValidAllyPetIndex().

Referenced by IsAllyPetAlive(), and SyncActiveAllyPet().

◆ IsActive()

bool ActivePetBattle::IsActive ( ) const
inline

◆ IsAllyAbilityOnCooldown()

bool ActivePetBattle::IsAllyAbilityOnCooldown ( uint8 petIndex,
uint8 abilitySlot ) const
inlineprivate

Definition at line 566 of file BattlePetBattleState.h.

References GetAllyAbilityCooldown().

Referenced by ApplyAbilityExchange(), and ApplyAbilityRound().

◆ IsAllyPetAlive()

bool ActivePetBattle::IsAllyPetAlive ( uint8 petIndex) const
inline

◆ IsEnemyHealthTrapEligible()

bool ActivePetBattle::IsEnemyHealthTrapEligible ( ) const
inlineprivate

Definition at line 548 of file BattlePetBattleState.h.

References EnemyHealth, and EnemyMaxHealth.

Referenced by GetTrapStatus().

◆ IsFinished()

bool ActivePetBattle::IsFinished ( ) const
inline

◆ IsMatchmaking()

bool ActivePetBattle::IsMatchmaking ( ) const
inline

Definition at line 88 of file BattlePetBattleState.h.

References BATTLE_PET_ACHIEVEMENT_SOURCE_PVP_MATCHMAKING, and Source.

◆ IsPvP()

bool ActivePetBattle::IsPvP ( ) const
inline

◆ IsValidAbilitySlot()

bool ActivePetBattle::IsValidAbilitySlot ( uint8 abilitySlot)
inlinestaticprivate

◆ IsValidAllyPetIndex()

bool ActivePetBattle::IsValidAllyPetIndex ( uint8 petIndex)
inlinestaticprivate

◆ NormalizeHealth()

uint32 ActivePetBattle::NormalizeHealth ( uint32 health,
uint32 maxHealth )
inlinestaticprivate

Definition at line 543 of file BattlePetBattleState.h.

Referenced by SetAllyPet(), StartPvp(), and StartWild().

◆ SelectAllyFrontPet()

bool ActivePetBattle::SelectAllyFrontPet ( uint8 frontPet)
inline

◆ SetAllyPet()

bool ActivePetBattle::SetAllyPet ( uint8 petIndex,
uint64 petId,
uint32 maxHealth,
uint32 health )
inline

◆ SnapshotAllyCooldowns()

void ActivePetBattle::SnapshotAllyCooldowns ( std::vector< ActivePetBattleCooldown > & cooldowns) const
inlineprivate

◆ StartAllyAbilityCooldown()

◆ StartPvp()

void ActivePetBattle::StartPvp ( uint64 opponentGuid,
uint64 allyPetId,
uint32 allyMaxHealth,
uint32 allyHealth,
uint64 enemyPetId,
uint32 enemyMaxHealth,
uint32 enemyHealth,
uint16 enemySpecies = 0,
uint8 enemyLevel = 0,
uint8 enemyQuality = 0,
uint8 allyFrontPet = 0,
uint8 enemyFrontPet = 3,
BattlePetAchievementSource source = BATTLE_PET_ACHIEVEMENT_SOURCE_PVP_DUEL )
inline

◆ StartWild()

void ActivePetBattle::StartWild ( uint64 enemyGuid,
uint64 allyPetId,
uint32 allyMaxHealth,
uint32 allyHealth,
uint64 enemyPetId,
uint32 enemyMaxHealth,
uint32 enemyHealth,
uint16 enemySpecies = 0,
uint8 enemyLevel = 0,
uint8 enemyQuality = 0,
uint8 enemyBreed = 0,
uint8 allyFrontPet = 0 )
inline

◆ SyncActiveAllyPet()

Member Data Documentation

◆ AchievementsApplied

bool ActivePetBattle::AchievementsApplied = false

Definition at line 514 of file BattlePetBattleState.h.

◆ AllyAura

ActivePetBattleAuraState ActivePetBattle::AllyAura
private

◆ AllyCooldowns

◆ AllyFrontPet

◆ AllyHealth

uint32 ActivePetBattle::AllyHealth = 0

Definition at line 506 of file BattlePetBattleState.h.

Referenced by ApplyAllyDamage(), GetTrapStatus(), and SyncActiveAllyPet().

◆ AllyMaxHealth

uint32 ActivePetBattle::AllyMaxHealth = 0

Definition at line 505 of file BattlePetBattleState.h.

Referenced by SyncActiveAllyPet().

◆ AllyPetID

uint64 ActivePetBattle::AllyPetID = 0

◆ AllyTeam

◆ BATTLE_PET_MAX_ACTIVE_TEAM_PETS

◆ Captured

bool ActivePetBattle::Captured = false

◆ EnemyAura

ActivePetBattleAuraState ActivePetBattle::EnemyAura
private

◆ EnemyBreed

uint8 ActivePetBattle::EnemyBreed = 0

Definition at line 517 of file BattlePetBattleState.h.

Referenced by StartWild().

◆ EnemyFrontPet

◆ EnemyGUID

◆ EnemyHealth

◆ EnemyLevel

◆ EnemyMaxHealth

uint32 ActivePetBattle::EnemyMaxHealth = 0

◆ EnemyPetID

uint64 ActivePetBattle::EnemyPetID = 0

Definition at line 502 of file BattlePetBattleState.h.

Referenced by StartPvp(), and StartWild().

◆ EnemyQuality

uint8 ActivePetBattle::EnemyQuality = 0

◆ EnemySpecies

◆ Finished

bool ActivePetBattle::Finished = false

Definition at line 509 of file BattlePetBattleState.h.

Referenced by AdvanceRound(), ApplyDamage(), CanAcceptRound(), Finish(), and IsFinished().

◆ PvPBattle

bool ActivePetBattle::PvPBattle = false

Definition at line 511 of file BattlePetBattleState.h.

Referenced by IsPvP(), StartPvp(), and StartWild().

◆ RewardsApplied

bool ActivePetBattle::RewardsApplied = false

Definition at line 513 of file BattlePetBattleState.h.

◆ RoundID

◆ Source

◆ TrapFailedAttempts

uint8 ActivePetBattle::TrapFailedAttempts = 0

Definition at line 521 of file BattlePetBattleState.h.

Referenced by ApplyTrapRound(), and ApplyTrapRoundWithEnemyResponse().

◆ WaitingForAllyFrontPet

◆ Winner


The documentation for this struct was generated from the following file: