From 8e308da25990a965750ec795dd22f9c104b10ceb Mon Sep 17 00:00:00 2001 From: raczman Date: Mon, 30 Mar 2009 23:45:17 +0200 Subject: Allow eventAI creature have events both inside instance and outside, without producing error message. Note that EFLAG_NORMAL/EFLAG_HEROIC must still be defined if this event should trigger in this mode. Creature outside instance will always use all events regardless. --HG-- branch : trunk --- .../scripts/scripts/creature/mob_event_ai.cpp | 38 +++++----------------- 1 file changed, 8 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/bindings/scripts/scripts/creature/mob_event_ai.cpp b/src/bindings/scripts/scripts/creature/mob_event_ai.cpp index 726bd1fb419..b302f1b3837 100644 --- a/src/bindings/scripts/scripts/creature/mob_event_ai.cpp +++ b/src/bindings/scripts/scripts/creature/mob_event_ai.cpp @@ -1377,11 +1377,11 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI } }; -CreatureAI* GetAI_Mob_EventAI(Creature *_Creature) +CreatureAI* GetAI_Mob_EventAI(Creature *pCreature) { //Select events by creature id std::list EventList; - uint32 ID = _Creature->GetEntry(); + uint32 ID = pCreature->GetEntry(); std::list::iterator i; @@ -1394,33 +1394,11 @@ CreatureAI* GetAI_Mob_EventAI(Creature *_Creature) if ((*i).event_flags & EFLAG_DEBUG_ONLY) continue; #endif - if( _Creature->GetMap()->IsDungeon() ) + if( pCreature->GetMap()->IsDungeon() ) { - if( _Creature->GetMap()->IsHeroic() ) - { - if( (*i).event_flags & EFLAG_HEROIC ) - { - EventList.push_back(EventHolder(*i)); - continue; - }else if( (*i).event_flags & EFLAG_NORMAL ) - continue; - } - else - { - if( (*i).event_flags & EFLAG_NORMAL ) - { - EventList.push_back(EventHolder(*i)); - continue; - }else if( (*i).event_flags & EFLAG_HEROIC ) - continue; - } - - if (EAI_ErrorLevel > 1) - { - error_db_log("SD2: Creature %u Event %u. Creature are in instance but neither EFLAG_NORMAL or EFLAG_HEROIC are set.", _Creature->GetEntry(), (*i).event_id); - EventList.push_back(EventHolder(*i)); - } - + if ((pCreature->GetMap()->IsHeroic() && (*i).event_flags & EFLAG_HEROIC) || + (!pCreature->GetMap()->IsHeroic() && (*i).event_flags & EFLAG_NORMAL)) + EventList.push_back(EventHolder(*i)); continue; } @@ -1432,12 +1410,12 @@ CreatureAI* GetAI_Mob_EventAI(Creature *_Creature) if (EventList.empty()) { if (EAI_ErrorLevel > 1) - error_db_log("SD2: Eventlist for Creature %u is empty but creature is using Mob_EventAI. Preventing EventAI on this creature.", _Creature->GetEntry()); + error_db_log("SD2: Eventlist for Creature %u is empty but creature is using Mob_EventAI. Preventing EventAI on this creature.", pCreature->GetEntry()); return NULL; } - return new Mob_EventAI (_Creature, EventList); + return new Mob_EventAI (pCreature, EventList); } void AddSC_mob_event() -- cgit v1.2.3