[svn] Fix hunter's frozen trap, half duration when pvp.
Use vector to store linked spell information to support multiple effects. --HG-- branch : trunk
This commit is contained in:
+16
-10
@@ -1055,12 +1055,15 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
|
||||
if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
|
||||
((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo);
|
||||
|
||||
if(int32 spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id, 1))
|
||||
if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id + 1000000))
|
||||
{
|
||||
if(spell_triggered > 0)
|
||||
unit->CastSpell(unit, spell_triggered, true, 0, 0, m_caster->GetGUID());
|
||||
else
|
||||
unit->RemoveAurasDueToSpell(-spell_triggered);
|
||||
for(std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i)
|
||||
{
|
||||
if(spell_triggered < 0)
|
||||
unit->RemoveAurasDueToSpell(-(*i));
|
||||
else
|
||||
unit->CastSpell(unit, *i, true, 0, 0, m_caster->GetGUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2252,12 +2255,15 @@ void Spell::cast(bool skipCheck)
|
||||
}
|
||||
}
|
||||
|
||||
if(int32 spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id, 0))
|
||||
if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id))
|
||||
{
|
||||
if(spell_triggered > 0)
|
||||
m_caster->CastSpell(m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster, spell_triggered, true);
|
||||
else
|
||||
m_caster->RemoveAurasDueToSpell(-spell_triggered);
|
||||
for(std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i)
|
||||
{
|
||||
if(spell_triggered < 0)
|
||||
m_caster->RemoveAurasDueToSpell(-(*i));
|
||||
else
|
||||
m_caster->CastSpell(m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster, *i, true);
|
||||
}
|
||||
}
|
||||
|
||||
// traded items have trade slot instead of guid in m_itemTargetGUID
|
||||
|
||||
@@ -2118,7 +2118,7 @@ void Spell::EffectApplyAura(uint32 i)
|
||||
|
||||
// Now Reduce spell duration using data received at spell hit
|
||||
int32 duration = Aur->GetAuraMaxDuration();
|
||||
unitTarget->ApplyDiminishingToDuration(m_diminishGroup,duration,m_caster,m_diminishLevel);
|
||||
unitTarget->ApplyDiminishingToDuration(m_diminishGroup,duration,caster,m_diminishLevel);
|
||||
Aur->setDiminishGroup(m_diminishGroup);
|
||||
|
||||
// if Aura removed and deleted, do not continue.
|
||||
|
||||
@@ -2087,10 +2087,9 @@ void SpellMgr::LoadSpellLinked()
|
||||
continue;
|
||||
}
|
||||
|
||||
SpellLinkedSpell linkedSpell;
|
||||
linkedSpell.spell = effect;
|
||||
linkedSpell.type = type;
|
||||
mSpellLinkedMap[trigger] = linkedSpell;
|
||||
if(type) //we will find a better way when more types are needed
|
||||
trigger += 1000000;
|
||||
mSpellLinkedMap[trigger].push_back(effect);
|
||||
|
||||
++count;
|
||||
} while( result->NextRow() );
|
||||
|
||||
+3
-11
@@ -648,12 +648,7 @@ struct SpellExtraAttribute
|
||||
|
||||
typedef std::map<uint32, SpellExtraAttribute> SpellExtraAttrMap;
|
||||
|
||||
struct SpellLinkedSpell
|
||||
{
|
||||
int32 spell;
|
||||
uint32 type;
|
||||
};
|
||||
typedef std::map<int32, SpellLinkedSpell> SpellLinkedMap;
|
||||
typedef std::map<int32, std::vector<int32> > SpellLinkedMap;
|
||||
|
||||
class SpellMgr
|
||||
{
|
||||
@@ -862,13 +857,10 @@ class SpellMgr
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32 GetSpellLinked(int32 spell_id, uint32 type) const
|
||||
const std::vector<int32> *GetSpellLinked(int32 spell_id) const
|
||||
{
|
||||
SpellLinkedMap::const_iterator itr = mSpellLinkedMap.find(spell_id);
|
||||
if(itr != mSpellLinkedMap.end())
|
||||
return itr->second.type == type ? itr->second.spell : 0;
|
||||
else
|
||||
return 0;
|
||||
return itr != mSpellLinkedMap.end() ? &(itr->second) : NULL;
|
||||
}
|
||||
|
||||
// Modifiers
|
||||
|
||||
+6
-6
@@ -4154,15 +4154,15 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
|
||||
statue = ((Totem*)caster);
|
||||
|
||||
|
||||
if(int32 spell_triggered = spellmgr.GetSpellLinked(-(int32)Aur->GetSpellProto()->Id, 0))
|
||||
if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(-(int32)Aur->GetSpellProto()->Id))
|
||||
{
|
||||
if(spell_triggered > 0)
|
||||
for(std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i)
|
||||
{
|
||||
if(Unit* caster = Aur->GetCaster())
|
||||
CastSpell(this, spell_triggered, true, 0, 0, caster->GetGUID());
|
||||
if(spell_triggered < 0)
|
||||
RemoveAurasDueToSpell(-(*i));
|
||||
else if(Unit* caster = Aur->GetCaster())
|
||||
CastSpell(this, *i, true, 0, 0, caster->GetGUID());
|
||||
}
|
||||
else
|
||||
RemoveAurasDueToSpell(-spell_triggered);
|
||||
}
|
||||
|
||||
sLog.outDebug("Aura %u now is remove mode %d",Aur->GetModifier()->m_auraname, mode);
|
||||
|
||||
Reference in New Issue
Block a user