diff options
| author | megamage <none@none> | 2009-01-25 16:42:30 -0600 |
|---|---|---|
| committer | megamage <none@none> | 2009-01-25 16:42:30 -0600 |
| commit | d1f1e9a956935e5eccfb3057f7104f02db73660c (patch) | |
| tree | bef8da0683c2975d33334f6b6f3f4a4742aab90f /src/bindings/scripts/include | |
| parent | 04cf7fe22659714cbba974b8a69ef330b521d0a5 (diff) | |
| parent | 2ecd61f028b3bdbce1009eef0a4c47bc5fd4e6d2 (diff) | |
*Merge.
--HG--
branch : trunk
Diffstat (limited to 'src/bindings/scripts/include')
| -rw-r--r-- | src/bindings/scripts/include/sc_creature.cpp | 16 | ||||
| -rw-r--r-- | src/bindings/scripts/include/sc_creature.h | 12 |
2 files changed, 16 insertions, 12 deletions
diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp index d18a65f66f5..fdc0483c809 100644 --- a/src/bindings/scripts/include/sc_creature.cpp +++ b/src/bindings/scripts/include/sc_creature.cpp @@ -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; } diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h index cf991baa301..6f60f8cf334 100644 --- a/src/bindings/scripts/include/sc_creature.h +++ b/src/bindings/scripts/include/sc_creature.h @@ -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); |
