mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[7741] Allow pets/charmed NPCs to count master's spell cast conditions in quests.
Signed-off-by: ApoC <apoc@nymfe.net>
This commit is contained in:
parent
8e2a664fad
commit
8e39ea0151
3 changed files with 43 additions and 23 deletions
|
|
@ -748,7 +748,7 @@ void Spell::prepareDataForTriggerSystem()
|
|||
{
|
||||
//==========================================================================================
|
||||
// Now fill data for trigger system, need know:
|
||||
// Ñan spell trigger another or not ( m_canTrigger )
|
||||
// an spell trigger another or not ( m_canTrigger )
|
||||
// Create base triggers flags for Attacker and Victim ( m_procAttacker and m_procVictim)
|
||||
//==========================================================================================
|
||||
// Fill flag can spell trigger or not
|
||||
|
|
@ -1091,8 +1091,11 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
|
|||
{
|
||||
// cast at creature (or GO) quest objectives update at successful cast finished (+channel finished)
|
||||
// ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm... )
|
||||
if( !((Creature*)unit)->isPet() && m_caster->GetTypeId() == TYPEID_PLAYER && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() )
|
||||
((Player*)m_caster)->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id);
|
||||
if( !((Creature*)unit)->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() )
|
||||
{
|
||||
if ( Player* p = GetPlayerForCastQuestCond() )
|
||||
p->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id);
|
||||
}
|
||||
|
||||
if(((Creature*)unit)->AI())
|
||||
((Creature*)unit)->AI()->SpellHit(m_caster ,m_spellInfo);
|
||||
|
|
@ -1237,8 +1240,11 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo *target)
|
|||
|
||||
// cast at creature (or GO) quest objectives update at successful cast finished (+channel finished)
|
||||
// ignore autorepeat/melee casts for speed (not exist quest for spells (hm... )
|
||||
if( m_caster->GetTypeId() == TYPEID_PLAYER && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() )
|
||||
((Player*)m_caster)->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id);
|
||||
if( !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() )
|
||||
{
|
||||
if ( Player* p = GetPlayerForCastQuestCond() )
|
||||
p->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id);
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::DoAllEffectOnTarget(ItemTargetInfo *target)
|
||||
|
|
@ -2691,30 +2697,33 @@ void Spell::update(uint32 difftime)
|
|||
// channeled spell processed independently for quest targeting
|
||||
// cast at creature (or GO) quest objectives update at successful cast channel finished
|
||||
// ignore autorepeat/melee casts for speed (not exist quest for spells (hm... )
|
||||
if( m_caster->GetTypeId() == TYPEID_PLAYER && !IsAutoRepeat() && !IsNextMeleeSwingSpell() )
|
||||
if( !IsAutoRepeat() && !IsNextMeleeSwingSpell() )
|
||||
{
|
||||
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
if ( Player* p = GetPlayerForCastQuestCond() )
|
||||
{
|
||||
TargetInfo* target = &*ihit;
|
||||
if(!IS_CREATURE_GUID(target->targetGUID))
|
||||
continue;
|
||||
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||
{
|
||||
TargetInfo* target = &*ihit;
|
||||
if(!IS_CREATURE_GUID(target->targetGUID))
|
||||
continue;
|
||||
|
||||
Unit* unit = m_caster->GetGUID()==target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster,target->targetGUID);
|
||||
if (unit==NULL)
|
||||
continue;
|
||||
Unit* unit = m_caster->GetGUID()==target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster,target->targetGUID);
|
||||
if (unit==NULL)
|
||||
continue;
|
||||
|
||||
((Player*)m_caster)->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id);
|
||||
}
|
||||
p->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id);
|
||||
}
|
||||
|
||||
for(std::list<GOTargetInfo>::iterator ihit= m_UniqueGOTargetInfo.begin();ihit != m_UniqueGOTargetInfo.end();++ihit)
|
||||
{
|
||||
GOTargetInfo* target = &*ihit;
|
||||
for(std::list<GOTargetInfo>::iterator ihit= m_UniqueGOTargetInfo.begin();ihit != m_UniqueGOTargetInfo.end();++ihit)
|
||||
{
|
||||
GOTargetInfo* target = &*ihit;
|
||||
|
||||
GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID);
|
||||
if(!go)
|
||||
continue;
|
||||
GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID);
|
||||
if(!go)
|
||||
continue;
|
||||
|
||||
((Player*)m_caster)->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id);
|
||||
p->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue