*Redefinition of eventAI EVENT_T_OOC_LOS. Read updated docs/EventAI.txt for details. - by nofantasy

--HG--
branch : trunk
This commit is contained in:
Blaymoira
2009-03-21 07:56:52 +01:00
parent 3120990ebd
commit 4413bfb548
3 changed files with 34 additions and 12 deletions

View File

@@ -1002,9 +1002,27 @@ void LoadDatabase()
error_db_log("TSCR: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
}
break;
case EVENT_T_RANGE:
case EVENT_T_OOC_LOS:
{
if (temp.event_param2 > VISIBLE_RANGE || temp.event_param2 <= 0)
{
error_db_log("SD2: Creature %u are using event(%u), but param2 (MaxAllowedRange=%u) are not within allowed range.", temp.creature_id, i, temp.event_param2);
temp.event_param2 = VISIBLE_RANGE;
}
if (temp.event_param3 == 0 && temp.event_param4 == 0 && temp.event_flags & EFLAG_REPEATABLE)
{
error_db_log("SD2: Creature %u are using event(%u) with EFLAG_REPEATABLE, but param3(RepeatMin) and param4(RepeatMax) are 0. Repeatable disabled.", temp.creature_id, i);
temp.event_flags &= ~EFLAG_REPEATABLE;
}
if (temp.event_param4 < temp.event_param3)
error_db_log("SD2: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
}
break;
case EVENT_T_RANGE:
case EVENT_T_FRIENDLY_HP:
case EVENT_T_FRIENDLY_IS_CC:
case EVENT_T_FRIENDLY_MISSING_BUFF:

View File

@@ -64,7 +64,7 @@ Events will not repeat until the creature exits combat unless EFLAG_REPEATABLE i
7 EVENT_T_EVADE NONE Expires upon creature EnterEvadeMode().
8 EVENT_T_SPELLHIT SpellID, School, RepeatMin, RepeatMax Expires upon Spell hit. If (param1) is set will only expire on that spell. If (param2) will only expire on spells of that school (-1 for all). Will repeat every (Param3) and (Param4) .
9 EVENT_T_RANGE MinDist, MaxDist, RepeatMin, RepeatMax Expires when the highest threat target distance is greater than (Param1) and less than (Param2). Will repeat every (Param3) and (Param4) .
10 EVENT_T_OOC_LOS NoHostile, NoFriendly, RepeatMin, RepeatMax Expires when a Player moves within visible distance to creature. Does not expire for Hostile Players if (Param1) is not 0. Does not expire for Friendly Players if (Param2) is not 0. Will repeat every (Param3) and (Param4) . Does not expire for creatures or pet or when the creature is in combat.
10 EVENT_T_OOC_LOS Hostile-or-Not, MaxAllowedRange, RepeatMin, RepeatMax Expires when a Unit moves within distance(MaxAllowedRange) to creature. If Param1=0 it will expire if Unit are Hostile. If Param1=1 it will only expire if Unit are not Hostile(generally determined by faction). Will repeat every (Param3) and (Param4). Does not expire when the creature is in combat.
11 EVENT_T_SPAWNED NONE Expires at initial spawn and at creature respawn (useful for setting ranged movement type)
12 EVENT_T_TARGET_HP HPMax%, HPMin%, RepeatMin, RepeatMax Expires when Current Target's HP is between (Param1) and (Param2). Will repeat every (Param3) and (Param4) .
13 EVENT_T_TARGET_CASTING RepeatMin, RepeatatMax Expires when the current target is casting a spell. Will repeat every (Param1) and (Param2) .

View File

@@ -1231,21 +1231,25 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
return;
//Check for OOC LOS Event
for (std::list<EventHolder>::iterator i = EventList.begin(); i != EventList.end(); ++i)
if (!m_creature->getVictim())
{
switch ((*i).Event.event_type)
for (std::list<EventHolder>::iterator itr = EventList.begin(); itr != EventList.end(); ++itr)
{
case EVENT_T_OOC_LOS:
if ((*itr).Event.event_type == EVENT_T_OOC_LOS)
{
if ((*i).Event.event_param1 && m_creature->IsHostileTo(who))
break;
//can trigger if closer than fMaxAllowedRange
float fMaxAllowedRange = (*itr).Event.event_param2;
if ((*i).Event.event_param2 && !m_creature->IsHostileTo(who))
break;
//if range is ok and we are actually in LOS
if (m_creature->IsWithinDistInMap(who, fMaxAllowedRange) && m_creature->IsWithinLOSInMap(who))
{
//if friendly event&&who is not hostile OR hostile event&&who is hostile
if (((*itr).Event.event_param1 && !m_creature->IsHostileTo(who)) ||
((!(*itr).Event.event_param1) && m_creature->IsHostileTo(who)))
ProcessEvent(*itr, who);
ProcessEvent(*i, who);
}
}
break;
}
}