mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[11489] Remove the old and custom UNIT_NPC_FLAG_GUARD for creatures.
Existing data moved to flags_extra field, with value CREATURE_FLAG_EXTRA_GUARD (0x400 / 1024). Remove isGuard() from Unit class to a new IsGuard() function in Creature class. Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
639cac83a3
commit
ecdb435b1e
10 changed files with 15 additions and 13 deletions
|
|
@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
|
||||||
`version` varchar(120) default NULL,
|
`version` varchar(120) default NULL,
|
||||||
`creature_ai_version` varchar(120) default NULL,
|
`creature_ai_version` varchar(120) default NULL,
|
||||||
`cache_id` int(10) default '0',
|
`cache_id` int(10) default '0',
|
||||||
`required_11453_01_mangos_spell_proc_event` bit(1) default NULL
|
`required_11489_01_mangos_creature_template` bit(1) default NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
|
||||||
4
sql/updates/11489_01_mangos_creature_template.sql
Normal file
4
sql/updates/11489_01_mangos_creature_template.sql
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
ALTER TABLE db_version CHANGE COLUMN required_11453_01_mangos_spell_proc_event required_11489_01_mangos_creature_template bit;
|
||||||
|
|
||||||
|
UPDATE creature_template SET flags_extra=flags_extra|0x00000400 WHERE npcflag=npcflag|0x10000000;
|
||||||
|
UPDATE creature_template SET npcflag=npcflag &~ 0x10000000;
|
||||||
|
|
@ -53,6 +53,7 @@ enum CreatureFlagsExtra
|
||||||
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
|
CREATURE_FLAG_EXTRA_AGGRO_ZONE = 0x00000200, // creature sets itself in combat with zone on aggro
|
||||||
|
CREATURE_FLAG_EXTRA_GUARD = 0x00000400, // creature is a guard
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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
|
||||||
|
|
@ -472,6 +473,8 @@ class MANGOS_DLL_SPEC Creature : public Unit
|
||||||
void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; }
|
void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; }
|
||||||
bool IsRacialLeader() const { return GetCreatureInfo()->RacialLeader; }
|
bool IsRacialLeader() const { return GetCreatureInfo()->RacialLeader; }
|
||||||
bool IsCivilian() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; }
|
bool IsCivilian() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; }
|
||||||
|
bool IsGuard() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_GUARD; }
|
||||||
|
|
||||||
bool CanWalk() const { return GetCreatureInfo()->InhabitType & INHABIT_GROUND; }
|
bool CanWalk() const { return GetCreatureInfo()->InhabitType & INHABIT_GROUND; }
|
||||||
bool CanSwim() const { return GetCreatureInfo()->InhabitType & INHABIT_WATER; }
|
bool CanSwim() const { return GetCreatureInfo()->InhabitType & INHABIT_WATER; }
|
||||||
bool CanFly() const { return GetCreatureInfo()->InhabitType & INHABIT_AIR; }
|
bool CanFly() const { return GetCreatureInfo()->InhabitType & INHABIT_AIR; }
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ namespace FactorySelector
|
||||||
if (!ai_factory && !ainame.empty())
|
if (!ai_factory && !ainame.empty())
|
||||||
ai_factory = ai_registry.GetRegistryItem( ainame.c_str() );
|
ai_factory = ai_registry.GetRegistryItem( ainame.c_str() );
|
||||||
|
|
||||||
if (!ai_factory && creature->isGuard() )
|
if (!ai_factory && creature->IsGuard())
|
||||||
ai_factory = ai_registry.GetRegistryItem("GuardAI");
|
ai_factory = ai_registry.GetRegistryItem("GuardAI");
|
||||||
|
|
||||||
// select by permit check
|
// select by permit check
|
||||||
|
|
|
||||||
|
|
@ -931,7 +931,7 @@ void CreatureEventAI::JustDied(Unit* killer)
|
||||||
{
|
{
|
||||||
Reset();
|
Reset();
|
||||||
|
|
||||||
if (m_creature->isGuard())
|
if (m_creature->IsGuard())
|
||||||
{
|
{
|
||||||
//Send Zone Under Attack message to the LocalDefense and WorldDefense Channels
|
//Send Zone Under Attack message to the LocalDefense and WorldDefense Channels
|
||||||
if (Player* pKiller = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
|
if (Player* pKiller = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
int GuardAI::Permissible(const Creature *creature)
|
int GuardAI::Permissible(const Creature *creature)
|
||||||
{
|
{
|
||||||
if( creature->isGuard())
|
if (creature->IsGuard())
|
||||||
return PERMIT_BASE_SPECIAL;
|
return PERMIT_BASE_SPECIAL;
|
||||||
|
|
||||||
return PERMIT_BASE_NO;
|
return PERMIT_BASE_NO;
|
||||||
|
|
|
||||||
|
|
@ -575,8 +575,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *
|
||||||
{
|
{
|
||||||
if (index == UNIT_NPC_FLAGS)
|
if (index == UNIT_NPC_FLAGS)
|
||||||
{
|
{
|
||||||
// remove custom flag before sending
|
uint32 appendValue = m_uint32Values[index];
|
||||||
uint32 appendValue = m_uint32Values[index] & ~UNIT_NPC_FLAG_GUARD;
|
|
||||||
|
|
||||||
if (GetTypeId() == TYPEID_UNIT)
|
if (GetTypeId() == TYPEID_UNIT)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -586,7 +586,6 @@ enum NPCFlags
|
||||||
UNIT_NPC_FLAG_STABLEMASTER = 0x00400000, // 100%
|
UNIT_NPC_FLAG_STABLEMASTER = 0x00400000, // 100%
|
||||||
UNIT_NPC_FLAG_GUILD_BANKER = 0x00800000, // cause client to send 997 opcode
|
UNIT_NPC_FLAG_GUILD_BANKER = 0x00800000, // cause client to send 997 opcode
|
||||||
UNIT_NPC_FLAG_SPELLCLICK = 0x01000000, // cause client to send 1015 opcode (spell click), dynamic, set at loading and don't must be set in DB
|
UNIT_NPC_FLAG_SPELLCLICK = 0x01000000, // cause client to send 1015 opcode (spell click), dynamic, set at loading and don't must be set in DB
|
||||||
UNIT_NPC_FLAG_GUARD = 0x10000000 // custom flag for guards
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// used in most movement packets (send and received)
|
// used in most movement packets (send and received)
|
||||||
|
|
@ -1387,14 +1386,11 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
return HasFlag( UNIT_NPC_FLAGS,
|
return HasFlag( UNIT_NPC_FLAGS,
|
||||||
UNIT_NPC_FLAG_VENDOR | UNIT_NPC_FLAG_TRAINER | UNIT_NPC_FLAG_FLIGHTMASTER |
|
UNIT_NPC_FLAG_VENDOR | UNIT_NPC_FLAG_TRAINER | UNIT_NPC_FLAG_FLIGHTMASTER |
|
||||||
UNIT_NPC_FLAG_PETITIONER | UNIT_NPC_FLAG_BATTLEMASTER | UNIT_NPC_FLAG_BANKER |
|
UNIT_NPC_FLAG_PETITIONER | UNIT_NPC_FLAG_BATTLEMASTER | UNIT_NPC_FLAG_BANKER |
|
||||||
UNIT_NPC_FLAG_INNKEEPER | UNIT_NPC_FLAG_GUARD | UNIT_NPC_FLAG_SPIRITHEALER |
|
UNIT_NPC_FLAG_INNKEEPER | UNIT_NPC_FLAG_SPIRITHEALER |
|
||||||
UNIT_NPC_FLAG_SPIRITGUIDE | UNIT_NPC_FLAG_TABARDDESIGNER | UNIT_NPC_FLAG_AUCTIONEER );
|
UNIT_NPC_FLAG_SPIRITGUIDE | UNIT_NPC_FLAG_TABARDDESIGNER | UNIT_NPC_FLAG_AUCTIONEER );
|
||||||
}
|
}
|
||||||
bool isSpiritService() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER | UNIT_NPC_FLAG_SPIRITGUIDE ); }
|
bool isSpiritService() const { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER | UNIT_NPC_FLAG_SPIRITGUIDE ); }
|
||||||
|
|
||||||
//Need fix or use this
|
|
||||||
bool isGuard() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GUARD); }
|
|
||||||
|
|
||||||
bool IsTaxiFlying() const { return hasUnitState(UNIT_STAT_TAXI_FLIGHT); }
|
bool IsTaxiFlying() const { return hasUnitState(UNIT_STAT_TAXI_FLIGHT); }
|
||||||
|
|
||||||
bool isInCombat() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); }
|
bool isInCombat() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); }
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11488"
|
#define REVISION_NR "11489"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#ifndef __REVISION_SQL_H__
|
#ifndef __REVISION_SQL_H__
|
||||||
#define __REVISION_SQL_H__
|
#define __REVISION_SQL_H__
|
||||||
#define REVISION_DB_CHARACTERS "required_11436_01_characters_character_queststatus"
|
#define REVISION_DB_CHARACTERS "required_11436_01_characters_character_queststatus"
|
||||||
#define REVISION_DB_MANGOS "required_11453_01_mangos_spell_proc_event"
|
#define REVISION_DB_MANGOS "required_11489_01_mangos_creature_template"
|
||||||
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
|
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
|
||||||
#endif // __REVISION_SQL_H__
|
#endif // __REVISION_SQL_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue