aboutsummaryrefslogtreecommitdiff
path: root/src/bindings/scripts
diff options
context:
space:
mode:
authormegamage <none@none>2009-01-06 12:15:18 -0600
committermegamage <none@none>2009-01-06 12:15:18 -0600
commit2b21f0e7302cfdb0fc79e3255f80dc33b939c974 (patch)
treec1fb071d3c86ead192f9cbf7acffa06c050cd4d5 /src/bindings/scripts
parent215039055bf5f017870d583c60c01c303d1a2d33 (diff)
parent290a187592d28cbfd9639ded43663077711f3379 (diff)
*Merge with Trinity 793.
--HG-- branch : trunk
Diffstat (limited to 'src/bindings/scripts')
-rw-r--r--src/bindings/scripts/ScriptMgr.cpp5
-rw-r--r--src/bindings/scripts/include/sc_creature.cpp46
-rw-r--r--src/bindings/scripts/scripts/creature/mob_event_ai.cpp2
3 files changed, 9 insertions, 44 deletions
diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp
index d28a17b9104..a4d75f6aeb2 100644
--- a/src/bindings/scripts/ScriptMgr.cpp
+++ b/src/bindings/scripts/ScriptMgr.cpp
@@ -656,7 +656,8 @@ void LoadDatabase()
LoadTrinityStrings(TScriptDB,"eventai_texts",-1,1+(TEXT_SOURCE_RANGE));
// Gather Additional data from EventAI Texts
- result = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM eventai_texts");
+ //result = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM eventai_texts");
+ result = TScriptDB.PQuery("SELECT entry, sound, type, language FROM eventai_texts");
outstring_log("TSCR: Loading EventAI Texts additional data...");
if (result)
@@ -674,7 +675,7 @@ void LoadDatabase()
temp.SoundId = fields[1].GetInt32();
temp.Type = fields[2].GetInt32();
temp.Language = fields[3].GetInt32();
- temp.Emote = fields[4].GetInt32();
+ temp.Emote = 0;//fields[4].GetInt32();
if (i >= 0)
{
diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp
index bb7f98c9f7b..20c5600dc02 100644
--- a/src/bindings/scripts/include/sc_creature.cpp
+++ b/src/bindings/scripts/include/sc_creature.cpp
@@ -746,8 +746,7 @@ Unit* ScriptedAI::FindCreature(uint32 entry, float range)
Creature* target = NULL;
Trinity::AllCreaturesOfEntryInRange check(m_creature, entry, range);
Trinity::CreatureSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(target, check);
- m_creature->VisitNearbyGridObject(range, searcher);
- if(!target) error_log("SD2 ERROR: Entry: %u not found!", entry);
+ m_creature->VisitNearbyObject(range, searcher);
return target;
}
@@ -757,70 +756,33 @@ GameObject* ScriptedAI::FindGameObject(uint32 entry, float range)
Trinity::AllGameObjectsWithEntryInGrid go_check(entry);
Trinity::GameObjectSearcher<Trinity::AllGameObjectsWithEntryInGrid> searcher(target, go_check);
m_creature->VisitNearbyGridObject(range, searcher);
- if(!target) error_log("SD2 ERROR: Entry: %u not found!", entry);
return target;
}
Unit* ScriptedAI::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff)
{
- CellPair p(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
- Cell cell(p);
- cell.data.Part.reserved = ALL_DISTRICT;
- cell.SetNoCreate();
-
Unit* pUnit = NULL;
-
Trinity::MostHPMissingInRange u_check(m_creature, range, MinHPDiff);
Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange> searcher(pUnit, u_check);
-
- /*
- typedef TYPELIST_4(GameObject, Creature*except pets*, DynamicObject, Corpse*Bones*) AllGridObjectTypes;
- This means that if we only search grid then we cannot possibly return pets or players so this is safe
- */
- TypeContainerVisitor<Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange>, GridTypeMapContainer > grid_unit_searcher(searcher);
-
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, grid_unit_searcher, *(m_creature->GetMap()));
+ m_creature->VisitNearbyObject(range, searcher);
return pUnit;
}
std::list<Creature*> ScriptedAI::DoFindFriendlyCC(float range)
{
- CellPair p(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
- Cell cell(p);
- cell.data.Part.reserved = ALL_DISTRICT;
- cell.SetNoCreate();
-
std::list<Creature*> pList;
-
Trinity::FriendlyCCedInRange u_check(m_creature, range);
Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange> searcher(pList, u_check);
-
- TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange>, GridTypeMapContainer > grid_creature_searcher(searcher);
-
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, grid_creature_searcher, *(m_creature->GetMap()));
-
+ m_creature->VisitNearbyObject(range, searcher);
return pList;
}
std::list<Creature*> ScriptedAI::DoFindFriendlyMissingBuff(float range, uint32 spellid)
{
- CellPair p(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
- Cell cell(p);
- cell.data.Part.reserved = ALL_DISTRICT;
- cell.SetNoCreate();
-
std::list<Creature*> pList;
-
Trinity::FriendlyMissingBuffInRange u_check(m_creature, range, spellid);
Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange> searcher(pList, u_check);
-
- TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange>, GridTypeMapContainer > grid_creature_searcher(searcher);
-
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, grid_creature_searcher, *(m_creature->GetMap()));
-
+ m_creature->VisitNearbyObject(range, searcher);
return pList;
}
diff --git a/src/bindings/scripts/scripts/creature/mob_event_ai.cpp b/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
index a629bf7b4d8..d764fb02c2e 100644
--- a/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
+++ b/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
@@ -790,6 +790,8 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
break;
case ACTION_T_FLEE:
{
+ if(m_creature->HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
+ break;
TimetoFleeLeft = 8000;
m_creature->DoFleeToGetAssistance();
IsFleeing = true;