mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 18:40:28 +00:00
converted all tabs to 4 spaces
This commit is contained in:
@@ -39,15 +39,15 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
|
||||
mEscortState = SMART_ESCORT_NONE;
|
||||
mCurrentWPID = 0;//first wp id is 1 !!
|
||||
mWPReached = false;
|
||||
mOOCReached = false;
|
||||
mOOCReached = false;
|
||||
mWPPauseTimer = 0;
|
||||
mLastWP = NULL;
|
||||
mEscortNPCFlags = 0;
|
||||
mEscortNPCFlags = 0;
|
||||
|
||||
mCanRepeatPath = false;
|
||||
|
||||
// spawn in run mode
|
||||
// Xinef: spawn in run mode and set mRun to run... this overrides SetWalk EVERYWHERE, RETARDS
|
||||
// Xinef: spawn in run mode and set mRun to run... this overrides SetWalk EVERYWHERE, RETARDS
|
||||
mRun = true;
|
||||
|
||||
mCanAutoAttack = true;
|
||||
@@ -73,10 +73,10 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
|
||||
|
||||
mJustReset = false;
|
||||
|
||||
// Xinef: Vehicle conditions
|
||||
m_ConditionsTimer = 0;
|
||||
if (me->GetVehicleKit())
|
||||
conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, me->GetEntry());
|
||||
// Xinef: Vehicle conditions
|
||||
m_ConditionsTimer = 0;
|
||||
if (me->GetVehicleKit())
|
||||
conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, me->GetEntry());
|
||||
}
|
||||
|
||||
void SmartAI::UpdateDespawn(const uint32 diff)
|
||||
@@ -95,8 +95,8 @@ void SmartAI::UpdateDespawn(const uint32 diff)
|
||||
else
|
||||
me->DespawnOrUnsummon();
|
||||
}
|
||||
else
|
||||
mDespawnTime -= diff;
|
||||
else
|
||||
mDespawnTime -= diff;
|
||||
}
|
||||
|
||||
WayPoint* SmartAI::GetNextWayPoint()
|
||||
@@ -192,10 +192,10 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* invoker)
|
||||
StopPath();
|
||||
|
||||
if (path)
|
||||
{
|
||||
{
|
||||
if (!LoadPath(path))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mWayPoints || mWayPoints->empty())
|
||||
return;
|
||||
@@ -206,11 +206,11 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* invoker)
|
||||
mCanRepeatPath = repeat;
|
||||
SetRun(run);
|
||||
|
||||
if (invoker && invoker->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
mEscortNPCFlags = me->GetUInt32Value(UNIT_NPC_FLAGS);
|
||||
me->SetUInt32Value(UNIT_NPC_FLAGS, 0);
|
||||
}
|
||||
if (invoker && invoker->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
mEscortNPCFlags = me->GetUInt32Value(UNIT_NPC_FLAGS);
|
||||
me->SetUInt32Value(UNIT_NPC_FLAGS, 0);
|
||||
}
|
||||
|
||||
Movement::PointsArray pathPoints;
|
||||
GenerateWayPointArray(&pathPoints);
|
||||
@@ -251,7 +251,7 @@ void SmartAI::PausePath(uint32 delay, bool forced)
|
||||
mWPPauseTimer = delay;
|
||||
if (forced && !mWPReached)
|
||||
{
|
||||
mForcedPaused = forced;
|
||||
mForcedPaused = forced;
|
||||
SetRun(mRun);
|
||||
if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == ESCORT_MOTION_TYPE)
|
||||
me->GetMotionMaster()->MovementExpired();
|
||||
@@ -288,11 +288,11 @@ void SmartAI::EndPath(bool fail)
|
||||
mLastWP = NULL;
|
||||
mWPPauseTimer = 0;
|
||||
|
||||
if (mEscortNPCFlags)
|
||||
{
|
||||
me->SetUInt32Value(UNIT_NPC_FLAGS, mEscortNPCFlags);
|
||||
mEscortNPCFlags = 0;
|
||||
}
|
||||
if (mEscortNPCFlags)
|
||||
{
|
||||
me->SetUInt32Value(UNIT_NPC_FLAGS, mEscortNPCFlags);
|
||||
mEscortNPCFlags = 0;
|
||||
}
|
||||
|
||||
ObjectList* targets = GetScript()->GetTargetList(SMART_ESCORT_TARGETS);
|
||||
if (targets && mEscortQuestID)
|
||||
@@ -305,8 +305,8 @@ void SmartAI::EndPath(bool fail)
|
||||
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
|
||||
{
|
||||
Player* groupGuy = groupRef->GetSource();
|
||||
if (!groupGuy || !player->IsInMap(groupGuy))
|
||||
continue;
|
||||
if (!groupGuy || !player->IsInMap(groupGuy))
|
||||
continue;
|
||||
|
||||
if (!fail && groupGuy->IsAtGroupRewardDistance(me) && !groupGuy->GetCorpse())
|
||||
groupGuy->AreaExploredOrEventHappens(mEscortQuestID);
|
||||
@@ -314,15 +314,15 @@ void SmartAI::EndPath(bool fail)
|
||||
groupGuy->FailQuest(mEscortQuestID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!fail && player->IsAtGroupRewardDistance(me) && !player->GetCorpse())
|
||||
player->GroupEventHappens(mEscortQuestID, me);
|
||||
else if (fail && player->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
|
||||
player->FailQuest(mEscortQuestID);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!fail && player->IsAtGroupRewardDistance(me) && !player->GetCorpse())
|
||||
player->GroupEventHappens(mEscortQuestID, me);
|
||||
else if (fail && player->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
|
||||
player->FailQuest(mEscortQuestID);
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
for (ObjectList::iterator iter = targets->begin(); iter != targets->end(); ++iter)
|
||||
{
|
||||
@@ -338,16 +338,16 @@ void SmartAI::EndPath(bool fail)
|
||||
}
|
||||
}
|
||||
|
||||
// Xinef: if the escort failed - DO NOT PROCESS ANYTHING, ITS RETARDED
|
||||
// Xinef: End Path events should be only processed if it was SUCCESSFUL stop or stop called by SMART_ACTION_WAYPOINT_STOP
|
||||
if (fail)
|
||||
{
|
||||
mCurrentWPID = 0;
|
||||
return;
|
||||
}
|
||||
// Xinef: if the escort failed - DO NOT PROCESS ANYTHING, ITS RETARDED
|
||||
// Xinef: End Path events should be only processed if it was SUCCESSFUL stop or stop called by SMART_ACTION_WAYPOINT_STOP
|
||||
if (fail)
|
||||
{
|
||||
mCurrentWPID = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, NULL, mCurrentWPID, GetScript()->GetPathId());
|
||||
mCurrentWPID = 0;
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, NULL, mCurrentWPID, GetScript()->GetPathId());
|
||||
mCurrentWPID = 0;
|
||||
|
||||
if (mCanRepeatPath)
|
||||
StartPath(mRun, GetScript()->GetPathId(), mCanRepeatPath);
|
||||
@@ -373,8 +373,8 @@ void SmartAI::ResumePath()
|
||||
|
||||
void SmartAI::ReturnToLastOOCPos()
|
||||
{
|
||||
me->SetWalk(false);
|
||||
float x, y, z, o;
|
||||
me->SetWalk(false);
|
||||
float x, y, z, o;
|
||||
me->GetHomePosition(x, y, z, o);
|
||||
me->GetMotionMaster()->MovePoint(SMART_ESCORT_LAST_OOC_POINT, x, y, z);
|
||||
}
|
||||
@@ -386,21 +386,21 @@ void SmartAI::UpdatePath(const uint32 diff)
|
||||
|
||||
if (mEscortInvokerCheckTimer < diff)
|
||||
{
|
||||
// Xinef: Escort failed - no players in range
|
||||
// Xinef: Despawn immediately
|
||||
// Xinef: Escort failed - no players in range
|
||||
// Xinef: Despawn immediately
|
||||
if (!IsEscortInvokerInRange())
|
||||
{
|
||||
StopPath(0, mEscortQuestID, true);
|
||||
|
||||
// Xinef: allow to properly hook out of range despawn action, which in most cases should perform the same operation as dying
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, me);
|
||||
me->DespawnOrUnsummon(1);
|
||||
return;
|
||||
// Xinef: allow to properly hook out of range despawn action, which in most cases should perform the same operation as dying
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, me);
|
||||
me->DespawnOrUnsummon(1);
|
||||
return;
|
||||
}
|
||||
mEscortInvokerCheckTimer = 1000;
|
||||
}
|
||||
else
|
||||
mEscortInvokerCheckTimer -= diff;
|
||||
else
|
||||
mEscortInvokerCheckTimer -= diff;
|
||||
|
||||
// handle pause
|
||||
if (HasEscortState(SMART_ESCORT_PAUSED))
|
||||
@@ -415,13 +415,13 @@ void SmartAI::UpdatePath(const uint32 diff)
|
||||
{
|
||||
mWPReached = false;
|
||||
mForcedPaused = false;
|
||||
ResumePath();
|
||||
ResumePath();
|
||||
}
|
||||
|
||||
mWPPauseTimer = 0;
|
||||
mWPPauseTimer = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
mWPPauseTimer -= diff;
|
||||
}
|
||||
|
||||
@@ -429,7 +429,7 @@ void SmartAI::UpdatePath(const uint32 diff)
|
||||
{
|
||||
if (mOOCReached)//reached OOC WP
|
||||
{
|
||||
mOOCReached = false;
|
||||
mOOCReached = false;
|
||||
RemoveEscortState(SMART_ESCORT_RETURNING);
|
||||
if (!HasEscortState(SMART_ESCORT_PAUSED))
|
||||
ResumePath();
|
||||
@@ -440,13 +440,13 @@ void SmartAI::UpdatePath(const uint32 diff)
|
||||
return;
|
||||
|
||||
// handle next wp
|
||||
if (!me->HasUnitState(UNIT_STATE_NOT_MOVE) && me->movespline->Finalized())//reached WP
|
||||
if (!me->HasUnitState(UNIT_STATE_NOT_MOVE) && me->movespline->Finalized())//reached WP
|
||||
{
|
||||
if (!mWPReached)
|
||||
{
|
||||
ResumePath();
|
||||
return;
|
||||
}
|
||||
if (!mWPReached)
|
||||
{
|
||||
ResumePath();
|
||||
return;
|
||||
}
|
||||
|
||||
mWPReached = false;
|
||||
if (mCurrentWPID == GetWPCount())
|
||||
@@ -464,16 +464,16 @@ void SmartAI::UpdatePath(const uint32 diff)
|
||||
|
||||
void SmartAI::CheckConditions(const uint32 diff)
|
||||
{
|
||||
Vehicle* vehicle = me->GetVehicleKit();
|
||||
if (!vehicle)
|
||||
return;
|
||||
Vehicle* vehicle = me->GetVehicleKit();
|
||||
if (!vehicle)
|
||||
return;
|
||||
|
||||
if (m_ConditionsTimer < diff)
|
||||
{
|
||||
if (!conditions.empty())
|
||||
{
|
||||
for (SeatMap::iterator itr = vehicle->Seats.begin(); itr != vehicle->Seats.end(); ++itr)
|
||||
if (Unit* passenger = ObjectAccessor::GetUnit(*me, itr->second.Passenger.Guid))
|
||||
if (Unit* passenger = ObjectAccessor::GetUnit(*me, itr->second.Passenger.Guid))
|
||||
{
|
||||
if (Player* player = passenger->ToPlayer())
|
||||
{
|
||||
@@ -487,13 +487,13 @@ void SmartAI::CheckConditions(const uint32 diff)
|
||||
}
|
||||
m_ConditionsTimer = 1000;
|
||||
}
|
||||
else
|
||||
m_ConditionsTimer -= diff;
|
||||
else
|
||||
m_ConditionsTimer -= diff;
|
||||
}
|
||||
|
||||
void SmartAI::UpdateAI(uint32 diff)
|
||||
{
|
||||
CheckConditions(diff);
|
||||
CheckConditions(diff);
|
||||
GetScript()->OnUpdate(diff);
|
||||
UpdatePath(diff);
|
||||
UpdateDespawn(diff);
|
||||
@@ -527,12 +527,12 @@ bool SmartAI::IsEscortInvokerInRange()
|
||||
ObjectList* targets = GetScript()->GetTargetList(SMART_ESCORT_TARGETS);
|
||||
if (targets)
|
||||
{
|
||||
float checkDist = me->GetInstanceScript() ? SMART_ESCORT_MAX_PLAYER_DIST*2 : SMART_ESCORT_MAX_PLAYER_DIST;
|
||||
float checkDist = me->GetInstanceScript() ? SMART_ESCORT_MAX_PLAYER_DIST*2 : SMART_ESCORT_MAX_PLAYER_DIST;
|
||||
if (targets->size() == 1 && GetScript()->IsPlayer((*targets->begin())))
|
||||
{
|
||||
Player* player = (*targets->begin())->ToPlayer();
|
||||
if (me->GetDistance(player) <= checkDist)
|
||||
return true;
|
||||
return true;
|
||||
|
||||
if (Group* group = player->GetGroup())
|
||||
{
|
||||
@@ -540,12 +540,12 @@ bool SmartAI::IsEscortInvokerInRange()
|
||||
{
|
||||
Player* groupGuy = groupRef->GetSource();
|
||||
|
||||
if (groupGuy && me->IsInMap(groupGuy) && me->GetDistance(groupGuy) <= checkDist)
|
||||
if (groupGuy && me->IsInMap(groupGuy) && me->GetDistance(groupGuy) <= checkDist)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
for (ObjectList::iterator iter = targets->begin(); iter != targets->end(); ++iter)
|
||||
{
|
||||
@@ -557,10 +557,10 @@ bool SmartAI::IsEscortInvokerInRange()
|
||||
}
|
||||
}
|
||||
|
||||
// Xinef: no valid target found
|
||||
return false;
|
||||
// Xinef: no valid target found
|
||||
return false;
|
||||
}
|
||||
// Xinef: no player invoker was stored, just ignore range check
|
||||
// Xinef: no player invoker was stored, just ignore range check
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -571,19 +571,19 @@ void SmartAI::MovepointReached(uint32 id)
|
||||
|
||||
// xinef: both point movement and escort generator can enter this function
|
||||
if (id == SMART_ESCORT_LAST_OOC_POINT)
|
||||
{
|
||||
mOOCReached = true;
|
||||
{
|
||||
mOOCReached = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mWPReached = true;
|
||||
mWPReached = true;
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_REACHED, NULL, mCurrentWPID);
|
||||
|
||||
if (mLastWP)
|
||||
{
|
||||
{
|
||||
me->SetPosition(mLastWP->x, mLastWP->y, mLastWP->z, me->GetOrientation());
|
||||
me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
|
||||
}
|
||||
me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
|
||||
}
|
||||
|
||||
if (HasEscortState(SMART_ESCORT_PAUSED))
|
||||
{
|
||||
@@ -593,20 +593,20 @@ void SmartAI::MovepointReached(uint32 id)
|
||||
me->StopMovingOnCurrentPos();
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
}
|
||||
// Xinef: Can be unset in ProcessEvents
|
||||
else if (HasEscortState(SMART_ESCORT_ESCORTING) && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == ESCORT_MOTION_TYPE)
|
||||
{
|
||||
mWPReached = false;
|
||||
if (mCurrentWPID == GetWPCount())
|
||||
EndPath();
|
||||
else if (GetNextWayPoint())
|
||||
{
|
||||
SetRun(mRun);
|
||||
// xinef: if we have reached waypoint, and there is no working spline movement it means our splitted array has ended, make new one
|
||||
if (me->movespline->Finalized())
|
||||
ResumePath();
|
||||
}
|
||||
}
|
||||
// Xinef: Can be unset in ProcessEvents
|
||||
else if (HasEscortState(SMART_ESCORT_ESCORTING) && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == ESCORT_MOTION_TYPE)
|
||||
{
|
||||
mWPReached = false;
|
||||
if (mCurrentWPID == GetWPCount())
|
||||
EndPath();
|
||||
else if (GetNextWayPoint())
|
||||
{
|
||||
SetRun(mRun);
|
||||
// xinef: if we have reached waypoint, and there is no working spline movement it means our splitted array has ended, make new one
|
||||
if (me->movespline->Finalized())
|
||||
ResumePath();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SmartAI::MovementInform(uint32 MovementType, uint32 Data)
|
||||
@@ -624,15 +624,15 @@ void SmartAI::MovementInform(uint32 MovementType, uint32 Data)
|
||||
|
||||
void SmartAI::EnterEvadeMode()
|
||||
{
|
||||
// xinef: fixes strange jumps when charming SmartAI npc
|
||||
// xinef: fixes strange jumps when charming SmartAI npc
|
||||
if (!me->IsAlive() || me->IsInEvadeMode())
|
||||
return;
|
||||
|
||||
if (IS_PLAYER_GUID(me->GetCharmerGUID()) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
|
||||
{
|
||||
me->AttackStop();
|
||||
return;
|
||||
}
|
||||
|
||||
if (IS_PLAYER_GUID(me->GetCharmerGUID()) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
|
||||
{
|
||||
me->AttackStop();
|
||||
return;
|
||||
}
|
||||
|
||||
me->RemoveEvadeAuras();
|
||||
|
||||
@@ -656,19 +656,19 @@ void SmartAI::EnterEvadeMode()
|
||||
{
|
||||
if (Unit* target = ObjectAccessor::GetUnit(*me, mFollowGuid))
|
||||
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
|
||||
me->ClearUnitState(UNIT_STATE_EVADE);
|
||||
me->ClearUnitState(UNIT_STATE_EVADE);
|
||||
|
||||
// xinef: do not forget to reset scripts as we wont call reached home
|
||||
GetScript()->OnReset();
|
||||
// xinef: do not forget to reset scripts as we wont call reached home
|
||||
GetScript()->OnReset();
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
|
||||
// xinef: do not forget to reset scripts as we wont call reached home
|
||||
if (!me->HasUnitState(UNIT_STATE_EVADE))
|
||||
GetScript()->OnReset();
|
||||
}
|
||||
|
||||
// xinef: do not forget to reset scripts as we wont call reached home
|
||||
if (!me->HasUnitState(UNIT_STATE_EVADE))
|
||||
GetScript()->OnReset();
|
||||
}
|
||||
}
|
||||
|
||||
void SmartAI::MoveInLineOfSight(Unit* who)
|
||||
@@ -678,8 +678,8 @@ void SmartAI::MoveInLineOfSight(Unit* who)
|
||||
|
||||
GetScript()->OnMoveInLineOfSight(who);
|
||||
|
||||
if (me->GetVictim())
|
||||
return;
|
||||
if (me->GetVictim())
|
||||
return;
|
||||
|
||||
if (me->HasReactState(REACT_PASSIVE) || AssistPlayerInCombat(who))
|
||||
return;
|
||||
@@ -697,7 +697,7 @@ bool SmartAI::CanAIAttack(const Unit* /*who*/) const
|
||||
|
||||
bool SmartAI::AssistPlayerInCombat(Unit* who)
|
||||
{
|
||||
// Xinef: if unit has no victim, or victim is player controlled thing
|
||||
// Xinef: if unit has no victim, or victim is player controlled thing
|
||||
if (!who->GetVictim() || IS_PLAYER_GUID(who->GetCharmerOrOwnerOrOwnGUID()))
|
||||
return false;
|
||||
|
||||
@@ -741,7 +741,7 @@ void SmartAI::JustRespawned()
|
||||
mFollowArrivedTimer = 1000;
|
||||
mFollowArrivedEntry = 0;
|
||||
mFollowCreditType = 0;
|
||||
mFollowArrivedAlive = true;
|
||||
mFollowArrivedAlive = true;
|
||||
}
|
||||
|
||||
int SmartAI::Permissible(const Creature* creature)
|
||||
@@ -768,8 +768,8 @@ void SmartAI::JustReachedHome()
|
||||
|
||||
void SmartAI::EnterCombat(Unit* enemy)
|
||||
{
|
||||
// Xinef: Interrupt channeled spells
|
||||
me->InterruptSpell(CURRENT_CHANNELED_SPELL, true, true);
|
||||
// Xinef: Interrupt channeled spells
|
||||
me->InterruptSpell(CURRENT_CHANNELED_SPELL, true, true);
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_AGGRO, enemy);
|
||||
}
|
||||
|
||||
@@ -792,27 +792,27 @@ void SmartAI::JustSummoned(Creature* creature)
|
||||
|
||||
void SmartAI::AttackStart(Unit* who)
|
||||
{
|
||||
// xinef: dont allow charmed npcs to act on their own
|
||||
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
|
||||
{
|
||||
if (who && mCanAutoAttack)
|
||||
me->Attack(who, true);
|
||||
return;
|
||||
}
|
||||
// xinef: dont allow charmed npcs to act on their own
|
||||
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
|
||||
{
|
||||
if (who && mCanAutoAttack)
|
||||
me->Attack(who, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (who && me->Attack(who, me->IsWithinMeleeRange(who)))
|
||||
{
|
||||
if (mCanCombatMove || GetScript()->GetMaxCombatDist())
|
||||
{
|
||||
SetRun(mRun);
|
||||
MovementGeneratorType type = me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE);
|
||||
if (type == ESCORT_MOTION_TYPE || type == POINT_MOTION_TYPE)
|
||||
{
|
||||
me->GetMotionMaster()->MovementExpired();
|
||||
me->StopMoving();
|
||||
}
|
||||
{
|
||||
SetRun(mRun);
|
||||
MovementGeneratorType type = me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE);
|
||||
if (type == ESCORT_MOTION_TYPE || type == POINT_MOTION_TYPE)
|
||||
{
|
||||
me->GetMotionMaster()->MovementExpired();
|
||||
me->StopMoving();
|
||||
}
|
||||
me->GetMotionMaster()->MoveChase(who, GetScript()->GetCasterActualDist() ? GetScript()->GetCasterActualDist() : GetScript()->GetActualCombatDist());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -831,7 +831,7 @@ void SmartAI::DamageTaken(Unit* doneBy, uint32& damage, DamageEffectType damaget
|
||||
if (doneBy)
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED, doneBy, damage);
|
||||
|
||||
// Xinef: skip nodamage type (eg. instakill effect)
|
||||
// Xinef: skip nodamage type (eg. instakill effect)
|
||||
if (damagetype != NODAMAGE && mInvincibilityHpLevel && (damage >= me->GetHealth() - mInvincibilityHpLevel))
|
||||
damage = me->GetHealth() - mInvincibilityHpLevel; // damage should not be nullified, because of player damage req.
|
||||
}
|
||||
@@ -869,9 +869,9 @@ void SmartAI::CorpseRemoved(uint32& respawnDelay)
|
||||
{
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_CORPSE_REMOVED, NULL, respawnDelay);
|
||||
|
||||
// xinef: end escort upon corpse remove, safe check in case of immediate despawn
|
||||
if (IsEscorted())
|
||||
EndPath(true);
|
||||
// xinef: end escort upon corpse remove, safe check in case of immediate despawn
|
||||
if (IsEscorted())
|
||||
EndPath(true);
|
||||
}
|
||||
|
||||
void SmartAI::PassengerBoarded(Unit* who, int8 seatId, bool apply)
|
||||
@@ -883,11 +883,11 @@ void SmartAI::InitializeAI()
|
||||
{
|
||||
GetScript()->OnInitialize(me);
|
||||
if (!me->isDead())
|
||||
{
|
||||
mJustReset = true;
|
||||
JustReachedHome();
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
|
||||
}
|
||||
{
|
||||
mJustReset = true;
|
||||
JustReachedHome();
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
|
||||
}
|
||||
}
|
||||
|
||||
void SmartAI::OnCharmed(bool apply)
|
||||
@@ -963,18 +963,18 @@ void SmartAI::sQuestReward(Player* player, Quest const* quest, uint32 opt)
|
||||
|
||||
void SmartAI::SetForcedCombatMove(float dist)
|
||||
{
|
||||
if (!me->GetVictim())
|
||||
return;
|
||||
if (!me->GetVictim())
|
||||
return;
|
||||
|
||||
SetRun(mRun);
|
||||
SetRun(mRun);
|
||||
me->GetMotionMaster()->MoveChase(me->GetVictim(), dist);
|
||||
}
|
||||
|
||||
void SmartAI::SetCombatMove(bool on)
|
||||
{
|
||||
// Xinef: Fix Combat Movement
|
||||
if (GetScript()->GetMaxCombatDist()/* || GetScript()->GetCasterMaxDist()*/) // Xinef: we only need this hack for old caster movement system
|
||||
return;
|
||||
// Xinef: Fix Combat Movement
|
||||
if (GetScript()->GetMaxCombatDist()/* || GetScript()->GetCasterMaxDist()*/) // Xinef: we only need this hack for old caster movement system
|
||||
return;
|
||||
|
||||
if (mCanCombatMove == on)
|
||||
return;
|
||||
@@ -1016,7 +1016,7 @@ void SmartAI::SetFollow(Unit* target, float dist, float angle, uint32 credit, ui
|
||||
mFollowArrivedTimer = 1000;
|
||||
mFollowCredit = credit;
|
||||
mFollowArrivedEntry = end;
|
||||
mFollowArrivedAlive = !aliveState; // negate - 0 is alive
|
||||
mFollowArrivedAlive = !aliveState; // negate - 0 is alive
|
||||
|
||||
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
|
||||
mFollowCreditType = creditType;
|
||||
@@ -1036,10 +1036,10 @@ void SmartAI::StopFollow(bool complete)
|
||||
me->StopMoving();
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
|
||||
if (!complete)
|
||||
return;
|
||||
if (!complete)
|
||||
return;
|
||||
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, mFollowGuid))
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, mFollowGuid))
|
||||
{
|
||||
if (!mFollowCreditType)
|
||||
player->RewardPlayerAndGroupAtEvent(mFollowCredit, me);
|
||||
@@ -1047,10 +1047,10 @@ void SmartAI::StopFollow(bool complete)
|
||||
player->GroupEventHappens(mFollowCredit, me);
|
||||
}
|
||||
|
||||
SetDespawnTime(5000);
|
||||
SetDespawnTime(5000);
|
||||
StartDespawn();
|
||||
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_FOLLOW_COMPLETED);
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_FOLLOW_COMPLETED);
|
||||
}
|
||||
|
||||
void SmartAI::SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker)
|
||||
@@ -1067,7 +1067,7 @@ void SmartAI::sOnGameEvent(bool start, uint16 eventId)
|
||||
|
||||
void SmartAI::OnSpellClick(Unit* clicker, bool& result)
|
||||
{
|
||||
// Xinef: i dont think this is necessery (can be made as event parameter)
|
||||
// Xinef: i dont think this is necessery (can be made as event parameter)
|
||||
//if (!result)
|
||||
// return;
|
||||
|
||||
@@ -1090,16 +1090,16 @@ void SmartGameObjectAI::InitializeAI()
|
||||
{
|
||||
GetScript()->OnInitialize(go);
|
||||
|
||||
// Xinef: do not call respawn event if go is not spawned
|
||||
if (go->isSpawned())
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
|
||||
// Xinef: do not call respawn event if go is not spawned
|
||||
if (go->isSpawned())
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
|
||||
//Reset();
|
||||
}
|
||||
|
||||
void SmartGameObjectAI::Reset()
|
||||
{
|
||||
// Xinef: call respawn event on reset
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
|
||||
// Xinef: call respawn event on reset
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
|
||||
|
||||
GetScript()->OnReset();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ enum SmartEscortState
|
||||
enum SmartEscortVars
|
||||
{
|
||||
SMART_ESCORT_MAX_PLAYER_DIST = 60,
|
||||
SMART_MAX_AID_DIST = SMART_ESCORT_MAX_PLAYER_DIST / 2,
|
||||
SMART_MAX_AID_DIST = SMART_ESCORT_MAX_PLAYER_DIST / 2,
|
||||
};
|
||||
|
||||
class SmartAI : public CreatureAI
|
||||
@@ -59,11 +59,11 @@ class SmartAI : public CreatureAI
|
||||
void GenerateWayPointArray(Movement::PointsArray* points);
|
||||
bool HasEscortState(uint32 uiEscortState) { return (mEscortState & uiEscortState); }
|
||||
void AddEscortState(uint32 uiEscortState) { mEscortState |= uiEscortState; }
|
||||
virtual bool IsEscorted() { return (mEscortState & SMART_ESCORT_ESCORTING); }
|
||||
virtual bool IsEscorted() { return (mEscortState & SMART_ESCORT_ESCORTING); }
|
||||
void RemoveEscortState(uint32 uiEscortState) { mEscortState &= ~uiEscortState; }
|
||||
void SetAutoAttack(bool on) { mCanAutoAttack = on; }
|
||||
void SetCombatMove(bool on);
|
||||
bool CanCombatMove() { return mCanCombatMove; }
|
||||
bool CanCombatMove() { return mCanCombatMove; }
|
||||
void SetFollow(Unit* target, float dist = 0.0f, float angle = 0.0f, uint32 credit = 0, uint32 end = 0, uint32 creditType = 0, bool aliveState = true);
|
||||
void StopFollow(bool complete);
|
||||
|
||||
@@ -196,16 +196,16 @@ class SmartAI : public CreatureAI
|
||||
|
||||
void OnSpellClick(Unit* clicker, bool& result);
|
||||
|
||||
// Xinef
|
||||
void SetWPPauseTimer(uint32 time) { mWPPauseTimer = time; }
|
||||
void SetForcedCombatMove(float dist);
|
||||
// Xinef
|
||||
void SetWPPauseTimer(uint32 time) { mWPPauseTimer = time; }
|
||||
void SetForcedCombatMove(float dist);
|
||||
|
||||
private:
|
||||
uint32 mFollowCreditType;
|
||||
uint32 mFollowArrivedTimer;
|
||||
uint32 mFollowCredit;
|
||||
uint32 mFollowArrivedEntry;
|
||||
bool mFollowArrivedAlive;
|
||||
bool mFollowArrivedAlive;
|
||||
uint64 mFollowGuid;
|
||||
float mFollowDist;
|
||||
float mFollowAngle;
|
||||
@@ -217,7 +217,7 @@ class SmartAI : public CreatureAI
|
||||
uint32 mEscortState;
|
||||
uint32 mCurrentWPID;
|
||||
bool mWPReached;
|
||||
bool mOOCReached;
|
||||
bool mOOCReached;
|
||||
uint32 mWPPauseTimer;
|
||||
WayPoint* mLastWP;
|
||||
uint32 mEscortNPCFlags;
|
||||
@@ -237,7 +237,7 @@ class SmartAI : public CreatureAI
|
||||
uint32 mEscortInvokerCheckTimer;
|
||||
bool mJustReset;
|
||||
|
||||
// Xinef: Vehicle conditions
|
||||
// Xinef: Vehicle conditions
|
||||
void CheckConditions(const uint32 diff);
|
||||
ConditionList conditions;
|
||||
uint32 m_ConditionsTimer;
|
||||
@@ -266,7 +266,7 @@ class SmartGameObjectAI : public GameObjectAI
|
||||
void OnGameEvent(bool start, uint16 eventId);
|
||||
void OnStateChanged(uint32 state, Unit* unit);
|
||||
void EventInform(uint32 eventId);
|
||||
void SpellHit(Unit* unit, const SpellInfo* spellInfo);
|
||||
void SpellHit(Unit* unit, const SpellInfo* spellInfo);
|
||||
|
||||
protected:
|
||||
SmartScript mScript;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -152,11 +152,11 @@ class SmartScript
|
||||
{
|
||||
if (reset == 0)
|
||||
itr->second += value;
|
||||
else
|
||||
itr->second = value;
|
||||
else
|
||||
itr->second = value;
|
||||
}
|
||||
else
|
||||
mCounterList.insert(std::make_pair(id, value));
|
||||
else
|
||||
mCounterList.insert(std::make_pair(id, value));
|
||||
|
||||
ProcessEventsFor(SMART_EVENT_COUNTER_SET, NULL, id);
|
||||
}
|
||||
@@ -232,42 +232,42 @@ class SmartScript
|
||||
typedef UNORDERED_MAP<uint32, uint32> CounterMap;
|
||||
CounterMap mCounterList;
|
||||
|
||||
// Xinef: Fix Combat Movement
|
||||
void SetActualCombatDist(uint32 dist) { mActualCombatDist = dist; }
|
||||
void RestoreMaxCombatDist() { mActualCombatDist = mMaxCombatDist; }
|
||||
uint32 GetActualCombatDist() const { return mActualCombatDist; }
|
||||
uint32 GetMaxCombatDist() const { return mMaxCombatDist; }
|
||||
// Xinef: Fix Combat Movement
|
||||
void SetActualCombatDist(uint32 dist) { mActualCombatDist = dist; }
|
||||
void RestoreMaxCombatDist() { mActualCombatDist = mMaxCombatDist; }
|
||||
uint32 GetActualCombatDist() const { return mActualCombatDist; }
|
||||
uint32 GetMaxCombatDist() const { return mMaxCombatDist; }
|
||||
|
||||
// Xinef: SmartCasterAI, replace above
|
||||
void SetCasterActualDist(float dist) { smartCasterActualDist = dist; }
|
||||
void RestoreCasterMaxDist() { smartCasterActualDist = smartCasterMaxDist; }
|
||||
Powers GetCasterPowerType() const { return smartCasterPowerType; }
|
||||
float GetCasterActualDist() const { return smartCasterActualDist; }
|
||||
float GetCasterMaxDist() const { return smartCasterMaxDist; }
|
||||
// Xinef: SmartCasterAI, replace above
|
||||
void SetCasterActualDist(float dist) { smartCasterActualDist = dist; }
|
||||
void RestoreCasterMaxDist() { smartCasterActualDist = smartCasterMaxDist; }
|
||||
Powers GetCasterPowerType() const { return smartCasterPowerType; }
|
||||
float GetCasterActualDist() const { return smartCasterActualDist; }
|
||||
float GetCasterMaxDist() const { return smartCasterMaxDist; }
|
||||
|
||||
bool AllowPhaseReset() const { return _allowPhaseReset; }
|
||||
void SetPhaseReset(bool allow) { _allowPhaseReset = allow; }
|
||||
bool AllowPhaseReset() const { return _allowPhaseReset; }
|
||||
void SetPhaseReset(bool allow) { _allowPhaseReset = allow; }
|
||||
|
||||
private:
|
||||
void IncPhase(uint32 p)
|
||||
{
|
||||
// Xinef: protect phase from overflowing
|
||||
mEventPhase = std::min<uint32>(SMART_EVENT_PHASE_12, mEventPhase + p);
|
||||
}
|
||||
{
|
||||
// Xinef: protect phase from overflowing
|
||||
mEventPhase = std::min<uint32>(SMART_EVENT_PHASE_12, mEventPhase + p);
|
||||
}
|
||||
|
||||
void DecPhase(uint32 p)
|
||||
{
|
||||
if (p >= mEventPhase)
|
||||
mEventPhase = 0;
|
||||
else
|
||||
mEventPhase -= p;
|
||||
}
|
||||
{
|
||||
if (p >= mEventPhase)
|
||||
mEventPhase = 0;
|
||||
else
|
||||
mEventPhase -= p;
|
||||
}
|
||||
bool IsInPhase(uint32 p) const
|
||||
{
|
||||
if (mEventPhase == 0)
|
||||
return false;
|
||||
return (1 << (mEventPhase - 1)) & p;
|
||||
}
|
||||
{
|
||||
if (mEventPhase == 0)
|
||||
return false;
|
||||
return (1 << (mEventPhase - 1)) & p;
|
||||
}
|
||||
void SetPhase(uint32 p = 0) { mEventPhase = p; }
|
||||
|
||||
SmartAIEventList mEvents;
|
||||
@@ -292,17 +292,17 @@ class SmartScript
|
||||
uint32 mTalkerEntry;
|
||||
bool mUseTextTimer;
|
||||
|
||||
// Xinef: Fix Combat Movement
|
||||
uint32 mActualCombatDist;
|
||||
uint32 mMaxCombatDist;
|
||||
// Xinef: Fix Combat Movement
|
||||
uint32 mActualCombatDist;
|
||||
uint32 mMaxCombatDist;
|
||||
|
||||
// Xinef: SmartCasterAI, replace above in future
|
||||
uint32 smartCasterActualDist;
|
||||
uint32 smartCasterMaxDist;
|
||||
Powers smartCasterPowerType;
|
||||
// Xinef: SmartCasterAI, replace above in future
|
||||
uint32 smartCasterActualDist;
|
||||
uint32 smartCasterMaxDist;
|
||||
Powers smartCasterPowerType;
|
||||
|
||||
// Xinef: misc
|
||||
bool _allowPhaseReset;
|
||||
// Xinef: misc
|
||||
bool _allowPhaseReset;
|
||||
|
||||
SMARTAI_TEMPLATE mTemplate;
|
||||
void InstallEvents();
|
||||
|
||||
@@ -241,19 +241,19 @@ void SmartAIMgr::LoadSmartAIFromDB()
|
||||
break;
|
||||
case SMART_EVENT_VICTIM_CASTING:
|
||||
case SMART_EVENT_IS_BEHIND_TARGET:
|
||||
if (temp.event.minMaxRepeat.min == 0 && temp.event.minMaxRepeat.max == 0)
|
||||
if (temp.event.minMaxRepeat.min == 0 && temp.event.minMaxRepeat.max == 0)
|
||||
temp.event.event_flags |= SMART_EVENT_FLAG_NOT_REPEATABLE;
|
||||
break;
|
||||
case SMART_EVENT_FRIENDLY_IS_CC:
|
||||
if (temp.event.friendlyCC.repeatMin == 0 && temp.event.friendlyCC.repeatMax == 0)
|
||||
if (temp.event.friendlyCC.repeatMin == 0 && temp.event.friendlyCC.repeatMax == 0)
|
||||
temp.event.event_flags |= SMART_EVENT_FLAG_NOT_REPEATABLE;
|
||||
break;
|
||||
}
|
||||
|
||||
// xinef: rozpierdol tc, niedojeby ze szok
|
||||
if (temp.action.type == SMART_ACTION_MOVE_TO_POS)
|
||||
if (temp.target.type == SMART_TARGET_SELF && (fabs(temp.target.x) > 200.0f || fabs(temp.target.y) > 200.0f || fabs(temp.target.z) > 200.0f))
|
||||
temp.target.type = SMART_TARGET_POSITION;
|
||||
// xinef: rozpierdol tc, niedojeby ze szok
|
||||
if (temp.action.type == SMART_ACTION_MOVE_TO_POS)
|
||||
if (temp.target.type == SMART_TARGET_SELF && (fabs(temp.target.x) > 200.0f || fabs(temp.target.y) > 200.0f || fabs(temp.target.z) > 200.0f))
|
||||
temp.target.type = SMART_TARGET_POSITION;
|
||||
|
||||
// creature entry / guid not found in storage, create empty event list for it and increase counters
|
||||
if (mEventMap[source_type].find(temp.entryOrGuid) == mEventMap[source_type].end())
|
||||
@@ -338,7 +338,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
|
||||
case SMART_TARGET_CLOSEST_ENEMY:
|
||||
case SMART_TARGET_CLOSEST_FRIENDLY:
|
||||
case SMART_TARGET_STORED:
|
||||
case SMART_TARGET_FARTHEST:
|
||||
case SMART_TARGET_FARTHEST:
|
||||
break;
|
||||
default:
|
||||
sLog->outErrorDb("SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
@@ -671,7 +671,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
}
|
||||
break;
|
||||
case SMART_EVENT_GO_STATE_CHANGED:
|
||||
case SMART_EVENT_GO_EVENT_INFORM:
|
||||
case SMART_EVENT_GO_EVENT_INFORM:
|
||||
case SMART_EVENT_TIMED_EVENT_TRIGGERED:
|
||||
case SMART_EVENT_INSTANCE_PLAYER_ENTER:
|
||||
case SMART_EVENT_TRANSPORT_RELOCATE:
|
||||
@@ -702,7 +702,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
case SMART_EVENT_GOSSIP_HELLO:
|
||||
case SMART_EVENT_JUST_CREATED:
|
||||
case SMART_EVENT_FOLLOW_COMPLETED:
|
||||
case SMART_EVENT_ON_SPELLCLICK:
|
||||
case SMART_EVENT_ON_SPELLCLICK:
|
||||
break;
|
||||
default:
|
||||
sLog->outErrorDb("SmartAIMgr: Not handled event_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
@@ -847,7 +847,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
return false;
|
||||
}
|
||||
if (e.action.randomPhase.phase1 == 0 &&
|
||||
if (e.action.randomPhase.phase1 == 0 &&
|
||||
e.action.randomPhase.phase2 == 0 &&
|
||||
e.action.randomPhase.phase3 == 0 &&
|
||||
e.action.randomPhase.phase4 == 0 &&
|
||||
@@ -970,13 +970,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
case SMART_ACTION_REMOVE_POWER:
|
||||
if (e.action.power.powerType > MAX_POWERS)
|
||||
{
|
||||
sLog->outError("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Power %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.power.powerType);
|
||||
sLog->outError("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Power %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.power.powerType);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case SMART_ACTION_GAME_EVENT_STOP:
|
||||
{
|
||||
return false;
|
||||
return false;
|
||||
uint32 eventId = e.action.gameEventStop.id;
|
||||
|
||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
|
||||
@@ -996,7 +996,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
}
|
||||
case SMART_ACTION_GAME_EVENT_START:
|
||||
{
|
||||
return false;
|
||||
return false;
|
||||
uint32 eventId = e.action.gameEventStart.id;
|
||||
|
||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
|
||||
@@ -1033,15 +1033,15 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_LOAD_GRID:
|
||||
{
|
||||
if (!Trinity::IsValidMapCoord(e.target.x, e.target.y))
|
||||
{
|
||||
sLog->outError("SmartScript: SMART_ACTION_LOAD_GRID uses invalid map coords: %u, skipped.", e.entryOrGuid);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_LOAD_GRID:
|
||||
{
|
||||
if (!Trinity::IsValidMapCoord(e.target.x, e.target.y))
|
||||
{
|
||||
sLog->outError("SmartScript: SMART_ACTION_LOAD_GRID uses invalid map coords: %u, skipped.", e.entryOrGuid);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_START_CLOSEST_WAYPOINT:
|
||||
case SMART_ACTION_FOLLOW:
|
||||
case SMART_ACTION_SET_ORIENTATION:
|
||||
@@ -1105,35 +1105,35 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
case SMART_ACTION_SEND_GOSSIP_MENU:
|
||||
case SMART_ACTION_GO_SET_LOOT_STATE:
|
||||
case SMART_ACTION_SEND_TARGET_TO_TARGET:
|
||||
case SMART_ACTION_SET_HOME_POS:
|
||||
case SMART_ACTION_SET_HOME_POS:
|
||||
case SMART_ACTION_SET_HEALTH_REGEN:
|
||||
case SMART_ACTION_SET_ROOT:
|
||||
case SMART_ACTION_SET_GO_FLAG:
|
||||
case SMART_ACTION_ADD_GO_FLAG:
|
||||
case SMART_ACTION_REMOVE_GO_FLAG:
|
||||
case SMART_ACTION_SUMMON_CREATURE_GROUP:
|
||||
case SMART_ACTION_RISE_UP:
|
||||
case SMART_ACTION_RISE_UP:
|
||||
case SMART_ACTION_MOVE_TO_POS_TARGET:
|
||||
case SMART_ACTION_SET_GO_STATE:
|
||||
case SMART_ACTION_EXIT_VEHICLE:
|
||||
case SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS:
|
||||
case SMART_ACTION_SET_COMBAT_DISTANCE:
|
||||
case SMART_ACTION_SET_CASTER_COMBAT_DIST:
|
||||
case SMART_ACTION_SET_SIGHT_DIST:
|
||||
case SMART_ACTION_FLEE:
|
||||
case SMART_ACTION_ADD_THREAT:
|
||||
case SMART_ACTION_LOAD_EQUIPMENT:
|
||||
case SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT:
|
||||
case SMART_ACTION_SET_HOVER:
|
||||
case SMART_ACTION_ADD_IMMUNITY:
|
||||
case SMART_ACTION_REMOVE_IMMUNITY:
|
||||
case SMART_ACTION_SET_COUNTER:
|
||||
case SMART_ACTION_FALL:
|
||||
case SMART_ACTION_SET_EVENT_FLAG_RESET:
|
||||
case SMART_ACTION_REMOVE_ALL_GAMEOBJECTS:
|
||||
case SMART_ACTION_STOP_MOTION:
|
||||
case SMART_ACTION_NO_ENVIRONMENT_UPDATE:
|
||||
case SMART_ACTION_ZONE_UNDER_ATTACK:
|
||||
case SMART_ACTION_SET_GO_STATE:
|
||||
case SMART_ACTION_EXIT_VEHICLE:
|
||||
case SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS:
|
||||
case SMART_ACTION_SET_COMBAT_DISTANCE:
|
||||
case SMART_ACTION_SET_CASTER_COMBAT_DIST:
|
||||
case SMART_ACTION_SET_SIGHT_DIST:
|
||||
case SMART_ACTION_FLEE:
|
||||
case SMART_ACTION_ADD_THREAT:
|
||||
case SMART_ACTION_LOAD_EQUIPMENT:
|
||||
case SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT:
|
||||
case SMART_ACTION_SET_HOVER:
|
||||
case SMART_ACTION_ADD_IMMUNITY:
|
||||
case SMART_ACTION_REMOVE_IMMUNITY:
|
||||
case SMART_ACTION_SET_COUNTER:
|
||||
case SMART_ACTION_FALL:
|
||||
case SMART_ACTION_SET_EVENT_FLAG_RESET:
|
||||
case SMART_ACTION_REMOVE_ALL_GAMEOBJECTS:
|
||||
case SMART_ACTION_STOP_MOTION:
|
||||
case SMART_ACTION_NO_ENVIRONMENT_UPDATE:
|
||||
case SMART_ACTION_ZONE_UNDER_ATTACK:
|
||||
break;
|
||||
default:
|
||||
sLog->outErrorDb("SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
|
||||
|
||||
@@ -57,7 +57,7 @@ enum SMART_EVENT_PHASE
|
||||
SMART_EVENT_PHASE_9 = 9,
|
||||
SMART_EVENT_PHASE_10 = 10,
|
||||
SMART_EVENT_PHASE_11 = 11,
|
||||
SMART_EVENT_PHASE_12 = 12,
|
||||
SMART_EVENT_PHASE_12 = 12,
|
||||
SMART_EVENT_PHASE_MAX = 13,
|
||||
|
||||
SMART_EVENT_PHASE_COUNT = 12
|
||||
@@ -390,7 +390,7 @@ struct SmartEvent
|
||||
uint32 eventId;
|
||||
} eventInform;
|
||||
|
||||
struct
|
||||
struct
|
||||
{
|
||||
uint32 eventId;
|
||||
} doAction;
|
||||
@@ -554,43 +554,43 @@ enum SMART_ACTION
|
||||
SMART_ACTION_GAME_EVENT_START = 112, // GameEventId
|
||||
SMART_ACTION_START_CLOSEST_WAYPOINT = 113, // wp1, wp2, wp3, wp4, wp5, wp6, wp7
|
||||
SMART_ACTION_RISE_UP = 114, // distance
|
||||
// RESERVED = 115,
|
||||
// RESERVED = 116,
|
||||
// RESERVED = 117,
|
||||
// RESERVED = 118,
|
||||
// RESERVED = 119,
|
||||
// RESERVED = 120,
|
||||
// RESERVED = 121,
|
||||
// RESERVED = 122,
|
||||
// RESERVED = 123,
|
||||
// RESERVED = 124,
|
||||
// RESERVED = 125,
|
||||
// RESERVED = 126,
|
||||
// RESERVED = 127,
|
||||
// RESERVED = 128,
|
||||
// RESERVED = 129,
|
||||
// 113!
|
||||
SMART_ACTION_MOVE_TO_POS_TARGET = 130, // pointId
|
||||
SMART_ACTION_SET_GO_STATE = 131, // state
|
||||
SMART_ACTION_EXIT_VEHICLE = 132, // none
|
||||
SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS = 133, // flags
|
||||
SMART_ACTION_SET_COMBAT_DISTANCE = 134, // combatDistance
|
||||
SMART_ACTION_SET_CASTER_COMBAT_DIST = 135, // followDistance, resetToMax
|
||||
SMART_ACTION_SET_SIGHT_DIST = 136, // sightDistance
|
||||
SMART_ACTION_FLEE = 137, // fleeTime
|
||||
SMART_ACTION_ADD_THREAT = 138, // +threat, -threat
|
||||
SMART_ACTION_LOAD_EQUIPMENT = 139, // id
|
||||
SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT = 140, // id min range, id max range
|
||||
SMART_ACTION_SET_HOVER = 141, // 0/1
|
||||
SMART_ACTION_ADD_IMMUNITY = 142, // type, id, value
|
||||
SMART_ACTION_REMOVE_IMMUNITY = 143, // type, id, value
|
||||
SMART_ACTION_FALL = 144, //
|
||||
SMART_ACTION_SET_EVENT_FLAG_RESET = 145, // 0/1
|
||||
SMART_ACTION_REMOVE_ALL_GAMEOBJECTS = 146,
|
||||
SMART_ACTION_STOP_MOTION = 147, // stopMoving, movementExpired
|
||||
SMART_ACTION_NO_ENVIRONMENT_UPDATE = 148,
|
||||
SMART_ACTION_ZONE_UNDER_ATTACK = 149,
|
||||
SMART_ACTION_LOAD_GRID = 150,
|
||||
// RESERVED = 115,
|
||||
// RESERVED = 116,
|
||||
// RESERVED = 117,
|
||||
// RESERVED = 118,
|
||||
// RESERVED = 119,
|
||||
// RESERVED = 120,
|
||||
// RESERVED = 121,
|
||||
// RESERVED = 122,
|
||||
// RESERVED = 123,
|
||||
// RESERVED = 124,
|
||||
// RESERVED = 125,
|
||||
// RESERVED = 126,
|
||||
// RESERVED = 127,
|
||||
// RESERVED = 128,
|
||||
// RESERVED = 129,
|
||||
// 113!
|
||||
SMART_ACTION_MOVE_TO_POS_TARGET = 130, // pointId
|
||||
SMART_ACTION_SET_GO_STATE = 131, // state
|
||||
SMART_ACTION_EXIT_VEHICLE = 132, // none
|
||||
SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS = 133, // flags
|
||||
SMART_ACTION_SET_COMBAT_DISTANCE = 134, // combatDistance
|
||||
SMART_ACTION_SET_CASTER_COMBAT_DIST = 135, // followDistance, resetToMax
|
||||
SMART_ACTION_SET_SIGHT_DIST = 136, // sightDistance
|
||||
SMART_ACTION_FLEE = 137, // fleeTime
|
||||
SMART_ACTION_ADD_THREAT = 138, // +threat, -threat
|
||||
SMART_ACTION_LOAD_EQUIPMENT = 139, // id
|
||||
SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT = 140, // id min range, id max range
|
||||
SMART_ACTION_SET_HOVER = 141, // 0/1
|
||||
SMART_ACTION_ADD_IMMUNITY = 142, // type, id, value
|
||||
SMART_ACTION_REMOVE_IMMUNITY = 143, // type, id, value
|
||||
SMART_ACTION_FALL = 144, //
|
||||
SMART_ACTION_SET_EVENT_FLAG_RESET = 145, // 0/1
|
||||
SMART_ACTION_REMOVE_ALL_GAMEOBJECTS = 146,
|
||||
SMART_ACTION_STOP_MOTION = 147, // stopMoving, movementExpired
|
||||
SMART_ACTION_NO_ENVIRONMENT_UPDATE = 148,
|
||||
SMART_ACTION_ZONE_UNDER_ATTACK = 149,
|
||||
SMART_ACTION_LOAD_GRID = 150,
|
||||
|
||||
SMART_ACTION_END = 151, // ZOMG!, zmienic w sql
|
||||
};
|
||||
@@ -605,7 +605,7 @@ struct SmartAction
|
||||
{
|
||||
uint32 textGroupID;
|
||||
uint32 duration;
|
||||
uint32 useTalkTarget;
|
||||
uint32 useTalkTarget;
|
||||
} talk;
|
||||
|
||||
struct
|
||||
@@ -668,10 +668,10 @@ struct SmartAction
|
||||
uint32 targetParam3;
|
||||
} crossCast;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 alternative;
|
||||
} activateObject;
|
||||
struct
|
||||
{
|
||||
uint32 alternative;
|
||||
} activateObject;
|
||||
|
||||
struct
|
||||
{
|
||||
@@ -679,7 +679,7 @@ struct SmartAction
|
||||
uint32 type;
|
||||
uint32 duration;
|
||||
uint32 attackInvoker;
|
||||
uint32 attackScriptOwner;
|
||||
uint32 attackScriptOwner;
|
||||
} summonCreature;
|
||||
|
||||
struct
|
||||
@@ -742,7 +742,7 @@ struct SmartAction
|
||||
uint32 entry;
|
||||
uint32 credit;
|
||||
uint32 creditType;
|
||||
uint32 aliveState;
|
||||
uint32 aliveState;
|
||||
} follow;
|
||||
|
||||
struct
|
||||
@@ -781,7 +781,7 @@ struct SmartAction
|
||||
{
|
||||
uint32 creature;
|
||||
uint32 team;
|
||||
uint32 doNotChangeLevel;
|
||||
uint32 doNotChangeLevel;
|
||||
} updateTemplate;
|
||||
|
||||
struct
|
||||
@@ -836,7 +836,7 @@ struct SmartAction
|
||||
{
|
||||
uint32 entry;
|
||||
uint32 despawnTime;
|
||||
uint32 targetsummon;
|
||||
uint32 targetsummon;
|
||||
} summonGO;
|
||||
|
||||
struct
|
||||
@@ -890,8 +890,8 @@ struct SmartAction
|
||||
struct
|
||||
{
|
||||
uint32 fly;
|
||||
uint32 speed;
|
||||
uint32 disableGravity;
|
||||
uint32 speed;
|
||||
uint32 disableGravity;
|
||||
} setFly;
|
||||
|
||||
struct
|
||||
@@ -995,13 +995,13 @@ struct SmartAction
|
||||
{
|
||||
uint32 speedxy;
|
||||
uint32 speedz;
|
||||
uint32 selfJump;
|
||||
uint32 selfJump;
|
||||
} jump;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 flag;
|
||||
} movementFlag;
|
||||
struct
|
||||
{
|
||||
uint32 flag;
|
||||
} movementFlag;
|
||||
|
||||
struct
|
||||
{
|
||||
@@ -1017,7 +1017,7 @@ struct SmartAction
|
||||
{
|
||||
uint32 pointId;
|
||||
uint32 transport;
|
||||
uint32 controlled;
|
||||
uint32 controlled;
|
||||
} MoveToPos;
|
||||
|
||||
struct
|
||||
@@ -1057,16 +1057,16 @@ struct SmartAction
|
||||
uint32 flag;
|
||||
} goFlag;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 state;
|
||||
} goState;
|
||||
struct
|
||||
{
|
||||
uint32 state;
|
||||
} goState;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 group;
|
||||
uint32 attackInvoker;
|
||||
uint32 attackScriptOwner;
|
||||
uint32 attackScriptOwner;
|
||||
} creatureGroup;
|
||||
|
||||
struct
|
||||
@@ -1095,61 +1095,61 @@ struct SmartAction
|
||||
uint32 wp6;
|
||||
} closestWaypointFromList;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 dist;
|
||||
} combatDistance;
|
||||
struct
|
||||
{
|
||||
uint32 dist;
|
||||
} combatDistance;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 dist;
|
||||
} sightDistance;
|
||||
struct
|
||||
{
|
||||
uint32 dist;
|
||||
} sightDistance;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 dist;
|
||||
uint32 reset;
|
||||
} casterDistance;
|
||||
struct
|
||||
{
|
||||
uint32 dist;
|
||||
uint32 reset;
|
||||
} casterDistance;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 spawnPos;
|
||||
} setHomePos;
|
||||
struct
|
||||
{
|
||||
uint32 spawnPos;
|
||||
} setHomePos;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 id;
|
||||
uint32 force;
|
||||
} loadEquipment;
|
||||
struct
|
||||
{
|
||||
uint32 id;
|
||||
uint32 force;
|
||||
} loadEquipment;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 minId;
|
||||
uint32 maxId;
|
||||
} randomTimedEvent;
|
||||
struct
|
||||
{
|
||||
uint32 minId;
|
||||
uint32 maxId;
|
||||
} randomTimedEvent;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 state;
|
||||
} setHover;
|
||||
struct
|
||||
{
|
||||
uint32 state;
|
||||
} setHover;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 type;
|
||||
uint32 id;
|
||||
uint32 value;
|
||||
} immunity;
|
||||
struct
|
||||
{
|
||||
uint32 type;
|
||||
uint32 id;
|
||||
uint32 value;
|
||||
} immunity;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 quickChange;
|
||||
} orientation;
|
||||
struct
|
||||
{
|
||||
uint32 quickChange;
|
||||
} orientation;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 stopMovement;
|
||||
uint32 movementExpired;
|
||||
} stopMotion;
|
||||
struct
|
||||
{
|
||||
uint32 stopMovement;
|
||||
uint32 movementExpired;
|
||||
} stopMotion;
|
||||
|
||||
//! Note for any new future actions
|
||||
//! All parameters must have type uint32
|
||||
@@ -1206,20 +1206,20 @@ enum SMARTAI_TARGETS
|
||||
SMART_TARGET_THREAT_LIST = 24, // All units on creature's threat list, maxdist, playerOnly
|
||||
SMART_TARGET_CLOSEST_ENEMY = 25, // maxDist, playerOnly
|
||||
SMART_TARGET_CLOSEST_FRIENDLY = 26, // maxDist, playerOnly
|
||||
// RESERVED = 27,
|
||||
// RESERVED = 28,
|
||||
// RESERVED = 29,
|
||||
// RESERVED = 30,
|
||||
// RESERVED = 31,
|
||||
// RESERVED = 32,
|
||||
// RESERVED = 33,
|
||||
// RESERVED = 34,
|
||||
// RESERVED = 35,
|
||||
// RESERVED = 36,
|
||||
// RESERVED = 37,
|
||||
// RESERVED = 38,
|
||||
// RESERVED = 39,
|
||||
SMART_TARGET_FARTHEST = 40,
|
||||
// RESERVED = 27,
|
||||
// RESERVED = 28,
|
||||
// RESERVED = 29,
|
||||
// RESERVED = 30,
|
||||
// RESERVED = 31,
|
||||
// RESERVED = 32,
|
||||
// RESERVED = 33,
|
||||
// RESERVED = 34,
|
||||
// RESERVED = 35,
|
||||
// RESERVED = 36,
|
||||
// RESERVED = 37,
|
||||
// RESERVED = 38,
|
||||
// RESERVED = 39,
|
||||
SMART_TARGET_FARTHEST = 40,
|
||||
|
||||
SMART_TARGET_END = 41
|
||||
};
|
||||
@@ -1232,7 +1232,7 @@ struct SmartTarget
|
||||
raw.param1 = p1;
|
||||
raw.param2 = p2;
|
||||
raw.param3 = p3;
|
||||
raw.param4 = p4;
|
||||
raw.param4 = p4;
|
||||
x = 0.0f;
|
||||
y = 0.0f;
|
||||
z = 0.0f;
|
||||
@@ -1242,19 +1242,19 @@ struct SmartTarget
|
||||
float x, y, z, o;
|
||||
union
|
||||
{
|
||||
// Xinef: allow random selectors to limit distance
|
||||
struct
|
||||
// Xinef: allow random selectors to limit distance
|
||||
struct
|
||||
{
|
||||
uint32 maxDist;
|
||||
uint32 playerOnly;
|
||||
uint32 powerType;
|
||||
uint32 playerOnly;
|
||||
uint32 powerType;
|
||||
} hostilRandom;
|
||||
|
||||
struct
|
||||
struct
|
||||
{
|
||||
uint32 maxDist;
|
||||
uint32 playerOnly;
|
||||
uint32 isInLos;
|
||||
uint32 playerOnly;
|
||||
uint32 isInLos;
|
||||
} farthest;
|
||||
|
||||
struct
|
||||
@@ -1262,21 +1262,21 @@ struct SmartTarget
|
||||
uint32 creature;
|
||||
uint32 minDist;
|
||||
uint32 maxDist;
|
||||
uint32 livingState;
|
||||
uint32 livingState;
|
||||
} unitRange;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 dbGuid;
|
||||
uint32 entry;
|
||||
uint32 getFromHashMap; // Does not work in instances
|
||||
uint32 getFromHashMap; // Does not work in instances
|
||||
} unitGUID;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 creature;
|
||||
uint32 dist;
|
||||
uint32 livingState;
|
||||
uint32 livingState;
|
||||
} unitDistance;
|
||||
|
||||
struct
|
||||
@@ -1307,7 +1307,7 @@ struct SmartTarget
|
||||
{
|
||||
uint32 dbGuid;
|
||||
uint32 entry;
|
||||
uint32 getFromHashMap; // Does not work in instances
|
||||
uint32 getFromHashMap; // Does not work in instances
|
||||
} goGUID;
|
||||
|
||||
struct
|
||||
@@ -1321,10 +1321,10 @@ struct SmartTarget
|
||||
uint32 map;
|
||||
} position;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 useCharmerOrOwner;
|
||||
} owner;
|
||||
struct
|
||||
{
|
||||
uint32 useCharmerOrOwner;
|
||||
} owner;
|
||||
|
||||
struct
|
||||
{
|
||||
@@ -1350,7 +1350,7 @@ struct SmartTarget
|
||||
uint32 param1;
|
||||
uint32 param2;
|
||||
uint32 param3;
|
||||
uint32 param4;
|
||||
uint32 param4;
|
||||
} raw;
|
||||
};
|
||||
};
|
||||
@@ -1476,7 +1476,7 @@ const uint32 SmartAIEventMask[SMART_EVENT_END][2] =
|
||||
{SMART_EVENT_JUST_CREATED, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
|
||||
{SMART_EVENT_GOSSIP_HELLO, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
|
||||
{SMART_EVENT_FOLLOW_COMPLETED, SMART_SCRIPT_TYPE_MASK_CREATURE },
|
||||
{SMART_EVENT_UNUSED_66, 0},
|
||||
{SMART_EVENT_UNUSED_66, 0},
|
||||
{SMART_EVENT_IS_BEHIND_TARGET, SMART_SCRIPT_TYPE_MASK_CREATURE },
|
||||
{SMART_EVENT_GAME_EVENT_START, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
|
||||
{SMART_EVENT_GAME_EVENT_END, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
|
||||
|
||||
Reference in New Issue
Block a user