Merge branch 'master' into 310

Conflicts:
	src/game/Unit.cpp
	src/shared/Database/SQLStorage.cpp
This commit is contained in:
tomrus88 2009-03-30 15:01:04 +04:00
commit abae3cac91
50 changed files with 468 additions and 150 deletions

View file

@ -593,6 +593,9 @@ void Spell::FillTargetMap()
case SPELL_EFFECT_REPUTATION:
if(m_targets.getUnitTarget())
tmpUnitMap.push_back(m_targets.getUnitTarget());
// Triggered spells have additional spell targets - cast them even if no explicit unit target is given (required for spell 50516 for example)
else if(m_spellInfo->Effect[i] == SPELL_EFFECT_TRIGGER_SPELL)
tmpUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_SUMMON_PLAYER:
if(m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->GetSelection())
@ -975,7 +978,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
// Get original caster (if exist) and calculate damage/healing from him data
Unit *caster = m_originalCaster ? m_originalCaster : m_caster;
// Skip if m_originalCaster not avaiable
// Skip if m_originalCaster not available
if (!caster)
return;
@ -1067,17 +1070,21 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
caster->ProcDamageAndSpell(unit, procAttacker, procVictim, procEx, 0, m_attackType, m_spellInfo);
}
// Call scripted function for AI if this spell is casted upon a creature (except pets)
if(IS_CREATURE_GUID(target->targetGUID))
// Call scripted function for AI if this spell is casted upon a creature
if(unit->GetTypeId()==TYPEID_UNIT)
{
// 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() )
// 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)->AI())
((Creature*)unit)->AI()->SpellHit(m_caster ,m_spellInfo);
}
// Call scripted function for AI if this spell is casted by a creature
if(m_caster->GetTypeId()==TYPEID_UNIT && ((Creature*)m_caster)->AI())
((Creature*)m_caster)->AI()->SpellHitTarget(unit,m_spellInfo);
}
void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
@ -4745,8 +4752,9 @@ SpellCastResult Spell::CheckRange(bool strict)
if(target && target != m_caster)
{
// distance from target center in checks
float dist = m_caster->GetDistance(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ());
// distance from target in checks
float dist = m_caster->GetCombatDistance(target);
if(dist > max_range)
return SPELL_FAILED_OUT_OF_RANGE; //0x5A;
if(dist < min_range)