Core/BattlePets: Move revive battle pet cooldown to spell script and add serverside spell for stable master heal cooldown
Port From (https://github.com/TrinityCore/TrinityCore/commit/05f2f4e8f69133d542f3eadf99410deb932cd30d)
This commit is contained in:
@@ -57,7 +57,6 @@ namespace Framework.Constants
|
|||||||
public const int SpellReviveBattlePets = 125439;
|
public const int SpellReviveBattlePets = 125439;
|
||||||
public const int SpellSummonBattlePet = 118301;
|
public const int SpellSummonBattlePet = 118301;
|
||||||
public const int MaxBattlePetLevel = 25;
|
public const int MaxBattlePetLevel = 25;
|
||||||
public static TimeSpan ReviveBattlePetsCooldown = TimeSpan.FromSeconds(180);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Lfg Const
|
/// Lfg Const
|
||||||
|
|||||||
@@ -1014,25 +1014,6 @@ namespace Game.Entities
|
|||||||
m_lastPotionId = 0;
|
m_lastPotionId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateReviveBattlePetCooldown()
|
|
||||||
{
|
|
||||||
SpellInfo reviveBattlePetSpellInfo = Global.SpellMgr.GetSpellInfo(SharedConst.SpellReviveBattlePets, Difficulty.None);
|
|
||||||
|
|
||||||
if (reviveBattlePetSpellInfo != null && HasSpell(SharedConst.SpellReviveBattlePets))
|
|
||||||
{
|
|
||||||
var remainingCooldown = GetSpellHistory().GetRemainingCategoryCooldown(reviveBattlePetSpellInfo);
|
|
||||||
if (remainingCooldown > TimeSpan.Zero)
|
|
||||||
{
|
|
||||||
if (remainingCooldown < SharedConst.ReviveBattlePetsCooldown)
|
|
||||||
GetSpellHistory().ModifyCooldown(reviveBattlePetSpellInfo, SharedConst.ReviveBattlePetsCooldown - remainingCooldown);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GetSpellHistory().StartCooldown(reviveBattlePetSpellInfo, 0, null, false, SharedConst.ReviveBattlePetsCooldown);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CanUseMastery()
|
public bool CanUseMastery()
|
||||||
{
|
{
|
||||||
ChrSpecializationRecord chrSpec = CliDB.ChrSpecializationStorage.LookupByKey(GetPrimarySpecialization());
|
ChrSpecializationRecord chrSpec = CliDB.ChrSpecializationStorage.LookupByKey(GetPrimarySpecialization());
|
||||||
|
|||||||
@@ -854,8 +854,6 @@ namespace Game
|
|||||||
|
|
||||||
pCurrChar.SendInitialPacketsAfterAddToMap();
|
pCurrChar.SendInitialPacketsAfterAddToMap();
|
||||||
|
|
||||||
pCurrChar.UpdateReviveBattlePetCooldown();
|
|
||||||
|
|
||||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_ONLINE);
|
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_ONLINE);
|
||||||
stmt.AddValue(0, pCurrChar.GetGUID().GetCounter());
|
stmt.AddValue(0, pCurrChar.GetGUID().GetCounter());
|
||||||
DB.Characters.Execute(stmt);
|
DB.Characters.Execute(stmt);
|
||||||
|
|||||||
@@ -4728,6 +4728,46 @@ namespace Scripts.Spells.Generic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Script] // 132334 - Trainer Heal Cooldown (SERVERSIDE)
|
||||||
|
class spell_gen_trainer_heal_cooldown : AuraScript
|
||||||
|
{
|
||||||
|
public override bool Validate(SpellInfo spellInfo)
|
||||||
|
{
|
||||||
|
return ValidateSpellInfo(SharedConst.SpellReviveBattlePets);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Load()
|
||||||
|
{
|
||||||
|
return GetUnitOwner().IsPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateReviveBattlePetCooldown(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||||
|
{
|
||||||
|
Player target = GetUnitOwner().ToPlayer();
|
||||||
|
SpellInfo reviveBattlePetSpellInfo = Global.SpellMgr.GetSpellInfo(SharedConst.SpellReviveBattlePets, Difficulty.None);
|
||||||
|
|
||||||
|
if (target.GetSession().GetBattlePetMgr().IsBattlePetSystemEnabled())
|
||||||
|
{
|
||||||
|
TimeSpan expectedCooldown = TimeSpan.FromMilliseconds(GetAura().GetMaxDuration());
|
||||||
|
TimeSpan remainingCooldown = target.GetSpellHistory().GetRemainingCategoryCooldown(reviveBattlePetSpellInfo);
|
||||||
|
if (remainingCooldown > TimeSpan.Zero)
|
||||||
|
{
|
||||||
|
if (remainingCooldown < expectedCooldown)
|
||||||
|
target.GetSpellHistory().ModifyCooldown(reviveBattlePetSpellInfo, expectedCooldown - remainingCooldown);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target.GetSpellHistory().StartCooldown(reviveBattlePetSpellInfo, 0, null, false, expectedCooldown);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Register()
|
||||||
|
{
|
||||||
|
OnEffectApply.Add(new EffectApplyHandler(UpdateReviveBattlePetCooldown, 0, AuraType.Dummy, AuraEffectHandleModes.Real));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Script] // 45313 - Anchor Here
|
[Script] // 45313 - Anchor Here
|
||||||
class spell_gen_anchor_here : SpellScript
|
class spell_gen_anchor_here : SpellScript
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user