Merge pull request #14454 from ariel-/cd
Port Core/Spells: Cooldown updates (6.x branch)
This commit is contained in:
commit
f4c1a8fb2d
35 files changed
+1043
-1093
No files matched your search
@@ -35,6 +35,7 @@
|
||||
#include "GroupMgr.h"
|
||||
#include "MMapFactory.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "SpellHistory.h"
|
||||
|
||||
class misc_commandscript : public CommandScript
|
||||
{
|
||||
@@ -708,7 +709,7 @@ public:
|
||||
|
||||
if (!*args)
|
||||
{
|
||||
target->RemoveAllSpellCooldown();
|
||||
target->GetSpellHistory()->ResetAllCooldowns();
|
||||
handler->PSendSysMessage(LANG_REMOVEALL_COOLDOWN, nameLink.c_str());
|
||||
}
|
||||
else
|
||||
@@ -718,14 +719,15 @@ public:
|
||||
if (!spellIid)
|
||||
return false;
|
||||
|
||||
if (!sSpellMgr->GetSpellInfo(spellIid))
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellIid);
|
||||
if (!spellInfo)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_UNKNOWN_SPELL, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
target->RemoveSpellCooldown(spellIid, true);
|
||||
target->GetSpellHistory()->ResetCooldown(spellIid, true);
|
||||
handler->PSendSysMessage(LANG_REMOVE_COOLDOWN, spellIid, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "PassiveAI.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SpellScript.h"
|
||||
#include "Transport.h"
|
||||
@@ -644,10 +645,10 @@ protected:
|
||||
{
|
||||
if (Instance->GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) == IN_PROGRESS &&
|
||||
!me->HasUnitState(UNIT_STATE_CASTING) && !me->HasReactState(REACT_PASSIVE) &&
|
||||
!me->HasSpellCooldown(BurningPitchId))
|
||||
!me->GetSpellHistory()->HasCooldown(BurningPitchId))
|
||||
{
|
||||
DoCastAOE(BurningPitchId, true);
|
||||
me->_AddCreatureSpellCooldown(BurningPitchId, time(NULL) + urand(3000, 4000) / IN_MILLISECONDS);
|
||||
me->GetSpellHistory()->AddCooldown(BurningPitchId, 0, std::chrono::milliseconds(urand(3000, 4000)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1469,7 +1470,7 @@ struct npc_gunship_boarding_addAI : public gunship_npc_AI
|
||||
DoCast(me, SPELL_BATTLE_EXPERIENCE, true);
|
||||
DoCast(me, SPELL_TELEPORT_TO_ENEMY_SHIP, true);
|
||||
DoCast(me, Instance->GetData(DATA_TEAM_IN_INSTANCE) == HORDE ? SPELL_MELEE_TARGETING_ON_ORGRIMS_HAMMER : SPELL_MELEE_TARGETING_ON_SKYBREAKER, true);
|
||||
me->_AddCreatureSpellCooldown(BurningPitchId, time(NULL) + 3);
|
||||
me->GetSpellHistory()->AddCooldown(BurningPitchId, 0, std::chrono::seconds(3));
|
||||
|
||||
std::list<Player*> players;
|
||||
Trinity::UnitAuraCheck check(true, Instance->GetData(DATA_TEAM_IN_INSTANCE) == HORDE ? SPELL_ON_ORGRIMS_HAMMER_DECK : SPELL_ON_SKYBREAKER_DECK);
|
||||
@@ -1698,11 +1699,11 @@ class npc_gunship_rocketeer : public CreatureScript
|
||||
return;
|
||||
|
||||
uint32 spellId = me->GetEntry() == NPC_SKYBREAKER_MORTAR_SOLDIER ? SPELL_ROCKET_ARTILLERY_A : SPELL_ROCKET_ARTILLERY_H;
|
||||
if (me->HasSpellCooldown(spellId))
|
||||
if (me->GetSpellHistory()->HasCooldown(spellId))
|
||||
return;
|
||||
|
||||
DoCastAOE(spellId, true);
|
||||
me->_AddCreatureSpellCooldown(spellId, time(NULL) + 9);
|
||||
me->GetSpellHistory()->AddCooldown(spellId, 0, std::chrono::seconds(9));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedGossip.h"
|
||||
#include "ScriptedEscortAI.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "SpellScript.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "Pet.h"
|
||||
#include "ReputationMgr.h"
|
||||
#include "SkillDiscovery.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "SpellScript.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "Vehicle.h"
|
||||
@@ -1293,8 +1294,8 @@ class spell_gen_divine_storm_cd_reset : public SpellScriptLoader
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
if (caster->HasSpellCooldown(SPELL_DIVINE_STORM))
|
||||
caster->RemoveSpellCooldown(SPELL_DIVINE_STORM, true);
|
||||
if (caster->GetSpellHistory()->HasCooldown(SPELL_DIVINE_STORM))
|
||||
caster->GetSpellHistory()->ResetCooldown(SPELL_DIVINE_STORM, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -3330,7 +3331,7 @@ class spell_pvp_trinket_wotf_shared_cd : public SpellScriptLoader
|
||||
{
|
||||
// This is only needed because spells cast from spell_linked_spell are triggered by default
|
||||
// Spell::SendSpellCooldown() skips all spells with TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD
|
||||
GetCaster()->ToPlayer()->AddSpellAndCategoryCooldowns(GetSpellInfo(), GetCastItem() ? GetCastItem()->GetEntry() : 0, GetSpell());
|
||||
GetCaster()->GetSpellHistory()->StartCooldown(GetSpellInfo(), 0, GetSpell());
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "CellImpl.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "SpellScript.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
|
||||
@@ -246,7 +247,7 @@ class spell_hun_chimera_shot : public SpellScriptLoader
|
||||
if (spellId)
|
||||
caster->CastCustomSpell(unitTarget, spellId, &basePoint, 0, 0, true);
|
||||
if (spellId == SPELL_HUNTER_CHIMERA_SHOT_SCORPID && caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown
|
||||
caster->ToPlayer()->AddSpellCooldown(spellId, 0, uint32(time(NULL) + 60));
|
||||
caster->GetSpellHistory()->AddCooldown(spellId, 0, std::chrono::minutes(1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -654,24 +655,20 @@ class spell_hun_readiness : public SpellScriptLoader
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
// immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath
|
||||
const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap();
|
||||
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
|
||||
GetCaster()->GetSpellHistory()->ResetCooldowns([](SpellHistory::CooldownStorageType::iterator itr) -> bool
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
|
||||
SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first);
|
||||
|
||||
///! If spellId in cooldown map isn't valid, the above will return a null pointer.
|
||||
if (spellInfo &&
|
||||
spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER &&
|
||||
if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER &&
|
||||
spellInfo->Id != SPELL_HUNTER_READINESS &&
|
||||
spellInfo->Id != SPELL_HUNTER_BESTIAL_WRATH &&
|
||||
spellInfo->Id != SPELL_DRAENEI_GIFT_OF_THE_NAARU &&
|
||||
spellInfo->GetRecoveryTime() > 0)
|
||||
caster->RemoveSpellCooldown((itr++)->first, true);
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "SpellScript.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SkillDiscovery.h"
|
||||
@@ -1349,7 +1350,7 @@ class spell_item_red_rider_air_rifle : public SpellScriptLoader
|
||||
caster->CastSpell(caster, SPELL_AIR_RIFLE_HOLD_VISUAL, true);
|
||||
// needed because this spell shares GCD with its triggered spells (which must not be cast with triggered flag)
|
||||
if (Player* player = caster->ToPlayer())
|
||||
player->GetGlobalCooldownMgr().CancelGlobalCooldown(GetSpellInfo());
|
||||
player->GetSpellHistory()->CancelGlobalCooldown(GetSpellInfo());
|
||||
if (urand(0, 4))
|
||||
caster->CastSpell(target, SPELL_AIR_RIFLE_SHOOT, false);
|
||||
else
|
||||
@@ -2368,7 +2369,7 @@ class spell_item_rocket_boots : public SpellScriptLoader
|
||||
if (Battleground* bg = caster->GetBattleground())
|
||||
bg->EventPlayerDroppedFlag(caster);
|
||||
|
||||
caster->RemoveSpellCooldown(SPELL_ROCKET_BOOTS_PROC);
|
||||
caster->GetSpellHistory()->ResetCooldown(SPELL_ROCKET_BOOTS_PROC);
|
||||
caster->CastSpell(caster, SPELL_ROCKET_BOOTS_PROC, true, NULL);
|
||||
}
|
||||
|
||||
@@ -2548,14 +2549,14 @@ class spell_item_refocus : public SpellScriptLoader
|
||||
if (!caster || caster->getClass() != CLASS_HUNTER)
|
||||
return;
|
||||
|
||||
if (caster->HasSpellCooldown(SPELL_AIMED_SHOT))
|
||||
caster->RemoveSpellCooldown(SPELL_AIMED_SHOT, true);
|
||||
if (caster->GetSpellHistory()->HasCooldown(SPELL_AIMED_SHOT))
|
||||
caster->GetSpellHistory()->ResetCooldown(SPELL_AIMED_SHOT, true);
|
||||
|
||||
if (caster->HasSpellCooldown(SPELL_MULTISHOT))
|
||||
caster->RemoveSpellCooldown(SPELL_MULTISHOT, true);
|
||||
if (caster->GetSpellHistory()->HasCooldown(SPELL_MULTISHOT))
|
||||
caster->GetSpellHistory()->ResetCooldown(SPELL_MULTISHOT, true);
|
||||
|
||||
if (caster->HasSpellCooldown(SPELL_VOLLEY))
|
||||
caster->RemoveSpellCooldown(SPELL_VOLLEY, true);
|
||||
if (caster->GetSpellHistory()->HasCooldown(SPELL_VOLLEY))
|
||||
caster->GetSpellHistory()->ResetCooldown(SPELL_VOLLEY, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "SpellScript.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
|
||||
@@ -171,22 +172,12 @@ class spell_mage_cold_snap : public SpellScriptLoader
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
// immediately finishes the cooldown on Frost spells
|
||||
const SpellCooldowns& cm = caster->GetSpellCooldownMap();
|
||||
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
|
||||
GetCaster()->GetSpellHistory()->ResetCooldowns([](SpellHistory::CooldownStorageType::iterator itr) -> bool
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first);
|
||||
|
||||
if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE &&
|
||||
(spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) &&
|
||||
spellInfo->Id != SPELL_MAGE_COLD_SNAP && spellInfo->GetRecoveryTime() > 0)
|
||||
{
|
||||
caster->RemoveSpellCooldown((itr++)->first, true);
|
||||
}
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
return spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) &&
|
||||
spellInfo->Id != SPELL_MAGE_COLD_SNAP && spellInfo->GetRecoveryTime() > 0;
|
||||
}, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellScript.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "Group.h"
|
||||
|
||||
enum PaladinSpells
|
||||
@@ -133,7 +134,7 @@ class spell_pal_ardent_defender : public SpellScriptLoader
|
||||
int32 remainingHealth = victim->GetHealth() - dmgInfo.GetDamage();
|
||||
uint32 allowedHealth = victim->CountPctFromMaxHealth(35);
|
||||
// If damage kills us
|
||||
if (remainingHealth <= 0 && !victim->ToPlayer()->HasSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL))
|
||||
if (remainingHealth <= 0 && !victim->GetSpellHistory()->HasCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL))
|
||||
{
|
||||
// Cast healing spell, completely avoid damage
|
||||
absorbAmount = dmgInfo.GetDamage();
|
||||
@@ -148,7 +149,7 @@ class spell_pal_ardent_defender : public SpellScriptLoader
|
||||
|
||||
int32 healAmount = int32(victim->CountPctFromMaxHealth(uint32(healPct * pctFromDefense)));
|
||||
victim->CastCustomSpell(victim, PAL_SPELL_ARDENT_DEFENDER_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff);
|
||||
victim->ToPlayer()->AddSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, time(NULL) + 120);
|
||||
victim->GetSpellHistory()->AddCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, std::chrono::minutes(2));
|
||||
}
|
||||
else if (remainingHealth < int32(allowedHealth))
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellScript.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "Containers.h"
|
||||
|
||||
enum RogueSpells
|
||||
@@ -139,11 +140,11 @@ class spell_rog_cheat_death : public SpellScriptLoader
|
||||
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
Player* target = GetTarget()->ToPlayer();
|
||||
if (dmgInfo.GetDamage() < target->GetHealth() || target->HasSpellCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN) || !roll_chance_i(absorbChance))
|
||||
if (dmgInfo.GetDamage() < target->GetHealth() || target->GetSpellHistory()->HasCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN) || !roll_chance_i(absorbChance))
|
||||
return;
|
||||
|
||||
target->CastSpell(target, SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, true);
|
||||
target->AddSpellCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, 0, time(NULL) + 60);
|
||||
target->GetSpellHistory()->AddCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, 0, std::chrono::minutes(1));
|
||||
|
||||
uint32 health10 = target->CountPctFromMaxHealth(10);
|
||||
|
||||
@@ -443,35 +444,21 @@ class spell_rog_preparation : public SpellScriptLoader
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
|
||||
//immediately finishes the cooldown on certain Rogue abilities
|
||||
const SpellCooldowns& cm = caster->GetSpellCooldownMap();
|
||||
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
|
||||
Unit* caster = GetCaster();
|
||||
caster->GetSpellHistory()->ResetCooldowns([caster](SpellHistory::CooldownStorageType::iterator itr) -> bool
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first);
|
||||
if (spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE)
|
||||
return false;
|
||||
|
||||
if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE)
|
||||
{
|
||||
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP || // Cold Blood, Shadowstep
|
||||
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT) // Vanish, Evasion, Sprint
|
||||
caster->RemoveSpellCooldown((itr++)->first, true);
|
||||
else if (caster->HasAura(SPELL_ROGUE_GLYPH_OF_PREPARATION))
|
||||
{
|
||||
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_DISMANTLE || // Dismantle
|
||||
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_KICK || // Kick
|
||||
(spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_BLADE_FLURRY && // Blade Flurry
|
||||
spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_BLADE_FLURRY))
|
||||
caster->RemoveSpellCooldown((itr++)->first, true);
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
return (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP || // Cold Blood, Shadowstep
|
||||
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT) || // Vanish, Evasion, Sprint
|
||||
(caster->HasAura(SPELL_ROGUE_GLYPH_OF_PREPARATION) &&
|
||||
(spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_DISMANTLE || // Dismantle
|
||||
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_KICK || // Kick
|
||||
(spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_BLADE_FLURRY && // Blade Flurry
|
||||
spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_BLADE_FLURRY)));
|
||||
}, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "ScriptMgr.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "Unit.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "SpellScript.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
|
||||
@@ -338,7 +339,7 @@ class spell_sha_earth_shield : public SpellScriptLoader
|
||||
{
|
||||
//! HACK due to currenct proc system implementation
|
||||
if (Player* player = GetTarget()->ToPlayer())
|
||||
if (player->HasSpellCooldown(SPELL_SHAMAN_EARTH_SHIELD_HEAL))
|
||||
if (player->GetSpellHistory()->HasCooldown(SPELL_SHAMAN_EARTH_SHIELD_HEAL))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -351,7 +352,7 @@ class spell_sha_earth_shield : public SpellScriptLoader
|
||||
|
||||
/// @hack: due to currenct proc system implementation
|
||||
if (Player* player = GetTarget()->ToPlayer())
|
||||
player->AddSpellCooldown(SPELL_SHAMAN_EARTH_SHIELD_HEAL, 0, time(NULL) + 3);
|
||||
player->GetSpellHistory()->AddCooldown(SPELL_SHAMAN_EARTH_SHIELD_HEAL, 0, std::chrono::seconds(3));
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -804,7 +805,7 @@ class spell_sha_item_t10_elemental_2p_bonus : public SpellScriptLoader
|
||||
{
|
||||
PreventDefaultAction();
|
||||
if (Player* target = GetTarget()->ToPlayer())
|
||||
target->ModifySpellCooldown(SPELL_SHAMAN_ELEMENTAL_MASTERY, -aurEff->GetAmount());
|
||||
target->GetSpellHistory()->ModifyCooldown(SPELL_SHAMAN_ELEMENTAL_MASTERY, -aurEff->GetAmount());
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "SpellScript.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
|
||||
@@ -847,7 +848,7 @@ class spell_warr_vigilance_trigger : public SpellScriptLoader
|
||||
|
||||
// Remove Taunt cooldown
|
||||
if (Player* target = GetHitPlayer())
|
||||
target->RemoveSpellCooldown(SPELL_WARRIOR_TAUNT, true);
|
||||
target->GetSpellHistory()->ResetCooldown(SPELL_WARRIOR_TAUNT, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -53,6 +53,7 @@ EndContentData */
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Cell.h"
|
||||
#include "CellImpl.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "Pet.h"
|
||||
#include "CreatureTextMgr.h"
|
||||
@@ -1214,14 +1215,14 @@ public:
|
||||
if (creature->IsQuestGiver())
|
||||
player->PrepareQuestMenu(creature->GetGUID());
|
||||
|
||||
if (player->HasSpellCooldown(SPELL_INT) ||
|
||||
player->HasSpellCooldown(SPELL_ARM) ||
|
||||
player->HasSpellCooldown(SPELL_DMG) ||
|
||||
player->HasSpellCooldown(SPELL_RES) ||
|
||||
player->HasSpellCooldown(SPELL_STR) ||
|
||||
player->HasSpellCooldown(SPELL_AGI) ||
|
||||
player->HasSpellCooldown(SPELL_STM) ||
|
||||
player->HasSpellCooldown(SPELL_SPI))
|
||||
if (player->GetSpellHistory()->HasCooldown(SPELL_INT) ||
|
||||
player->GetSpellHistory()->HasCooldown(SPELL_ARM) ||
|
||||
player->GetSpellHistory()->HasCooldown(SPELL_DMG) ||
|
||||
player->GetSpellHistory()->HasCooldown(SPELL_RES) ||
|
||||
player->GetSpellHistory()->HasCooldown(SPELL_STR) ||
|
||||
player->GetSpellHistory()->HasCooldown(SPELL_AGI) ||
|
||||
player->GetSpellHistory()->HasCooldown(SPELL_STM) ||
|
||||
player->GetSpellHistory()->HasCooldown(SPELL_SPI))
|
||||
player->SEND_GOSSIP_MENU(7393, creature->GetGUID());
|
||||
else
|
||||
{
|
||||
@@ -1281,52 +1282,44 @@ public:
|
||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) override
|
||||
{
|
||||
player->PlayerTalkClass->ClearMenus();
|
||||
uint32 spellId = 0;
|
||||
switch (sender)
|
||||
{
|
||||
case GOSSIP_SENDER_MAIN:
|
||||
SendAction(player, creature, action);
|
||||
break;
|
||||
case GOSSIP_SENDER_MAIN + 1:
|
||||
creature->CastSpell(player, SPELL_DMG, false);
|
||||
player->AddSpellCooldown(SPELL_DMG, 0, time(NULL) + 7200);
|
||||
SendAction(player, creature, action);
|
||||
spellId = SPELL_DMG;
|
||||
break;
|
||||
case GOSSIP_SENDER_MAIN + 2:
|
||||
creature->CastSpell(player, SPELL_RES, false);
|
||||
player->AddSpellCooldown(SPELL_RES, 0, time(NULL) + 7200);
|
||||
SendAction(player, creature, action);
|
||||
spellId = SPELL_RES;
|
||||
break;
|
||||
case GOSSIP_SENDER_MAIN + 3:
|
||||
creature->CastSpell(player, SPELL_ARM, false);
|
||||
player->AddSpellCooldown(SPELL_ARM, 0, time(NULL) + 7200);
|
||||
SendAction(player, creature, action);
|
||||
spellId = SPELL_ARM;
|
||||
break;
|
||||
case GOSSIP_SENDER_MAIN + 4:
|
||||
creature->CastSpell(player, SPELL_SPI, false);
|
||||
player->AddSpellCooldown(SPELL_SPI, 0, time(NULL) + 7200);
|
||||
SendAction(player, creature, action);
|
||||
spellId = SPELL_SPI;
|
||||
break;
|
||||
case GOSSIP_SENDER_MAIN + 5:
|
||||
creature->CastSpell(player, SPELL_INT, false);
|
||||
player->AddSpellCooldown(SPELL_INT, 0, time(NULL) + 7200);
|
||||
SendAction(player, creature, action);
|
||||
spellId = SPELL_INT;
|
||||
break;
|
||||
case GOSSIP_SENDER_MAIN + 6:
|
||||
creature->CastSpell(player, SPELL_STM, false);
|
||||
player->AddSpellCooldown(SPELL_STM, 0, time(NULL) + 7200);
|
||||
SendAction(player, creature, action);
|
||||
spellId = SPELL_STM;
|
||||
break;
|
||||
case GOSSIP_SENDER_MAIN + 7:
|
||||
creature->CastSpell(player, SPELL_STR, false);
|
||||
player->AddSpellCooldown(SPELL_STR, 0, time(NULL) + 7200);
|
||||
SendAction(player, creature, action);
|
||||
spellId = SPELL_STR;
|
||||
break;
|
||||
case GOSSIP_SENDER_MAIN + 8:
|
||||
creature->CastSpell(player, SPELL_AGI, false);
|
||||
player->AddSpellCooldown(SPELL_AGI, 0, time(NULL) + 7200);
|
||||
SendAction(player, creature, action);
|
||||
spellId = SPELL_AGI;
|
||||
break;
|
||||
}
|
||||
|
||||
if (spellId)
|
||||
{
|
||||
creature->CastSpell(player, spellId, false);
|
||||
player->GetSpellHistory()->AddCooldown(spellId, 0, std::chrono::hours(2));
|
||||
SendAction(player, creature, action);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user