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
This commit is contained in:
raczman
2009-03-30 23:45:17 +02:00
parent e097f358a1
commit 8e308da259
@@ -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<EventHolder> EventList;
uint32 ID = _Creature->GetEntry();
uint32 ID = pCreature->GetEntry();
std::list<EventAI_Event>::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( _Creature->GetMap()->IsHeroic() )
{
if( (*i).event_flags & EFLAG_HEROIC )
if( pCreature->GetMap()->IsDungeon() )
{
if ((pCreature->GetMap()->IsHeroic() && (*i).event_flags & EFLAG_HEROIC) ||
(!pCreature->GetMap()->IsHeroic() && (*i).event_flags & EFLAG_NORMAL))
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));
}
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()