aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2013-10-26 14:39:00 +0200
committerShauren <shauren.trinity@gmail.com>2013-10-26 14:39:00 +0200
commitb81bf7d0250939ee96b942f554c16d950f06c7b1 (patch)
tree2d161702e541dbba3acd420f8315801043c2bb03
parentdaf5a4b5c33ee56abfbaf6bbd1a91dd27a45aeec (diff)
Core/Spells: Implemented additional conditions for spells that start cooldown after an event instead of after cast
-rw-r--r--src/server/game/DataStores/DBCEnums.h6
-rw-r--r--src/server/game/DataStores/DBCStores.cpp6
-rw-r--r--src/server/game/DataStores/DBCStores.h3
-rw-r--r--src/server/game/DataStores/DBCStructure.h6
-rw-r--r--src/server/game/DataStores/DBCfmt.h1
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp8
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp2
-rw-r--r--src/server/game/Entities/Player/Player.cpp36
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp10
-rw-r--r--src/server/game/Handlers/ItemHandler.cpp2
-rw-r--r--src/server/game/Handlers/MovementHandler.cpp2
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.h8
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp6
-rw-r--r--src/server/game/Spells/Spell.cpp4
-rw-r--r--src/server/game/Spells/SpellEffects.cpp10
-rw-r--r--src/server/game/Spells/SpellInfo.cpp16
-rw-r--r--src/server/game/Spells/SpellInfo.h4
17 files changed, 79 insertions, 51 deletions
diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h
index a7189ea415a..171d0fe8cc2 100644
--- a/src/server/game/DataStores/DBCEnums.h
+++ b/src/server/game/DataStores/DBCEnums.h
@@ -344,6 +344,12 @@ enum ItemLimitCategoryMode
ITEM_LIMIT_CATEGORY_MODE_EQUIP = 1 // limit applied to amount equipped items (including used gems)
};
+enum SpellCategoryFlags
+{
+ SPELL_CATEGORY_FLAG_COOLDOWN_SCALES_WITH_WEAPON_SPEED = 0x01, // unused
+ SPELL_CATEGORY_FLAG_COOLDOWN_STARTS_ON_EVENT = 0x04
+};
+
enum TotemCategoryType
{
TOTEM_CATEGORY_TYPE_KNIFE = 1,
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index 95592cd87d9..aa292934021 100644
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -154,10 +154,11 @@ DBCStorage <SoundEntriesEntry> sSoundEntriesStore(SoundEntriesfmt);
DBCStorage <SpellItemEnchantmentEntry> sSpellItemEnchantmentStore(SpellItemEnchantmentfmt);
DBCStorage <SpellItemEnchantmentConditionEntry> sSpellItemEnchantmentConditionStore(SpellItemEnchantmentConditionfmt);
DBCStorage <SpellEntry> sSpellStore(SpellEntryfmt);
-SpellCategoryStore sSpellCategoryStore;
+SpellCategoryStore sSpellsByCategoryStore;
PetFamilySpellsStore sPetFamilySpellsStore;
DBCStorage <SpellCastTimesEntry> sSpellCastTimesStore(SpellCastTimefmt);
+DBCStorage <SpellCategoryEntry> sSpellCategoryStore(SpellCategoryfmt);
DBCStorage <SpellDifficultyEntry> sSpellDifficultyStore(SpellDifficultyfmt);
DBCStorage <SpellDurationEntry> sSpellDurationStore(SpellDurationfmt);
DBCStorage <SpellFocusObjectEntry> sSpellFocusObjectStore(SpellFocusObjectfmt);
@@ -408,7 +409,7 @@ void LoadDBCStores(const std::string& dataPath)
{
SpellEntry const* spell = sSpellStore.LookupEntry(i);
if (spell && spell->Category)
- sSpellCategoryStore[spell->Category].insert(i);
+ sSpellsByCategoryStore[spell->Category].insert(i);
}
for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j)
@@ -442,6 +443,7 @@ void LoadDBCStores(const std::string& dataPath)
}
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellCastTimesStore, dbcPath, "SpellCastTimes.dbc");
+ LoadDBC(availableDbcLocales, bad_dbc_files, sSpellCategoryStore, dbcPath, "SpellCategory.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellDifficultyStore, dbcPath, "SpellDifficulty.dbc", &CustomSpellDifficultyfmt, &CustomSpellDifficultyIndex);
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellDurationStore, dbcPath, "SpellDuration.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellFocusObjectStore, dbcPath, "SpellFocusObject.dbc");
diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h
index cac93a120a5..808ebb78fa5 100644
--- a/src/server/game/DataStores/DBCStores.h
+++ b/src/server/game/DataStores/DBCStores.h
@@ -148,12 +148,13 @@ extern DBCStorage <SkillLineEntry> sSkillLineStore;
extern DBCStorage <SkillLineAbilityEntry> sSkillLineAbilityStore;
extern DBCStorage <SoundEntriesEntry> sSoundEntriesStore;
extern DBCStorage <SpellCastTimesEntry> sSpellCastTimesStore;
+extern DBCStorage <SpellCategoryEntry> sSpellCategoryStore;
extern DBCStorage <SpellDifficultyEntry> sSpellDifficultyStore;
extern DBCStorage <SpellDurationEntry> sSpellDurationStore;
extern DBCStorage <SpellFocusObjectEntry> sSpellFocusObjectStore;
extern DBCStorage <SpellItemEnchantmentEntry> sSpellItemEnchantmentStore;
extern DBCStorage <SpellItemEnchantmentConditionEntry> sSpellItemEnchantmentConditionStore;
-extern SpellCategoryStore sSpellCategoryStore;
+extern SpellCategoryStore sSpellsByCategoryStore;
extern PetFamilySpellsStore sPetFamilySpellsStore;
extern DBCStorage <SpellRadiusEntry> sSpellRadiusStore;
extern DBCStorage <SpellRangeEntry> sSpellRangeStore;
diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h
index aff54f75a40..1dce61e90f6 100644
--- a/src/server/game/DataStores/DBCStructure.h
+++ b/src/server/game/DataStores/DBCStructure.h
@@ -1675,6 +1675,12 @@ struct SpellCastTimesEntry
//int32 MinCastTime; // 3 unsure
};
+struct SpellCategoryEntry
+{
+ uint32 Id;
+ uint32 Flags;
+};
+
struct SpellDifficultyEntry
{
uint32 ID; // 0
diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h
index 5326ab70fa3..0066db2b049 100644
--- a/src/server/game/DataStores/DBCfmt.h
+++ b/src/server/game/DataStores/DBCfmt.h
@@ -97,6 +97,7 @@ char const SkillLinefmt[] = "nixssssssssssssssssxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxx
char const SkillLineAbilityfmt[] = "niiiixxiiiiixx";
char const SoundEntriesfmt[] = "nxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
char const SpellCastTimefmt[] = "nixx";
+char const SpellCategoryfmt[] = "ni";
char const SpellDifficultyfmt[] = "niiii";
const std::string CustomSpellDifficultyfmt = "ppppp";
const std::string CustomSpellDifficultyIndex = "id";
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index f68d87de2f4..e4fda515c8a 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -2141,8 +2141,8 @@ void Creature::AddCreatureSpellCooldown(uint32 spellid)
if (cooldown)
_AddCreatureSpellCooldown(spellid, time(NULL) + cooldown/IN_MILLISECONDS);
- if (spellInfo->Category)
- _AddCreatureCategoryCooldown(spellInfo->Category, time(NULL));
+ if (spellInfo->GetCategory())
+ _AddCreatureCategoryCooldown(spellInfo->GetCategory(), time(NULL));
}
bool Creature::HasCategoryCooldown(uint32 spell_id) const
@@ -2151,7 +2151,7 @@ bool Creature::HasCategoryCooldown(uint32 spell_id) const
if (!spellInfo)
return false;
- CreatureSpellCooldowns::const_iterator itr = m_CreatureCategoryCooldowns.find(spellInfo->Category);
+ CreatureSpellCooldowns::const_iterator itr = m_CreatureCategoryCooldowns.find(spellInfo->GetCategory());
return(itr != m_CreatureCategoryCooldowns.end() && time_t(itr->second + (spellInfo->CategoryRecoveryTime / IN_MILLISECONDS)) > time(NULL));
}
@@ -2185,7 +2185,7 @@ void Creature::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs
}
// Not send cooldown for this spells
- if (spellInfo->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
+ if (spellInfo->IsCooldownStartedOnEvent())
continue;
if (spellInfo->PreventionType != SPELL_PREVENTION_TYPE_SILENCE)
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 9758564c8f2..dfe658a30d3 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -2056,7 +2056,7 @@ void Pet::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs)
}
// Not send cooldown for this spells
- if (spellInfo->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
+ if (spellInfo->IsCooldownStartedOnEvent())
continue;
if (spellInfo->PreventionType != SPELL_PREVENTION_TYPE_SILENCE)
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index eaee6dc090a..80f3f022a20 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -3384,7 +3384,7 @@ void Player::SendInitialSpells()
data << uint32(itr->first);
data << uint16(itr->second.itemid); // cast item id
- data << uint16(sEntry->Category); // spell category
+ data << uint16(sEntry->GetCategory()); // spell category
// send infinity cooldown in special format
if (itr->second.end >= infTime)
@@ -3396,7 +3396,7 @@ void Player::SendInitialSpells()
time_t cooldown = itr->second.end > curTime ? (itr->second.end-curTime)*IN_MILLISECONDS : 0;
- if (sEntry->Category) // may be wrong, but anyway better than nothing...
+ if (sEntry->GetCategory()) // may be wrong, but anyway better than nothing...
{
data << uint32(0); // cooldown
data << uint32(cooldown); // category cooldown
@@ -4259,16 +4259,16 @@ void Player::RemoveSpellCooldown(uint32 spell_id, bool update /* = false */)
// I am not sure which one is more efficient
void Player::RemoveCategoryCooldown(uint32 cat)
{
- SpellCategoryStore::const_iterator i_scstore = sSpellCategoryStore.find(cat);
- if (i_scstore != sSpellCategoryStore.end())
+ SpellCategoryStore::const_iterator i_scstore = sSpellsByCategoryStore.find(cat);
+ if (i_scstore != sSpellsByCategoryStore.end())
for (SpellCategorySet::const_iterator i_scset = i_scstore->second.begin(); i_scset != i_scstore->second.end(); ++i_scset)
RemoveSpellCooldown(*i_scset, true);
}
void Player::RemoveSpellCategoryCooldown(uint32 cat, bool update /* = false */)
{
- SpellCategoryStore::const_iterator ct = sSpellCategoryStore.find(cat);
- if (ct == sSpellCategoryStore.end())
+ SpellCategoryStore::const_iterator ct = sSpellsByCategoryStore.find(cat);
+ if (ct == sSpellsByCategoryStore.end())
return;
const SpellCategorySet& ct_set = ct->second;
@@ -20433,13 +20433,13 @@ void Player::PetSpellInitialize()
time_t cooldown = (itr->second > curTime) ? (itr->second - curTime) * IN_MILLISECONDS : 0;
data << uint32(itr->first); // spell ID
- CreatureSpellCooldowns::const_iterator categoryitr = pet->m_CreatureCategoryCooldowns.find(spellInfo->Category);
+ CreatureSpellCooldowns::const_iterator categoryitr = pet->m_CreatureCategoryCooldowns.find(spellInfo->GetCategory());
if (categoryitr != pet->m_CreatureCategoryCooldowns.end())
{
time_t categoryCooldown = (categoryitr->second > curTime) ? (categoryitr->second - curTime) * IN_MILLISECONDS : 0;
- data << uint16(spellInfo->Category); // spell category
- data << uint32(cooldown); // spell cooldown
- data << uint32(categoryCooldown); // category cooldown
+ data << uint16(spellInfo->GetCategory()); // spell category
+ data << uint32(cooldown); // spell cooldown
+ data << uint32(categoryCooldown); // category cooldown
}
else
{
@@ -20546,13 +20546,13 @@ void Player::VehicleSpellInitialize()
time_t cooldown = (itr->second > now) ? (itr->second - now) * IN_MILLISECONDS : 0;
data << uint32(itr->first); // spell ID
- CreatureSpellCooldowns::const_iterator categoryitr = vehicle->m_CreatureCategoryCooldowns.find(spellInfo->Category);
+ CreatureSpellCooldowns::const_iterator categoryitr = vehicle->m_CreatureCategoryCooldowns.find(spellInfo->GetCategory());
if (categoryitr != vehicle->m_CreatureCategoryCooldowns.end())
{
time_t categoryCooldown = (categoryitr->second > now) ? (categoryitr->second - now) * IN_MILLISECONDS : 0;
- data << uint16(spellInfo->Category); // spell category
- data << uint32(cooldown); // spell cooldown
- data << uint32(categoryCooldown); // category cooldown
+ data << uint16(spellInfo->GetCategory()); // spell category
+ data << uint32(cooldown); // spell cooldown
+ data << uint32(categoryCooldown); // category cooldown
}
else
{
@@ -21220,7 +21220,7 @@ void Player::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs)
}
// Not send cooldown for this spells
- if (spellInfo->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
+ if (spellInfo->IsCooldownStartedOnEvent())
continue;
if (spellInfo->PreventionType != SPELL_PREVENTION_TYPE_SILENCE)
@@ -21683,7 +21683,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 ite
// if no cooldown found above then base at DBC data
if (rec < 0 && catrec < 0)
{
- cat = spellInfo->Category;
+ cat = spellInfo->GetCategory();
rec = spellInfo->RecoveryTime;
catrec = spellInfo->CategoryRecoveryTime;
}
@@ -21734,8 +21734,8 @@ void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 ite
// category spells
if (cat && catrec > 0)
{
- SpellCategoryStore::const_iterator i_scstore = sSpellCategoryStore.find(cat);
- if (i_scstore != sSpellCategoryStore.end())
+ SpellCategoryStore::const_iterator i_scstore = sSpellsByCategoryStore.find(cat);
+ if (i_scstore != sSpellsByCategoryStore.end())
{
for (SpellCategorySet::const_iterator i_scset = i_scstore->second.begin(); i_scset != i_scstore->second.end(); ++i_scset)
{
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index c3a611c441f..ef6d9b9edef 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -4838,7 +4838,7 @@ void Unit::AddGameObject(GameObject* gameObj)
{
SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(gameObj->GetSpellId());
// Need disable spell use for owner
- if (createBySpell && createBySpell->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
+ if (createBySpell && createBySpell->IsCooldownStartedOnEvent())
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
ToPlayer()->AddSpellAndCategoryCooldowns(createBySpell, 0, NULL, true);
}
@@ -4869,7 +4869,7 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del)
{
SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(spellid);
// Need activate spell use for owner
- if (createBySpell && createBySpell->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
+ if (createBySpell && createBySpell->IsCooldownStartedOnEvent())
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
ToPlayer()->SendCooldownEvent(createBySpell);
}
@@ -9382,7 +9382,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
// Send infinity cooldown - client does that automatically but after relog cooldown needs to be set again
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
- if (spellInfo && (spellInfo->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE))
+ if (spellInfo && (spellInfo->IsCooldownStartedOnEvent()))
ToPlayer()->AddSpellAndCategoryCooldowns(spellInfo, 0, NULL, true);
}
}
@@ -9424,7 +9424,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
// Remove infinity cooldown
- if (spellInfo && (spellInfo->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE))
+ if (spellInfo && (spellInfo->IsCooldownStartedOnEvent()))
ToPlayer()->SendCooldownEvent(spellInfo);
}
@@ -10546,7 +10546,7 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
break;
}
// Exorcism
- else if (spellProto->Category == 19)
+ else if (spellProto->GetCategory() == 19)
{
if (victim->GetCreatureTypeMask() & CREATURE_TYPEMASK_DEMON_OR_UNDEAD)
return true;
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index 5f458edbb07..d9727ea7ded 100644
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -382,7 +382,7 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket& recvData)
else
{
data << uint32(spell->RecoveryTime);
- data << uint32(spell->Category);
+ data << uint32(spell->GetCategory());
data << uint32(spell->CategoryRecoveryTime);
}
}
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp
index 36d1e1cb1ea..955f6b3c456 100644
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -354,7 +354,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
uint32 mstime = getMSTime();
/*----------------------*/
- if(m_clientTimeDelay == 0)
+ if (m_clientTimeDelay == 0)
m_clientTimeDelay = mstime - movementInfo.time;
/* process position-change */
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h
index 7cfb1e04850..ddd6c1127e1 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.h
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.h
@@ -317,11 +317,11 @@ namespace Trinity
// Wards
if ((spellProtoA->SpellFamilyName == SPELLFAMILY_MAGE) ||
(spellProtoA->SpellFamilyName == SPELLFAMILY_WARLOCK))
- if (spellProtoA->Category == 56)
+ if (spellProtoA->GetCategory() == 56)
return true;
if ((spellProtoB->SpellFamilyName == SPELLFAMILY_MAGE) ||
(spellProtoB->SpellFamilyName == SPELLFAMILY_WARLOCK))
- if (spellProtoB->Category == 56)
+ if (spellProtoB->GetCategory() == 56)
return false;
// Sacred Shield
@@ -343,9 +343,9 @@ namespace Trinity
return false;
// Ice Barrier
- if (spellProtoA->Category == 471)
+ if (spellProtoA->GetCategory() == 471)
return true;
- if (spellProtoB->Category == 471)
+ if (spellProtoB->GetCategory() == 471)
return false;
// Sacrifice
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index d7b8003f19a..4b6423503c1 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -413,7 +413,7 @@ void Aura::_ApplyForTarget(Unit* target, Unit* caster, AuraApplication * auraApp
// set infinity cooldown state for spells
if (caster && caster->GetTypeId() == TYPEID_PLAYER)
{
- if (m_spellInfo->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
+ if (m_spellInfo->IsCooldownStartedOnEvent())
{
Item* castItem = m_castItemGuid ? caster->ToPlayer()->GetItemByGuid(m_castItemGuid) : NULL;
caster->ToPlayer()->AddSpellAndCategoryCooldowns(m_spellInfo, castItem ? castItem->GetEntry() : 0, NULL, true);
@@ -446,7 +446,7 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * auraA
// reset cooldown state for spells
if (caster && caster->GetTypeId() == TYPEID_PLAYER)
{
- if (GetSpellInfo()->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
+ if (GetSpellInfo()->IsCooldownStartedOnEvent())
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
caster->ToPlayer()->SendCooldownEvent(GetSpellInfo());
}
@@ -1279,7 +1279,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
break;
case SPELLFAMILY_ROGUE:
// Sprint (skip non player casted spells by category)
- if (GetSpellInfo()->SpellFamilyFlags[0] & 0x40 && GetSpellInfo()->Category == 44)
+ if (GetSpellInfo()->SpellFamilyFlags[0] & 0x40 && GetSpellInfo()->GetCategory() == 44)
// in official maybe there is only one icon?
if (target->HasAura(58039)) // Glyph of Blurred Speed
target->CastSpell(target, 61922, true); // Sprint (waterwalk)
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index aa629b46e28..e91bba13fa0 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -3552,7 +3552,7 @@ void Spell::SendSpellCooldown()
return;
// mana/health/etc potions, disabled by client (until combat out as declarate)
- if (m_CastItem && m_CastItem->IsPotion())
+ if (m_CastItem && (m_CastItem->IsPotion() || m_spellInfo->IsCooldownStartedOnEvent()))
{
// need in some way provided data for Spell::finish SendCooldownEvent
_player->SetLastPotionId(m_CastItem->GetEntry());
@@ -3560,7 +3560,7 @@ void Spell::SendSpellCooldown()
}
// have infinity cooldown but set at aura apply // do not set cooldown for triggered spells (needed by reincarnation)
- if (m_spellInfo->Attributes & (SPELL_ATTR0_DISABLED_WHILE_ACTIVE | SPELL_ATTR0_PASSIVE) || (_triggeredCastFlags & TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD))
+ if (m_spellInfo->IsCooldownStartedOnEvent() || m_spellInfo->IsPassive() || (_triggeredCastFlags & TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD))
return;
_player->AddSpellAndCategoryCooldowns(m_spellInfo, m_CastItem ? m_CastItem->GetEntry() : 0, this);
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 0732c389bfa..e580a3d0f2d 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -369,7 +369,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
case SPELLFAMILY_WARRIOR:
{
// Shield Slam
- if (m_spellInfo->SpellFamilyFlags[1] & 0x200 && m_spellInfo->Category == 1209)
+ if (m_spellInfo->SpellFamilyFlags[1] & 0x200 && m_spellInfo->GetCategory() == 1209)
{
uint8 level = m_caster->getLevel();
uint32 block_value = m_caster->GetShieldBlockValue(uint32(float(level) * 24.5f), uint32(float(level) * 34.5f));
@@ -943,7 +943,7 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
// Remove spell cooldown (not category) if spell triggering spell with cooldown and same category
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->CategoryRecoveryTime && spellInfo->CategoryRecoveryTime
- && m_spellInfo->Category == spellInfo->Category)
+ && m_spellInfo->GetCategory() == spellInfo->GetCategory())
m_caster->ToPlayer()->RemoveSpellCooldown(spellInfo->Id);
// original caster guid only for GO cast
@@ -996,7 +996,7 @@ void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex)
// Remove spell cooldown (not category) if spell triggering spell with cooldown and same category
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->CategoryRecoveryTime && spellInfo->CategoryRecoveryTime
- && m_spellInfo->Category == spellInfo->Category)
+ && m_spellInfo->GetCategory() == spellInfo->GetCategory())
m_caster->ToPlayer()->RemoveSpellCooldown(spellInfo->Id);
// original caster guid only for GO cast
@@ -2521,7 +2521,7 @@ void Spell::EffectDispel(SpellEffIndex effIndex)
// On success dispel
// Devour Magic
- if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->Category == SPELLCATEGORY_DEVOUR_MAGIC)
+ if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->GetCategory() == SPELLCATEGORY_DEVOUR_MAGIC)
{
int32 heal_amount = m_spellInfo->Effects[EFFECT_1].CalcValue();
m_caster->CastCustomSpell(m_caster, 19658, &heal_amount, NULL, NULL, true);
@@ -4106,7 +4106,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
case SPELLFAMILY_PALADIN:
{
// Judgement (seal trigger)
- if (m_spellInfo->Category == SPELLCATEGORY_JUDGEMENT)
+ if (m_spellInfo->GetCategory() == SPELLCATEGORY_JUDGEMENT)
{
if (!unitTarget || !unitTarget->IsAlive())
return;
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index a0e1ec065cc..0cab2cd4540 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -763,7 +763,7 @@ SpellEffectInfo::StaticData SpellEffectInfo::_data[TOTAL_SPELL_EFFECTS] =
SpellInfo::SpellInfo(SpellEntry const* spellEntry)
{
Id = spellEntry->Id;
- Category = spellEntry->Category;
+ CategoryEntry = spellEntry->Category ? sSpellCategoryStore.LookupEntry(spellEntry->Category) : NULL;
Dispel = spellEntry->Dispel;
Mechanic = spellEntry->Mechanic;
Attributes = spellEntry->Attributes;
@@ -859,6 +859,11 @@ SpellInfo::~SpellInfo()
_UnloadImplicitTargetConditionLists();
}
+uint32 SpellInfo::GetCategory() const
+{
+ return CategoryEntry ? CategoryEntry->Id : 0;
+}
+
bool SpellInfo::HasEffect(SpellEffects effect) const
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
@@ -1103,6 +1108,11 @@ bool SpellInfo::IsStackableOnOneSlotWithDifferentCasters() const
return StackAmount > 1 && !IsChanneled() && !(AttributesEx3 & SPELL_ATTR3_STACK_FOR_DIFF_CASTERS);
}
+bool SpellInfo::IsCooldownStartedOnEvent() const
+{
+ return Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE || (CategoryEntry && CategoryEntry->Flags & SPELL_CATEGORY_FLAG_COOLDOWN_STARTS_ON_EVENT);
+}
+
bool SpellInfo::IsDeathPersistent() const
{
return AttributesEx3 & SPELL_ATTR3_DEATH_PERSISTENT;
@@ -1712,7 +1722,7 @@ SpellCastResult SpellInfo::CheckVehicle(Unit const* caster) const
bool SpellInfo::CheckTargetCreatureType(Unit const* target) const
{
// Curse of Doom & Exorcism: not find another way to fix spell target check :/
- if (SpellFamilyName == SPELLFAMILY_WARLOCK && Category == 1179)
+ if (SpellFamilyName == SPELLFAMILY_WARLOCK && GetCategory() == 1179)
{
// not allow cast at player
if (target->GetTypeId() == TYPEID_PLAYER)
@@ -1816,7 +1826,7 @@ AuraStateType SpellInfo::GetAuraState() const
return AURA_STATE_FAERIE_FIRE;
// Sting (hunter's pet ability)
- if (Category == 1133)
+ if (GetCategory() == 1133)
return AURA_STATE_FAERIE_FIRE;
// Victorious
diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h
index c2ca938d26f..74d95171b4b 100644
--- a/src/server/game/Spells/SpellInfo.h
+++ b/src/server/game/Spells/SpellInfo.h
@@ -290,7 +290,7 @@ class SpellInfo
{
public:
uint32 Id;
- uint32 Category;
+ SpellCategoryEntry const* CategoryEntry;
uint32 Dispel;
uint32 Mechanic;
uint32 Attributes;
@@ -368,6 +368,7 @@ public:
SpellInfo(SpellEntry const* spellEntry);
~SpellInfo();
+ uint32 GetCategory() const;
bool HasEffect(SpellEffects effect) const;
bool HasAura(AuraType aura) const;
bool HasAreaAuraEffect() const;
@@ -393,6 +394,7 @@ public:
bool IsPassiveStackableWithRanks() const;
bool IsMultiSlotAura() const;
bool IsStackableOnOneSlotWithDifferentCasters() const;
+ bool IsCooldownStartedOnEvent() const;
bool IsDeathPersistent() const;
bool IsRequiringDeadTarget() const;
bool IsAllowingDeadTarget() const;