aboutsummaryrefslogtreecommitdiff
path: root/src/bindings/scripts
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-29 16:49:28 -0500
committermegamage <none@none>2009-05-29 16:49:28 -0500
commit89f4c1c444b9a0b090d71667c26f05165394a594 (patch)
treeb70b3583bba1a1341f1e371e9a9a1956dc1377c0 /src/bindings/scripts
parent3faa712d429fe5e352b73a6e5e524a2d1f4630d7 (diff)
*Add function FindNearestCreature and FindNearestGameObject to replace old FindCreature and FindGameObject
--HG-- branch : trunk
Diffstat (limited to 'src/bindings/scripts')
-rw-r--r--src/bindings/scripts/include/sc_creature.cpp22
-rw-r--r--src/bindings/scripts/include/sc_creature.h7
-rw-r--r--src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_elder_nadox.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp6
-rw-r--r--src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp6
-rw-r--r--src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp6
-rw-r--r--src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp16
-rw-r--r--src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp16
-rw-r--r--src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp5
-rw-r--r--src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/utgarde_keep.cpp2
19 files changed, 42 insertions, 72 deletions
diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp
index 347330c2006..b0ff9d48584 100644
--- a/src/bindings/scripts/include/sc_creature.cpp
+++ b/src/bindings/scripts/include/sc_creature.cpp
@@ -507,28 +507,6 @@ 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* FindCreature(uint32 entry, float range, Unit* Finder)
-{
- if(!Finder)
- return NULL;
- Creature* target = NULL;
- Trinity::AllCreaturesOfEntryInRange check(Finder, entry, range);
- Trinity::CreatureSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(Finder, target, check);
- Finder->VisitNearbyObject(range, searcher);
- return target;
-}
-
-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(Finder, target, go_check);
- Finder->VisitNearbyGridObject(range, searcher);
- return target;
-}
-
Unit* ScriptedAI::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff)
{
Unit* pUnit = NULL;
diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h
index 88801227493..3eef1db1947 100644
--- a/src/bindings/scripts/include/sc_creature.h
+++ b/src/bindings/scripts/include/sc_creature.h
@@ -29,13 +29,6 @@ class SummonList : private std::list<uint64>
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 PointMovement
{
uint32 m_uiCreatureEntry;
diff --git a/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp b/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp
index edf762360ad..76fdba757d2 100644
--- a/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp
+++ b/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp
@@ -183,7 +183,7 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI
{
case 0: {
m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
- GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature);
+ GameObject* Cage = m_creature->FindNearestGameObject(GO_CAGE, 20);
if(Cage)
Cage->SetGoState(GO_STATE_ACTIVE);
break;}
@@ -213,7 +213,7 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI
if (!IsBeingEscorted)
m_creature->setFaction(1602);
- GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature);
+ GameObject* Cage = m_creature->FindNearestGameObject(GO_CAGE, 20);
if(Cage)
Cage->SetGoState(GO_STATE_READY);
}
diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp
index 739bde2b650..654a0c802d6 100644
--- a/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp
+++ b/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp
@@ -240,7 +240,7 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI
{
DoCast(m_creature->getVictim(),SPELL_ARCANE_BOLT);
ArcaneBolt_Timer = 2000 + rand()%2500;
- Unit *shaffar = FindCreature(ENTRY_SHAFFAR, 100, m_creature);
+ Unit *shaffar = m_creature->FindNearestCreature(ENTRY_SHAFFAR, 100);
if(!shaffar || shaffar->isDead())
{
m_creature->SetVisibility(VISIBILITY_OFF);
diff --git a/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_elder_nadox.cpp b/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_elder_nadox.cpp
index 02839b58b68..f2c21be08c5 100644
--- a/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_elder_nadox.cpp
+++ b/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_elder_nadox.cpp
@@ -121,7 +121,7 @@ struct TRINITY_DLL_DECL boss_elder_nadoxAI : public ScriptedAI
if(HeroicMode)
if(rage_Timer < diff)
{
- Unit* Swarmer = FindCreature(MOB_AHNKAHAR_SWARMER,35,m_creature);
+ Unit* Swarmer = m_creature->FindNearestCreature(MOB_AHNKAHAR_SWARMER, 35);
if(Swarmer)
{
diff --git a/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp b/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp
index 68b0c32600f..4ae561d483c 100644
--- a/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp
+++ b/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp
@@ -443,7 +443,7 @@ struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI
case 10: DoScriptText(SAY_PROGRESS_3, m_creature, player);
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break;
case 20:{
- Unit* Mercenary = FindCreature(MOB_MERCENARY, 99, m_creature);
+ Unit* Mercenary = m_creature->FindNearestCreature(MOB_MERCENARY, 99);
if(Mercenary)
{
DoScriptText(SAY_MERCENARY_4, Mercenary);
diff --git a/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp b/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp
index 55ed80e3c5e..1dd15dd9a46 100644
--- a/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp
+++ b/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp
@@ -266,7 +266,7 @@ void npc_unworthy_initiateAI::UpdateAI(const uint32 diff)
for(int i = 0; i < 12; i++)
{
GameObject* temp_prison;
- temp_prison = FindGameObject(acherus_soul_prison[i],30,m_creature);
+ temp_prison = me->FindNearestGameObject(acherus_soul_prison[i],30);
if(!temp_prison) return;
if(dist == 99 || dist > m_creature->GetDistance2d(temp_prison))
{
@@ -363,7 +363,7 @@ bool GOHello_go_acherus_soul_prison(Player *player, GameObject* _GO)
Creature* finder = player->SummonCreature(WORLD_TRIGGER,_GO->GetPositionX(),_GO->GetPositionY(),_GO->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,2000);
if(!finder) return false;
- Unit* prison_anchor = FindCreature(29521,5,finder);
+ Unit* prison_anchor = finder->FindNearestCreature(29521, 15);
if(!prison_anchor) return false;
uint64 owner = ((npc_unworthy_initiate_anchorAI*)((Creature*)prison_anchor)->AI())->GetTarget();
diff --git a/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp b/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp
index fe019f30675..c0733579f27 100644
--- a/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp
+++ b/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp
@@ -169,7 +169,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI
case 0:
{
m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
- GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature);
+ GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20);
if(Cage)
Cage->SetGoState(GO_STATE_ACTIVE);
DoScriptText(SAY_START, m_creature, player);
@@ -207,7 +207,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI
case 33:
m_creature->SetOrientation(5.858011);
DoScriptText(SAY_END2, m_creature, player);
- Unit* CaptainHelios = FindCreature(NPC_CAPTAIN_HELIOS, 50, m_creature);
+ Unit* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50);
if(CaptainHelios)
DoScriptText(SAY_CAPTAIN_ANSWER, CaptainHelios, player);
break;
@@ -221,7 +221,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI
if (!IsBeingEscorted)
m_creature->setFaction(1602);
- GameObject* Cage = FindGameObject(GO_CAGE, 20, m_creature);
+ GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20);
if(Cage)
Cage->SetGoState(GO_STATE_READY);
}
diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp
index e1365a05a77..f274693d10e 100644
--- a/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp
+++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp
@@ -291,7 +291,7 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI
void EnterCombat(Unit* who)
{
- if(Creature *Kelidan = (Creature *)FindCreature(ENTRY_KELIDAN, 100, m_creature))
+ if(Creature *Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100))
((boss_kelidan_the_breakerAI*)Kelidan->AI())->ChannelerEngaged(who);
if (m_creature->IsNonMeleeSpellCasted(false))
m_creature->InterruptNonMeleeSpells(true);
@@ -300,7 +300,7 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI
void JustDied(Unit* Killer)
{
- if(Creature *Kelidan = (Creature *)FindCreature(ENTRY_KELIDAN, 100, m_creature))
+ if(Creature *Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100))
((boss_kelidan_the_breakerAI*)Kelidan->AI())->ChannelerDied(Killer);
}
@@ -311,7 +311,7 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI
if(check_Timer < diff)
{
if (!m_creature->IsNonMeleeSpellCasted(false))
- if(Creature *Kelidan = (Creature *)FindCreature(ENTRY_KELIDAN, 100, m_creature))
+ if(Creature *Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100))
{
uint64 channeler = ((boss_kelidan_the_breakerAI*)Kelidan->AI())->GetChanneled(m_creature);
if(Unit *channeled = Unit::GetUnit(*m_creature, channeler))
diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp
index 46e08c40432..89de9b9188d 100644
--- a/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp
+++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp
@@ -281,7 +281,7 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI
{
Creature *Nazan = Unit::GetCreature(*m_creature, NazanGUID);
Creature *Vazruden = Unit::GetCreature(*m_creature, VazrudenGUID);
- if(Nazan || (Nazan = (Creature *)FindCreature(ENTRY_NAZAN, 5000, m_creature)))
+ if(Nazan || (Nazan = me->FindNearestCreature(ENTRY_NAZAN, 5000)))
{
Nazan->SetLootRecipient(NULL);
Nazan->SetVisibility(VISIBILITY_OFF);
@@ -289,7 +289,7 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI
Nazan->RemoveCorpse();
NazanGUID = 0;
}
- if(Vazruden || (Vazruden = (Creature *)FindCreature(ENTRY_VAZRUDEN, 5000, m_creature)))
+ if(Vazruden || (Vazruden = me->FindNearestCreature(ENTRY_VAZRUDEN, 5000)))
{
Vazruden->SetLootRecipient(NULL);
Vazruden->SetVisibility(VISIBILITY_OFF);
@@ -423,7 +423,7 @@ struct TRINITY_DLL_DECL mob_hellfire_sentryAI : public ScriptedAI
void JustDied(Unit* who)
{
- if(Creature *herald = (Creature *)FindCreature(ENTRY_VAZRUDEN_HERALD,150, m_creature))
+ if(Creature *herald = me->FindNearestCreature(ENTRY_VAZRUDEN_HERALD,150))
((boss_vazruden_the_heraldAI *)herald->AI())->SentryDownBy(who);
}
diff --git a/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp b/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp
index 5cc797d52ff..1d27afe8977 100644
--- a/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp
+++ b/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp
@@ -115,7 +115,7 @@ struct TRINITY_DLL_DECL npc_greengill_slaveAI : public ScriptedAI
((Player*)plr)->KilledMonster(25086, m_creature->GetGUID());
}
DoCast(m_creature, ENRAGE);
- Unit* Myrmidon = FindCreature(DM, 70, m_creature);
+ Unit* Myrmidon = me->FindNearestCreature(DM, 70);
if(Myrmidon)
{
m_creature->AddThreat(Myrmidon, 100000.0f);
diff --git a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp
index 2581e9522ec..1b70d5b1dee 100644
--- a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp
+++ b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp
@@ -881,11 +881,11 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI
((Player*)player)->GroupEventHappens(Q_ALMABTRIEB, m_creature);
Completed = true;
}
- {Unit* Thadell = FindCreature(N_THADELL, 30, m_creature);
+ {Unit* Thadell = me->FindNearestCreature(N_THADELL, 30);
if(Thadell)
DoScriptText(SAY_THADELL_1, m_creature);}break;
case 13:
- {Unit* Thadell = FindCreature(N_THADELL, 30, m_creature);
+ {Unit* Thadell = me->FindNearestCreature(N_THADELL, 30);
if(Thadell)
DoScriptText(SAY_THADELL_2, m_creature, player);}break;
}
diff --git a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp
index 5231b95f73d..6ba339a4c4b 100644
--- a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp
+++ b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp
@@ -215,7 +215,7 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI
m_creature->setFaction(FACTION_FRIENDLY);
DoCast(caster, SPELL_FORCE_OF_NELTHARAKU, true);
- Unit* Dragonmaw = FindCreature(CREATURE_DRAGONMAW_SUBJUGATOR, 50, m_creature);
+ Unit* Dragonmaw = me->FindNearestCreature(CREATURE_DRAGONMAW_SUBJUGATOR, 50);
if(Dragonmaw)
{
@@ -275,7 +275,7 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI
float dx, dy, dz;
- Unit* EscapeDummy = FindCreature(CREATURE_ESCAPE_DUMMY, 30, m_creature);
+ Unit* EscapeDummy = me->FindNearestCreature(CREATURE_ESCAPE_DUMMY, 30);
if(EscapeDummy)
EscapeDummy->GetPosition(dx, dy, dz);
else
@@ -773,7 +773,7 @@ struct TRINITY_DLL_DECL npc_overlord_morghorAI : public ScriptedAI
return 6000; break;
case 27:
{
- Unit* Yarzill = FindCreature(C_YARZILL, 50, m_creature);
+ Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50);
if (Yarzill)
Yarzill->SetUInt64Value(UNIT_FIELD_TARGET, PlayerGUID);
return 500; }break;
@@ -785,19 +785,19 @@ struct TRINITY_DLL_DECL npc_overlord_morghorAI : public ScriptedAI
return 1000; break;
case 29:
{
- Unit* Yarzill = FindCreature(C_YARZILL, 50, m_creature);
+ Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50);
if(Yarzill)
DoScriptText(YARZILL_THE_MERC_SAY, Yarzill, plr);
return 5000; }break;
case 30:
{
- Unit* Yarzill = FindCreature(C_YARZILL, 50, m_creature);
+ Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50);
if (Yarzill)
Yarzill->SetUInt64Value(UNIT_FIELD_TARGET, 0);
return 5000; }break;
case 31:
{
- Unit* Yarzill = FindCreature(C_YARZILL, 50, m_creature);
+ Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50);
if (Yarzill)
Yarzill->CastSpell(plr, 41540, true);
return 1000;}break;
@@ -1616,7 +1616,7 @@ bool GOQuestAccept_GO_crystal_prison(Player* plr, GameObject* go, Quest const* q
{
if(quest->GetQuestId() == QUEST_BATTLE_OF_THE_CRIMSON_WATCH )
{
- Unit* Illidan = FindCreature(22083, 50, plr);
+ Unit* Illidan = plr->FindNearestCreature(22083, 50);
if(Illidan && !(((npc_lord_illidan_stormrageAI*)((Creature*)Illidan)->AI())->EventStarted))
{
@@ -1736,7 +1736,7 @@ struct TRINITY_DLL_DECL npc_enraged_spiritAI : public ScriptedAI
// FIND TOTEM, PROCESS QUEST
if (Summoned)
{
- totemOspirits = FindCreature(ENTRY_TOTEM_OF_SPIRITS, RADIUS_TOTEM_OF_SPIRITS, m_creature);
+ totemOspirits = me->FindNearestCreature(ENTRY_TOTEM_OF_SPIRITS, RADIUS_TOTEM_OF_SPIRITS);
if (totemOspirits)
{
Summoned->setFaction(ENRAGED_SOUL_FRIENDLY);
diff --git a/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp b/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp
index fe57e99c035..7f6d3d23976 100644
--- a/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp
+++ b/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp
@@ -397,14 +397,14 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->setFaction(1194);
- Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature);
+ Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20);
if(Creepjack)
{
((Creature*)Creepjack)->AI()->EnterEvadeMode();
Creepjack->setFaction(1194);
Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
- Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature);
+ Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20);
if(Malone)
{
((Creature*)Malone)->AI()->EnterEvadeMode();
@@ -420,10 +420,10 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI
switch(Step)
{
case 0:{ m_creature->SetInFront(player);
- Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature);
+ Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20);
if(Creepjack)
Creepjack->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
- Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature);
+ Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20);
if(Malone)
Malone->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); }return 2000;
@@ -454,7 +454,7 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
if(player)
{
- Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature);
+ Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20);
if(Creepjack)
{
Creepjack->Attack(player, true);
@@ -462,7 +462,7 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI
Creepjack->GetMotionMaster()->MoveChase(player);
Creepjack->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
- Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature);
+ Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20);
if(Malone)
{
Malone->Attack(player, true);
@@ -478,7 +478,7 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI
if((m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 1 && !Done)
{
- Unit* Creepjack = FindCreature(NPC_CREEPJACK, 20, m_creature);
+ Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20);
if(Creepjack)
{
((Creature*)Creepjack)->AI()->EnterEvadeMode();
@@ -486,7 +486,7 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI
Creepjack->GetMotionMaster()->MoveTargetedHome();
Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
- Unit* Malone = FindCreature(NPC_MALONE, 20, m_creature);
+ Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20);
if(Malone)
{
((Creature*)Malone)->AI()->EnterEvadeMode();
diff --git a/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp b/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp
index 55a65ac5d9b..98aea1a9b35 100644
--- a/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp
+++ b/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp
@@ -132,7 +132,7 @@ struct TRINITY_DLL_DECL npc_deathstalker_erlandAI : public npc_escortAI
player->GroupEventHappens(QUEST_ESCORTING, m_creature);break;
case 14: DoScriptText(SAY_THANKS, m_creature, player);break;
case 15: {
- Unit* Rane = FindCreature(NPC_RANE, 20, m_creature);
+ Unit* Rane = me->FindNearestCreature(NPC_RANE, 20);
if(Rane)
DoScriptText(SAY_RANE, Rane);
break;}
@@ -140,7 +140,7 @@ struct TRINITY_DLL_DECL npc_deathstalker_erlandAI : public npc_escortAI
case 17: DoScriptText(SAY_MOVE_QUINN, m_creature); break;
case 24: DoScriptText(SAY_GREETINGS, m_creature);break;
case 25: {
- Unit* Quinn = FindCreature(NPC_QUINN, 20, m_creature);
+ Unit* Quinn = me->FindNearestCreature(NPC_QUINN, 20);
if(Quinn)
DoScriptText(SAY_QUINN, Quinn);
break;}
diff --git a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp
index c68f659ec7f..fbc2fe321e4 100644
--- a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp
+++ b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp
@@ -378,9 +378,8 @@ struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI
m_creature->SummonCreature(SPAWN_SECOND_2, -7515.07, -4797.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
m_creature->SummonCreature(SPAWN_SECOND_2, -7518.07, -4792.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
DoScriptText(SAY_CHICKEN_AMB, m_creature);
- {Unit* scoff = FindCreature(SPAWN_SECOND_2, 30, m_creature);
- if(scoff)
- DoScriptText(SAY_SCOFF, scoff);}break;
+ if(Unit* scoff = me->FindNearestCreature(SPAWN_SECOND_2, 30))
+ DoScriptText(SAY_SCOFF, scoff);
break;
case 86:
diff --git a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp
index e1282d0a723..2e95c08b5c1 100644
--- a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp
+++ b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp
@@ -358,7 +358,7 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI
{
case 0:
{
- GameObject* Cage = FindGameObject(GO_CAGE, 10, m_creature);
+ GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 10);
if(Cage)
Cage->SetGoState(GO_STATE_ACTIVE);
}break;
diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp
index ac4b22bb2f7..f164e473148 100644
--- a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp
+++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp
@@ -399,7 +399,7 @@ struct TRINITY_DLL_DECL mob_ingvar_throw_dummyAI : public ScriptedAI
void Reset()
{
- Unit* target = FindCreature(ENTRY_THROW_TARGET,50,m_creature);
+ Unit* target = m_creature->FindNearestCreature(ENTRY_THROW_TARGET,50);
if(target)
{
DoCast(m_creature, HeroicMode ? H_SPELL_SHADOW_AXE_DAMAGE : SPELL_SHADOW_AXE_DAMAGE);
diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/utgarde_keep.cpp b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/utgarde_keep.cpp
index 923328627e4..73ffafca12f 100644
--- a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/utgarde_keep.cpp
+++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/utgarde_keep.cpp
@@ -111,7 +111,7 @@ struct TRINITY_DLL_DECL npc_dragonflayer_forge_masterAI : public ScriptedAI
for(int i = 0; i < 3 ; i++)
{
GameObject* temp;
- temp = FindGameObject(entry_search[i],30,m_creature);
+ temp = m_creature->FindNearestGameObject(entry_search[i],30);
if(temp)
{
if(diff > m_creature->GetDistance2d(temp))