diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index 80d84e5cd..ecaec64e8 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -126,6 +126,7 @@ SpellCategoryStore sSpellCategoryStore; PetFamilySpellsStore sPetFamilySpellsStore; DBCStorage sSpellCastTimesStore(SpellCastTimefmt); +DBCStorage sSpellDifficultyStore(SpellDifficultyfmt); DBCStorage sSpellDurationStore(SpellDurationfmt); DBCStorage sSpellFocusObjectStore(SpellFocusObjectfmt); DBCStorage sSpellRadiusStore(SpellRadiusfmt); @@ -323,7 +324,7 @@ void LoadDBCStores(const std::string& dataPath) exit(1); } - const uint32 DBCFilesCount = 84; + const uint32 DBCFilesCount = 85; barGoLink bar( (int)DBCFilesCount ); @@ -478,6 +479,7 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellCastTimesStore, dbcPath,"SpellCastTimes.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellDurationStore, dbcPath,"SpellDuration.dbc"); + LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellDifficultyStore, dbcPath,"SpellDifficulty.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellFocusObjectStore, dbcPath,"SpellFocusObject.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellItemEnchantmentStore,dbcPath,"SpellItemEnchantment.dbc"); LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellItemEnchantmentConditionStore,dbcPath,"SpellItemEnchantmentCondition.dbc"); diff --git a/src/game/DBCStores.h b/src/game/DBCStores.h index 5acc2b806..30cd74db7 100644 --- a/src/game/DBCStores.h +++ b/src/game/DBCStores.h @@ -136,6 +136,7 @@ extern DBCStorage sSkillLineStore; extern DBCStorage sSkillLineAbilityStore; extern DBCStorage sSoundEntriesStore; extern DBCStorage sSpellCastTimesStore; +extern DBCStorage sSpellDifficultyStore; extern DBCStorage sSpellDurationStore; extern DBCStorage sSpellFocusObjectStore; extern DBCStorage sSpellItemEnchantmentStore; diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index d8e4d4a6d..2067c1c80 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1469,7 +1469,7 @@ struct SpellEntry //uint32 PowerDisplayId; // 228 PowerDisplay.dbc, new in 3.1 //float unk_320_4[3]; // 229-231 3.2.0 //uint32 spellDescriptionVariableID; // 232 3.2.0 - //uint32 SpellDifficultyId; // 233 3.3.0 + uint32 SpellDifficultyId; // 233 m_spellDifficultyID - id from SpellDifficulty.dbc // helpers int32 CalculateSimpleValue(SpellEffectIndex eff) const { return EffectBasePoints[eff] + int32(1); } @@ -1546,6 +1546,12 @@ struct SpellShapeshiftEntry uint32 spellId[8]; // 27-34 spells which appear in the bar after shapeshifting }; +struct SpellDifficultyEntry +{ + uint32 ID; // 0 m_ID + uint32 spellId[MAX_DIFFICULTY]; // 1-4 m_spellId[4] +}; + struct SpellDurationEntry { uint32 ID; diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index e7d58694f..97e3a6285 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -87,7 +87,8 @@ const char SkillLineAbilityfmt[]="niiiixxiiiiixx"; const char SoundEntriesfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const char SpellCastTimefmt[]="nixx"; const char SpellDurationfmt[]="niii"; -const char SpellEntryfmt[]="niiiiiiiiiixixixiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifxiiiiiiiiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiiiiiiiiiiixssssssssssssssssxssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiiiiiiiiiiixfffxxxiiiiixxxxxxx"; +const char SpellDifficultyfmt[]="niiii"; +const char SpellEntryfmt[]="niiiiiiiiiixixixiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifxiiiiiiiiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiiiiiiiiiiixssssssssssssssssxssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiiiiiiiiiiixfffxxxiiiiixxxxxxi"; const char SpellFocusObjectfmt[]="nxxxxxxxxxxxxxxxxx"; const char SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiixxx"; const char SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX"; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 29592ad0d..57f5e4313 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -312,13 +312,22 @@ void SpellCastTargets::write( ByteBuffer& data ) const data << m_strTarget; } -Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, ObjectGuid originalCasterGUID, Spell** triggeringContainer ) +Spell::Spell( Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid originalCasterGUID, Spell** triggeringContainer ) { - ASSERT( Caster != NULL && info != NULL ); + ASSERT( caster != NULL && info != NULL ); ASSERT( info == sSpellStore.LookupEntry( info->Id ) && "`info` must be pointer to sSpellStore element"); - m_spellInfo = info; - m_caster = Caster; + if (caster->GetTypeId() != TYPEID_PLAYER && caster->IsInWorld() && caster->GetMap()->IsDungeon()) + { + if (SpellEntry const* spellEntry = GetSpellEntryByDifficulty(info->SpellDifficultyId, caster->GetMap()->GetDifficulty())) + m_spellInfo = spellEntry; + else + m_spellInfo = info; + } + else + m_spellInfo = info; + + m_caster = caster; m_selfContainer = NULL; m_triggeringContainer = triggeringContainer; m_referencedFromCurrentSpell = false; diff --git a/src/game/Spell.h b/src/game/Spell.h index cff17d9fa..4b36463b0 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -358,7 +358,7 @@ class Spell void EffectSpecCount(SpellEffectIndex eff_idx); void EffectActivateSpec(SpellEffectIndex eff_idx); - Spell( Unit* Caster, SpellEntry const *info, bool triggered, ObjectGuid originalCasterGUID = ObjectGuid(), Spell** triggeringContainer = NULL ); + Spell( Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid originalCasterGUID = ObjectGuid(), Spell** triggeringContainer = NULL ); ~Spell(); void prepare(SpellCastTargets const* targets, Aura* triggeredByAura = NULL); diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 937d534ac..2985713de 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -3591,3 +3591,17 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 return true; } + +SpellEntry const* GetSpellEntryByDifficulty(uint32 id, Difficulty difficulty) +{ + SpellDifficultyEntry const* spellDiff = sSpellDifficultyStore.LookupEntry(id); + + if (!spellDiff) + return NULL; + + if (!spellDiff->spellId[difficulty]) + return NULL; + + SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellDiff->spellId[difficulty]); + return spellEntry; +} diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 270a33c31..e5b0bfec5 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -447,6 +447,8 @@ bool IsDiminishingReturnsGroupDurationLimited(DiminishingGroup group); DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group); int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellEntry const* spellproto); +SpellEntry const* GetSpellEntryByDifficulty(uint32 id, Difficulty difficulty); + // Spell proc event related declarations (accessed using SpellMgr functions) enum ProcFlags { diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index c29ce02e9..3d0d448cf 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1077,7 +1077,7 @@ void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castIte CastSpell(Victim, spellInfo, triggered, castItem, triggeredByAura, originalCaster); } -void Unit::CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, Item *castItem, Aura* triggeredByAura, ObjectGuid originalCaster) +void Unit::CastSpell(Unit* Victim, SpellEntry const *spellInfo, bool triggered, Item *castItem, Aura* triggeredByAura, ObjectGuid originalCaster) { if(!spellInfo) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 733f9475b..210aebcc0 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9788" + #define REVISION_NR "9789" #endif // __REVISION_NR_H__