From 169dce868b90035633e395fb84454bbaf874a987 Mon Sep 17 00:00:00 2001 From: megamage Date: Mon, 5 Jan 2009 15:25:35 -0600 Subject: *Allow FindCreature to find pet/guardian/active creatures. --HG-- branch : trunk --- src/bindings/scripts/include/sc_creature.cpp | 46 +++------------------------- 1 file changed, 4 insertions(+), 42 deletions(-) (limited to 'src/bindings/scripts') 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 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 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 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, GridTypeMapContainer > grid_unit_searcher(searcher); - - CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, grid_unit_searcher, *(m_creature->GetMap())); + m_creature->VisitNearbyObject(range, searcher); return pUnit; } std::list 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 pList; - Trinity::FriendlyCCedInRange u_check(m_creature, range); Trinity::CreatureListSearcher searcher(pList, u_check); - - TypeContainerVisitor, GridTypeMapContainer > grid_creature_searcher(searcher); - - CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, grid_creature_searcher, *(m_creature->GetMap())); - + m_creature->VisitNearbyObject(range, searcher); return pList; } std::list 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 pList; - Trinity::FriendlyMissingBuffInRange u_check(m_creature, range, spellid); Trinity::CreatureListSearcher searcher(pList, u_check); - - TypeContainerVisitor, GridTypeMapContainer > grid_creature_searcher(searcher); - - CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, grid_creature_searcher, *(m_creature->GetMap())); - + m_creature->VisitNearbyObject(range, searcher); return pList; } -- cgit v1.2.3 From cb0319382240d21381335f5d70a8dfd8bcf04feb Mon Sep 17 00:00:00 2001 From: megamage Date: Mon, 5 Jan 2009 19:14:30 -0600 Subject: *Remove emote column from eventai_texts for compatibility with ACID. --HG-- branch : trunk --- sql/updates/789_world.sql | 1 + src/bindings/scripts/ScriptMgr.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 sql/updates/789_world.sql (limited to 'src/bindings/scripts') diff --git a/sql/updates/789_world.sql b/sql/updates/789_world.sql new file mode 100644 index 00000000000..0c51d1b3fac --- /dev/null +++ b/sql/updates/789_world.sql @@ -0,0 +1 @@ +ALTER TABLE eventai_texts DROP COLUMN emote; \ No newline at end of file diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index e605dd2d5a4..663836514ca 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) { -- cgit v1.2.3 From be6dddc4d59bf6c5e0a61268fb62bec4bdf32a79 Mon Sep 17 00:00:00 2001 From: megamage Date: Mon, 5 Jan 2009 19:19:44 -0600 Subject: *Do not let mob flee to call help when it has AURA_PREVENTS_FLEEING. --HG-- branch : trunk --- src/bindings/scripts/scripts/creature/mob_event_ai.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/bindings/scripts') 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; -- cgit v1.2.3