Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4

Conflicts:
	src/server/game/Entities/DynamicObject/DynamicObject.h
	src/server/game/Entities/Player/Player.cpp
	src/server/game/Entities/Transport/Transport.cpp
	src/server/game/Entities/Unit/Unit.cpp
	src/server/game/Entities/Vehicle/Vehicle.cpp
	src/server/game/Handlers/MovementHandler.cpp
	src/server/game/Server/WorldSession.cpp
	src/server/game/Spells/Spell.cpp
	src/server/scripts/Spells/spell_dk.cpp
	src/server/shared/Utilities/Util.cpp
This commit is contained in:
Vincent-Michael
2014-06-15 19:36:30 +02:00
80 changed files with 896 additions and 750 deletions

View File

@@ -488,9 +488,6 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
case SMART_ACTION_CAST:
{
if (!me)
break;
ObjectList* targets = GetTargets(e, unit);
if (!targets)
break;
@@ -502,31 +499,36 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!(e.action.cast.flags & SMARTCAST_AURA_NOT_PRESENT) || !(*itr)->ToUnit()->HasAura(e.action.cast.spell))
{
if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS)
me->InterruptNonMeleeSpells(false);
if (e.action.cast.flags & SMARTCAST_COMBAT_MOVE)
if (me)
{
// If cast flag SMARTCAST_COMBAT_MOVE is set combat movement will not be allowed
// unless target is outside spell range, out of mana, or LOS.
if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS)
me->InterruptNonMeleeSpells(false);
bool _allowMove = false;
SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(e.action.cast.spell);
int32 mana = me->GetPower(POWER_MANA);
if (e.action.cast.flags & SMARTCAST_COMBAT_MOVE)
{
// If cast flag SMARTCAST_COMBAT_MOVE is set combat movement will not be allowed
// unless target is outside spell range, out of mana, or LOS.
if (me->GetDistance(*itr) > spellInfo->GetMaxRange(true) ||
me->GetDistance(*itr) < spellInfo->GetMinRange(true) ||
!me->IsWithinLOSInMap(*itr) ||
mana < spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask()))
bool _allowMove = false;
SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(e.action.cast.spell);
int32 mana = me->GetPower(POWER_MANA);
if (me->GetDistance(*itr) > spellInfo->GetMaxRange(true) ||
me->GetDistance(*itr) < spellInfo->GetMinRange(true) ||
!me->IsWithinLOSInMap(*itr) ||
mana < spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask()))
_allowMove = true;
CAST_AI(SmartAI, me->AI())->SetCombatMove(_allowMove);
CAST_AI(SmartAI, me->AI())->SetCombatMove(_allowMove);
}
me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED));
}
else if (go)
go->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED));
me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED));
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_CAST:: Creature %u casts spell %u on target %u with castflags %u",
me->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags);
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_CAST:: %s: %u casts spell %u on target %u with castflags %u",
GetLogNameForGuid(me ? me->GetGUID() : go->GetGUID()), me ? me->GetGUIDLow() : go->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags);
}
else
TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId()));