mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +01:00
*Merge.
--HG-- branch : trunk
This commit is contained in:
@@ -761,21 +761,25 @@ void ScriptedAI::DoTeleportAll(float x, float y, float z, float o)
|
||||
i_pl->TeleportTo(m_creature->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT);
|
||||
}
|
||||
|
||||
Unit* ScriptedAI::FindCreature(uint32 entry, float range)
|
||||
{
|
||||
Unit* FindCreature(uint32 entry, float range, Unit* Finder)
|
||||
{
|
||||
if(!Finder)
|
||||
return NULL;
|
||||
Creature* target = NULL;
|
||||
Trinity::AllCreaturesOfEntryInRange check(m_creature, entry, range);
|
||||
Trinity::AllCreaturesOfEntryInRange check(Finder, entry, range);
|
||||
Trinity::CreatureSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(target, check);
|
||||
m_creature->VisitNearbyObject(range, searcher);
|
||||
Finder->VisitNearbyObject(range, searcher);
|
||||
return target;
|
||||
}
|
||||
|
||||
GameObject* ScriptedAI::FindGameObject(uint32 entry, float range)
|
||||
GameObject* FindGameObject(uint32 entry, float range, Unit* Finder)
|
||||
{
|
||||
if(!Finder)
|
||||
return NULL;
|
||||
GameObject* target = NULL;
|
||||
Trinity::AllGameObjectsWithEntryInGrid go_check(entry);
|
||||
Trinity::GameObjectSearcher<Trinity::AllGameObjectsWithEntryInGrid> searcher(target, go_check);
|
||||
m_creature->VisitNearbyGridObject(range, searcher);
|
||||
Finder->VisitNearbyGridObject(range, searcher);
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,12 @@ private:
|
||||
Creature *m_creature;
|
||||
};
|
||||
|
||||
//Get a single creature of given entry
|
||||
Unit* FindCreature(uint32 entry, float range, Unit* Finder);
|
||||
|
||||
//Get a single gameobject of given entry
|
||||
GameObject* FindGameObject(uint32 entry, float range, Unit* Finder);
|
||||
|
||||
struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
|
||||
{
|
||||
ScriptedAI(Creature* creature) : m_creature(creature), InCombat(false), IsFleeing(false) {}
|
||||
@@ -153,12 +159,6 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
|
||||
void DoTeleportPlayer(Unit* pUnit, float x, float y, float z, float o);
|
||||
void DoTeleportAll(float x, float y, float z, float o);
|
||||
|
||||
//Get a single creature of given entry
|
||||
Unit* FindCreature(uint32 entry, float range);
|
||||
|
||||
//Get a single gameobject of given entry
|
||||
GameObject* FindGameObject(uint32 entry, float range);
|
||||
|
||||
//Returns friendly unit with the most amount of hp missing from max hp
|
||||
Unit* DoSelectLowestHpFriendly(float range, uint32 MinHPDiff = 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user