diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/DataStores/DBCStructure.h | 4 | ||||
-rwxr-xr-x | src/server/game/DataStores/DBCfmt.h | 2 | ||||
-rwxr-xr-x | src/server/game/Miscellaneous/SharedDefines.h | 74 | ||||
-rwxr-xr-x | src/server/game/Spells/Spell.cpp | 47 | ||||
-rwxr-xr-x | src/server/game/Spells/Spell.h | 1 | ||||
-rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Spells/SpellInfo.h | 2 |
7 files changed, 120 insertions, 12 deletions
diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 7b076698d9d..4e688d39c75 100644 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -1766,8 +1766,8 @@ struct SpellEntry uint32 AttributesEx6; // 7 m_attributesExF uint32 AttributesEx7; // 8 m_attributesExG uint32 AttributesEx8; // 9 m_attributesExH - // uint32 unk_400_1; // 10 4.0.0 - // uint32 unk_420_1 // 11 4.2.0 + uint32 AttributesEx9; // 10 m_attributesExI + uint32 AttributesEx10; // 11 m_attributesExJ uint32 CastingTimeIndex; // 12 m_castingTimeIndex uint32 DurationIndex; // 13 m_durationIndex uint32 powerType; // 14 m_powerType diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index bdef905acfd..4999a10a9de 100755 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -128,7 +128,7 @@ const std::string CustomSpellDifficultyfmt="ppppp"; const std::string CustomSpellDifficultyIndex="id"; const char SpellDurationfmt[]="niii"; const char SpellEffectEntryfmt[]="nifiiiffiiiiiifiifiiiiiiiix"; -const char SpellEntryfmt[]="niiiiiiiiixxiiiifiiiissxxiixxixiiiiiiixiiiiiiiix"; +const char SpellEntryfmt[]="niiiiiiiiiiiiiiifiiiissxxiixxixiiiiiiixiiiiiiiix"; const std::string CustomSpellEntryfmt="papppppppppppapapaaaaaaaaaaapaaapapppppppaaaaapaapaaaaaaaaaaaaaaaaaappppppppppppppppppppppppppppppppppppaaaaaapppppppppaaapppppppppaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaappppppppapppaaaaappaaaaaaa"; const std::string CustomSpellEntryIndex = "Id"; const char SpellFocusObjectfmt[]="nx"; diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index c129310a91a..fc656f2e88b 100755 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -437,7 +437,7 @@ enum SpellAttr4 SPELL_ATTR4_UNK13 = 0x00002000, // 13 SPELL_ATTR4_DAMAGE_DOESNT_BREAK_AURAS = 0x00004000, // 14 doesn't break auras by damage from these spells SPELL_ATTR4_UNK15 = 0x00008000, // 15 - SPELL_ATTR4_NOT_USABLE_IN_ARENA = 0x00010000, // 16 + SPELL_ATTR4_NOT_USABLE_IN_ARENA_OR_RATED_BG = 0x00010000, // 16 Cannot be used in both Arenas or Rated Battlegrounds SPELL_ATTR4_USABLE_IN_ARENA = 0x00020000, // 17 SPELL_ATTR4_AREA_TARGET_CHAIN = 0x00040000, // 18 (NYI)hits area targets one after another instead of all at once SPELL_ATTR4_UNK19 = 0x00080000, // 19 proc dalayed, after damage or don't proc on absorb? @@ -599,6 +599,78 @@ enum SpellAttr8 SPELL_ATTR8_UNK31 = 0x80000000 // 31 }; +enum SpellAttr9 +{ + SPELL_ATTR9_UNK0 = 0x00000001, // 0 + SPELL_ATTR9_UNK1 = 0x00000002, // 1 + SPELL_ATTR9_UNK2 = 0x00000004, // 2 + SPELL_ATTR9_UNK3 = 0x00000008, // 3 + SPELL_ATTR9_UNK4 = 0x00000010, // 4 + SPELL_ATTR9_UNK5 = 0x00000020, // 5 + SPELL_ATTR9_UNK6 = 0x00000040, // 6 + SPELL_ATTR9_UNK7 = 0x00000080, // 7 + SPELL_ATTR9_UNK8 = 0x00000100, // 8 + SPELL_ATTR9_NOT_USABLE_IN_ARENA = 0x00000200, // 9 Cannot be used in arenas + SPELL_ATTR9_UNK10 = 0x00000400, // 10 + SPELL_ATTR9_UNK11 = 0x00000800, // 11 + SPELL_ATTR9_UNK12 = 0x00001000, // 12 + SPELL_ATTR9_UNK13 = 0x00002000, // 13 + SPELL_ATTR9_USABLE_IN_RATED_BATTLEGROUNDS = 0x00004000, // 14 Can be used in Rated Battlegrounds + SPELL_ATTR9_UNK15 = 0x00008000, // 15 + SPELL_ATTR9_UNK16 = 0x00010000, // 16 + SPELL_ATTR9_UNK17 = 0x00020000, // 17 + SPELL_ATTR9_UNK18 = 0x00040000, // 18 + SPELL_ATTR9_UNK19 = 0x00080000, // 19 + SPELL_ATTR9_UNK20 = 0x00100000, // 20 + SPELL_ATTR9_UNK21 = 0x00200000, // 21 + SPELL_ATTR9_UNK22 = 0x00400000, // 22 + SPELL_ATTR9_UNK23 = 0x00800000, // 23 + SPELL_ATTR9_UNK24 = 0x01000000, // 24 + SPELL_ATTR9_UNK25 = 0x02000000, // 25 + SPELL_ATTR9_UNK26 = 0x04000000, // 26 + SPELL_ATTR9_UNK27 = 0x08000000, // 27 + SPELL_ATTR9_UNK28 = 0x10000000, // 28 + SPELL_ATTR9_UNK29 = 0x20000000, // 29 + SPELL_ATTR9_UNK30 = 0x40000000, // 30 + SPELL_ATTR9_UNK31 = 0x80000000 // 31 +}; + +enum SpellAttr10 +{ + SPELL_ATTR10_UNK0 = 0x00000001, // 0 + SPELL_ATTR10_UNK1 = 0x00000002, // 1 + SPELL_ATTR10_UNK2 = 0x00000004, // 2 + SPELL_ATTR10_UNK3 = 0x00000008, // 3 + SPELL_ATTR10_UNK4 = 0x00000010, // 4 + SPELL_ATTR10_UNK5 = 0x00000020, // 5 + SPELL_ATTR10_UNK6 = 0x00000040, // 6 + SPELL_ATTR10_UNK7 = 0x00000080, // 7 + SPELL_ATTR10_UNK8 = 0x00000100, // 8 + SPELL_ATTR10_UNK9 = 0x00000200, // 9 + SPELL_ATTR10_UNK10 = 0x00000400, // 10 + SPELL_ATTR10_UNK11 = 0x00000800, // 11 + SPELL_ATTR10_UNK12 = 0x00001000, // 12 + SPELL_ATTR10_UNK13 = 0x00002000, // 13 + SPELL_ATTR10_UNK14 = 0x00004000, // 14 + SPELL_ATTR10_UNK15 = 0x00008000, // 15 + SPELL_ATTR10_UNK16 = 0x00010000, // 16 + SPELL_ATTR10_UNK17 = 0x00020000, // 17 + SPELL_ATTR10_UNK18 = 0x00040000, // 18 + SPELL_ATTR10_UNK19 = 0x00080000, // 19 + SPELL_ATTR10_UNK20 = 0x00100000, // 20 + SPELL_ATTR10_UNK21 = 0x00200000, // 21 + SPELL_ATTR10_UNK22 = 0x00400000, // 22 + SPELL_ATTR10_UNK23 = 0x00800000, // 23 + SPELL_ATTR10_UNK24 = 0x01000000, // 24 + SPELL_ATTR10_UNK25 = 0x02000000, // 25 + SPELL_ATTR10_UNK26 = 0x04000000, // 26 + SPELL_ATTR10_UNK27 = 0x08000000, // 27 + SPELL_ATTR10_UNK28 = 0x10000000, // 28 + SPELL_ATTR10_UNK29 = 0x20000000, // 29 + SPELL_ATTR10_UNK30 = 0x40000000, // 30 + SPELL_ATTR10_UNK31 = 0x80000000 // 31 +}; + #define MIN_TALENT_SPEC 0 #define MAX_TALENT_SPEC 1 #define MIN_TALENT_SPECS 1 diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index ed8a4252128..98833c3eb41 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4889,14 +4889,14 @@ SpellCastResult Spell::CheckCast(bool strict) if (!m_caster->ToPlayer()->InBattleground()) return SPELL_FAILED_ONLY_BATTLEGROUNDS; - // do not allow spells to be cast in arenas - // - with greater than 10 min CD without SPELL_ATTR4_USABLE_IN_ARENA flag - // - with SPELL_ATTR4_NOT_USABLE_IN_ARENA flag - if ((m_spellInfo->AttributesEx4 & SPELL_ATTR4_NOT_USABLE_IN_ARENA) || - (m_spellInfo->GetRecoveryTime() > 10 * MINUTE * IN_MILLISECONDS && !(m_spellInfo->AttributesEx4 & SPELL_ATTR4_USABLE_IN_ARENA))) - if (MapEntry const* mapEntry = sMapStore.LookupEntry(m_caster->GetMapId())) - if (mapEntry->IsBattleArena()) - return SPELL_FAILED_NOT_IN_ARENA; + // do not allow spells to be cast in arenas or rated battlegrounds + if (Player * player = m_caster->ToPlayer()) + if (player->InArena()/* || player->InRatedBattleGround() NYI*/) + { + SpellCastResult castResult = CheckArenaAndRatedBattlegroundCastRules(); + if (castResult != SPELL_CAST_OK) + return castResult; + } // zone check if (m_caster->GetTypeId() == TYPEID_UNIT || !m_caster->ToPlayer()->isGameMaster()) @@ -5656,6 +5656,37 @@ SpellCastResult Spell::CheckCasterAuras() const return SPELL_CAST_OK; } +SpellCastResult Spell::CheckArenaAndRatedBattlegroundCastRules() +{ + bool isRatedBattleground = false; // NYI + bool isArena = !isRatedBattleground; + + // check USABLE attributes + // USABLE takes precedence over NOT_USABLE + if (isRatedBattleground && m_spellInfo->AttributesEx9 & SPELL_ATTR9_USABLE_IN_RATED_BATTLEGROUNDS) + return SPELL_CAST_OK; + + if (isArena && m_spellInfo->AttributesEx4 & SPELL_ATTR4_USABLE_IN_ARENA) + return SPELL_CAST_OK; + + // check NOT_USABLE attributes + if (m_spellInfo->AttributesEx4 & SPELL_ATTR4_NOT_USABLE_IN_ARENA_OR_RATED_BG) + return isArena ? SPELL_FAILED_NOT_IN_ARENA : SPELL_FAILED_NOT_IN_RATED_BATTLEGROUND; + + if (isArena && m_spellInfo->AttributesEx9 & SPELL_ATTR9_NOT_USABLE_IN_ARENA) + return SPELL_FAILED_NOT_IN_ARENA; + + // check cooldowns + uint32 spellCooldown = m_spellInfo->GetRecoveryTime(); + if (isArena && spellCooldown > 10 * MINUTE * IN_MILLISECONDS) // not sure if still needed + return SPELL_FAILED_NOT_IN_ARENA; + + if (isRatedBattleground && spellCooldown > 15 * MINUTE * IN_MILLISECONDS) + return SPELL_FAILED_NOT_IN_RATED_BATTLEGROUND; + + return SPELL_CAST_OK; +} + bool Spell::CanAutoCast(Unit* target) { uint64 targetguid = target->GetGUID(); diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index cb9a5fdef4d..ce8754cbff7 100755 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -396,6 +396,7 @@ class Spell SpellCastResult CheckPower(); SpellCastResult CheckRuneCost(uint32 runeCostID); SpellCastResult CheckCasterAuras() const; + SpellCastResult CheckArenaAndRatedBattlegroundCastRules(); int32 CalculateDamage(uint8 i, Unit const* target) const { return m_caster->CalculateSpellDamage(target, m_spellInfo, i, &m_spellValue->EffectBasePoints[i]); } diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 72cd40ea1ea..8fa008da823 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -766,6 +766,8 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry) AttributesEx6 = spellEntry->AttributesEx6; AttributesEx7 = spellEntry->AttributesEx7; AttributesEx8 = spellEntry->AttributesEx8; + AttributesEx9 = spellEntry->AttributesEx9; + AttributesEx10 = spellEntry->AttributesEx10; AttributesCu = 0; CastTimeEntry = spellEntry->CastingTimeIndex ? sSpellCastTimesStore.LookupEntry(spellEntry->CastingTimeIndex) : NULL; DurationEntry = spellEntry->DurationIndex ? sSpellDurationStore.LookupEntry(spellEntry->DurationIndex) : NULL; diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index b77adf6ad58..1161ac23aa3 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -308,6 +308,8 @@ public: uint32 AttributesEx6; uint32 AttributesEx7; uint32 AttributesEx8; + uint32 AttributesEx9; + uint32 AttributesEx10; uint32 AttributesCu; uint32 Stances; uint32 StancesNot; |