mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[7672] Move ReceiveEmote from script API to AI API.
This is also fix triggering ReceiveEmote for EventAI broken at it move to mangos sources.
This commit is contained in:
parent
5020fcd3f1
commit
78dd259c38
9 changed files with 17 additions and 30 deletions
|
|
@ -235,15 +235,6 @@ bool AreaTrigger ( Player *player, AreaTriggerEntry* atEntry )
|
|||
return tmpscript->pAreaTrigger(player, atEntry);
|
||||
}
|
||||
|
||||
MANGOS_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);
|
||||
}
|
||||
|
||||
MANGOS_DLL_EXPORT
|
||||
bool ItemUse( Player *player, Item* _Item, SpellCastTargets const& targets)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,7 +41,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), pEffectDummyGameObj(NULL), pEffectDummyCreature(NULL),
|
||||
pGOChooseReward(NULL), pItemUse(NULL), pEffectDummyGameObj(NULL), pEffectDummyCreature(NULL),
|
||||
pEffectDummyItem(NULL), GetAI(NULL)
|
||||
{}
|
||||
|
||||
|
|
@ -63,7 +63,6 @@ struct Script
|
|||
bool (*pItemQuestAccept )(Player *player, Item *_Item, Quest const*_Quest );
|
||||
bool (*pGOQuestAccept )(Player *player, GameObject *_GO, Quest const*_Quest );
|
||||
bool (*pGOChooseReward )(Player *player, GameObject *_GO, Quest const*_Quest, uint32 opt );
|
||||
bool (*pReceiveEmote )(Player *player, Creature *_Creature, uint32 emote );
|
||||
bool (*pItemUse )(Player *player, Item* _Item, SpellCastTargets const& targets);
|
||||
bool (*pEffectDummyGameObj )(Unit*, uint32, uint32, GameObject* );
|
||||
bool (*pEffectDummyCreature )(Unit*, uint32, uint32, Creature* );
|
||||
|
|
|
|||
|
|
@ -587,8 +587,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 )
|
||||
|
|
|
|||
|
|
@ -25,9 +25,10 @@
|
|||
#include "Dynamic/ObjectRegistry.h"
|
||||
#include "Dynamic/FactoryHolder.h"
|
||||
|
||||
class WorldObject;
|
||||
class Unit;
|
||||
class Creature;
|
||||
class WorldObject;
|
||||
class Player;
|
||||
struct SpellEntry;
|
||||
|
||||
#define TIME_INTERVAL_LOOK 5000
|
||||
|
|
@ -88,6 +89,9 @@ class MANGOS_DLL_SPEC CreatureAI
|
|||
// Called at waypoint reached or point movement finished
|
||||
virtual void MovementInform(uint32 /*MovementType*/, uint32 /*Data*/) {}
|
||||
|
||||
// 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)
|
||||
|
|
|
|||
|
|
@ -1629,19 +1629,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)
|
||||
{
|
||||
CreatureEventAI* pTmpCreature = (CreatureEventAI*)(pCreature->AI());
|
||||
if (bEmptyList)
|
||||
return;
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -1696,10 +1694,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,6 +265,7 @@ class MANGOS_DLL_SPEC CreatureEventAI : public CreatureAI
|
|||
void SpellHit(Unit* pUnit, const SpellEntry* pSpell);
|
||||
void UpdateAI(const uint32 diff);
|
||||
bool IsVisible(Unit *) const;
|
||||
void ReceiveEmote(Player* pPlayer, uint32 text_emote);
|
||||
static int Permissible(const Creature *);
|
||||
|
||||
bool ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pActionInvoker = NULL);
|
||||
|
|
@ -277,7 +278,6 @@ class MANGOS_DLL_SPEC CreatureEventAI : public CreatureAI
|
|||
void DoZoneInCombat(Unit* pUnit);
|
||||
void DoMeleeAttackIfReady();
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ bool LoadScriptingModule(char const* libName)
|
|||
||!(testScript->scriptAreaTrigger =(scriptCallAreaTrigger )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"AreaTrigger" ))
|
||||
||!(testScript->ItemQuestAccept =(scriptCallItemQuestAccept )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ItemQuestAccept" ))
|
||||
||!(testScript->GOQuestAccept =(scriptCallGOQuestAccept )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GOQuestAccept" ))
|
||||
||!(testScript->ReceiveEmote =(scriptCallReceiveEmote )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ReceiveEmote" ))
|
||||
||!(testScript->ItemUse =(scriptCallItemUse )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ItemUse" ))
|
||||
||!(testScript->EffectDummyGameObj =(scriptCallEffectDummyGameObj )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"EffectDummyGameObj" ))
|
||||
||!(testScript->EffectDummyCreature =(scriptCallEffectDummyCreature )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"EffectDummyCreature" ))
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ typedef bool(MANGOS_IMPORT * scriptCallAreaTrigger)( Player *player, AreaTrigger
|
|||
typedef bool(MANGOS_IMPORT * scriptCallItemQuestAccept)(Player *player, Item *, Quest const*);
|
||||
typedef bool(MANGOS_IMPORT * scriptCallGOQuestAccept)(Player *player, GameObject *, Quest const*);
|
||||
typedef bool(MANGOS_IMPORT * scriptCallGOChooseReward)(Player *player, GameObject *, Quest const*, uint32 opt );
|
||||
typedef bool(MANGOS_IMPORT * scriptCallReceiveEmote) ( Player *player, Creature *_Creature, uint32 emote );
|
||||
typedef bool(MANGOS_IMPORT * scriptCallItemUse) (Player *player, Item *_Item, SpellCastTargets const& targets);
|
||||
typedef bool(MANGOS_IMPORT * scriptCallEffectDummyGameObj) (Unit *caster, uint32 spellId, uint32 effIndex, GameObject *gameObjTarget);
|
||||
typedef bool(MANGOS_IMPORT * scriptCallEffectDummyCreature) (Unit *caster, uint32 spellId, uint32 effIndex, Creature *crTarget);
|
||||
|
|
@ -83,7 +82,6 @@ typedef struct
|
|||
scriptCallAreaTrigger scriptAreaTrigger;
|
||||
scriptCallItemQuestAccept ItemQuestAccept;
|
||||
scriptCallGOQuestAccept GOQuestAccept;
|
||||
scriptCallReceiveEmote ReceiveEmote;
|
||||
scriptCallItemUse ItemUse;
|
||||
scriptCallEffectDummyGameObj EffectDummyGameObj;
|
||||
scriptCallEffectDummyCreature EffectDummyCreature;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7671"
|
||||
#define REVISION_NR "7672"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue