mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[12702] Add additional miscValue to AIEvent throwing (original author @Schmoozerd), also fixed compile
This commit is contained in:
parent
868e4772b0
commit
9775f0bd8c
6 changed files with 16 additions and 14 deletions
|
|
@ -163,11 +163,12 @@ void CreatureAI::HandleMovementOnAttackStart(Unit* victim)
|
|||
class AiDelayEventAround : public BasicEvent
|
||||
{
|
||||
public:
|
||||
AiDelayEventAround(AIEventType eventType, ObjectGuid invokerGuid, Creature& owner, std::list<Creature*> const& receivers) :
|
||||
AiDelayEventAround(AIEventType eventType, ObjectGuid invokerGuid, Creature& owner, std::list<Creature*> const& receivers, uint32 miscValue) :
|
||||
BasicEvent(),
|
||||
m_eventType(eventType),
|
||||
m_invokerGuid(invokerGuid),
|
||||
m_owner(owner)
|
||||
m_owner(owner),
|
||||
m_miscValue(miscValue)
|
||||
{
|
||||
// Pushing guids because in delay can happen some creature gets despawned => invalid pointer
|
||||
m_receiverGuids.reserve(receivers.size());
|
||||
|
|
@ -183,7 +184,7 @@ class AiDelayEventAround : public BasicEvent
|
|||
{
|
||||
if (Creature* pReceiver = m_owner.GetMap()->GetAnyTypeCreature(*itr))
|
||||
{
|
||||
pReceiver->AI()->ReceiveAIEvent(m_eventType, &m_owner, pInvoker);
|
||||
pReceiver->AI()->ReceiveAIEvent(m_eventType, &m_owner, pInvoker, m_miscValue);
|
||||
// Special case for type 0 (call-assistance)
|
||||
if (m_eventType == AI_EVENT_CALL_ASSISTANCE && pInvoker && pReceiver->CanAssistTo(&m_owner, pInvoker))
|
||||
{
|
||||
|
|
@ -205,9 +206,10 @@ class AiDelayEventAround : public BasicEvent
|
|||
Creature& m_owner;
|
||||
|
||||
AIEventType m_eventType;
|
||||
uint32 m_miscValue;
|
||||
};
|
||||
|
||||
void CreatureAI::SendAIEvent(AIEventType eventType, Unit* pInvoker, uint32 uiDelay, float fRadius) const
|
||||
void CreatureAI::SendAIEvent(AIEventType eventType, Unit* pInvoker, uint32 uiDelay, float fRadius, uint32 miscValue /*=0*/) const
|
||||
{
|
||||
if (fRadius > 0)
|
||||
{
|
||||
|
|
@ -220,14 +222,14 @@ void CreatureAI::SendAIEvent(AIEventType eventType, Unit* pInvoker, uint32 uiDel
|
|||
|
||||
if (!receiverList.empty())
|
||||
{
|
||||
AiDelayEventAround* e = new AiDelayEventAround(eventType, pInvoker ? pInvoker->GetObjectGuid() : ObjectGuid(), *m_creature, receiverList);
|
||||
AiDelayEventAround* e = new AiDelayEventAround(eventType, pInvoker ? pInvoker->GetObjectGuid() : ObjectGuid(), *m_creature, receiverList, miscValue);
|
||||
m_creature->m_Events.AddEvent(e, m_creature->m_Events.CalculateTime(uiDelay));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CreatureAI::SendAIEvent(AIEventType eventType, Unit* pInvoker, Creature* pReceiver) const
|
||||
void CreatureAI::SendAIEvent(AIEventType eventType, Unit* pInvoker, Creature* pReceiver, uint32 miscValue /*=0*/) const
|
||||
{
|
||||
MANGOS_ASSERT(pReceiver);
|
||||
pReceiver->AI()->ReceiveAIEvent(eventType, m_creature, pInvoker);
|
||||
pReceiver->AI()->ReceiveAIEvent(eventType, m_creature, pInvoker, miscValue);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ class MANGOS_DLL_SPEC CreatureAI
|
|||
* @param uiDelay delay time until the Event will be triggered
|
||||
* @param fRadius range in which for receiver is searched
|
||||
*/
|
||||
void SendAIEvent(AIEventType eventType, Unit* pInvoker, uint32 uiDelay, float fRadius) const;
|
||||
void SendAIEvent(AIEventType eventType, Unit* pInvoker, uint32 uiDelay, float fRadius, uint32 miscValue = 0) const;
|
||||
|
||||
/**
|
||||
* Send an AI Event to a Creature
|
||||
|
|
@ -325,7 +325,7 @@ class MANGOS_DLL_SPEC CreatureAI
|
|||
* @param pInvoker Unit that triggered this event (like an attacker)
|
||||
* @param pReceiver Creature to receive this event
|
||||
*/
|
||||
void SendAIEvent(AIEventType eventType, Unit* pInvoker, Creature* pReceiver) const;
|
||||
void SendAIEvent(AIEventType eventType, Unit* pInvoker, Creature* pReceiver, uint32 miscValue = 0) const;
|
||||
|
||||
/**
|
||||
* Called when an AI Event is received
|
||||
|
|
@ -333,7 +333,7 @@ class MANGOS_DLL_SPEC CreatureAI
|
|||
* @param pSender Creature that sent this event
|
||||
* @param pInvoker Unit that triggered this event (like an attacker)
|
||||
*/
|
||||
virtual void ReceiveAIEvent(AIEventType /*eventType*/, Creature* /*pSender*/, Unit* /*pInvoker*/) {}
|
||||
virtual void ReceiveAIEvent(AIEventType /*eventType*/, Creature* /*pSender*/, Unit* /*pInvoker*/, uint32 /*miscValue*/) {}
|
||||
|
||||
protected:
|
||||
void HandleMovementOnAttackStart(Unit* victim);
|
||||
|
|
|
|||
|
|
@ -1077,7 +1077,7 @@ void CreatureEventAI::SummonedCreatureDespawn(Creature* pUnit)
|
|||
}
|
||||
}
|
||||
|
||||
void CreatureEventAI::ReceiveAIEvent(AIEventType eventType, Creature* pSender, Unit* pInvoker)
|
||||
void CreatureEventAI::ReceiveAIEvent(AIEventType eventType, Creature* pSender, Unit* pInvoker, uint32 miscValue)
|
||||
{
|
||||
if (m_bEmptyList || !pSender)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -625,7 +625,7 @@ class MANGOS_DLL_SPEC CreatureEventAI : public CreatureAI
|
|||
void ReceiveEmote(Player* pPlayer, uint32 text_emote) override;
|
||||
void SummonedCreatureJustDied(Creature* unit) override;
|
||||
void SummonedCreatureDespawn(Creature* unit) override;
|
||||
void ReceiveAIEvent(AIEventType eventType, Creature* pSender, Unit* pInvoker) override;
|
||||
void ReceiveAIEvent(AIEventType eventType, Creature* pSender, Unit* pInvoker, uint32 miscValue) override;
|
||||
|
||||
static int Permissible(const Creature*);
|
||||
|
||||
|
|
|
|||
|
|
@ -499,7 +499,7 @@ enum SummonPropFlags
|
|||
SUMMON_PROP_FLAG_UNK7 = 0x0040, // 12 spells in 3.0.3, no idea
|
||||
SUMMON_PROP_FLAG_UNK8 = 0x0080, // 4 spells in 3.0.3, no idea
|
||||
SUMMON_PROP_FLAG_UNK9 = 0x0100, // 51 spells in 3.0.3, no idea, many quest related
|
||||
SUMMON_PROP_FLAG_UNK10 = 0x0200, // 51 spells in 3.0.3, something defensive
|
||||
SUMMON_PROP_FLAG_INHERIT_FACTION = 0x0200, // 51 spells in 3.0.3, something defensive
|
||||
SUMMON_PROP_FLAG_UNK11 = 0x0400, // 3 spells, requires something near?
|
||||
SUMMON_PROP_FLAG_UNK12 = 0x0800, // 30 spells in 3.0.3, no idea
|
||||
SUMMON_PROP_FLAG_UNK13 = 0x1000, // 8 spells in 3.0.3, siege vehicle
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "12701"
|
||||
#define REVISION_NR "12702"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue