[svn] Fix broken spell target 38 (script target).
Implement linked spells, but will not enable it before testing. --HG-- branch : trunk
This commit is contained in:
+32
-9
@@ -922,6 +922,14 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
|
|||||||
|
|
||||||
if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
|
if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
|
||||||
((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo);
|
((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo);
|
||||||
|
|
||||||
|
if(int32 spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id, 1))
|
||||||
|
{
|
||||||
|
if(spell_triggered > 0)
|
||||||
|
m_caster->CastSpell(unit, spell_triggered, true);
|
||||||
|
else
|
||||||
|
unit->RemoveAurasDueToSpell(-spell_triggered);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
|
void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
|
||||||
@@ -1286,16 +1294,17 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
|
|||||||
else
|
else
|
||||||
radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex));
|
radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex));
|
||||||
|
|
||||||
if(m_originalCaster)
|
|
||||||
if(Player* modOwner = m_originalCaster->GetSpellModOwner())
|
|
||||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius,this);
|
|
||||||
|
|
||||||
uint32 EffectChainTarget = m_spellInfo->EffectChainTarget[i];
|
uint32 EffectChainTarget = m_spellInfo->EffectChainTarget[i];
|
||||||
if(m_originalCaster)
|
|
||||||
if(Player* modOwner = m_originalCaster->GetSpellModOwner())
|
|
||||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_JUMP_TARGETS, EffectChainTarget, this);
|
|
||||||
|
|
||||||
uint32 unMaxTargets = m_spellInfo->MaxAffectedTargets;
|
uint32 unMaxTargets = m_spellInfo->MaxAffectedTargets;
|
||||||
|
if(m_originalCaster)
|
||||||
|
{
|
||||||
|
if(Player* modOwner = m_originalCaster->GetSpellModOwner())
|
||||||
|
{
|
||||||
|
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius,this);
|
||||||
|
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_JUMP_TARGETS, EffectChainTarget, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch(cur)
|
switch(cur)
|
||||||
{
|
{
|
||||||
// specific unit
|
// specific unit
|
||||||
@@ -1551,9 +1560,15 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
|
|||||||
else if(goScriptTarget)
|
else if(goScriptTarget)
|
||||||
m_targets.setDestination(goScriptTarget->GetPositionX(),goScriptTarget->GetPositionY(),goScriptTarget->GetPositionZ());
|
m_targets.setDestination(goScriptTarget->GetPositionX(),goScriptTarget->GetPositionY(),goScriptTarget->GetPositionZ());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(creatureScriptTarget)
|
||||||
|
TagUnitMap.push_back(creatureScriptTarget);
|
||||||
|
else if(goScriptTarget)
|
||||||
|
AddGOTarget(goScriptTarget, i);
|
||||||
|
}
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
|
|
||||||
// dummy
|
// dummy
|
||||||
case TARGET_AREAEFFECT_CUSTOM_2:
|
case TARGET_AREAEFFECT_CUSTOM_2:
|
||||||
{
|
{
|
||||||
@@ -2177,6 +2192,14 @@ void Spell::cast(bool skipCheck)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(int32 spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id, 0))
|
||||||
|
{
|
||||||
|
if(spell_triggered > 0)
|
||||||
|
m_caster->CastSpell(m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster, spell_triggered, true);
|
||||||
|
else
|
||||||
|
m_caster->RemoveAurasDueToSpell(-spell_triggered);
|
||||||
|
}
|
||||||
|
|
||||||
// traded items have trade slot instead of guid in m_itemTargetGUID
|
// traded items have trade slot instead of guid in m_itemTargetGUID
|
||||||
// set to real guid to be sent later to the client
|
// set to real guid to be sent later to the client
|
||||||
m_targets.updateTradeSlotItem();
|
m_targets.updateTradeSlotItem();
|
||||||
|
|||||||
+20
-39
@@ -2051,14 +2051,14 @@ void SpellMgr::LoadSpellLinked()
|
|||||||
mSpellLinkedMap.clear(); // need for reload case
|
mSpellLinkedMap.clear(); // need for reload case
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
// 0 1
|
// 0 1 2
|
||||||
QueryResult *result = WorldDatabase.Query("SELECT spell0, spell1 FROM spell_linked_spell");
|
QueryResult *result = WorldDatabase.Query("SELECT spell_trigger, spell_effect, type FROM spell_linked_spell");
|
||||||
if( !result )
|
if( !result )
|
||||||
{
|
{
|
||||||
barGoLink bar( 1 );
|
barGoLink bar( 1 );
|
||||||
bar.step();
|
bar.step();
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString( ">> Loaded %u spell pet auras", count );
|
sLog.outString( ">> Loaded %u linked spells", count );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2070,54 +2070,35 @@ void SpellMgr::LoadSpellLinked()
|
|||||||
|
|
||||||
bar.step();
|
bar.step();
|
||||||
|
|
||||||
uint16 spell = fields[0].GetUInt16();
|
int32 trigger = fields[0].GetInt32();
|
||||||
uint16 pet = fields[1].GetUInt16();
|
int32 effect = fields[1].GetInt32();
|
||||||
uint16 aura = fields[2].GetUInt16();
|
int32 type = fields[2].GetInt32();
|
||||||
|
|
||||||
SpellPetAuraMap::iterator itr = mSpellPetAuraMap.find(spell);
|
SpellEntry const* spellInfo = sSpellStore.LookupEntry(abs(trigger));
|
||||||
if(itr != mSpellPetAuraMap.end())
|
if (!spellInfo)
|
||||||
{
|
{
|
||||||
itr->second.AddAura(pet, aura);
|
sLog.outErrorDb("Spell %u listed in `spell_linked_spell` does not exist", abs(trigger));
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else
|
spellInfo = sSpellStore.LookupEntry(abs(effect));
|
||||||
|
if (!spellInfo)
|
||||||
{
|
{
|
||||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
|
sLog.outErrorDb("Spell %u listed in `spell_linked_spell` does not exist", abs(effect));
|
||||||
if (!spellInfo)
|
continue;
|
||||||
{
|
|
||||||
sLog.outErrorDb("Spell %u listed in `spell_pet_auras` does not exist", spell);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int i = 0;
|
|
||||||
for(; i < 3; ++i)
|
|
||||||
if((spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA &&
|
|
||||||
spellInfo->EffectApplyAuraName[i] == SPELL_AURA_DUMMY) ||
|
|
||||||
spellInfo->Effect[i] == SPELL_EFFECT_DUMMY)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if(i == 3)
|
|
||||||
{
|
|
||||||
sLog.outError("Spell %u listed in `spell_pet_auras` does not have dummy aura or dummy effect", spell);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
SpellEntry const* spellInfo2 = sSpellStore.LookupEntry(aura);
|
|
||||||
if (!spellInfo2)
|
|
||||||
{
|
|
||||||
sLog.outErrorDb("Aura %u listed in `spell_pet_auras` does not exist", aura);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
PetAura pa(pet, aura, spellInfo->EffectImplicitTargetA[i] == TARGET_PET, spellInfo->EffectBasePoints[i] + spellInfo->EffectBaseDice[i]);
|
|
||||||
mSpellPetAuraMap[spell] = pa;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SpellLinkedSpell linkedSpell;
|
||||||
|
linkedSpell.spell = effect;
|
||||||
|
linkedSpell.type = type;
|
||||||
|
mSpellLinkedMap[trigger] = linkedSpell;
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
} while( result->NextRow() );
|
} while( result->NextRow() );
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString( ">> Loaded %u spell pet auras", count );
|
sLog.outString( ">> Loaded %u linked spells", count );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Some checks for spells, to prevent adding depricated/broken spells for trainers, spell book, etc
|
/// Some checks for spells, to prevent adding depricated/broken spells for trainers, spell book, etc
|
||||||
|
|||||||
+8
-3
@@ -648,7 +648,12 @@ struct SpellExtraAttribute
|
|||||||
|
|
||||||
typedef std::map<uint32, SpellExtraAttribute> SpellExtraAttrMap;
|
typedef std::map<uint32, SpellExtraAttribute> SpellExtraAttrMap;
|
||||||
|
|
||||||
typedef std::map<int32, int32> SpellLinkedMap;
|
struct SpellLinkedSpell
|
||||||
|
{
|
||||||
|
int32 spell;
|
||||||
|
uint32 type;
|
||||||
|
};
|
||||||
|
typedef std::map<int32, SpellLinkedSpell> SpellLinkedMap;
|
||||||
|
|
||||||
class SpellMgr
|
class SpellMgr
|
||||||
{
|
{
|
||||||
@@ -857,11 +862,11 @@ class SpellMgr
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 GetSpellLinked(int32 spell_id) const
|
int32 GetSpellLinked(int32 spell_id, uint32 type) const
|
||||||
{
|
{
|
||||||
SpellLinkedMap::const_iterator itr = mSpellLinkedMap.find(spell_id);
|
SpellLinkedMap::const_iterator itr = mSpellLinkedMap.find(spell_id);
|
||||||
if(itr != mSpellLinkedMap.end())
|
if(itr != mSpellLinkedMap.end())
|
||||||
return itr->second;
|
return itr->second.type == type ? itr->second.spell : 0;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4163,6 +4163,18 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
|
|||||||
if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->isTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE)
|
if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->isTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE)
|
||||||
statue = ((Totem*)caster);
|
statue = ((Totem*)caster);
|
||||||
|
|
||||||
|
|
||||||
|
if(int32 spell_triggered = spellmgr.GetSpellLinked(-(int32)Aur->GetSpellProto()->Id, 0))
|
||||||
|
{
|
||||||
|
if(spell_triggered > 0)
|
||||||
|
{
|
||||||
|
if(Unit* caster = Aur->GetCaster())
|
||||||
|
CastSpell(this, spell_triggered, true, 0, 0, caster->GetGUID());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
RemoveAurasDueToSpell(-spell_triggered);
|
||||||
|
}
|
||||||
|
|
||||||
sLog.outDebug("Aura %u now is remove mode %d",Aur->GetModifier()->m_auraname, mode);
|
sLog.outDebug("Aura %u now is remove mode %d",Aur->GetModifier()->m_auraname, mode);
|
||||||
Aur->ApplyModifier(false,true);
|
Aur->ApplyModifier(false,true);
|
||||||
Aur->_RemoveAura();
|
Aur->_RemoveAura();
|
||||||
|
|||||||
Reference in New Issue
Block a user