diff options
-rw-r--r-- | src/bindings/scripts/ScriptMgr.cpp | 9 | ||||
-rw-r--r-- | src/bindings/scripts/ScriptMgr.h | 3 | ||||
-rw-r--r-- | src/game/ChatHandler.cpp | 4 | ||||
-rw-r--r-- | src/game/CreatureAI.h | 4 | ||||
-rw-r--r-- | src/game/CreatureEventAI.cpp | 21 | ||||
-rw-r--r-- | src/game/CreatureEventAI.h | 2 | ||||
-rw-r--r-- | src/game/ScriptCalls.cpp | 1 | ||||
-rw-r--r-- | src/game/ScriptCalls.h | 2 |
8 files changed, 15 insertions, 31 deletions
diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index fa3b2466db9..1591f53922b 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -1832,15 +1832,6 @@ bool ItemUse( Player *player, Item* _Item, SpellCastTargets const& 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 ) { Script *tmpscript = m_scripts[crTarget->GetScriptId()]; diff --git a/src/bindings/scripts/ScriptMgr.h b/src/bindings/scripts/ScriptMgr.h index 92e8728abf0..719cf7932e9 100644 --- a/src/bindings/scripts/ScriptMgr.h +++ b/src/bindings/scripts/ScriptMgr.h @@ -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* ); diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp index ae282b05c1e..333f2290816 100644 --- a/src/game/ChatHandler.cpp +++ b/src/game/ChatHandler.cpp @@ -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 ) diff --git a/src/game/CreatureAI.h b/src/game/CreatureAI.h index c968f07532a..41e973f704c 100644 --- a/src/game/CreatureAI.h +++ b/src/game/CreatureAI.h @@ -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) diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 3c45fbdf9b3..8b47e7a3d7b 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -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; - - CreatureEventAI* pTmpCreature = (CreatureEventAI*)(pCreature->AI()); - - if (pTmpCreature->bEmptyList) - return true; + if (bEmptyList) + return; - 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; } diff --git a/src/game/CreatureEventAI.h b/src/game/CreatureEventAI.h index 83e925e1fd4..e945f7661be 100644 --- a/src/game/CreatureEventAI.h +++ b/src/game/CreatureEventAI.h @@ -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); diff --git a/src/game/ScriptCalls.cpp b/src/game/ScriptCalls.cpp index fbcfee6db71..a3015e88a2f 100644 --- a/src/game/ScriptCalls.cpp +++ b/src/game/ScriptCalls.cpp @@ -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" )) diff --git a/src/game/ScriptCalls.h b/src/game/ScriptCalls.h index b95c82eb13e..2ace2839e28 100644 --- a/src/game/ScriptCalls.h +++ b/src/game/ScriptCalls.h @@ -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; |