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:
|
// 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)
|
// Create base triggers flags for Attacker and Victim ( m_procAttacker and m_procVictim)
|
||||||
//==========================================================================================
|
//==========================================================================================
|
||||||
// Fill flag can spell trigger or not
|
// 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)
|
// 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... )
|
// 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() )
|
if( !((Creature*)unit)->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() )
|
||||||
((Player*)m_caster)->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id);
|
{
|
||||||
|
if ( Player* p = GetPlayerForCastQuestCond() )
|
||||||
|
p->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id);
|
||||||
|
}
|
||||||
|
|
||||||
if(((Creature*)unit)->AI())
|
if(((Creature*)unit)->AI())
|
||||||
((Creature*)unit)->AI()->SpellHit(m_caster ,m_spellInfo);
|
((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)
|
// 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... )
|
// ignore autorepeat/melee casts for speed (not exist quest for spells (hm... )
|
||||||
if( m_caster->GetTypeId() == TYPEID_PLAYER && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() )
|
if( !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() )
|
||||||
((Player*)m_caster)->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id);
|
{
|
||||||
|
if ( Player* p = GetPlayerForCastQuestCond() )
|
||||||
|
p->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::DoAllEffectOnTarget(ItemTargetInfo *target)
|
void Spell::DoAllEffectOnTarget(ItemTargetInfo *target)
|
||||||
|
|
@ -2691,30 +2697,33 @@ void Spell::update(uint32 difftime)
|
||||||
// channeled spell processed independently for quest targeting
|
// channeled spell processed independently for quest targeting
|
||||||
// cast at creature (or GO) quest objectives update at successful cast channel finished
|
// 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... )
|
// 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;
|
for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
|
||||||
if(!IS_CREATURE_GUID(target->targetGUID))
|
{
|
||||||
continue;
|
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);
|
Unit* unit = m_caster->GetGUID()==target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster,target->targetGUID);
|
||||||
if (unit==NULL)
|
if (unit==NULL)
|
||||||
continue;
|
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)
|
for(std::list<GOTargetInfo>::iterator ihit= m_UniqueGOTargetInfo.begin();ihit != m_UniqueGOTargetInfo.end();++ihit)
|
||||||
{
|
{
|
||||||
GOTargetInfo* target = &*ihit;
|
GOTargetInfo* target = &*ihit;
|
||||||
|
|
||||||
GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID);
|
GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID);
|
||||||
if(!go)
|
if(!go)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
((Player*)m_caster)->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id);
|
p->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -434,6 +434,17 @@ class Spell
|
||||||
|
|
||||||
CurrentSpellTypes GetCurrentContainer();
|
CurrentSpellTypes GetCurrentContainer();
|
||||||
|
|
||||||
|
Player* GetPlayerForCastQuestCond()
|
||||||
|
{
|
||||||
|
if ( m_caster->GetTypeId() == TYPEID_PLAYER )
|
||||||
|
return (Player*)m_caster;
|
||||||
|
|
||||||
|
if ( Unit* u = m_caster->GetCharmerOrOwner() )
|
||||||
|
if ( u->GetTypeId() == TYPEID_PLAYER )
|
||||||
|
return (Player*)u;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
Unit* GetCaster() const { return m_caster; }
|
Unit* GetCaster() const { return m_caster; }
|
||||||
Unit* GetOriginalCaster() const { return m_originalCaster; }
|
Unit* GetOriginalCaster() const { return m_originalCaster; }
|
||||||
int32 GetPowerCost() const { return m_powerCost; }
|
int32 GetPowerCost() const { return m_powerCost; }
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7740"
|
#define REVISION_NR "7741"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue