From 2914f3168b8f469176bea558f9f245c010596c7c Mon Sep 17 00:00:00 2001 From: sanctum32 Date: Sat, 16 Nov 2013 21:52:12 +0200 Subject: [PATCH] [12717] Implemented ACTION_T_EMOTE_TARGET --- doc/EventAI.txt | 8 +++++++- src/game/CreatureEventAI.cpp | 16 +++++++++++++++- src/game/CreatureEventAI.h | 7 +++++++ src/shared/revision_nr.h | 2 +- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/doc/EventAI.txt b/doc/EventAI.txt index af5c362f7..ed850cf6c 100644 --- a/doc/EventAI.txt +++ b/doc/EventAI.txt @@ -136,7 +136,7 @@ For all ACTION_T_RANDOM Actions, When a Particular Param is selected for the Eve 29 ACTION_T_RANGED_MOVEMENT Distance, Angle Changes the movement generator to a ranged type. (note: default melee type can still be set by using 0 as angle and 0 as distance). 30 ACTION_T_RANDOM_PHASE PhaseId1, PhaseId2, PhaseId3 Sets a phase to a specified id(s)* 31 ACTION_T_RANDOM_PHASE_RANGE PhaseMin, PhaseMax Sets a phase to a random id (Phase = PhaseMin + rnd % PhaseMin-PhaseMax). PhaseMax must be greater than PhaseMin. -32 ACTION_T_SUMMON CreatureID, Target, SummonID Summons a creature (Param1) to attack target (Param2) at location specified by EventAI_Summons (Param3). +32 ACTION_T_SUMMON_ID CreatureID, Target, SummonID Summons a creature (Param1) to attack target (Param2) at location specified by EventAI_Summons (Param3). 33 ACTION_T_KILLED_MONSTER CreatureID, Target Calls KilledMonster (Param1) for a target (Param2). 34 ACTION_T_SET_INST_DATA Field, Data Calls ScriptedInstance::SetData with field (Param1) and data (Param2). 35 ACTION_T_SET_INST_DATA64 Field, Target Calls ScriptedInstance::SetData64 with field (Param1) and target's GUID (Param2). @@ -151,6 +151,7 @@ For all ACTION_T_RANDOM Actions, When a Particular Param is selected for the Eve 44 ACTION_T_CHANCED_TEXT Chance, -TextId1, -TextId2 Displays by Chance (1..100) the specified -TextId. When -TextId2 is specified, the selection will be randomized. Text types are defined, along with other options for the text, in a table below. Param2 and Param3 needs to be negative. 45 ACTION_T_THROW_AI_EVENT EventType, Radius Throws an AIEvent of type (Param1) to nearby friendly Npcs in range of (Param2) 46 ACTION_T_SET_THROW_MASK EventTypeMask Marks for which AIEvents the npc will throw AIEvents on its own. +47 ACTION_T_EMOTE_TARGET EmoteId, TargetGuid NPC faces to creature (Param2) and does a specified emote id (Param2). * = Use -1 where the param is expected to do nothing. Random constant is generated for each event, so if you have a random yell and a random sound, they will be linked up with each other (ie. param2 with param2). @@ -891,6 +892,11 @@ Currently supported are: So if you want an npc to throw AIEvents automatically on death and on critical health, you would set its EventTypeMask to 0x03 +----------------------------- +47 = ACTION_T_EMOTE_TARGET +----------------------------- + + ========================================= Target Types ========================================= diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 4ccf1b92d..46ac7e523 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -959,7 +959,21 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 { m_throwAIEventMask = action.setThrowMask.eventTypeMask; break; - } + } + case ACTION_T_EMOTE_TARGET: + { + Unit* pCreature = m_creature->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, action.emoteTarget.targetGuid)); + if (!pCreature) + { + sLog.outErrorEventAI("Event %d. Cannot find creature by guid %d", EventId, action.emoteTarget.targetGuid); + return; + } + + + m_creature->SetFacingToObject(pCreature); + m_creature->HandleEmote(action.emoteTarget.emoteId); + break; + } } } diff --git a/src/game/CreatureEventAI.h b/src/game/CreatureEventAI.h index 670986f06..f25e161c8 100644 --- a/src/game/CreatureEventAI.h +++ b/src/game/CreatureEventAI.h @@ -117,6 +117,7 @@ enum EventAI_ActionType ACTION_T_CHANCED_TEXT = 44, // Chance to display the text, TextId1, optionally TextId2. If more than just -TextId1 is defined, randomize. Negative values. ACTION_T_THROW_AI_EVENT = 45, // EventType, Radius, unused ACTION_T_SET_THROW_MASK = 46, // EventTypeMask, unused, unused + ACTION_T_EMOTE_TARGET = 47, // Emote, EmoteTarget, EntryOrGuid ACTION_T_END, }; @@ -397,6 +398,12 @@ struct CreatureEventAI_Action uint32 unused1; uint32 unused2; } setThrowMask; + // ACTION_T_EMOTE_TARGET = 47 + struct + { + uint32 emoteId; + uint32 targetGuid; + } emoteTarget; // RAW struct { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 3781d1700..17086e563 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "12716" + #define REVISION_NR "12717" #endif // __REVISION_NR_H__