*Add new eventAI action 105 call assistance. Param1 = radius.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-04-25 09:15:40 -05:00
parent c4e6f9708f
commit 8644c48db8
5 changed files with 19 additions and 4 deletions
+4 -2
View File
@@ -1932,13 +1932,15 @@ Unit* Creature::SelectNearestTarget(float dist) const
return target; return target;
} }
void Creature::CallAssistance() void Creature::CallAssistance(float radius)
{ {
if( !m_AlreadyCallAssistance && getVictim() && !isPet() && !isCharmed()) if( !m_AlreadyCallAssistance && getVictim() && !isPet() && !isCharmed())
{ {
SetNoCallAssistance(true); SetNoCallAssistance(true);
float radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS); if(!radius)
radius = sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS);
if(radius > 0) if(radius > 0)
{ {
std::list<Creature*> assistList; std::list<Creature*> assistList;
+1 -1
View File
@@ -617,7 +617,7 @@ class TRINITY_DLL_SPEC Creature : public Unit
float GetAttackDistance(Unit const* pl) const; float GetAttackDistance(Unit const* pl) const;
Unit* SelectNearestTarget(float dist = 0) const; Unit* SelectNearestTarget(float dist = 0) const;
void CallAssistance(); void CallAssistance(float radius = 0);
void SetNoCallAssistance(bool val) { m_AlreadyCallAssistance = val; } void SetNoCallAssistance(bool val) { m_AlreadyCallAssistance = val; }
bool CanAssistTo(const Unit* u, const Unit* enemy) const; bool CanAssistTo(const Unit* u, const Unit* enemy) const;
void DoFleeToGetAssistance(float radius = 50); void DoFleeToGetAssistance(float radius = 50);
+5 -1
View File
@@ -998,8 +998,12 @@ void CreatureEventAI::ProcessAction(uint16 type, uint32 param1, uint32 param2, u
{ {
sLog.outErrorDb("TSCR: EventAI failed to spawn object %u. Spawn event %d is on creature %d", param1, EventId, m_creature->GetEntry()); sLog.outErrorDb("TSCR: EventAI failed to spawn object %u. Spawn event %d is on creature %d", param1, EventId, m_creature->GetEntry());
} }
break;
} }
break; case ACTION_T_CALL_ASSISTANCE:
m_creature->SetNoCallAssistance(false);
m_creature->CallAssistance(param1);
break;
} }
} }
+1
View File
@@ -107,6 +107,7 @@ enum EventAI_ActionType
ACTION_T_SET_AGGRESSIVE = 102, //Apply ACTION_T_SET_AGGRESSIVE = 102, //Apply
ACTION_T_ATTACK_START_PULSE = 103, //Distance ACTION_T_ATTACK_START_PULSE = 103, //Distance
ACTION_T_SUMMON_GO = 104, //GameObjectID, DespawnTime in ms ACTION_T_SUMMON_GO = 104, //GameObjectID, DespawnTime in ms
ACTION_T_CALL_ASSISTANCE = 105, //Radius
ACTION_T_END, ACTION_T_END,
}; };
+8
View File
@@ -650,6 +650,14 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case ACTION_T_RANDOM_TEXTEMOTE: case ACTION_T_RANDOM_TEXTEMOTE:
sLog.outErrorDb("CreatureEventAI: Event %u Action %u currently unused ACTION type. Did you forget to update database?", i, j+1); sLog.outErrorDb("CreatureEventAI: Event %u Action %u currently unused ACTION type. Did you forget to update database?", i, j+1);
break; break;
case ACTION_T_SET_ACTIVE:
case ACTION_T_SET_AGGRESSIVE:
case ACTION_T_ATTACK_START_PULSE:
case ACTION_T_SUMMON_GO:
case ACTION_T_CALL_ASSISTANCE:
break;
default: default:
sLog.outErrorDb("CreatureEventAI: Event %u Action %u have currently not checked at load action type (%u). Need check code update?", i, j+1, temp.action[j].type); sLog.outErrorDb("CreatureEventAI: Event %u Action %u have currently not checked at load action type (%u). Need check code update?", i, j+1, temp.action[j].type);
break; break;