*modified spelldifficulty handler to work with all spell casts for creatures that are in instances thanks to Shauren for help
*modified most of the scripts to use normal_mode spell for casting (code was autogenerated, post errors if any) *added sql for all modded spells (autogenerated..) --HG-- branch : trunk
This commit is contained in:
@@ -2211,18 +2211,6 @@ void Creature::GetRespawnCoord(float &x, float &y, float &z, float* ori, float*
|
||||
*dist = 0;
|
||||
}
|
||||
|
||||
uint32 Creature::GetSpellIdForDifficulty(uint32 spellId)
|
||||
{
|
||||
//search for instance mode spell
|
||||
if (GetMap() && GetMap()->IsDungeon())
|
||||
{
|
||||
spellId = spellmgr.GetSpellIdForDifficultyFromSpellid(spellId, Difficulty(GetMap()->GetSpawnMode()));
|
||||
}
|
||||
else
|
||||
sLog.outDebug("Unit::GetSpellIdForDifficulty called for non-instanced creature");
|
||||
return spellId;
|
||||
}
|
||||
|
||||
void Creature::AllLootRemovedFromCorpse()
|
||||
{
|
||||
if (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE))
|
||||
|
||||
@@ -418,7 +418,6 @@ class Creature : public Unit, public GridObject<Creature>
|
||||
void Update(uint32 time); // overwrited Unit::Update
|
||||
void GetRespawnCoord(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const;
|
||||
uint32 GetEquipmentId() const { return GetCreatureInfo()->equipmentId; }
|
||||
uint32 GetSpellIdForDifficulty(uint32 spellId);
|
||||
|
||||
void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; }
|
||||
bool isRacialLeader() const { return GetCreatureInfo()->RacialLeader; }
|
||||
|
||||
@@ -593,15 +593,11 @@ inline bool CreatureAI::_EnterEvadeMode()
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void UnitAI::DoCast(Unit* victim, uint32 spellId, bool triggered, bool useMode)
|
||||
inline void UnitAI::DoCast(Unit* victim, uint32 spellId, bool triggered)
|
||||
{
|
||||
if (!victim || (me->hasUnitState(UNIT_STAT_CASTING) && !triggered))
|
||||
return;
|
||||
|
||||
//search for instance mode spell
|
||||
if(useMode && me->ToCreature())
|
||||
spellId = me->ToCreature()->GetSpellIdForDifficulty(spellId);
|
||||
|
||||
me->CastSpell(victim, spellId, triggered);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -371,7 +371,7 @@ void SpellCastTargets::write (WorldPacket * data)
|
||||
}
|
||||
|
||||
Spell::Spell(Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID, Spell** triggeringContainer, bool skipCheck)
|
||||
: m_spellInfo(info), m_spellValue(new SpellValue(m_spellInfo))
|
||||
: m_spellInfo(spellmgr.GetSpellForDifficultyFromSpell(info, Caster)), m_spellValue(new SpellValue(m_spellInfo))
|
||||
, m_caster(Caster)
|
||||
{
|
||||
m_customAttr = spellmgr.GetSpellCustomAttr(m_spellInfo->Id);
|
||||
|
||||
+24
-20
@@ -1016,43 +1016,47 @@ class SpellMgr
|
||||
}
|
||||
|
||||
// Spell Difficulty data
|
||||
uint32 GetSpellIdForDifficultyFromSpellid(uint32 spellId, Difficulty mapDiff)
|
||||
SpellEntry const* GetSpellForDifficultyFromSpell(SpellEntry const* spell, Unit* Caster)
|
||||
{
|
||||
/*SpellEntry const* spell = sSpellStore.LookupEntry(spellId);
|
||||
if (!spell)
|
||||
return spellId;//CastSpell() will handle incorrect spells
|
||||
*/
|
||||
uint32 mode = uint32(mapDiff);
|
||||
//spell never can be NULL in this case!
|
||||
if(!Caster->ToCreature() || !Caster->ToCreature()->GetMap() || !Caster->ToCreature()->GetMap()->IsDungeon())
|
||||
return spell;
|
||||
|
||||
uint32 mode = uint32(Caster->ToCreature()->GetMap()->GetSpawnMode());
|
||||
if(mode >= MAX_DIFFICULTY)
|
||||
{
|
||||
sLog.outError("GetSpellIdForDifficultyFromSpellid: Incorrect Difficulty for spell %u.", spellId);
|
||||
return spellId;//return source spell
|
||||
sLog.outError("GetSpellForDifficultyFromSpell: Incorrect Difficulty for spell %u.", spell->Id);
|
||||
return spell;//return source spell
|
||||
}
|
||||
uint32 SpellDiffId = GetSpellDifficultyId(spellId);
|
||||
uint32 SpellDiffId = GetSpellDifficultyId(spell->Id);
|
||||
if(!SpellDiffId)
|
||||
{
|
||||
sLog.outDebug("GetSpellIdForDifficultyFromSpellid: Difficulty not found for spell %u.", spellId);
|
||||
return spellId;//return source spell, it has only REGULAR_DIFFICULTY
|
||||
}
|
||||
return spell;//return source spell, it has only REGULAR_DIFFICULTY
|
||||
|
||||
SpellDifficultyEntry const *SpellDiff = sSpellDifficultyStore.LookupEntry(SpellDiffId);
|
||||
if (!SpellDiff)
|
||||
{
|
||||
sLog.outDebug("GetSpellIdForDifficultyFromSpellid: SpellDifficultyEntry not found for spell %u. This Should never happen.", spellId);
|
||||
return spellId;//return source spell
|
||||
sLog.outDebug("GetSpellForDifficultyFromSpell: SpellDifficultyEntry not found for spell %u. This Should never happen.", spell->Id);
|
||||
return spell;//return source spell
|
||||
}
|
||||
if(SpellDiff->SpellID[mode] <= 0 && mode > DUNGEON_DIFFICULTY_HEROIC)
|
||||
{
|
||||
uint8 baseMode = mode;
|
||||
mode -= 2;
|
||||
sLog.outDebug("GetSpellForDifficultyFromSpellid: spell %u mode %u spell is NULL, using mode %u", spellId, baseMode, mode);
|
||||
sLog.outDebug("GetSpellForDifficultyFromSpell: spell %u mode %u spell is NULL, using mode %u", spell->Id, baseMode, mode);
|
||||
}
|
||||
if(SpellDiff->SpellID[mode] <= 0)
|
||||
{
|
||||
sLog.outErrorDb("GetSpellForDifficultyFromSpellid: spell %u mode %u spell is 0. Check spelldifficulty_dbc!", spellId, mode);
|
||||
return spellId;
|
||||
sLog.outErrorDb("GetSpellForDifficultyFromSpell: spell %u mode %u spell is 0. Check spelldifficulty_dbc!", spell->Id, mode);
|
||||
return spell;
|
||||
}
|
||||
sLog.outDebug("GetSpellForDifficultyFromSpellid: spellid for spell %u in %u mode is %u ", spellId, mode, uint32(SpellDiff->SpellID[mode]));
|
||||
return uint32(SpellDiff->SpellID[mode]);
|
||||
SpellEntry const* newSpell = sSpellStore.LookupEntry(SpellDiff->SpellID[mode]);
|
||||
if (!newSpell)
|
||||
{
|
||||
sLog.outDebug("GetSpellForDifficultyFromSpell: spell %u not found in spell, this should never happen.", newSpell->Id);//alerady checked at startup
|
||||
return spell;
|
||||
}
|
||||
sLog.outDebug("GetSpellForDifficultyFromSpell: spellid for spell %u in mode %u is %u ", spell->Id, mode, newSpell->Id);
|
||||
return newSpell;
|
||||
}
|
||||
|
||||
// Spell target coordinates
|
||||
|
||||
+2
-6
@@ -193,12 +193,8 @@ void UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered)
|
||||
return;
|
||||
}
|
||||
|
||||
void UnitAI::DoCast(uint32 spellId, bool useMode)
|
||||
{
|
||||
//search for instance mode spell
|
||||
if(useMode && me->ToCreature())
|
||||
spellId = me->ToCreature()->GetSpellIdForDifficulty(spellId);
|
||||
|
||||
void UnitAI::DoCast(uint32 spellId)
|
||||
{
|
||||
Unit *target = NULL;
|
||||
//sLog.outError("aggre %u %u", spellId, (uint32)AISpellInfo[spellId].target);
|
||||
switch(AISpellInfo[spellId].target)
|
||||
|
||||
+2
-2
@@ -126,8 +126,8 @@ class UnitAI
|
||||
void AttackStartCaster(Unit *victim, float dist);
|
||||
|
||||
void DoAddAuraToAllHostilePlayers(uint32 spellid);
|
||||
void DoCast(uint32 spellId, bool useMode = false);
|
||||
void DoCast(Unit* victim, uint32 spellId, bool triggered = false, bool useMode = false);
|
||||
void DoCast(uint32 spellId);
|
||||
void DoCast(Unit* victim, uint32 spellId, bool triggered = false);
|
||||
void DoCastToAllHostilePlayers(uint32 spellid, bool triggered = false);
|
||||
void DoCastVictim(uint32 spellId, bool triggered = false);
|
||||
void DoCastAOE(uint32 spellId, bool triggered = false);
|
||||
|
||||
Reference in New Issue
Block a user