rendered paste bodyIndex: scripts/guard/guard_ai.h
===================================================================
--- scripts/guard/guard_ai.h (Revision 316)
+++ scripts/guard/guard_ai.h (Arbeitskopie)
@@ -33,8 +33,9 @@
void Reset();
void AttackStart(Unit *who);
+ void AttackNotice(Unit *who);
void MoveInLineOfSight(Unit *who);
void UpdateAI(const uint32 diff);
Index: scripts/guard/guard_ai.cpp
===================================================================
--- scripts/guard/guard_ai.cpp (Revision 316)
+++ scripts/guard/guard_ai.cpp (Arbeitskopie)
@@ -28,6 +28,16 @@
#define GENERIC_CREATURE_COOLDOWN 5000
+#define ATTACK_WARNING_MSG_1 "Wir werden angegriffen !"
+#define ATTACK_WARNING_MSG_2 "Zeit zu Töten !"
+#define ATTACK_WARNING_MSG_3 "Argh!"
+#define ATTACK_WARNING_MSG_4 "Zeit zu Sterben !"
+
+#define ATTACK_WARNING_SOUND_1 6198
+#define ATTACK_WARNING_SOUND_2 6205
+#define ATTACK_WARNING_SOUND_3 6206
+#define ATTACK_WARNING_SOUND_4 6207
+
void guardAI::Reset()
{
GlobalCooldown = 0;
@@ -45,12 +55,7 @@
if (!who)
return;
- //Send Zone Under Attack message to the LocalDefense and WorldDefense Channels
- if (who->GetTypeId() == TYPEID_PLAYER && !ZoneAttackMsgTimer)
- {
- m_creature->SendZoneUnderAttackMessage((Player*)who);
- ZoneAttackMsgTimer = 30000;
- }
+ AttackNotice(who);
if (who->isTargetableForAttack() && who!= m_creature)
{
@@ -63,6 +68,46 @@
}
}
+void guardAI::AttackNotice(Unit *who)
+{
+ // Send Zone Under Attack message to the LocalDefense and WorldDefense Channels
+ // Yell Attack message and play Attack sound
+ if (who->GetTypeId() == TYPEID_PLAYER && !ZoneAttackMsgTimer)
+ {
+ m_creature->SendZoneUnderAttackMessage((Player*)who);
+
+ int _language = LANG_UNIVERSAL;
+ int _sound_id = ATTACK_WARNING_SOUND_1;
+ const char * _text = ATTACK_WARNING_MSG_1;
+
+ switch(m_creature->getFaction())
+ {
+ case 85:
+ _language = LANG_ORCISH; break;
+ case 79:
+ _language = LANG_DARNASSIAN; break;
+ default:
+ break;
+ }
+ switch(rand()%4)
+ {
+ case 1:
+ _sound_id = ATTACK_WARNING_SOUND_2; _text = ATTACK_WARNING_MSG_2; break;
+ case 2:
+ _sound_id = ATTACK_WARNING_SOUND_3; _text = ATTACK_WARNING_MSG_3; break;
+ case 3:
+ _sound_id = ATTACK_WARNING_SOUND_4; _text = ATTACK_WARNING_MSG_4; break;
+ default:
+ break;
+ }
+
+ m_creature->Yell(_text,_language,0);
+ DoPlaySoundToSet(m_creature,_sound_id);
+
+ ZoneAttackMsgTimer = 30000;
+ }
+}
+
void guardAI::MoveInLineOfSight(Unit *who)
{
if (!who || m_creature->getVictim())
@@ -76,12 +121,7 @@
if(who->HasStealthAura())
who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
- //Send Zone Under Attack message to the LocalDefense and WorldDefense Channels
- if (who->GetTypeId() == TYPEID_PLAYER && !ZoneAttackMsgTimer)
- {
- m_creature->SendZoneUnderAttackMessage((Player*)who);
- ZoneAttackMsgTimer = 30000;
- }
+ AttackNotice(who);
//Begin melee attack if we are within range
if (m_creature->IsWithinDistInMap(who, ATTACK_DISTANCE))