Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/game/Battlegrounds/BattlegroundMgr.cpp src/server/game/Entities/Player/Player.cpp src/server/game/Handlers/QuestHandler.cpp src/server/game/Spells/SpellInfo.h src/server/game/World/World.cpp
This commit is contained in:
commit
f7aedaef33
56 files changed
+455
-117
No files matched your search
@@ -67,7 +67,10 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
|
||||
mFollowCredit = 0;
|
||||
mFollowArrivedEntry = 0;
|
||||
mFollowCreditType = 0;
|
||||
mFollowArrivedTimer = 0;
|
||||
mInvincibilityHpLevel = 0;
|
||||
|
||||
mJustReset = false;
|
||||
}
|
||||
|
||||
void SmartAI::UpdateDespawn(const uint32 diff)
|
||||
@@ -88,13 +91,6 @@ void SmartAI::UpdateDespawn(const uint32 diff)
|
||||
} else mDespawnTime -= diff;
|
||||
}
|
||||
|
||||
void SmartAI::Reset()
|
||||
{
|
||||
if (!HasEscortState(SMART_ESCORT_ESCORTING))//dont mess up escort movement after combat
|
||||
SetRun(mRun);
|
||||
GetScript()->OnReset();
|
||||
}
|
||||
|
||||
WayPoint* SmartAI::GetNextWayPoint()
|
||||
{
|
||||
if (!mWayPoints || mWayPoints->empty())
|
||||
@@ -476,7 +472,8 @@ void SmartAI::EnterEvadeMode()
|
||||
else
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
|
||||
Reset();
|
||||
if (!HasEscortState(SMART_ESCORT_ESCORTING))//dont mess up escort movement after combat
|
||||
SetRun(mRun);
|
||||
}
|
||||
|
||||
void SmartAI::MoveInLineOfSight(Unit* who)
|
||||
@@ -567,7 +564,8 @@ void SmartAI::JustRespawned()
|
||||
if (me->getFaction() != me->GetCreatureTemplate()->faction_A)
|
||||
me->RestoreFaction();
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
|
||||
Reset();
|
||||
mJustReset = true;
|
||||
JustReachedHome();
|
||||
mFollowGuid = 0;//do not reset follower on Reset(), we need it after combat evade
|
||||
mFollowDist = 0;
|
||||
mFollowAngle = 0;
|
||||
@@ -586,10 +584,17 @@ int SmartAI::Permissible(const Creature* creature)
|
||||
|
||||
void SmartAI::JustReachedHome()
|
||||
{
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_REACHED_HOME);
|
||||
GetScript()->OnReset();
|
||||
|
||||
if (!UpdateVictim() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE && me->GetWaypointPath())
|
||||
me->ToCreature()->GetMotionMaster()->MovePath(me->GetWaypointPath(), true);
|
||||
if (!mJustReset)
|
||||
{
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_REACHED_HOME);
|
||||
|
||||
if (!UpdateVictim() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE && me->GetWaypointPath())
|
||||
me->ToCreature()->GetMotionMaster()->MovePath(me->GetWaypointPath(), true);
|
||||
}
|
||||
|
||||
mJustReset = false;
|
||||
}
|
||||
|
||||
void SmartAI::EnterCombat(Unit* enemy)
|
||||
@@ -597,6 +602,9 @@ void SmartAI::EnterCombat(Unit* enemy)
|
||||
me->InterruptNonMeleeSpells(false); // must be before ProcessEvents
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_AGGRO, enemy);
|
||||
me->GetPosition(&mLastOOCPos);
|
||||
SetRun(mRun);
|
||||
if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == POINT_MOTION_TYPE)
|
||||
me->GetMotionMaster()->MovementExpired();
|
||||
}
|
||||
|
||||
void SmartAI::JustDied(Unit* killer)
|
||||
@@ -618,16 +626,10 @@ void SmartAI::JustSummoned(Creature* creature)
|
||||
|
||||
void SmartAI::AttackStart(Unit* who)
|
||||
{
|
||||
if (who && me->Attack(who, true))
|
||||
if (who && me->Attack(who, me->IsWithinMeleeRange(who)))
|
||||
{
|
||||
SetRun(mRun);
|
||||
if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == POINT_MOTION_TYPE)
|
||||
me->GetMotionMaster()->MovementExpired();
|
||||
|
||||
if (mCanCombatMove)
|
||||
me->GetMotionMaster()->MoveChase(who);
|
||||
|
||||
me->GetPosition(&mLastOOCPos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -692,7 +694,8 @@ void SmartAI::InitializeAI()
|
||||
{
|
||||
GetScript()->OnInitialize(me);
|
||||
if (!me->isDead())
|
||||
Reset();
|
||||
mJustReset = true;
|
||||
JustReachedHome();
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,10 +71,7 @@ class SmartAI : public CreatureAI
|
||||
// Called when creature is spawned or respawned
|
||||
void JustRespawned();
|
||||
|
||||
// Called after InitializeAI(), EnterEvadeMode() for resetting variables
|
||||
void Reset();
|
||||
|
||||
// Called at reaching home after evade
|
||||
// Called at reaching home after evade, InitializeAI(), EnterEvadeMode() for resetting variables
|
||||
void JustReachedHome();
|
||||
|
||||
// Called for reaction at enter to combat if not in combat yet (enemy can be NULL)
|
||||
@@ -232,6 +229,7 @@ class SmartAI : public CreatureAI
|
||||
uint32 mDespawnState;
|
||||
void UpdateDespawn(const uint32 diff);
|
||||
uint32 mEscortInvokerCheckTimer;
|
||||
bool mJustReset;
|
||||
};
|
||||
|
||||
class SmartGameObjectAI : public GameObjectAI
|
||||
|
||||
@@ -369,7 +369,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (IsPlayer(*itr))
|
||||
if (Quest const* q = sObjectMgr->GetQuestTemplate(e.action.quest.quest))
|
||||
{
|
||||
(*itr)->ToPlayer()->AddQuest(q, NULL);
|
||||
(*itr)->ToPlayer()->AddQuestAndCheckCompletion(q, NULL);
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_ADD_QUEST: Player guidLow %u add quest %u",
|
||||
(*itr)->GetGUIDLow(), e.action.quest.quest);
|
||||
}
|
||||
@@ -973,12 +973,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
}
|
||||
case SMART_ACTION_UPDATE_TEMPLATE:
|
||||
{
|
||||
if (!me || me->GetEntry() == e.action.updateTemplate.creature)
|
||||
ObjectList* targets = GetTargets(e, unit);
|
||||
|
||||
if (!targets)
|
||||
break;
|
||||
|
||||
me->UpdateEntry(e.action.updateTemplate.creature, e.action.updateTemplate.team ? HORDE : ALLIANCE);
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_UPDATE_TEMPLATE: Creature %u, Template: %u, Team: %u",
|
||||
me->GetGUIDLow(), me->GetEntry(), e.action.updateTemplate.team ? HORDE : ALLIANCE);
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsCreature(*itr))
|
||||
(*itr)->ToCreature()->UpdateEntry(e.action.updateTemplate.creature, e.action.updateTemplate.team ? HORDE : ALLIANCE);
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_DIE:
|
||||
@@ -1042,8 +1046,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
}
|
||||
case SMART_ACTION_SET_INGAME_PHASE_MASK:
|
||||
{
|
||||
if (GetBaseObject())
|
||||
GetBaseObject()->SetPhaseMask(e.action.ingamePhaseMask.mask, true);
|
||||
if (WorldObject* baseObj = GetBaseObject())
|
||||
baseObj->SetPhaseMask(e.action.ingamePhaseMask.mask, true);
|
||||
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL:
|
||||
|
||||
@@ -805,7 +805,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_UPDATE_TEMPLATE:
|
||||
if (e.action.updateTemplate.creature && !IsCreatureValid(e, e.action.updateTemplate.creature))
|
||||
if (!IsCreatureValid(e, e.action.updateTemplate.creature))
|
||||
return false;
|
||||
break;
|
||||
case SMART_ACTION_SET_SHEATH:
|
||||
|
||||
@@ -1037,6 +1037,10 @@ struct SmartTarget
|
||||
raw.param1 = p1;
|
||||
raw.param2 = p2;
|
||||
raw.param3 = p3;
|
||||
x = 0.0f;
|
||||
y = 0.0f;
|
||||
z = 0.0f;
|
||||
o = 0.0f;
|
||||
}
|
||||
SMARTAI_TARGETS type;
|
||||
float x, y, z, o;
|
||||
|
||||
Reference in new issue
Block a user