[11032] Implement CREATURE_FLAG_EXTRA_AGGRO_ZONE.

This let control zone wide aggro in DB data instead
need special script code.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Schmoozerd 2011-01-18 13:46:10 +03:00 committed by VladimirMangos
parent 3bb16cacdb
commit 54cb8f1a63
5 changed files with 21 additions and 6 deletions

View file

@ -1985,7 +1985,7 @@ void Creature::SetInCombatWithZone()
if (pPlayer->isGameMaster()) if (pPlayer->isGameMaster())
continue; continue;
if (pPlayer->isAlive()) if (pPlayer->isAlive() && !IsFriendlyTo(pPlayer))
{ {
pPlayer->SetInCombatWith(this); pPlayer->SetInCombatWith(this);
AddThreat(pPlayer); AddThreat(pPlayer);

View file

@ -52,6 +52,7 @@ enum CreatureFlagsExtra
CREATURE_FLAG_EXTRA_NO_XP_AT_KILL = 0x00000040, // creature kill not provide XP CREATURE_FLAG_EXTRA_NO_XP_AT_KILL = 0x00000040, // creature kill not provide XP
CREATURE_FLAG_EXTRA_INVISIBLE = 0x00000080, // creature is always invisible for player (mostly trigger creatures) CREATURE_FLAG_EXTRA_INVISIBLE = 0x00000080, // creature is always invisible for player (mostly trigger creatures)
CREATURE_FLAG_EXTRA_NOT_TAUNTABLE = 0x00000100, // creature is immune to taunt auras and effect attack me CREATURE_FLAG_EXTRA_NOT_TAUNTABLE = 0x00000100, // creature is immune to taunt auras and effect attack me
CREATURE_FLAG_EXTRA_AGGRO_ZONE = 0x00000200, // creature sets itself in combat with zone on aggro
}; };
// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform // GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform

View file

@ -1350,7 +1350,15 @@ void ObjectMgr::LoadCreatures()
if(cInfo->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) if(cInfo->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
{ {
if(!mapEntry || !mapEntry->IsDungeon()) if(!mapEntry || !mapEntry->IsDungeon())
sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature are not in instance.",guid,data.id); sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND (%u) but creature are not in instance.",
guid, data.id, CREATURE_FLAG_EXTRA_INSTANCE_BIND);
}
if(cInfo->flags_extra & CREATURE_FLAG_EXTRA_AGGRO_ZONE)
{
if(!mapEntry || !mapEntry->IsDungeon())
sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_AGGRO_ZONE (%u) but creature are not in instance.",
guid, data.id, CREATURE_FLAG_EXTRA_AGGRO_ZONE);
} }
if(data.curmana < cInfo->minmana) if(data.curmana < cInfo->minmana)

View file

@ -7711,11 +7711,17 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
if (getStandState() == UNIT_STAND_STATE_CUSTOM) if (getStandState() == UNIT_STAND_STATE_CUSTOM)
SetStandState(UNIT_STAND_STATE_STAND); SetStandState(UNIT_STAND_STATE_STAND);
if (((Creature*)this)->AI()) Creature* pCreature = (Creature*)this;
((Creature*)this)->AI()->EnterCombat(enemy);
if (pCreature->AI())
pCreature->AI()->EnterCombat(enemy);
// Some bosses are set into combat with zone
if (GetMap()->IsDungeon() && (pCreature->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_AGGRO_ZONE))
pCreature->SetInCombatWithZone();
if (InstanceData* mapInstance = GetInstanceData()) if (InstanceData* mapInstance = GetInstanceData())
mapInstance->OnCreatureEnterCombat((Creature*)this); mapInstance->OnCreatureEnterCombat(pCreature);
} }
} }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11031" #define REVISION_NR "11032"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__