[7672] Move ReceiveEmote from script API to AI API. Author: VladimirMangos
This is also fix triggering ReceiveEmote for EventAI broken at it move to core. --HG-- branch : trunk
This commit is contained in:
@@ -1831,15 +1831,6 @@ bool ItemUse( Player *player, Item* _Item, SpellCastTargets const& targets)
|
||||
return tmpscript->pItemUse(player,_Item,targets);
|
||||
}
|
||||
|
||||
TRINITY_DLL_EXPORT
|
||||
bool ReceiveEmote( Player *player, Creature *_Creature, uint32 emote )
|
||||
{
|
||||
Script *tmpscript = m_scripts[_Creature->GetScriptId()];
|
||||
if (!tmpscript || !tmpscript->pReceiveEmote) return false;
|
||||
|
||||
return tmpscript->pReceiveEmote(player, _Creature, emote);
|
||||
}
|
||||
|
||||
TRINITY_DLL_EXPORT
|
||||
bool EffectDummyCreature(Unit *caster, uint32 spellId, uint32 effIndex, Creature *crTarget )
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ struct Script
|
||||
pGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGossipSelectWithCode(NULL),
|
||||
pQuestSelect(NULL), pQuestComplete(NULL), pNPCDialogStatus(NULL), pGODialogStatus(NULL),
|
||||
pChooseReward(NULL), pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL),
|
||||
pGOQuestAccept(NULL), pGOChooseReward(NULL),pReceiveEmote(NULL),pItemUse(NULL),
|
||||
pGOQuestAccept(NULL), pGOChooseReward(NULL),pItemUse(NULL),
|
||||
pEffectDummyCreature(NULL), pEffectDummyGameObj(NULL), pEffectDummyItem(NULL),
|
||||
GetAI(NULL), GetInstanceData(NULL)
|
||||
{}
|
||||
@@ -59,7 +59,6 @@ struct Script
|
||||
bool (*pItemQuestAccept )(Player*, Item *, Quest const* );
|
||||
bool (*pGOQuestAccept )(Player*, GameObject*, Quest const* );
|
||||
bool (*pGOChooseReward )(Player*, GameObject*, Quest const*, uint32 );
|
||||
bool (*pReceiveEmote )(Player*, Creature*, uint32 );
|
||||
bool (*pItemUse )(Player*, Item*, SpellCastTargets const& );
|
||||
bool (*pEffectDummyCreature )(Unit*, uint32, uint32, Creature* );
|
||||
bool (*pEffectDummyGameObj )(Unit*, uint32, uint32, GameObject* );
|
||||
|
||||
@@ -657,8 +657,8 @@ void WorldSession::HandleTextEmoteOpcode( WorldPacket & recv_data )
|
||||
GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE, text_emote, 0, unit);
|
||||
|
||||
//Send scripted event call
|
||||
if (unit && unit->GetTypeId()==TYPEID_UNIT && Script)
|
||||
Script->ReceiveEmote(GetPlayer(),(Creature*)unit,text_emote);
|
||||
if (unit && unit->GetTypeId()==TYPEID_UNIT && ((Creature*)unit)->AI())
|
||||
((Creature*)unit)->AI()->ReceiveEmote(GetPlayer(),text_emote);
|
||||
}
|
||||
|
||||
void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data )
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "Dynamic/ObjectRegistry.h"
|
||||
#include "Dynamic/FactoryHolder.h"
|
||||
|
||||
class WorldObject;
|
||||
class Unit;
|
||||
class Creature;
|
||||
class Player;
|
||||
@@ -167,6 +168,9 @@ class TRINITY_DLL_SPEC CreatureAI : public UnitAI
|
||||
|
||||
void DoZoneInCombat(Unit* pUnit = NULL);
|
||||
|
||||
// Called at text emote receive from player
|
||||
virtual void ReceiveEmote(Player* pPlayer, uint32 text_emote) {}
|
||||
|
||||
///== Triggered Actions Requested ==================
|
||||
|
||||
// Called when creature attack expected (if creature can and no have current victim)
|
||||
|
||||
@@ -1582,22 +1582,17 @@ bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Trigge
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CreatureEventAI::ReceiveEmote(Player* pPlayer, Creature* pCreature, uint32 uiEmote)
|
||||
void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote)
|
||||
{
|
||||
if(pCreature->isCharmed())
|
||||
return true;
|
||||
if (bEmptyList)
|
||||
return;
|
||||
|
||||
CreatureEventAI* pTmpCreature = (CreatureEventAI*)(pCreature->AI());
|
||||
|
||||
if (pTmpCreature->bEmptyList)
|
||||
return true;
|
||||
|
||||
for (std::list<CreatureEventAIHolder>::iterator itr = pTmpCreature->CreatureEventAIList.begin(); itr != pTmpCreature->CreatureEventAIList.end(); ++itr)
|
||||
for (std::list<CreatureEventAIHolder>::iterator itr = CreatureEventAIList.begin(); itr != CreatureEventAIList.end(); ++itr)
|
||||
{
|
||||
if ((*itr).Event.event_type == EVENT_T_RECEIVE_EMOTE)
|
||||
{
|
||||
if ((*itr).Event.event_param1 != uiEmote)
|
||||
return true;
|
||||
if ((*itr).Event.event_param1 != text_emote)
|
||||
return;
|
||||
|
||||
bool bProcess = false;
|
||||
|
||||
@@ -1652,10 +1647,8 @@ bool CreatureEventAI::ReceiveEmote(Player* pPlayer, Creature* pCreature, uint32
|
||||
if (bProcess)
|
||||
{
|
||||
sLog.outDebug("CreatureEventAI: ReceiveEmote CreatureEventAI: Condition ok, processing");
|
||||
pTmpCreature->ProcessEvent(*itr, pPlayer);
|
||||
ProcessEvent(*itr, pPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -268,6 +268,7 @@ class TRINITY_DLL_SPEC CreatureEventAI : public CreatureAI
|
||||
void MoveInLineOfSight(Unit *who);
|
||||
void SpellHit(Unit* pUnit, const SpellEntry* pSpell);
|
||||
void UpdateAI(const uint32 diff);
|
||||
void ReceiveEmote(Player* pPlayer, uint32 text_emote);
|
||||
static int Permissible(const Creature *);
|
||||
|
||||
bool ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pActionInvoker = NULL);
|
||||
@@ -278,7 +279,6 @@ class TRINITY_DLL_SPEC CreatureEventAI : public CreatureAI
|
||||
|
||||
void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target);
|
||||
bool CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered);
|
||||
bool ReceiveEmote(Player* pPlayer, Creature* pCreature, uint32 uiEmote);
|
||||
|
||||
Unit* DoSelectLowestHpFriendly(float range, uint32 MinHPDiff);
|
||||
void DoFindFriendlyMissingBuff(std::list<Creature*>& _list, float range, uint32 spellid);
|
||||
|
||||
@@ -76,7 +76,6 @@ bool LoadScriptingModule(char const* libName)
|
||||
||!(testScript->scriptAreaTrigger =(scriptCallAreaTrigger )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"AreaTrigger" ))
|
||||
||!(testScript->ItemQuestAccept =(scriptCallItemQuestAccept )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ItemQuestAccept" ))
|
||||
||!(testScript->GOQuestAccept =(scriptCallGOQuestAccept )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"GOQuestAccept" ))
|
||||
||!(testScript->ReceiveEmote =(scriptCallReceiveEmote )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ReceiveEmote" ))
|
||||
||!(testScript->ItemUse =(scriptCallItemUse )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"ItemUse" ))
|
||||
||!(testScript->EffectDummyGameObj =(scriptCallEffectDummyGameObj )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"EffectDummyGameObj" ))
|
||||
||!(testScript->EffectDummyCreature =(scriptCallEffectDummyCreature )TRINITY_GET_PROC_ADDR(testScript->hScriptsLib,"EffectDummyCreature" ))
|
||||
|
||||
@@ -58,7 +58,6 @@ typedef bool(TRINITY_IMPORT * scriptCallAreaTrigger)( Player *player, AreaTrigge
|
||||
typedef bool(TRINITY_IMPORT * scriptCallItemQuestAccept)(Player *player, Item *, Quest const*);
|
||||
typedef bool(TRINITY_IMPORT * scriptCallGOQuestAccept)(Player *player, GameObject *, Quest const*);
|
||||
typedef bool(TRINITY_IMPORT * scriptCallGOChooseReward)(Player *player, GameObject *, Quest const*, uint32 opt );
|
||||
typedef bool(TRINITY_IMPORT * scriptCallReceiveEmote) ( Player *player, Creature *_Creature, uint32 emote );
|
||||
typedef bool(TRINITY_IMPORT * scriptCallItemUse) (Player *player, Item *_Item, SpellCastTargets const& targets);
|
||||
typedef bool(TRINITY_IMPORT * scriptCallEffectDummyGameObj) (Unit *caster, uint32 spellId, uint32 effIndex, GameObject *gameObjTarget);
|
||||
typedef bool(TRINITY_IMPORT * scriptCallEffectDummyCreature) (Unit *caster, uint32 spellId, uint32 effIndex, Creature *crTarget);
|
||||
@@ -89,7 +88,6 @@ typedef struct
|
||||
scriptCallAreaTrigger scriptAreaTrigger;
|
||||
scriptCallItemQuestAccept ItemQuestAccept;
|
||||
scriptCallGOQuestAccept GOQuestAccept;
|
||||
scriptCallReceiveEmote ReceiveEmote;
|
||||
scriptCallItemUse ItemUse;
|
||||
scriptCallEffectDummyGameObj EffectDummyGameObj;
|
||||
scriptCallEffectDummyCreature EffectDummyCreature;
|
||||
|
||||
Reference in New Issue
Block a user