Core/Spells: Implemented additional conditions for spells that start cooldown after an event instead of after cast
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1675,6 +1675,12 @@ struct SpellCastTimesEntry
|
||||
//int32 MinCastTime; // 3 unsure
|
||||
};
|
||||
|
||||
struct SpellCategoryEntry
|
||||
{
|
||||
uint32 Id;
|
||||
uint32 Flags;
|
||||
};
|
||||
|
||||
struct SpellDifficultyEntry
|
||||
{
|
||||
uint32 ID; // 0
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user