mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
Core/BattlePets: Move revive battle pet cooldown to spell script and add serverside spell for stable master heal cooldown
This commit is contained in:
11
sql/updates/world/master/2022_10_14_00_world.sql
Normal file
11
sql/updates/world/master/2022_10_14_00_world.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
DELETE FROM `serverside_spell` WHERE `Id`=132334;
|
||||
INSERT INTO `serverside_spell` (`Id`,`DifficultyID`,`CategoryId`,`Dispel`,`Mechanic`,`Attributes`,`AttributesEx`,`AttributesEx2`,`AttributesEx3`,`AttributesEx4`,`AttributesEx5`,`AttributesEx6`,`AttributesEx7`,`AttributesEx8`,`AttributesEx9`,`AttributesEx10`,`AttributesEx11`,`AttributesEx12`,`AttributesEx13`,`AttributesEx14`,`Stances`,`StancesNot`,`Targets`,`TargetCreatureType`,`RequiresSpellFocus`,`FacingCasterFlags`,`CasterAuraState`,`TargetAuraState`,`ExcludeCasterAuraState`,`ExcludeTargetAuraState`,`CasterAuraSpell`,`TargetAuraSpell`,`ExcludeCasterAuraSpell`,`ExcludeTargetAuraSpell`,`CastingTimeIndex`,`RecoveryTime`,`CategoryRecoveryTime`,`StartRecoveryCategory`,`StartRecoveryTime`,`InterruptFlags`,`AuraInterruptFlags1`,`AuraInterruptFlags2`,`ChannelInterruptFlags1`,`ChannelInterruptFlags2`,`ProcFlags`,`ProcFlags2`,`ProcChance`,`ProcCharges`,`ProcCooldown`,`ProcBasePPM`,`MaxLevel`,`BaseLevel`,`SpellLevel`,`DurationIndex`,`RangeIndex`,`Speed`,`LaunchDelay`,`StackAmount`,`EquippedItemClass`,`EquippedItemSubClassMask`,`EquippedItemInventoryTypeMask`,`ContentTuningId`,`SpellName`,`ConeAngle`,`ConeWidth`,`MaxTargetLevel`,`MaxAffectedTargets`,`SpellFamilyName`,`SpellFamilyFlags1`,`SpellFamilyFlags2`,`SpellFamilyFlags3`,`SpellFamilyFlags4`,`DmgClass`,`PreventionType`,`AreaGroupId`,`SchoolMask`,`ChargeCategoryId`) VALUES
|
||||
(132334,0,0,0,0,0x2D800000,0x80000020,0x10024081,0x530000,0x100081,0x60408,0x10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,1,0,0,0,-1,0,0,0,'Trainer Heal Cooldown',0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||
|
||||
DELETE FROM `serverside_spell_effect` WHERE `SpellID`=132334;
|
||||
INSERT INTO `serverside_spell_effect` (`SpellID`,`Effect`,`EffectAura`,`EffectChainAmplitude`) VALUES
|
||||
(132334,6,4,1);
|
||||
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_gen_trainer_heal_cooldown';
|
||||
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
|
||||
(132334,'spell_gen_trainer_heal_cooldown');
|
||||
@@ -39,7 +39,6 @@ enum BattlePetMisc
|
||||
};
|
||||
|
||||
static constexpr uint16 MAX_BATTLE_PET_LEVEL = 25;
|
||||
static constexpr Milliseconds REVIVE_BATTLE_PETS_COOLDOWN = 180s;
|
||||
|
||||
enum class BattlePetBreedQuality : uint8
|
||||
{
|
||||
|
||||
@@ -22575,25 +22575,6 @@ void Player::UpdatePotionCooldown(Spell* spell)
|
||||
m_lastPotionId = 0;
|
||||
}
|
||||
|
||||
void Player::UpdateReviveBattlePetCooldown()
|
||||
{
|
||||
SpellInfo const* reviveBattlePetSpellInfo = sSpellMgr->GetSpellInfo(BattlePets::SPELL_REVIVE_BATTLE_PETS, DIFFICULTY_NONE);
|
||||
|
||||
if (reviveBattlePetSpellInfo && HasSpell(BattlePets::SPELL_REVIVE_BATTLE_PETS))
|
||||
{
|
||||
SpellHistory::Duration remainingCooldown = GetSpellHistory()->GetRemainingCategoryCooldown(reviveBattlePetSpellInfo);
|
||||
if (remainingCooldown > SpellHistory::Duration::zero())
|
||||
{
|
||||
if (remainingCooldown < BattlePets::REVIVE_BATTLE_PETS_COOLDOWN)
|
||||
GetSpellHistory()->ModifyCooldown(reviveBattlePetSpellInfo, BattlePets::REVIVE_BATTLE_PETS_COOLDOWN - remainingCooldown);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetSpellHistory()->StartCooldown(reviveBattlePetSpellInfo, 0, nullptr, false, BattlePets::REVIVE_BATTLE_PETS_COOLDOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::SetResurrectRequestData(WorldObject const* caster, uint32 health, uint32 mana, uint32 appliedAura)
|
||||
{
|
||||
ASSERT(!IsResurrectRequested());
|
||||
|
||||
@@ -1842,7 +1842,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
uint32 GetLastPotionId() const { return m_lastPotionId; }
|
||||
void SetLastPotionId(uint32 item_id) { m_lastPotionId = item_id; }
|
||||
void UpdatePotionCooldown(Spell* spell = nullptr);
|
||||
void UpdateReviveBattlePetCooldown();
|
||||
|
||||
void SetResurrectRequestData(WorldObject const* caster, uint32 health, uint32 mana, uint32 appliedAura);
|
||||
void ClearResurrectRequestData()
|
||||
|
||||
@@ -1203,8 +1203,6 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder const& holder)
|
||||
|
||||
pCurrChar->SendInitialPacketsAfterAddToMap();
|
||||
|
||||
pCurrChar->UpdateReviveBattlePetCooldown();
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ONLINE);
|
||||
stmt->setUInt64(0, pCurrChar->GetGUID().GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Battleground.h"
|
||||
#include "BattlePetMgr.h"
|
||||
#include "CellImpl.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "DB2Stores.h"
|
||||
@@ -5021,6 +5022,48 @@ class spell_summon_battle_pet : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
// 132334 - Trainer Heal Cooldown (SERVERSIDE)
|
||||
class spell_gen_trainer_heal_cooldown : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_gen_trainer_heal_cooldown);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ BattlePets::SPELL_REVIVE_BATTLE_PETS });
|
||||
}
|
||||
|
||||
bool Load() override
|
||||
{
|
||||
return GetUnitOwner()->IsPlayer();
|
||||
}
|
||||
|
||||
void UpdateReviveBattlePetCooldown(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Player* target = GetUnitOwner()->ToPlayer();
|
||||
SpellInfo const* reviveBattlePetSpellInfo = sSpellMgr->AssertSpellInfo(BattlePets::SPELL_REVIVE_BATTLE_PETS, DIFFICULTY_NONE);
|
||||
|
||||
if (target->GetSession()->GetBattlePetMgr()->IsBattlePetSystemEnabled())
|
||||
{
|
||||
Milliseconds expectedCooldown = Milliseconds(GetAura()->GetMaxDuration());
|
||||
SpellHistory::Duration remainingCooldown = target->GetSpellHistory()->GetRemainingCategoryCooldown(reviveBattlePetSpellInfo);
|
||||
if (remainingCooldown > SpellHistory::Duration::zero())
|
||||
{
|
||||
if (remainingCooldown < expectedCooldown)
|
||||
target->GetSpellHistory()->ModifyCooldown(reviveBattlePetSpellInfo, expectedCooldown - remainingCooldown);
|
||||
}
|
||||
else
|
||||
{
|
||||
target->GetSpellHistory()->StartCooldown(reviveBattlePetSpellInfo, 0, nullptr, false, expectedCooldown);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_gen_trainer_heal_cooldown::UpdateReviveBattlePetCooldown, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
// 45313 - Anchor Here
|
||||
class spell_gen_anchor_here : public SpellScript
|
||||
{
|
||||
@@ -5336,6 +5379,7 @@ void AddSC_generic_spell_scripts()
|
||||
RegisterSpellScript(spell_defender_of_azeroth_death_gate_selector);
|
||||
RegisterSpellScript(spell_defender_of_azeroth_speak_with_mograine);
|
||||
RegisterSpellScript(spell_summon_battle_pet);
|
||||
RegisterSpellScript(spell_gen_trainer_heal_cooldown);
|
||||
RegisterSpellScript(spell_gen_anchor_here);
|
||||
RegisterSpellScript(spell_gen_mount_check_aura);
|
||||
RegisterSpellScript(spell_gen_ancestral_call);
|
||||
|
||||
Reference in New Issue
Block a user