mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-15 20:52:22 -04:00
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include "SmartScript.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Vehicle.h"
|
||||
#include "MoveSplineInit.h"
|
||||
#include "GameEventMgr.h"
|
||||
|
||||
class TrinityStringTextBuilder
|
||||
@@ -251,7 +252,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
{
|
||||
if (IsUnit(*itr))
|
||||
{
|
||||
(*itr)->SendPlaySound(e.action.sound.sound, e.action.sound.onlySelf > 0 ? true : false);
|
||||
(*itr)->SendPlaySound(e.action.sound.sound, e.action.sound.onlySelf > 0);
|
||||
TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SOUND: target: %s (GuidLow: %u), sound: %u, onlyself: %u",
|
||||
(*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), e.action.sound.sound, e.action.sound.onlySelf);
|
||||
}
|
||||
@@ -515,7 +516,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS)
|
||||
me->InterruptNonMeleeSpells(false);
|
||||
|
||||
me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false);
|
||||
me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED));
|
||||
TC_LOG_DEBUG(LOG_FILTER_DATABASE_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);
|
||||
}
|
||||
@@ -546,7 +547,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS)
|
||||
tempLastInvoker->InterruptNonMeleeSpells(false);
|
||||
|
||||
tempLastInvoker->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false);
|
||||
tempLastInvoker->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED));
|
||||
TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_INVOKER_CAST: Invoker %u casts spell %u on target %u with castflags %u",
|
||||
tempLastInvoker->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags);
|
||||
}
|
||||
@@ -696,7 +697,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (!IsSmart())
|
||||
break;
|
||||
|
||||
CAST_AI(SmartAI, me->AI())->SetAutoAttack(e.action.autoAttack.attack ? true : false);
|
||||
CAST_AI(SmartAI, me->AI())->SetAutoAttack(e.action.autoAttack.attack);
|
||||
TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_AUTO_ATTACK: Creature: %u bool on = %u",
|
||||
me->GetGUIDLow(), e.action.autoAttack.attack);
|
||||
break;
|
||||
@@ -706,7 +707,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (!IsSmart())
|
||||
break;
|
||||
|
||||
bool move = e.action.combatMove.move ? true : false;
|
||||
bool move = e.action.combatMove.move;
|
||||
CAST_AI(SmartAI, me->AI())->SetCombatMove(move);
|
||||
TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_ALLOW_COMBAT_MOVEMENT: Creature %u bool on = %u",
|
||||
me->GetGUIDLow(), e.action.combatMove.move);
|
||||
@@ -1281,7 +1282,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (!IsSmart())
|
||||
break;
|
||||
|
||||
CAST_AI(SmartAI, me->AI())->SetFly(e.action.setFly.fly ? true : false);
|
||||
CAST_AI(SmartAI, me->AI())->SetFly(e.action.setFly.fly);
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_SET_RUN:
|
||||
@@ -1289,7 +1290,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (!IsSmart())
|
||||
break;
|
||||
|
||||
CAST_AI(SmartAI, me->AI())->SetRun(e.action.setRun.run ? true : false);
|
||||
CAST_AI(SmartAI, me->AI())->SetRun(e.action.setRun.run);
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_SET_SWIM:
|
||||
@@ -1297,7 +1298,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (!IsSmart())
|
||||
break;
|
||||
|
||||
CAST_AI(SmartAI, me->AI())->SetSwim(e.action.setSwim.swim ? true : false);
|
||||
CAST_AI(SmartAI, me->AI())->SetSwim(e.action.setSwim.swim);
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_WP_START:
|
||||
@@ -1305,9 +1306,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (!IsSmart())
|
||||
break;
|
||||
|
||||
bool run = e.action.wpStart.run ? true : false;
|
||||
bool run = e.action.wpStart.run;
|
||||
uint32 entry = e.action.wpStart.pathID;
|
||||
bool repeat = e.action.wpStart.repeat ? true : false;
|
||||
bool repeat = e.action.wpStart.repeat;
|
||||
ObjectList* targets = GetTargets(e, unit);
|
||||
StoreTargetList(targets, SMART_ESCORT_TARGETS);
|
||||
me->SetReactState((ReactStates)e.action.wpStart.reactState);
|
||||
@@ -1335,7 +1336,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
uint32 DespawnTime = e.action.wpStop.despawnTime;
|
||||
uint32 quest = e.action.wpStop.quest;
|
||||
bool fail = e.action.wpStop.fail ? true : false;
|
||||
bool fail = e.action.wpStop.fail;
|
||||
CAST_AI(SmartAI, me->AI())->StopPath(DespawnTime, quest, fail);
|
||||
break;
|
||||
}
|
||||
@@ -1353,7 +1354,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
break;
|
||||
|
||||
if (e.GetTargetType() == SMART_TARGET_SELF)
|
||||
me->SetFacingTo(me->GetHomePosition().GetOrientation());
|
||||
me->SetFacingTo((me->GetTransport() ? me->GetTransportHomePosition() : me->GetHomePosition()).GetOrientation());
|
||||
else if (e.GetTargetType() == SMART_TARGET_POSITION)
|
||||
me->SetFacingTo(e.target.o);
|
||||
else if (ObjectList* targets = GetTargets(e, unit))
|
||||
@@ -1406,7 +1407,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
}
|
||||
|
||||
if (!target)
|
||||
me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, e.target.x, e.target.y, e.target.z);
|
||||
{
|
||||
G3D::Vector3 dest(e.target.x, e.target.y, e.target.z);
|
||||
if (e.action.MoveToPos.transport)
|
||||
if (TransportBase* trans = me->GetDirectTransport())
|
||||
trans->CalculatePassengerPosition(dest.x, dest.y, dest.z);
|
||||
|
||||
me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, dest.x, dest.y, dest.z);
|
||||
}
|
||||
else
|
||||
me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
|
||||
break;
|
||||
@@ -1680,7 +1688,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
interruptedSpell = true;
|
||||
}
|
||||
|
||||
(*itr)->ToUnit()->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false);
|
||||
(*itr)->ToUnit()->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED));
|
||||
}
|
||||
else
|
||||
TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "Spell %u not casted 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, (*it)->GetGUID(), (*it)->GetEntry(), uint32((*it)->GetTypeId()));
|
||||
@@ -2041,7 +2049,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsCreature(*itr))
|
||||
(*itr)->ToCreature()->setRegeneratingHealth(e.action.setHealthRegen.regenHealth ? true : false);
|
||||
(*itr)->ToCreature()->setRegeneratingHealth(e.action.setHealthRegen.regenHealth);
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
@@ -2054,7 +2062,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsCreature(*itr))
|
||||
(*itr)->ToCreature()->SetControlled(e.action.setRoot.root ? true : false, UNIT_STATE_ROOT);
|
||||
(*itr)->ToCreature()->SetControlled(e.action.setRoot.root, UNIT_STATE_ROOT);
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
@@ -2510,7 +2518,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
|
||||
}
|
||||
case SMART_TARGET_CLOSEST_CREATURE:
|
||||
{
|
||||
Creature* target = GetClosestCreatureWithEntry(baseObject, e.target.closest.entry, (float)(e.target.closest.dist ? e.target.closest.dist : 100), e.target.closest.dead ? false : true);
|
||||
Creature* target = GetClosestCreatureWithEntry(baseObject, e.target.closest.entry, (float)(e.target.closest.dist ? e.target.closest.dist : 100), !e.target.closest.dead);
|
||||
if (target)
|
||||
l->push_back(target);
|
||||
break;
|
||||
@@ -2677,7 +2685,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
|
||||
ProcessTimedAction(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax, me->GetVictim());
|
||||
break;
|
||||
}
|
||||
case SMART_EVENT_TARGET_CASTING:
|
||||
case SMART_EVENT_VICTIM_CASTING:
|
||||
{
|
||||
if (!me || !me->IsInCombat())
|
||||
return;
|
||||
@@ -3139,7 +3147,7 @@ void SmartScript::UpdateTimer(SmartScriptHolder& e, uint32 const diff)
|
||||
case SMART_EVENT_MANA_PCT:
|
||||
case SMART_EVENT_TARGET_MANA_PCT:
|
||||
case SMART_EVENT_RANGE:
|
||||
case SMART_EVENT_TARGET_CASTING:
|
||||
case SMART_EVENT_VICTIM_CASTING:
|
||||
case SMART_EVENT_FRIENDLY_HEALTH:
|
||||
case SMART_EVENT_FRIENDLY_IS_CC:
|
||||
case SMART_EVENT_FRIENDLY_MISSING_BUFF:
|
||||
|
||||
Reference in New Issue
Block a user