Scripts/SmartAI: Some clean-up work:
- NULL -> nullptr - Rename "AssistPlayerInCombat(who)" to "AssistPlayerInCombatAgainst(who)" to reflect what the method actually does - Code style No functionality was changed.
This commit is contained in:
1 parent
11f46f2030
commit
f8862f19f5
8 files changed
+45
-73
No files matched your search
@@ -66,7 +66,7 @@ void npc_escortAI::AttackStart(Unit* who)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//see followerAI
|
//see followerAI
|
||||||
bool npc_escortAI::AssistPlayerInCombat(Unit* who)
|
bool npc_escortAI::AssistPlayerInCombatAgainst(Unit* who)
|
||||||
{
|
{
|
||||||
if (!who || !who->GetVictim())
|
if (!who || !who->GetVictim())
|
||||||
return false;
|
return false;
|
||||||
@@ -107,7 +107,7 @@ void npc_escortAI::MoveInLineOfSight(Unit* who)
|
|||||||
{
|
{
|
||||||
if (me->HasReactState(REACT_AGGRESSIVE) && !me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me))
|
if (me->HasReactState(REACT_AGGRESSIVE) && !me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me))
|
||||||
{
|
{
|
||||||
if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombat(who))
|
if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombatAgainst(who))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
|
if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ struct npc_escortAI : public ScriptedAI
|
|||||||
Player* GetPlayerForEscort() { return ObjectAccessor::GetPlayer(*me, m_uiPlayerGUID); }
|
Player* GetPlayerForEscort() { return ObjectAccessor::GetPlayer(*me, m_uiPlayerGUID); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool AssistPlayerInCombat(Unit* who);
|
bool AssistPlayerInCombatAgainst(Unit* who);
|
||||||
bool IsPlayerOrGroupInRange();
|
bool IsPlayerOrGroupInRange();
|
||||||
void FillPointMovementListForCreature();
|
void FillPointMovementListForCreature();
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ void FollowerAI::AttackStart(Unit* who)
|
|||||||
//This part provides assistance to a player that are attacked by who, even if out of normal aggro range
|
//This part provides assistance to a player that are attacked by who, even if out of normal aggro range
|
||||||
//It will cause me to attack who that are attacking _any_ player (which has been confirmed may happen also on offi)
|
//It will cause me to attack who that are attacking _any_ player (which has been confirmed may happen also on offi)
|
||||||
//The flag (type_flag) is unconfirmed, but used here for further research and is a good candidate.
|
//The flag (type_flag) is unconfirmed, but used here for further research and is a good candidate.
|
||||||
bool FollowerAI::AssistPlayerInCombat(Unit* who)
|
bool FollowerAI::AssistPlayerInCombatAgainst(Unit* who)
|
||||||
{
|
{
|
||||||
if (!who || !who->GetVictim())
|
if (!who || !who->GetVictim())
|
||||||
return false;
|
return false;
|
||||||
@@ -104,7 +104,7 @@ void FollowerAI::MoveInLineOfSight(Unit* who)
|
|||||||
{
|
{
|
||||||
if (me->HasReactState(REACT_AGGRESSIVE) && !me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me))
|
if (me->HasReactState(REACT_AGGRESSIVE) && !me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me))
|
||||||
{
|
{
|
||||||
if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombat(who))
|
if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombatAgainst(who))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
|
if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class FollowerAI : public ScriptedAI
|
|||||||
void AddFollowState(uint32 uiFollowState) { m_uiFollowState |= uiFollowState; }
|
void AddFollowState(uint32 uiFollowState) { m_uiFollowState |= uiFollowState; }
|
||||||
void RemoveFollowState(uint32 uiFollowState) { m_uiFollowState &= ~uiFollowState; }
|
void RemoveFollowState(uint32 uiFollowState) { m_uiFollowState &= ~uiFollowState; }
|
||||||
|
|
||||||
bool AssistPlayerInCombat(Unit* who);
|
bool AssistPlayerInCombatAgainst(Unit* who);
|
||||||
|
|
||||||
ObjectGuid m_uiLeaderGUID;
|
ObjectGuid m_uiLeaderGUID;
|
||||||
uint32 m_uiUpdateFollowTimer;
|
uint32 m_uiUpdateFollowTimer;
|
||||||
|
|||||||
@@ -30,12 +30,12 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
|
|||||||
{
|
{
|
||||||
// copy script to local (protection for table reload)
|
// copy script to local (protection for table reload)
|
||||||
|
|
||||||
mWayPoints = NULL;
|
mWayPoints = nullptr;
|
||||||
mEscortState = SMART_ESCORT_NONE;
|
mEscortState = SMART_ESCORT_NONE;
|
||||||
mCurrentWPID = 0;//first wp id is 1 !!
|
mCurrentWPID = 0;//first wp id is 1 !!
|
||||||
mWPReached = false;
|
mWPReached = false;
|
||||||
mWPPauseTimer = 0;
|
mWPPauseTimer = 0;
|
||||||
mLastWP = NULL;
|
mLastWP = nullptr;
|
||||||
|
|
||||||
mCanRepeatPath = false;
|
mCanRepeatPath = false;
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ void SmartAI::UpdateDespawn(const uint32 diff)
|
|||||||
WayPoint* SmartAI::GetNextWayPoint()
|
WayPoint* SmartAI::GetNextWayPoint()
|
||||||
{
|
{
|
||||||
if (!mWayPoints || mWayPoints->empty())
|
if (!mWayPoints || mWayPoints->empty())
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
mCurrentWPID++;
|
mCurrentWPID++;
|
||||||
WPPath::const_iterator itr = mWayPoints->find(mCurrentWPID);
|
WPPath::const_iterator itr = mWayPoints->find(mCurrentWPID);
|
||||||
@@ -103,7 +103,7 @@ WayPoint* SmartAI::GetNextWayPoint()
|
|||||||
}
|
}
|
||||||
return (*itr).second;
|
return (*itr).second;
|
||||||
}
|
}
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* /*invoker*/)
|
void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* /*invoker*/)
|
||||||
@@ -130,7 +130,7 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* /*invoker*/)
|
|||||||
{
|
{
|
||||||
mLastOOCPos = me->GetPosition();
|
mLastOOCPos = me->GetPosition();
|
||||||
me->GetMotionMaster()->MovePoint(wp->id, wp->x, wp->y, wp->z);
|
me->GetMotionMaster()->MovePoint(wp->id, wp->x, wp->y, wp->z);
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, NULL, wp->id, GetScript()->GetPathId());
|
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_START, nullptr, wp->id, GetScript()->GetPathId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ void SmartAI::PausePath(uint32 delay, bool forced)
|
|||||||
me->StopMoving();//force stop
|
me->StopMoving();//force stop
|
||||||
me->GetMotionMaster()->MoveIdle();//force stop
|
me->GetMotionMaster()->MoveIdle();//force stop
|
||||||
}
|
}
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_PAUSED, NULL, mLastWP->id, GetScript()->GetPathId());
|
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_PAUSED, nullptr, mLastWP->id, GetScript()->GetPathId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartAI::StopPath(uint32 DespawnTime, uint32 quest, bool fail)
|
void SmartAI::StopPath(uint32 DespawnTime, uint32 quest, bool fail)
|
||||||
@@ -183,19 +183,19 @@ void SmartAI::StopPath(uint32 DespawnTime, uint32 quest, bool fail)
|
|||||||
mLastOOCPos = me->GetPosition();
|
mLastOOCPos = me->GetPosition();
|
||||||
me->StopMoving();//force stop
|
me->StopMoving();//force stop
|
||||||
me->GetMotionMaster()->MoveIdle();
|
me->GetMotionMaster()->MoveIdle();
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_STOPPED, NULL, mLastWP->id, GetScript()->GetPathId());
|
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_STOPPED, nullptr, mLastWP->id, GetScript()->GetPathId());
|
||||||
EndPath(fail);
|
EndPath(fail);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartAI::EndPath(bool fail)
|
void SmartAI::EndPath(bool fail)
|
||||||
{
|
{
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, NULL, mLastWP->id, GetScript()->GetPathId());
|
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, nullptr, mLastWP->id, GetScript()->GetPathId());
|
||||||
|
|
||||||
RemoveEscortState(SMART_ESCORT_ESCORTING | SMART_ESCORT_PAUSED | SMART_ESCORT_RETURNING);
|
RemoveEscortState(SMART_ESCORT_ESCORTING | SMART_ESCORT_PAUSED | SMART_ESCORT_RETURNING);
|
||||||
mWayPoints = NULL;
|
mWayPoints = nullptr;
|
||||||
mCurrentWPID = 0;
|
mCurrentWPID = 0;
|
||||||
mWPPauseTimer = 0;
|
mWPPauseTimer = 0;
|
||||||
mLastWP = NULL;
|
mLastWP = nullptr;
|
||||||
|
|
||||||
if (mCanRepeatPath)
|
if (mCanRepeatPath)
|
||||||
StartPath(mRun, GetScript()->GetPathId(), true);
|
StartPath(mRun, GetScript()->GetPathId(), true);
|
||||||
@@ -216,7 +216,7 @@ void SmartAI::EndPath(bool fail)
|
|||||||
|
|
||||||
if (Group* group = player->GetGroup())
|
if (Group* group = player->GetGroup())
|
||||||
{
|
{
|
||||||
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
|
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next())
|
||||||
{
|
{
|
||||||
Player* groupGuy = groupRef->GetSource();
|
Player* groupGuy = groupRef->GetSource();
|
||||||
|
|
||||||
@@ -226,7 +226,8 @@ void SmartAI::EndPath(bool fail)
|
|||||||
groupGuy->FailQuest(mEscortQuestID);
|
groupGuy->FailQuest(mEscortQuestID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
for (ObjectList::iterator iter = targets->begin(); iter != targets->end(); ++iter)
|
for (ObjectList::iterator iter = targets->begin(); iter != targets->end(); ++iter)
|
||||||
{
|
{
|
||||||
@@ -278,7 +279,7 @@ void SmartAI::UpdatePath(const uint32 diff)
|
|||||||
{
|
{
|
||||||
if (!me->IsInCombat() && !HasEscortState(SMART_ESCORT_RETURNING) && (mWPReached || mLastWPIDReached == SMART_ESCORT_LAST_OOC_POINT || mForcedPaused))
|
if (!me->IsInCombat() && !HasEscortState(SMART_ESCORT_RETURNING) && (mWPReached || mLastWPIDReached == SMART_ESCORT_LAST_OOC_POINT || mForcedPaused))
|
||||||
{
|
{
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_RESUMED, NULL, mLastWP->id, GetScript()->GetPathId());
|
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_RESUMED, nullptr, mLastWP->id, GetScript()->GetPathId());
|
||||||
RemoveEscortState(SMART_ESCORT_PAUSED);
|
RemoveEscortState(SMART_ESCORT_PAUSED);
|
||||||
if (mForcedPaused)// if paused between 2 wps resend movement
|
if (mForcedPaused)// if paused between 2 wps resend movement
|
||||||
{
|
{
|
||||||
@@ -365,7 +366,7 @@ bool SmartAI::IsEscortInvokerInRange()
|
|||||||
|
|
||||||
if (Group* group = player->GetGroup())
|
if (Group* group = player->GetGroup())
|
||||||
{
|
{
|
||||||
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
|
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next())
|
||||||
{
|
{
|
||||||
Player* groupGuy = groupRef->GetSource();
|
Player* groupGuy = groupRef->GetSource();
|
||||||
|
|
||||||
@@ -373,7 +374,8 @@ bool SmartAI::IsEscortInvokerInRange()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
for (ObjectList::iterator iter = targets->begin(); iter != targets->end(); ++iter)
|
for (ObjectList::iterator iter = targets->begin(); iter != targets->end(); ++iter)
|
||||||
{
|
{
|
||||||
@@ -391,7 +393,7 @@ bool SmartAI::IsEscortInvokerInRange()
|
|||||||
void SmartAI::MovepointReached(uint32 id)
|
void SmartAI::MovepointReached(uint32 id)
|
||||||
{
|
{
|
||||||
if (id != SMART_ESCORT_LAST_OOC_POINT && mLastWPIDReached != id)
|
if (id != SMART_ESCORT_LAST_OOC_POINT && mLastWPIDReached != id)
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_REACHED, NULL, id);
|
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_REACHED, nullptr, id);
|
||||||
|
|
||||||
mLastWPIDReached = id;
|
mLastWPIDReached = id;
|
||||||
mWPReached = true;
|
mWPReached = true;
|
||||||
@@ -402,7 +404,7 @@ void SmartAI::MovementInform(uint32 MovementType, uint32 Data)
|
|||||||
if ((MovementType == POINT_MOTION_TYPE && Data == SMART_ESCORT_LAST_OOC_POINT) || MovementType == FOLLOW_MOTION_TYPE)
|
if ((MovementType == POINT_MOTION_TYPE && Data == SMART_ESCORT_LAST_OOC_POINT) || MovementType == FOLLOW_MOTION_TYPE)
|
||||||
me->ClearUnitState(UNIT_STATE_EVADE);
|
me->ClearUnitState(UNIT_STATE_EVADE);
|
||||||
|
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_MOVEMENTINFORM, NULL, MovementType, Data);
|
GetScript()->ProcessEventsFor(SMART_EVENT_MOVEMENTINFORM, nullptr, MovementType, Data);
|
||||||
if (MovementType != POINT_MOTION_TYPE || !HasEscortState(SMART_ESCORT_ESCORTING))
|
if (MovementType != POINT_MOTION_TYPE || !HasEscortState(SMART_ESCORT_ESCORTING))
|
||||||
return;
|
return;
|
||||||
MovepointReached(Data);
|
MovepointReached(Data);
|
||||||
@@ -448,7 +450,7 @@ void SmartAI::MoveInLineOfSight(Unit* who)
|
|||||||
|
|
||||||
GetScript()->OnMoveInLineOfSight(who);
|
GetScript()->OnMoveInLineOfSight(who);
|
||||||
|
|
||||||
if (AssistPlayerInCombat(who))
|
if (AssistPlayerInCombatAgainst(who))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CreatureAI::MoveInLineOfSight(who);
|
CreatureAI::MoveInLineOfSight(who);
|
||||||
@@ -459,7 +461,7 @@ bool SmartAI::CanAIAttack(const Unit* /*who*/) const
|
|||||||
return !(me->HasReactState(REACT_PASSIVE));
|
return !(me->HasReactState(REACT_PASSIVE));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SmartAI::AssistPlayerInCombat(Unit* who)
|
bool SmartAI::AssistPlayerInCombatAgainst(Unit* who)
|
||||||
{
|
{
|
||||||
if (me->HasReactState(REACT_PASSIVE))
|
if (me->HasReactState(REACT_PASSIVE))
|
||||||
return false;
|
return false;
|
||||||
@@ -627,7 +629,7 @@ void SmartAI::UpdateAIWhileCharmed(const uint32 /*diff*/) { }
|
|||||||
|
|
||||||
void SmartAI::CorpseRemoved(uint32& respawnDelay)
|
void SmartAI::CorpseRemoved(uint32& respawnDelay)
|
||||||
{
|
{
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_CORPSE_REMOVED, NULL, respawnDelay);
|
GetScript()->ProcessEventsFor(SMART_EVENT_CORPSE_REMOVED, nullptr, respawnDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartAI::PassengerBoarded(Unit* who, int8 seatId, bool apply)
|
void SmartAI::PassengerBoarded(Unit* who, int8 seatId, bool apply)
|
||||||
@@ -646,7 +648,7 @@ void SmartAI::InitializeAI()
|
|||||||
|
|
||||||
void SmartAI::OnCharmed(bool apply)
|
void SmartAI::OnCharmed(bool apply)
|
||||||
{
|
{
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_CHARMED, NULL, 0, 0, apply);
|
GetScript()->ProcessEventsFor(SMART_EVENT_CHARMED, nullptr, 0, 0, apply);
|
||||||
|
|
||||||
if (!apply && !me->IsInEvadeMode())
|
if (!apply && !me->IsInEvadeMode())
|
||||||
if (Unit* charmer = me->GetCharmer())
|
if (Unit* charmer = me->GetCharmer())
|
||||||
@@ -655,7 +657,7 @@ void SmartAI::OnCharmed(bool apply)
|
|||||||
|
|
||||||
void SmartAI::DoAction(int32 param)
|
void SmartAI::DoAction(int32 param)
|
||||||
{
|
{
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_ACTION_DONE, NULL, param);
|
GetScript()->ProcessEventsFor(SMART_EVENT_ACTION_DONE, nullptr, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 SmartAI::GetData(uint32 /*id*/) const
|
uint32 SmartAI::GetData(uint32 /*id*/) const
|
||||||
@@ -665,7 +667,7 @@ uint32 SmartAI::GetData(uint32 /*id*/) const
|
|||||||
|
|
||||||
void SmartAI::SetData(uint32 id, uint32 value)
|
void SmartAI::SetData(uint32 id, uint32 value)
|
||||||
{
|
{
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_DATA_SET, NULL, id, value);
|
GetScript()->ProcessEventsFor(SMART_EVENT_DATA_SET, nullptr, id, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartAI::SetGUID(ObjectGuid /*guid*/, int32 /*id*/) { }
|
void SmartAI::SetGUID(ObjectGuid /*guid*/, int32 /*id*/) { }
|
||||||
@@ -799,7 +801,7 @@ void SmartAI::SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker)
|
|||||||
|
|
||||||
void SmartAI::sOnGameEvent(bool start, uint16 eventId)
|
void SmartAI::sOnGameEvent(bool start, uint16 eventId)
|
||||||
{
|
{
|
||||||
GetScript()->ProcessEventsFor(start ? SMART_EVENT_GAME_EVENT_START : SMART_EVENT_GAME_EVENT_END, NULL, eventId);
|
GetScript()->ProcessEventsFor(start ? SMART_EVENT_GAME_EVENT_START : SMART_EVENT_GAME_EVENT_END, nullptr, eventId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartAI::OnSpellClick(Unit* clicker, bool& result)
|
void SmartAI::OnSpellClick(Unit* clicker, bool& result)
|
||||||
@@ -838,14 +840,14 @@ void SmartGameObjectAI::Reset()
|
|||||||
bool SmartGameObjectAI::GossipHello(Player* player)
|
bool SmartGameObjectAI::GossipHello(Player* player)
|
||||||
{
|
{
|
||||||
TC_LOG_DEBUG("scripts.ai", "SmartGameObjectAI::GossipHello");
|
TC_LOG_DEBUG("scripts.ai", "SmartGameObjectAI::GossipHello");
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_GOSSIP_HELLO, player, 0, 0, false, NULL, go);
|
GetScript()->ProcessEventsFor(SMART_EVENT_GOSSIP_HELLO, player, 0, 0, false, nullptr, go);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when a player selects a gossip item in the gameobject's gossip menu.
|
// Called when a player selects a gossip item in the gameobject's gossip menu.
|
||||||
bool SmartGameObjectAI::GossipSelect(Player* player, uint32 sender, uint32 action)
|
bool SmartGameObjectAI::GossipSelect(Player* player, uint32 sender, uint32 action)
|
||||||
{
|
{
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_GOSSIP_SELECT, player, sender, action, false, NULL, go);
|
GetScript()->ProcessEventsFor(SMART_EVENT_GOSSIP_SELECT, player, sender, action, false, nullptr, go);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -858,26 +860,26 @@ bool SmartGameObjectAI::GossipSelectCode(Player* /*player*/, uint32 /*sender*/,
|
|||||||
// Called when a player accepts a quest from the gameobject.
|
// Called when a player accepts a quest from the gameobject.
|
||||||
bool SmartGameObjectAI::QuestAccept(Player* player, Quest const* quest)
|
bool SmartGameObjectAI::QuestAccept(Player* player, Quest const* quest)
|
||||||
{
|
{
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_ACCEPTED_QUEST, player, quest->GetQuestId(), 0, false, NULL, go);
|
GetScript()->ProcessEventsFor(SMART_EVENT_ACCEPTED_QUEST, player, quest->GetQuestId(), 0, false, nullptr, go);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when a player selects a quest reward.
|
// Called when a player selects a quest reward.
|
||||||
bool SmartGameObjectAI::QuestReward(Player* player, Quest const* quest, uint32 opt)
|
bool SmartGameObjectAI::QuestReward(Player* player, Quest const* quest, uint32 opt)
|
||||||
{
|
{
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_REWARD_QUEST, player, quest->GetQuestId(), opt, false, NULL, go);
|
GetScript()->ProcessEventsFor(SMART_EVENT_REWARD_QUEST, player, quest->GetQuestId(), opt, false, nullptr, go);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the gameobject is destroyed (destructible buildings only).
|
// Called when the gameobject is destroyed (destructible buildings only).
|
||||||
void SmartGameObjectAI::Destroyed(Player* player, uint32 eventId)
|
void SmartGameObjectAI::Destroyed(Player* player, uint32 eventId)
|
||||||
{
|
{
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, player, eventId, 0, false, NULL, go);
|
GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, player, eventId, 0, false, nullptr, go);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartGameObjectAI::SetData(uint32 id, uint32 value)
|
void SmartGameObjectAI::SetData(uint32 id, uint32 value)
|
||||||
{
|
{
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_DATA_SET, NULL, id, value);
|
GetScript()->ProcessEventsFor(SMART_EVENT_DATA_SET, nullptr, id, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartGameObjectAI::SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker)
|
void SmartGameObjectAI::SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker)
|
||||||
@@ -889,7 +891,7 @@ void SmartGameObjectAI::SetScript9(SmartScriptHolder& e, uint32 entry, Unit* inv
|
|||||||
|
|
||||||
void SmartGameObjectAI::OnGameEvent(bool start, uint16 eventId)
|
void SmartGameObjectAI::OnGameEvent(bool start, uint16 eventId)
|
||||||
{
|
{
|
||||||
GetScript()->ProcessEventsFor(start ? SMART_EVENT_GAME_EVENT_START : SMART_EVENT_GAME_EVENT_END, NULL, eventId);
|
GetScript()->ProcessEventsFor(start ? SMART_EVENT_GAME_EVENT_START : SMART_EVENT_GAME_EVENT_END, nullptr, eventId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartGameObjectAI::OnStateChanged(uint32 state, Unit* unit)
|
void SmartGameObjectAI::OnStateChanged(uint32 state, Unit* unit)
|
||||||
@@ -899,7 +901,7 @@ void SmartGameObjectAI::OnStateChanged(uint32 state, Unit* unit)
|
|||||||
|
|
||||||
void SmartGameObjectAI::EventInform(uint32 eventId)
|
void SmartGameObjectAI::EventInform(uint32 eventId)
|
||||||
{
|
{
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_GO_EVENT_INFORM, NULL, eventId);
|
GetScript()->ProcessEventsFor(SMART_EVENT_GO_EVENT_INFORM, nullptr, eventId);
|
||||||
}
|
}
|
||||||
|
|
||||||
class SmartTrigger : public AreaTriggerScript
|
class SmartTrigger : public AreaTriggerScript
|
||||||
@@ -915,7 +917,7 @@ class SmartTrigger : public AreaTriggerScript
|
|||||||
|
|
||||||
TC_LOG_DEBUG("scripts.ai", "AreaTrigger %u is using SmartTrigger script", trigger->id);
|
TC_LOG_DEBUG("scripts.ai", "AreaTrigger %u is using SmartTrigger script", trigger->id);
|
||||||
SmartScript script;
|
SmartScript script;
|
||||||
script.OnInitialize(NULL, trigger);
|
script.OnInitialize(nullptr, trigger);
|
||||||
script.ProcessEventsFor(SMART_EVENT_AREATRIGGER_ONTRIGGER, player, trigger->id);
|
script.ProcessEventsFor(SMART_EVENT_AREATRIGGER_ONTRIGGER, player, trigger->id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class SmartAI : public CreatureAI
|
|||||||
explicit SmartAI(Creature* c);
|
explicit SmartAI(Creature* c);
|
||||||
|
|
||||||
// Start moving to the desired MovePoint
|
// Start moving to the desired MovePoint
|
||||||
void StartPath(bool run = false, uint32 path = 0, bool repeat = false, Unit* invoker = NULL);
|
void StartPath(bool run = false, uint32 path = 0, bool repeat = false, Unit* invoker = nullptr);
|
||||||
bool LoadPath(uint32 entry);
|
bool LoadPath(uint32 entry);
|
||||||
void PausePath(uint32 delay, bool forced = false);
|
void PausePath(uint32 delay, bool forced = false);
|
||||||
void StopPath(uint32 DespawnTime = 0, uint32 quest = 0, bool fail = false);
|
void StopPath(uint32 DespawnTime = 0, uint32 quest = 0, bool fail = false);
|
||||||
@@ -75,7 +75,7 @@ class SmartAI : public CreatureAI
|
|||||||
// Called at reaching home after evade, InitializeAI(), EnterEvadeMode() for resetting variables
|
// Called at reaching home after evade, InitializeAI(), EnterEvadeMode() for resetting variables
|
||||||
void JustReachedHome() override;
|
void JustReachedHome() override;
|
||||||
|
|
||||||
// Called for reaction at enter to combat if not in combat yet (enemy can be NULL)
|
// Called for reaction at enter to combat if not in combat yet (enemy can be nullptr)
|
||||||
void EnterCombat(Unit* enemy) override;
|
void EnterCombat(Unit* enemy) override;
|
||||||
|
|
||||||
// Called for reaction at stopping attack at no attackers or targets
|
// Called for reaction at stopping attack at no attackers or targets
|
||||||
@@ -221,7 +221,7 @@ class SmartAI : public CreatureAI
|
|||||||
bool mCanCombatMove;
|
bool mCanCombatMove;
|
||||||
bool mForcedPaused;
|
bool mForcedPaused;
|
||||||
uint32 mInvincibilityHpLevel;
|
uint32 mInvincibilityHpLevel;
|
||||||
bool AssistPlayerInCombat(Unit* who);
|
bool AssistPlayerInCombatAgainst(Unit* who);
|
||||||
|
|
||||||
uint32 mDespawnTime;
|
uint32 mDespawnTime;
|
||||||
uint32 mDespawnState;
|
uint32 mDespawnState;
|
||||||
|
|||||||
@@ -3613,36 +3613,6 @@ void SmartScript::OnMoveInLineOfSight(Unit* who)
|
|||||||
|
|
||||||
ProcessEventsFor(me->IsInCombat() ? SMART_EVENT_IC_LOS : SMART_EVENT_OOC_LOS, who);
|
ProcessEventsFor(me->IsInCombat() ? SMART_EVENT_IC_LOS : SMART_EVENT_OOC_LOS, who);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void SmartScript::UpdateAIWhileCharmed(const uint32 diff) { }
|
|
||||||
|
|
||||||
void SmartScript::DoAction(const int32 param) { }
|
|
||||||
|
|
||||||
uint32 SmartScript::GetData(uint32 id)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SmartScript::SetData(uint32 id, uint32 value) { }
|
|
||||||
|
|
||||||
void SmartScript::SetGUID(uint64 guid, int32 id) { }
|
|
||||||
|
|
||||||
uint64 SmartScript::GetGUID(int32 id)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SmartScript::MovepointStart(uint32 id) { }
|
|
||||||
|
|
||||||
void SmartScript::SetRun(bool run) { }
|
|
||||||
|
|
||||||
void SmartScript::SetMovePathEndAction(SMART_ACTION action) { }
|
|
||||||
|
|
||||||
uint32 SmartScript::DoChat(int8 id, uint64 whisperGuid)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}*/
|
|
||||||
// SmartScript end
|
// SmartScript end
|
||||||
|
|
||||||
Unit* SmartScript::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff)
|
Unit* SmartScript::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff)
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ class SmartScript
|
|||||||
ObjectListMap::iterator itr = mTargetStorage->find(id);
|
ObjectListMap::iterator itr = mTargetStorage->find(id);
|
||||||
if (itr != mTargetStorage->end())
|
if (itr != mTargetStorage->end())
|
||||||
return (*itr).second->GetObjectList();
|
return (*itr).second->GetObjectList();
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StoreCounter(uint32 id, uint32 value, uint32 reset)
|
void StoreCounter(uint32 id, uint32 value, uint32 reset)
|
||||||
|
|||||||
Reference in new issue
Block a user