mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 07:37:03 +00:00
[11827] Implement Creature Linking via database
Thanks to Silverice for feedback! This system interprets the content of the table `creature_linking_template`. To trigger different actions on different events of the npcs that are linked together. Possible event/ action combinations can be taken form the flags in CreatureLinkingMgr.h::CreatureLinkingFlags
This commit is contained in:
parent
6edfcea7f0
commit
fbdd79141c
16 changed files with 783 additions and 7 deletions
|
|
@ -49,6 +49,7 @@
|
|||
#include "MovementGenerator.h"
|
||||
#include "movement/MoveSplineInit.h"
|
||||
#include "movement/MoveSpline.h"
|
||||
#include "CreatureLinkingMgr.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdarg.h>
|
||||
|
|
@ -263,6 +264,9 @@ Unit::Unit() :
|
|||
// remove aurastates allowing special moves
|
||||
for(int i=0; i < MAX_REACTIVE; ++i)
|
||||
m_reactiveTimer[i] = 0;
|
||||
|
||||
m_isCreatureLinkingTrigger = false;
|
||||
m_isSpawningLinked = false;
|
||||
}
|
||||
|
||||
Unit::~Unit()
|
||||
|
|
@ -843,6 +847,9 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||
if (InstanceData* mapInstance = cVictim->GetInstanceData())
|
||||
mapInstance->OnCreatureDeath(cVictim);
|
||||
|
||||
if (cVictim->IsLinkingEventTrigger())
|
||||
cVictim->GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_DIE, cVictim);
|
||||
|
||||
// Dungeon specific stuff, only applies to players killing creatures
|
||||
if(cVictim->GetInstanceId())
|
||||
{
|
||||
|
|
@ -7798,6 +7805,9 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
|
|||
|
||||
if (InstanceData* mapInstance = GetInstanceData())
|
||||
mapInstance->OnCreatureEnterCombat(pCreature);
|
||||
|
||||
if (m_isCreatureLinkingTrigger)
|
||||
GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_AGGRO, pCreature, enemy);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -8562,6 +8572,9 @@ void Unit::TauntFadeOut(Unit *taunter)
|
|||
if (InstanceData* mapInstance = GetInstanceData())
|
||||
mapInstance->OnCreatureEvade((Creature*)this);
|
||||
|
||||
if (m_isCreatureLinkingTrigger)
|
||||
GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_EVADE, (Creature*)this);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -8662,6 +8675,9 @@ bool Unit::SelectHostileTarget()
|
|||
if (InstanceData* mapInstance = GetInstanceData())
|
||||
mapInstance->OnCreatureEvade((Creature*)this);
|
||||
|
||||
if (m_isCreatureLinkingTrigger)
|
||||
GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_EVADE, (Creature*)this);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue