From a171606c6fc8ae81a9c6b0586549b0c15613c137 Mon Sep 17 00:00:00 2001 From: insunaa Date: Fri, 9 Aug 2024 15:19:50 +0200 Subject: [PATCH 1/4] StaticFlags: Implement CreatureTypeFlags from StaticFlags --- src/game/Globals/ObjectMgr.cpp | 71 ++++++++++++++++++++++++++++++++ src/game/Globals/ObjectMgr.h | 2 + src/game/Globals/SharedDefines.h | 28 ++++++------- 3 files changed, 87 insertions(+), 14 deletions(-) diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index f8a8a440730..048d4b89191 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -750,6 +750,8 @@ void ObjectMgr::LoadCreatureTemplates() sLog.outErrorDb("Table creature_template entry %u StringID2 %u does not exist. Setting to 0.", cInfo->Entry, cInfo->StringID2); const_cast(cInfo)->StringID2 = 0; } + if (cInfo->StaticFlags || cInfo->StaticFlags2 || cInfo->StaticFlags3 || cInfo->StaticFlags4) + const_cast(cInfo)->CreatureTypeFlags = GetTypeFlagsFromStaticFlags(cInfo->CreatureTypeFlags, cInfo->StaticFlags, cInfo->StaticFlags2, cInfo->StaticFlags3, cInfo->StaticFlags4); } sLog.outString(">> Loaded %u creature definitions", sCreatureStorage.GetRecordCount()); @@ -1035,6 +1037,75 @@ VehicleSeatParameters const* ObjectMgr::GetVehicleSeatParameters(uint32 seatEntr return &itr->second; } +uint32 ObjectMgr::GetTypeFlagsFromStaticFlags(uint32 typeFlags, uint32 staticFlags1, uint32 staticFlags2, uint32 staticFlags3, uint32 staticFlags4) const +{ + if (staticFlags1 & uint32(CreatureStaticFlags::TAMEABLE)) + typeFlags |= CREATURE_TYPEFLAGS_TAMEABLE; + if (staticFlags1 & uint32(CreatureStaticFlags::BOSS_MOB)) + typeFlags |= CREATURE_TYPEFLAGS_BOSS_MOB; + if (staticFlags1 & uint32(CreatureStaticFlags::VISIBLE_TO_GHOSTS)) + typeFlags |= CREATURE_TYPEFLAGS_GHOST_VISIBLE; + if (staticFlags1 & uint32(CreatureStaticFlags::NO_FACTION_TOOLTIP)) + typeFlags |= CREATURE_TYPEFLAGS_NO_FACTION_TOOLTIP; + if (staticFlags1 & uint32(CreatureStaticFlags::DO_NOT_PLAY_WOUND_ANIM)) + typeFlags |= CREATURE_TYPEFLAGS_NO_WOUND_ANIM; + if (staticFlags1 & uint32(CreatureStaticFlags::MORE_AUDIBLE)) + typeFlags |= CREATURE_TYPEFLAGS_MORE_AUDIBLE; + if (staticFlags2 & uint32(CreatureStaticFlags2::SPELL_ATTACKABLE)) + typeFlags |= CREATURE_TYPEFLAGS_SPELL_ATTACKABLE; + if (staticFlags2 & uint32(CreatureStaticFlags2::INTERACT_WHILE_DEAD)) + typeFlags |= CREATURE_TYPEFLAGS_INTERACT_DEAD; + if (staticFlags2 & uint32(CreatureStaticFlags2::SKIN_WITH_HERBALISM)) + typeFlags |= CREATURE_TYPEFLAGS_HERBLOOT; + if (staticFlags2 & uint32(CreatureStaticFlags2::SKIN_WITH_MINING)) + typeFlags |= CREATURE_TYPEFLAGS_MININGLOOT; + if (staticFlags2 & uint32(CreatureStaticFlags2::ALLOW_MOUNTED_COMBAT)) + typeFlags |= CREATURE_TYPEFLAGS_MOUNTED_COMBAT; + if (staticFlags2 & uint32(CreatureStaticFlags2::NO_DEATH_MESSAGE)) + typeFlags |= CREATURE_TYPEFLAGS_NO_DEATH_MSG; // Not proven + if (staticFlags2 & uint32(CreatureStaticFlags2::CAN_ASSIST)) + typeFlags |= CREATURE_TYPEFLAGS_CAN_ASSIST; + if (staticFlags2 & uint32(CreatureStaticFlags2::NO_PET_BAR)) + typeFlags |= CREATURE_TYPEFLAGS_NO_PET_BAR; + if (staticFlags3 & uint32(CreatureStaticFlags3::MASK_UID)) + typeFlags |= CREATURE_TYPEFLAGS_NO_UID; + if (staticFlags3 & uint32(CreatureStaticFlags3::SKIN_WITH_ENGINEERING)) + typeFlags |= CREATURE_TYPEFLAGS_ENGINEERLOOT; + if (staticFlags3 & uint32(CreatureStaticFlags3::TAMEABLE_EXOTIC)) + typeFlags |= CREATURE_TYPEFLAGS_EXOTIC; + if (staticFlags3 & uint32(CreatureStaticFlags3::NO_NAME_PLATE)) + typeFlags |= CREATURE_TYPEFLAGS_NO_NAMEPLATE; // Not proven + if (staticFlags3 & uint32(CreatureStaticFlags3::USE_MODEL_COLLISION_SIZE)) + typeFlags |= CREATURE_TYPEFLAGS_MODEL_COLLISION_SIZE; // Not proven + if (staticFlags3 & uint32(CreatureStaticFlags3::ALLOW_INTERACTION_WHILE_IN_COMBAT)) + typeFlags |= CREATURE_TYPEFLAGS_SIEGE_WEAPON; // Not proven + if (staticFlags3 & uint32(CreatureStaticFlags3::COLLIDE_WITH_MISSILES)) + typeFlags |= CREATURE_TYPEFLAGS_COLLIDE_WITH_MISSILES; // Not proven + if (staticFlags3 & uint32(CreatureStaticFlags3::DO_NOT_PLAY_MOUNTED_ANIMATIONS)) + typeFlags |= CREATURE_TYPEFLAGS_NO_MOUNTED_ANIM; // Not proven + if (staticFlags3 & uint32(CreatureStaticFlags3::LINK_ALL)) + typeFlags |= CREATURE_TYPEFLAGS_UNK23; // Not proven + if (staticFlags4 & uint32(CreatureStaticFlags4::INTERACT_ONLY_WITH_CREATOR)) + typeFlags |= CREATURE_TYPEFLAGS_SQUIRE; // Not proven + if (staticFlags4 & uint32(CreatureStaticFlags4::DO_NOT_PLAY_UNIT_EVENT_SOUNDS)) + typeFlags |= CREATURE_TYPEFLAGS_NO_DEATH_SOUND; // Not proven + if (staticFlags4 & uint32(CreatureStaticFlags4::HAS_NO_SHADOW_BLOB)) + typeFlags |= CREATURE_TYPEFLAGS_NO_SHADOW_BLOB; // Not proven + if (staticFlags4 & uint32(CreatureStaticFlags4::TREAT_AS_RAID_UNIT_FOR_HELPFUL_SPELLS)) + typeFlags |= CREATURE_TYPEFLAGS_TREAT_AS_IN_RAID; + if (staticFlags4 & uint32(CreatureStaticFlags4::FORCE_GOSSIP)) + typeFlags |= CREATURE_TYPEFLAGS_FORCE_GOSSIP; + if (staticFlags4 & uint32(CreatureStaticFlags4::DO_NOT_SHEATHE)) + typeFlags |= CREATURE_TYPEFLAGS_UNK29; // Not proven + if (staticFlags4 & uint32(CreatureStaticFlags4::DO_NOT_TARGET_ON_INTERACTION)) + typeFlags |= CREATURE_TYPEFLAGS_UNK30; // Not proven + if (staticFlags4 & uint32(CreatureStaticFlags4::DO_NOT_RENDER_OBJECT_NAME)) + typeFlags |= CREATURE_TYPEFLAGS_UNK31; // Not proven + if (staticFlags4 & uint32(CreatureStaticFlags4::QUEST_BOSS)) + typeFlags |= CREATURE_TYPEFLAGS_QUEST_BOSS; + return typeFlags; +} + CreatureImmunityVector const* ObjectMgr::GetCreatureImmunitySet(uint32 entry, uint32 setId) const { auto itr = m_creatureImmunities.find(entry); diff --git a/src/game/Globals/ObjectMgr.h b/src/game/Globals/ObjectMgr.h index a00a45f8e89..3970a8c9b71 100644 --- a/src/game/Globals/ObjectMgr.h +++ b/src/game/Globals/ObjectMgr.h @@ -1301,6 +1301,8 @@ class ObjectMgr // Vehicles VehicleSeatParameters const* GetVehicleSeatParameters(uint32 seatEntry) const; + + uint32 GetTypeFlagsFromStaticFlags(uint32 typeFlags, uint32 staticFlags1, uint32 staticFlags2, uint32 staticFlags3, uint32 staticFlags4) const; protected: // current locale settings diff --git a/src/game/Globals/SharedDefines.h b/src/game/Globals/SharedDefines.h index e3e3c6f9f67..849c5a8a7fc 100644 --- a/src/game/Globals/SharedDefines.h +++ b/src/game/Globals/SharedDefines.h @@ -1320,30 +1320,30 @@ enum CreatureTypeFlags { CREATURE_TYPEFLAGS_TAMEABLE = 0x00000001, // Tameable by any hunter CREATURE_TYPEFLAGS_GHOST_VISIBLE = 0x00000002, // Creatures which can _also_ be seen when player is a ghost, used in CanInteract function by client, can't be attacked - CREATURE_TYPEFLAGS_UNK3 = 0x00000004, // "BOSS" flag for tooltips - CREATURE_TYPEFLAGS_UNK4 = 0x00000008, - CREATURE_TYPEFLAGS_UNK5 = 0x00000010, // controls something in client tooltip related to creature faction - CREATURE_TYPEFLAGS_UNK6 = 0x00000020, // may be sound related - CREATURE_TYPEFLAGS_UNK7 = 0x00000040, // may be related to attackable / not attackable creatures with spells, used together with lua_IsHelpfulSpell/lua_IsHarmfulSpell + CREATURE_TYPEFLAGS_BOSS_MOB = 0x00000004, // "BOSS" flag for tooltips + CREATURE_TYPEFLAGS_NO_WOUND_ANIM = 0x00000008, + CREATURE_TYPEFLAGS_NO_FACTION_TOOLTIP=0x00000010, // controls something in client tooltip related to creature faction + CREATURE_TYPEFLAGS_MORE_AUDIBLE = 0x00000020, // may be sound related + CREATURE_TYPEFLAGS_SPELL_ATTACKABLE = 0x00000040, // may be related to attackable / not attackable creatures with spells, used together with lua_IsHelpfulSpell/lua_IsHarmfulSpell CREATURE_TYPEFLAGS_INTERACT_DEAD = 0x00000080, // Creature can be interacted with even if it's dead CREATURE_TYPEFLAGS_HERBLOOT = 0x00000100, // Can be looted by herbalist CREATURE_TYPEFLAGS_MININGLOOT = 0x00000200, // Can be looted by miner - CREATURE_TYPEFLAGS_UNK11 = 0x00000400, // no idea, but it used by client + CREATURE_TYPEFLAGS_NO_DEATH_MSG = 0x00000400, // no idea, but it used by client CREATURE_TYPEFLAGS_MOUNTED_COMBAT = 0x00000800, // possibility to attack and cast spells while mounted CREATURE_TYPEFLAGS_CAN_ASSIST = 0x00001000, // Can aid any player (and group) in combat. Typically seen for escorting NPC's - CREATURE_TYPEFLAGS_UNK14 = 0x00002000, // checked from calls in Lua_PetHasActionBar - CREATURE_TYPEFLAGS_UNK15 = 0x00004000, // Lua_UnitGUID, client does guid_low &= 0xFF000000 if this flag is set + CREATURE_TYPEFLAGS_NO_PET_BAR = 0x00002000, // checked from calls in Lua_PetHasActionBar + CREATURE_TYPEFLAGS_NO_UID = 0x00004000, // Lua_UnitGUID, client does guid_low &= 0xFF000000 if this flag is set CREATURE_TYPEFLAGS_ENGINEERLOOT = 0x00008000, // Can be looted by engineer CREATURE_TYPEFLAGS_EXOTIC = 0x00010000, // Can be tamed by hunter as exotic pet - CREATURE_TYPEFLAGS_UNK18 = 0x00020000, // related to CreatureDisplayInfo and scaling in some way + CREATURE_TYPEFLAGS_MODEL_COLLISION_SIZE=0x00020000, // related to CreatureDisplayInfo and scaling in some way CREATURE_TYPEFLAGS_SIEGE_WEAPON = 0x00040000, // Related to vehicle/siege weapons - CREATURE_TYPEFLAGS_COLLIDE_WITH_MISSILES = 0x00080000, // - CREATURE_TYPEFLAGS_UNK21 = 0x00100000, // no idea, but it used by client, may be related to rendering - CREATURE_TYPEFLAGS_UNK22 = 0x00200000, // may be has something to do with animation (disable animation?) + CREATURE_TYPEFLAGS_COLLIDE_WITH_MISSILES=0x00080000, // may be has something to do with missiles + CREATURE_TYPEFLAGS_NO_NAMEPLATE = 0x00100000, // no idea, but it used by client, may be related to rendering + CREATURE_TYPEFLAGS_NO_MOUNTED_ANIM = 0x00200000, // may be has something to do with animation (disable animation?) CREATURE_TYPEFLAGS_UNK23 = 0x00400000, // this one probably controls some creature visual CREATURE_TYPEFLAGS_SQUIRE = 0x00800000, // First seen in 3.2.2. Related to banner/backpack of creature/companion, used in CanInteract function by client - CREATURE_TYPEFLAGS_UNK25 = 0x01000000, // pet sounds related? - CREATURE_TYPEFLAGS_UNK26 = 0x02000000, // this one probably controls some creature visual + CREATURE_TYPEFLAGS_NO_DEATH_SOUND = 0x01000000, // pet sounds related? + CREATURE_TYPEFLAGS_NO_SHADOW_BLOB = 0x02000000, // this one probably controls some creature visual CREATURE_TYPEFLAGS_TREAT_AS_IN_RAID = 0x04000000, // creature has no type, or forces creature to be considered as in party, may be related to creature assistance CREATURE_TYPEFLAGS_FORCE_GOSSIP = 0x08000000, // used in Lua_ForceGossip CREATURE_TYPEFLAGS_UNK29 = 0x10000000, // no idea, but it used by client From a84ac2108526483c44b152facb0503dcce1a4020 Mon Sep 17 00:00:00 2001 From: insunaa Date: Fri, 9 Aug 2024 19:00:31 +0200 Subject: [PATCH 2/4] StaticFlags: Checked accuracy of some flags --- src/game/Globals/ObjectMgr.cpp | 16 ++++++++-------- src/game/Globals/SharedDefines.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index 048d4b89191..d234d5175e9 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -1048,9 +1048,9 @@ uint32 ObjectMgr::GetTypeFlagsFromStaticFlags(uint32 typeFlags, uint32 staticFla if (staticFlags1 & uint32(CreatureStaticFlags::NO_FACTION_TOOLTIP)) typeFlags |= CREATURE_TYPEFLAGS_NO_FACTION_TOOLTIP; if (staticFlags1 & uint32(CreatureStaticFlags::DO_NOT_PLAY_WOUND_ANIM)) - typeFlags |= CREATURE_TYPEFLAGS_NO_WOUND_ANIM; + typeFlags |= CREATURE_TYPEFLAGS_NO_WOUND_ANIM; // Not Proven if (staticFlags1 & uint32(CreatureStaticFlags::MORE_AUDIBLE)) - typeFlags |= CREATURE_TYPEFLAGS_MORE_AUDIBLE; + typeFlags |= CREATURE_TYPEFLAGS_MORE_AUDIBLE; // Not Proven if (staticFlags2 & uint32(CreatureStaticFlags2::SPELL_ATTACKABLE)) typeFlags |= CREATURE_TYPEFLAGS_SPELL_ATTACKABLE; if (staticFlags2 & uint32(CreatureStaticFlags2::INTERACT_WHILE_DEAD)) @@ -1062,7 +1062,7 @@ uint32 ObjectMgr::GetTypeFlagsFromStaticFlags(uint32 typeFlags, uint32 staticFla if (staticFlags2 & uint32(CreatureStaticFlags2::ALLOW_MOUNTED_COMBAT)) typeFlags |= CREATURE_TYPEFLAGS_MOUNTED_COMBAT; if (staticFlags2 & uint32(CreatureStaticFlags2::NO_DEATH_MESSAGE)) - typeFlags |= CREATURE_TYPEFLAGS_NO_DEATH_MSG; // Not proven + typeFlags |= CREATURE_TYPEFLAGS_NO_DEATH_MSG; if (staticFlags2 & uint32(CreatureStaticFlags2::CAN_ASSIST)) typeFlags |= CREATURE_TYPEFLAGS_CAN_ASSIST; if (staticFlags2 & uint32(CreatureStaticFlags2::NO_PET_BAR)) @@ -1074,7 +1074,7 @@ uint32 ObjectMgr::GetTypeFlagsFromStaticFlags(uint32 typeFlags, uint32 staticFla if (staticFlags3 & uint32(CreatureStaticFlags3::TAMEABLE_EXOTIC)) typeFlags |= CREATURE_TYPEFLAGS_EXOTIC; if (staticFlags3 & uint32(CreatureStaticFlags3::NO_NAME_PLATE)) - typeFlags |= CREATURE_TYPEFLAGS_NO_NAMEPLATE; // Not proven + typeFlags |= CREATURE_TYPEFLAGS_NO_NAMEPLATE; if (staticFlags3 & uint32(CreatureStaticFlags3::USE_MODEL_COLLISION_SIZE)) typeFlags |= CREATURE_TYPEFLAGS_MODEL_COLLISION_SIZE; // Not proven if (staticFlags3 & uint32(CreatureStaticFlags3::ALLOW_INTERACTION_WHILE_IN_COMBAT)) @@ -1082,13 +1082,13 @@ uint32 ObjectMgr::GetTypeFlagsFromStaticFlags(uint32 typeFlags, uint32 staticFla if (staticFlags3 & uint32(CreatureStaticFlags3::COLLIDE_WITH_MISSILES)) typeFlags |= CREATURE_TYPEFLAGS_COLLIDE_WITH_MISSILES; // Not proven if (staticFlags3 & uint32(CreatureStaticFlags3::DO_NOT_PLAY_MOUNTED_ANIMATIONS)) - typeFlags |= CREATURE_TYPEFLAGS_NO_MOUNTED_ANIM; // Not proven + typeFlags |= CREATURE_TYPEFLAGS_NO_MOUNTED_ANIM; if (staticFlags3 & uint32(CreatureStaticFlags3::LINK_ALL)) typeFlags |= CREATURE_TYPEFLAGS_UNK23; // Not proven if (staticFlags4 & uint32(CreatureStaticFlags4::INTERACT_ONLY_WITH_CREATOR)) - typeFlags |= CREATURE_TYPEFLAGS_SQUIRE; // Not proven + typeFlags |= CREATURE_TYPEFLAGS_SQUIRE; if (staticFlags4 & uint32(CreatureStaticFlags4::DO_NOT_PLAY_UNIT_EVENT_SOUNDS)) - typeFlags |= CREATURE_TYPEFLAGS_NO_DEATH_SOUND; // Not proven + typeFlags |= CREATURE_TYPEFLAGS_NO_DEATH_SOUND; if (staticFlags4 & uint32(CreatureStaticFlags4::HAS_NO_SHADOW_BLOB)) typeFlags |= CREATURE_TYPEFLAGS_NO_SHADOW_BLOB; // Not proven if (staticFlags4 & uint32(CreatureStaticFlags4::TREAT_AS_RAID_UNIT_FOR_HELPFUL_SPELLS)) @@ -1096,7 +1096,7 @@ uint32 ObjectMgr::GetTypeFlagsFromStaticFlags(uint32 typeFlags, uint32 staticFla if (staticFlags4 & uint32(CreatureStaticFlags4::FORCE_GOSSIP)) typeFlags |= CREATURE_TYPEFLAGS_FORCE_GOSSIP; if (staticFlags4 & uint32(CreatureStaticFlags4::DO_NOT_SHEATHE)) - typeFlags |= CREATURE_TYPEFLAGS_UNK29; // Not proven + typeFlags |= CREATURE_TYPEFLAGS_FORCE_UNSHEATHE; if (staticFlags4 & uint32(CreatureStaticFlags4::DO_NOT_TARGET_ON_INTERACTION)) typeFlags |= CREATURE_TYPEFLAGS_UNK30; // Not proven if (staticFlags4 & uint32(CreatureStaticFlags4::DO_NOT_RENDER_OBJECT_NAME)) diff --git a/src/game/Globals/SharedDefines.h b/src/game/Globals/SharedDefines.h index 849c5a8a7fc..ba579895c45 100644 --- a/src/game/Globals/SharedDefines.h +++ b/src/game/Globals/SharedDefines.h @@ -1346,7 +1346,7 @@ enum CreatureTypeFlags CREATURE_TYPEFLAGS_NO_SHADOW_BLOB = 0x02000000, // this one probably controls some creature visual CREATURE_TYPEFLAGS_TREAT_AS_IN_RAID = 0x04000000, // creature has no type, or forces creature to be considered as in party, may be related to creature assistance CREATURE_TYPEFLAGS_FORCE_GOSSIP = 0x08000000, // used in Lua_ForceGossip - CREATURE_TYPEFLAGS_UNK29 = 0x10000000, // no idea, but it used by client + CREATURE_TYPEFLAGS_FORCE_UNSHEATHE = 0x10000000, // no idea, but it used by client CREATURE_TYPEFLAGS_UNK30 = 0x20000000, CREATURE_TYPEFLAGS_UNK31 = 0x40000000, CREATURE_TYPEFLAGS_QUEST_BOSS = 0x80000000, // Lua_UnitIsQuestBoss From 49ac1bb855c9017ac6734cd07b8474e8dabfa1e2 Mon Sep 17 00:00:00 2001 From: insunaa Date: Fri, 9 Aug 2024 22:46:31 +0200 Subject: [PATCH 3/4] StaticFlags: Rename remaining UNKs --- src/game/Globals/ObjectMgr.cpp | 22 +++++------ src/game/Globals/SharedDefines.h | 64 ++++++++++++++++---------------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index d234d5175e9..f95bf0a3c00 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -1048,9 +1048,9 @@ uint32 ObjectMgr::GetTypeFlagsFromStaticFlags(uint32 typeFlags, uint32 staticFla if (staticFlags1 & uint32(CreatureStaticFlags::NO_FACTION_TOOLTIP)) typeFlags |= CREATURE_TYPEFLAGS_NO_FACTION_TOOLTIP; if (staticFlags1 & uint32(CreatureStaticFlags::DO_NOT_PLAY_WOUND_ANIM)) - typeFlags |= CREATURE_TYPEFLAGS_NO_WOUND_ANIM; // Not Proven + typeFlags |= CREATURE_TYPEFLAGS_NO_WOUND_ANIM; if (staticFlags1 & uint32(CreatureStaticFlags::MORE_AUDIBLE)) - typeFlags |= CREATURE_TYPEFLAGS_MORE_AUDIBLE; // Not Proven + typeFlags |= CREATURE_TYPEFLAGS_MORE_AUDIBLE; if (staticFlags2 & uint32(CreatureStaticFlags2::SPELL_ATTACKABLE)) typeFlags |= CREATURE_TYPEFLAGS_SPELL_ATTACKABLE; if (staticFlags2 & uint32(CreatureStaticFlags2::INTERACT_WHILE_DEAD)) @@ -1068,7 +1068,7 @@ uint32 ObjectMgr::GetTypeFlagsFromStaticFlags(uint32 typeFlags, uint32 staticFla if (staticFlags2 & uint32(CreatureStaticFlags2::NO_PET_BAR)) typeFlags |= CREATURE_TYPEFLAGS_NO_PET_BAR; if (staticFlags3 & uint32(CreatureStaticFlags3::MASK_UID)) - typeFlags |= CREATURE_TYPEFLAGS_NO_UID; + typeFlags |= CREATURE_TYPEFLAGS_MASK_UID; if (staticFlags3 & uint32(CreatureStaticFlags3::SKIN_WITH_ENGINEERING)) typeFlags |= CREATURE_TYPEFLAGS_ENGINEERLOOT; if (staticFlags3 & uint32(CreatureStaticFlags3::TAMEABLE_EXOTIC)) @@ -1076,31 +1076,31 @@ uint32 ObjectMgr::GetTypeFlagsFromStaticFlags(uint32 typeFlags, uint32 staticFla if (staticFlags3 & uint32(CreatureStaticFlags3::NO_NAME_PLATE)) typeFlags |= CREATURE_TYPEFLAGS_NO_NAMEPLATE; if (staticFlags3 & uint32(CreatureStaticFlags3::USE_MODEL_COLLISION_SIZE)) - typeFlags |= CREATURE_TYPEFLAGS_MODEL_COLLISION_SIZE; // Not proven + typeFlags |= CREATURE_TYPEFLAGS_MODEL_COLLISION_SIZE; if (staticFlags3 & uint32(CreatureStaticFlags3::ALLOW_INTERACTION_WHILE_IN_COMBAT)) - typeFlags |= CREATURE_TYPEFLAGS_SIEGE_WEAPON; // Not proven + typeFlags |= CREATURE_TYPEFLAGS_SIEGE_WEAPON; if (staticFlags3 & uint32(CreatureStaticFlags3::COLLIDE_WITH_MISSILES)) - typeFlags |= CREATURE_TYPEFLAGS_COLLIDE_WITH_MISSILES; // Not proven + typeFlags |= CREATURE_TYPEFLAGS_COLLIDE_WITH_MISSILES; if (staticFlags3 & uint32(CreatureStaticFlags3::DO_NOT_PLAY_MOUNTED_ANIMATIONS)) typeFlags |= CREATURE_TYPEFLAGS_NO_MOUNTED_ANIM; if (staticFlags3 & uint32(CreatureStaticFlags3::LINK_ALL)) - typeFlags |= CREATURE_TYPEFLAGS_UNK23; // Not proven + typeFlags |= CREATURE_TYPEFLAGS_LINK_ALL; if (staticFlags4 & uint32(CreatureStaticFlags4::INTERACT_ONLY_WITH_CREATOR)) typeFlags |= CREATURE_TYPEFLAGS_SQUIRE; if (staticFlags4 & uint32(CreatureStaticFlags4::DO_NOT_PLAY_UNIT_EVENT_SOUNDS)) typeFlags |= CREATURE_TYPEFLAGS_NO_DEATH_SOUND; if (staticFlags4 & uint32(CreatureStaticFlags4::HAS_NO_SHADOW_BLOB)) - typeFlags |= CREATURE_TYPEFLAGS_NO_SHADOW_BLOB; // Not proven + typeFlags |= CREATURE_TYPEFLAGS_NO_SHADOW_BLOB; if (staticFlags4 & uint32(CreatureStaticFlags4::TREAT_AS_RAID_UNIT_FOR_HELPFUL_SPELLS)) typeFlags |= CREATURE_TYPEFLAGS_TREAT_AS_IN_RAID; if (staticFlags4 & uint32(CreatureStaticFlags4::FORCE_GOSSIP)) typeFlags |= CREATURE_TYPEFLAGS_FORCE_GOSSIP; if (staticFlags4 & uint32(CreatureStaticFlags4::DO_NOT_SHEATHE)) - typeFlags |= CREATURE_TYPEFLAGS_FORCE_UNSHEATHE; + typeFlags |= CREATURE_TYPEFLAGS_DO_NOT_SHEATHE; if (staticFlags4 & uint32(CreatureStaticFlags4::DO_NOT_TARGET_ON_INTERACTION)) - typeFlags |= CREATURE_TYPEFLAGS_UNK30; // Not proven + typeFlags |= CREATURE_TYPEFLAGS_NO_INTERACT_TARGET; if (staticFlags4 & uint32(CreatureStaticFlags4::DO_NOT_RENDER_OBJECT_NAME)) - typeFlags |= CREATURE_TYPEFLAGS_UNK31; // Not proven + typeFlags |= CREATURE_TYPEFLAGS_DO_NOT_RENDER_NAME; if (staticFlags4 & uint32(CreatureStaticFlags4::QUEST_BOSS)) typeFlags |= CREATURE_TYPEFLAGS_QUEST_BOSS; return typeFlags; diff --git a/src/game/Globals/SharedDefines.h b/src/game/Globals/SharedDefines.h index ba579895c45..4a5f0a7b822 100644 --- a/src/game/Globals/SharedDefines.h +++ b/src/game/Globals/SharedDefines.h @@ -1318,38 +1318,38 @@ enum CreatureFamily enum CreatureTypeFlags { - CREATURE_TYPEFLAGS_TAMEABLE = 0x00000001, // Tameable by any hunter - CREATURE_TYPEFLAGS_GHOST_VISIBLE = 0x00000002, // Creatures which can _also_ be seen when player is a ghost, used in CanInteract function by client, can't be attacked - CREATURE_TYPEFLAGS_BOSS_MOB = 0x00000004, // "BOSS" flag for tooltips - CREATURE_TYPEFLAGS_NO_WOUND_ANIM = 0x00000008, - CREATURE_TYPEFLAGS_NO_FACTION_TOOLTIP=0x00000010, // controls something in client tooltip related to creature faction - CREATURE_TYPEFLAGS_MORE_AUDIBLE = 0x00000020, // may be sound related - CREATURE_TYPEFLAGS_SPELL_ATTACKABLE = 0x00000040, // may be related to attackable / not attackable creatures with spells, used together with lua_IsHelpfulSpell/lua_IsHarmfulSpell - CREATURE_TYPEFLAGS_INTERACT_DEAD = 0x00000080, // Creature can be interacted with even if it's dead - CREATURE_TYPEFLAGS_HERBLOOT = 0x00000100, // Can be looted by herbalist - CREATURE_TYPEFLAGS_MININGLOOT = 0x00000200, // Can be looted by miner - CREATURE_TYPEFLAGS_NO_DEATH_MSG = 0x00000400, // no idea, but it used by client - CREATURE_TYPEFLAGS_MOUNTED_COMBAT = 0x00000800, // possibility to attack and cast spells while mounted - CREATURE_TYPEFLAGS_CAN_ASSIST = 0x00001000, // Can aid any player (and group) in combat. Typically seen for escorting NPC's - CREATURE_TYPEFLAGS_NO_PET_BAR = 0x00002000, // checked from calls in Lua_PetHasActionBar - CREATURE_TYPEFLAGS_NO_UID = 0x00004000, // Lua_UnitGUID, client does guid_low &= 0xFF000000 if this flag is set - CREATURE_TYPEFLAGS_ENGINEERLOOT = 0x00008000, // Can be looted by engineer - CREATURE_TYPEFLAGS_EXOTIC = 0x00010000, // Can be tamed by hunter as exotic pet - CREATURE_TYPEFLAGS_MODEL_COLLISION_SIZE=0x00020000, // related to CreatureDisplayInfo and scaling in some way - CREATURE_TYPEFLAGS_SIEGE_WEAPON = 0x00040000, // Related to vehicle/siege weapons - CREATURE_TYPEFLAGS_COLLIDE_WITH_MISSILES=0x00080000, // may be has something to do with missiles - CREATURE_TYPEFLAGS_NO_NAMEPLATE = 0x00100000, // no idea, but it used by client, may be related to rendering - CREATURE_TYPEFLAGS_NO_MOUNTED_ANIM = 0x00200000, // may be has something to do with animation (disable animation?) - CREATURE_TYPEFLAGS_UNK23 = 0x00400000, // this one probably controls some creature visual - CREATURE_TYPEFLAGS_SQUIRE = 0x00800000, // First seen in 3.2.2. Related to banner/backpack of creature/companion, used in CanInteract function by client - CREATURE_TYPEFLAGS_NO_DEATH_SOUND = 0x01000000, // pet sounds related? - CREATURE_TYPEFLAGS_NO_SHADOW_BLOB = 0x02000000, // this one probably controls some creature visual - CREATURE_TYPEFLAGS_TREAT_AS_IN_RAID = 0x04000000, // creature has no type, or forces creature to be considered as in party, may be related to creature assistance - CREATURE_TYPEFLAGS_FORCE_GOSSIP = 0x08000000, // used in Lua_ForceGossip - CREATURE_TYPEFLAGS_FORCE_UNSHEATHE = 0x10000000, // no idea, but it used by client - CREATURE_TYPEFLAGS_UNK30 = 0x20000000, - CREATURE_TYPEFLAGS_UNK31 = 0x40000000, - CREATURE_TYPEFLAGS_QUEST_BOSS = 0x80000000, // Lua_UnitIsQuestBoss + CREATURE_TYPEFLAGS_TAMEABLE = 0x00000001, // Tameable by any hunter + CREATURE_TYPEFLAGS_GHOST_VISIBLE = 0x00000002, // Creatures which can _also_ be seen when player is a ghost, used in CanInteract function by client, can't be attacked + CREATURE_TYPEFLAGS_BOSS_MOB = 0x00000004, // "BOSS" flag for tooltips + CREATURE_TYPEFLAGS_NO_WOUND_ANIM = 0x00000008, + CREATURE_TYPEFLAGS_NO_FACTION_TOOLTIP = 0x00000010, // controls something in client tooltip related to creature faction + CREATURE_TYPEFLAGS_MORE_AUDIBLE = 0x00000020, // may be sound related + CREATURE_TYPEFLAGS_SPELL_ATTACKABLE = 0x00000040, // may be related to attackable / not attackable creatures with spells, used together with lua_IsHelpfulSpell/lua_IsHarmfulSpell + CREATURE_TYPEFLAGS_INTERACT_DEAD = 0x00000080, // Creature can be interacted with even if it's dead + CREATURE_TYPEFLAGS_HERBLOOT = 0x00000100, // Can be looted by herbalist + CREATURE_TYPEFLAGS_MININGLOOT = 0x00000200, // Can be looted by miner + CREATURE_TYPEFLAGS_NO_DEATH_MSG = 0x00000400, // no idea, but it used by client + CREATURE_TYPEFLAGS_MOUNTED_COMBAT = 0x00000800, // possibility to attack and cast spells while mounted + CREATURE_TYPEFLAGS_CAN_ASSIST = 0x00001000, // Can aid any player (and group) in combat. Typically seen for escorting NPC's + CREATURE_TYPEFLAGS_NO_PET_BAR = 0x00002000, // checked from calls in Lua_PetHasActionBar + CREATURE_TYPEFLAGS_MASK_UID = 0x00004000, // Lua_UnitGUID, client does guid_low &= 0xFF000000 if this flag is set + CREATURE_TYPEFLAGS_ENGINEERLOOT = 0x00008000, // Can be looted by engineer + CREATURE_TYPEFLAGS_EXOTIC = 0x00010000, // Can be tamed by hunter as exotic pet + CREATURE_TYPEFLAGS_MODEL_COLLISION_SIZE = 0x00020000, // related to CreatureDisplayInfo and scaling in some way + CREATURE_TYPEFLAGS_SIEGE_WEAPON = 0x00040000, // Related to vehicle/siege weapons + CREATURE_TYPEFLAGS_COLLIDE_WITH_MISSILES = 0x00080000, // may be has something to do with missiles + CREATURE_TYPEFLAGS_NO_NAMEPLATE = 0x00100000, // no idea, but it used by client, may be related to rendering + CREATURE_TYPEFLAGS_NO_MOUNTED_ANIM = 0x00200000, // may be has something to do with animation (disable animation?) + CREATURE_TYPEFLAGS_LINK_ALL = 0x00400000, // this one probably controls some creature visual + CREATURE_TYPEFLAGS_SQUIRE = 0x00800000, // First seen in 3.2.2. Related to banner/backpack of creature/companion, used in CanInteract function by client + CREATURE_TYPEFLAGS_NO_DEATH_SOUND = 0x01000000, // pet sounds related? + CREATURE_TYPEFLAGS_NO_SHADOW_BLOB = 0x02000000, // this one probably controls some creature visual + CREATURE_TYPEFLAGS_TREAT_AS_IN_RAID = 0x04000000, // creature has no type, or forces creature to be considered as in party, may be related to creature assistance + CREATURE_TYPEFLAGS_FORCE_GOSSIP = 0x08000000, // used in Lua_ForceGossip + CREATURE_TYPEFLAGS_DO_NOT_SHEATHE = 0x10000000, // no idea, but it used by client + CREATURE_TYPEFLAGS_NO_INTERACT_TARGET = 0x20000000, + CREATURE_TYPEFLAGS_DO_NOT_RENDER_NAME = 0x40000000, + CREATURE_TYPEFLAGS_QUEST_BOSS = 0x80000000, // Lua_UnitIsQuestBoss }; enum CreatureEliteType From b841e749255ddcc646dabf2243a9f5f7e19ddbec Mon Sep 17 00:00:00 2001 From: insunaa Date: Sat, 10 Aug 2024 08:22:13 +0200 Subject: [PATCH 4/4] Optional: Separate CreatureTypeFlags into their own namespace --- src/game/AI/BaseAI/CreatureAI.cpp | 2 +- src/game/AI/ScriptDevAI/base/escort_ai.cpp | 2 +- src/game/AI/ScriptDevAI/base/follower_ai.cpp | 2 +- src/game/Entities/Creature.cpp | 2 +- src/game/Entities/Creature.h | 12 ++-- src/game/Entities/Relations.cpp | 22 +++---- src/game/Globals/ObjectMgr.cpp | 64 +++++++++---------- src/game/Globals/SharedDefines.h | 67 ++++++++++---------- src/game/Mails/MailHandler.cpp | 2 +- src/game/PlayerBot/Base/PlayerbotAI.cpp | 2 +- 10 files changed, 90 insertions(+), 87 deletions(-) diff --git a/src/game/AI/BaseAI/CreatureAI.cpp b/src/game/AI/BaseAI/CreatureAI.cpp index e3106f760d6..a9ce2489a47 100644 --- a/src/game/AI/BaseAI/CreatureAI.cpp +++ b/src/game/AI/BaseAI/CreatureAI.cpp @@ -33,7 +33,7 @@ CreatureAI::CreatureAI(Creature* creature, uint32 combatActions) : m_creature(creature), m_deathPrevented(false), m_followAngle(0.f), m_followDist(0.f) { - m_dismountOnAggro = !(m_creature->GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_MOUNTED_COMBAT); + m_dismountOnAggro = !(m_creature->GetCreatureInfo()->CreatureTypeFlags & CreatureTypeFlags::MOUNTED_COMBAT); SetMeleeEnabled(!(m_creature->GetSettings().HasFlag(CreatureStaticFlags::NO_MELEE_FLEE) || m_creature->GetSettings().HasFlag(CreatureStaticFlags4::NO_MELEE_APPROACH))); if (m_creature->GetSettings().HasFlag(CreatureStaticFlags::SESSILE)) diff --git a/src/game/AI/ScriptDevAI/base/escort_ai.cpp b/src/game/AI/ScriptDevAI/base/escort_ai.cpp index a22112e1954..8bd85511110 100644 --- a/src/game/AI/ScriptDevAI/base/escort_ai.cpp +++ b/src/game/AI/ScriptDevAI/base/escort_ai.cpp @@ -61,7 +61,7 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* who) return false; // experimental (unknown) flag not present - if (!(m_creature->GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_CAN_ASSIST)) + if (!(m_creature->GetCreatureInfo()->CreatureTypeFlags & CreatureTypeFlags::CAN_ASSIST)) return false; // unit state prevents (similar check is done in CanInitiateAttack which also include checking unit_flags. We skip those here) diff --git a/src/game/AI/ScriptDevAI/base/follower_ai.cpp b/src/game/AI/ScriptDevAI/base/follower_ai.cpp index e5d35b15b5d..f0c3c58cc6f 100644 --- a/src/game/AI/ScriptDevAI/base/follower_ai.cpp +++ b/src/game/AI/ScriptDevAI/base/follower_ai.cpp @@ -36,7 +36,7 @@ bool FollowerAI::AssistPlayerInCombat(Unit* who) return false; // experimental (unknown) flag not present - if (!(m_creature->GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_CAN_ASSIST)) + if (!(m_creature->GetCreatureInfo()->CreatureTypeFlags & CreatureTypeFlags::CAN_ASSIST)) return false; // unit state prevents (similar check is done in CanInitiateAttack which also include checking unit_flags. We skip those here) diff --git a/src/game/Entities/Creature.cpp b/src/game/Entities/Creature.cpp index 91c20f49ad5..a557321ebfa 100644 --- a/src/game/Entities/Creature.cpp +++ b/src/game/Entities/Creature.cpp @@ -2171,7 +2171,7 @@ bool Creature::IsVisibleInGridForPlayer(Player* pl) const } // Dead player can see ghosts - if (GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_GHOST_VISIBLE) + if (GetCreatureInfo()->CreatureTypeFlags & CreatureTypeFlags::GHOST_VISIBLE) return true; // and not see any other diff --git a/src/game/Entities/Creature.h b/src/game/Entities/Creature.h index 15b5db99088..70e5d57d0c6 100644 --- a/src/game/Entities/Creature.h +++ b/src/game/Entities/Creature.h @@ -194,11 +194,11 @@ struct CreatureInfo SkillType GetRequiredLootSkill() const { - if (CreatureTypeFlags & CREATURE_TYPEFLAGS_HERBLOOT) + if (CreatureTypeFlags & CreatureTypeFlags::HERBLOOT) return SKILL_HERBALISM; - if (CreatureTypeFlags & CREATURE_TYPEFLAGS_MININGLOOT) + if (CreatureTypeFlags & CreatureTypeFlags::MININGLOOT) return SKILL_MINING; - if (CreatureTypeFlags & CREATURE_TYPEFLAGS_ENGINEERLOOT) + if (CreatureTypeFlags & CreatureTypeFlags::ENGINEERLOOT) return SKILL_ENGINEERING; return SKILL_SKINNING; // normal case @@ -206,12 +206,12 @@ struct CreatureInfo bool IsExotic() const { - return (CreatureTypeFlags & CREATURE_TYPEFLAGS_EXOTIC) != 0; + return (CreatureTypeFlags & CreatureTypeFlags::EXOTIC) != 0; } bool isTameable(bool exotic) const { - if (CreatureType != CREATURE_TYPE_BEAST || Family == 0 || (CreatureTypeFlags & CREATURE_TYPEFLAGS_TAMEABLE) == 0) + if (CreatureType != CREATURE_TYPE_BEAST || Family == 0 || (CreatureTypeFlags & CreatureTypeFlags::TAMEABLE) == 0) return false; // if can tame exotic then can tame any tameable @@ -783,7 +783,7 @@ class Creature : public Unit uint32 GetInteractionPauseTimer() const { return m_interactionPauseTimer; } GridReference& GetGridRef() { return m_gridRef; } - bool IsRegeneratingHealth() const { return (GetCreatureInfo()->RegenerateStats & REGEN_FLAG_HEALTH) != 0 && !(GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_SIEGE_WEAPON); } + bool IsRegeneratingHealth() const { return (GetCreatureInfo()->RegenerateStats & REGEN_FLAG_HEALTH) != 0 && !(GetCreatureInfo()->CreatureTypeFlags & CreatureTypeFlags::SIEGE_WEAPON); } bool IsRegeneratingPower() const; virtual uint8 GetPetAutoSpellSize() const { return CREATURE_MAX_SPELLS; } virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const diff --git a/src/game/Entities/Relations.cpp b/src/game/Entities/Relations.cpp index 651467c73f5..84d604daeb4 100644 --- a/src/game/Entities/Relations.cpp +++ b/src/game/Entities/Relations.cpp @@ -338,7 +338,7 @@ bool Unit::IsFriend(const Unit* unit) const // WotLK+: Special flag overrides reaction if (GetTypeId() == TYPEID_UNIT) { - if (static_cast(this)->GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_TREAT_AS_IN_RAID) + if (static_cast(this)->GetCreatureInfo()->CreatureTypeFlags & CreatureTypeFlags::TREAT_AS_IN_RAID) return true; } return (GetReactionTo(unit) > REP_NEUTRAL); @@ -367,7 +367,7 @@ bool Unit::CanAttack(const Unit* unit) const // Creatures cannot attack player ghosts, unless it is a specially flagged ghost creature if (GetTypeId() == TYPEID_UNIT && unit->GetTypeId() == TYPEID_PLAYER && static_cast(unit)->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) { - if (!(static_cast(this)->GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_GHOST_VISIBLE)) + if (!(static_cast(this)->GetCreatureInfo()->CreatureTypeFlags & CreatureTypeFlags::GHOST_VISIBLE)) return false; } @@ -478,7 +478,7 @@ bool Unit::CanAttackNow(const Unit* unit) const if (IsMounted()) { // ... unless we are a creature with a special flag - if (GetTypeId() != TYPEID_UNIT || !(static_cast(this)->GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_MOUNTED_COMBAT)) + if (GetTypeId() != TYPEID_UNIT || !(static_cast(this)->GetCreatureInfo()->CreatureTypeFlags & CreatureTypeFlags::MOUNTED_COMBAT)) return false; } @@ -524,7 +524,7 @@ bool Unit::CanAssist(const Unit* unit, bool ignoreFlags) const if (GetReactionTo(unit) < REP_FRIENDLY) { // ... unless we are a creature with a special flag - if (GetTypeId() != TYPEID_UNIT || !(static_cast(this)->GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_TREAT_AS_IN_RAID)) + if (GetTypeId() != TYPEID_UNIT || !(static_cast(this)->GetCreatureInfo()->CreatureTypeFlags & CreatureTypeFlags::TREAT_AS_IN_RAID)) return false; } @@ -568,10 +568,10 @@ bool Unit::CanAssist(const Unit* unit, bool ignoreFlags) const { if (const uint32 flags = static_cast(unit)->GetCreatureInfo()->CreatureTypeFlags) { - if (flags & CREATURE_TYPEFLAGS_CAN_ASSIST) + if (flags & CreatureTypeFlags::CAN_ASSIST) return true; - if (flags & CREATURE_TYPEFLAGS_TREAT_AS_IN_RAID) + if (flags & CreatureTypeFlags::TREAT_AS_IN_RAID) return true; } } @@ -668,14 +668,14 @@ bool Unit::CanInteract(const Unit* unit) const // We can't interact with anyone as a ghost except specially flagged NPCs if (GetTypeId() == TYPEID_PLAYER && static_cast(this)->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) { - if (unit->GetTypeId() != TYPEID_UNIT || !(static_cast(unit)->GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_GHOST_VISIBLE)) + if (unit->GetTypeId() != TYPEID_UNIT || !(static_cast(unit)->GetCreatureInfo()->CreatureTypeFlags & CreatureTypeFlags::GHOST_VISIBLE)) return false; } // WotLK+: personal squire support if (GetTypeId() == TYPEID_PLAYER && unit->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) && unit->GetTypeId() == TYPEID_UNIT) { - if ((static_cast(unit)->GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_SQUIRE) && unit->GetOwnerGuid() != GetObjectGuid()) + if ((static_cast(unit)->GetCreatureInfo()->CreatureTypeFlags & CreatureTypeFlags::SQUIRE) && unit->GetOwnerGuid() != GetObjectGuid()) return false; } @@ -724,7 +724,7 @@ bool Unit::CanInteractNow(const Unit* unit) const // We can't interact with dead units, unless it's a creature with special flag if (!unit->IsAlive()) { - if (GetTypeId() != TYPEID_UNIT || !(static_cast(unit)->GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_INTERACT_DEAD)) + if (GetTypeId() != TYPEID_UNIT || !(static_cast(unit)->GetCreatureInfo()->CreatureTypeFlags & CreatureTypeFlags::INTERACT_DEAD)) return false; } @@ -739,7 +739,7 @@ bool Unit::CanInteractNow(const Unit* unit) const bool interactable = false; // We can interact with siege weapons in fight - if (!interactable && unit->GetTypeId() == TYPEID_UNIT && (static_cast(unit)->GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_SIEGE_WEAPON)) + if (!interactable && unit->GetTypeId() == TYPEID_UNIT && (static_cast(unit)->GetCreatureInfo()->CreatureTypeFlags & CreatureTypeFlags::SIEGE_WEAPON)) interactable = true; // We can interact with UNIT_FLAG2_INTERACT_ANY_REACTION flagged units even in fight @@ -1368,7 +1368,7 @@ bool Unit::CanAttackServerside(const Unit* unit, bool ignoreFlagsSource, bool ig // Creatures cannot attack player ghosts, unless it is a specially flagged ghost creature if (GetTypeId() == TYPEID_UNIT && unit->GetTypeId() == TYPEID_PLAYER && static_cast(unit)->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) { - if (!(static_cast(this)->GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_GHOST_VISIBLE)) + if (!(static_cast(this)->GetCreatureInfo()->CreatureTypeFlags & CreatureTypeFlags::GHOST_VISIBLE)) return false; } diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index f95bf0a3c00..dfc5747eaec 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -1040,69 +1040,69 @@ VehicleSeatParameters const* ObjectMgr::GetVehicleSeatParameters(uint32 seatEntr uint32 ObjectMgr::GetTypeFlagsFromStaticFlags(uint32 typeFlags, uint32 staticFlags1, uint32 staticFlags2, uint32 staticFlags3, uint32 staticFlags4) const { if (staticFlags1 & uint32(CreatureStaticFlags::TAMEABLE)) - typeFlags |= CREATURE_TYPEFLAGS_TAMEABLE; + typeFlags |= CreatureTypeFlags::TAMEABLE; if (staticFlags1 & uint32(CreatureStaticFlags::BOSS_MOB)) - typeFlags |= CREATURE_TYPEFLAGS_BOSS_MOB; + typeFlags |= CreatureTypeFlags::BOSS_MOB; if (staticFlags1 & uint32(CreatureStaticFlags::VISIBLE_TO_GHOSTS)) - typeFlags |= CREATURE_TYPEFLAGS_GHOST_VISIBLE; + typeFlags |= CreatureTypeFlags::GHOST_VISIBLE; if (staticFlags1 & uint32(CreatureStaticFlags::NO_FACTION_TOOLTIP)) - typeFlags |= CREATURE_TYPEFLAGS_NO_FACTION_TOOLTIP; + typeFlags |= CreatureTypeFlags::NO_FACTION_TOOLTIP; if (staticFlags1 & uint32(CreatureStaticFlags::DO_NOT_PLAY_WOUND_ANIM)) - typeFlags |= CREATURE_TYPEFLAGS_NO_WOUND_ANIM; + typeFlags |= CreatureTypeFlags::NO_WOUND_ANIM; if (staticFlags1 & uint32(CreatureStaticFlags::MORE_AUDIBLE)) - typeFlags |= CREATURE_TYPEFLAGS_MORE_AUDIBLE; + typeFlags |= CreatureTypeFlags::MORE_AUDIBLE; if (staticFlags2 & uint32(CreatureStaticFlags2::SPELL_ATTACKABLE)) - typeFlags |= CREATURE_TYPEFLAGS_SPELL_ATTACKABLE; + typeFlags |= CreatureTypeFlags::SPELL_ATTACKABLE; if (staticFlags2 & uint32(CreatureStaticFlags2::INTERACT_WHILE_DEAD)) - typeFlags |= CREATURE_TYPEFLAGS_INTERACT_DEAD; + typeFlags |= CreatureTypeFlags::INTERACT_DEAD; if (staticFlags2 & uint32(CreatureStaticFlags2::SKIN_WITH_HERBALISM)) - typeFlags |= CREATURE_TYPEFLAGS_HERBLOOT; + typeFlags |= CreatureTypeFlags::HERBLOOT; if (staticFlags2 & uint32(CreatureStaticFlags2::SKIN_WITH_MINING)) - typeFlags |= CREATURE_TYPEFLAGS_MININGLOOT; + typeFlags |= CreatureTypeFlags::MININGLOOT; if (staticFlags2 & uint32(CreatureStaticFlags2::ALLOW_MOUNTED_COMBAT)) - typeFlags |= CREATURE_TYPEFLAGS_MOUNTED_COMBAT; + typeFlags |= CreatureTypeFlags::MOUNTED_COMBAT; if (staticFlags2 & uint32(CreatureStaticFlags2::NO_DEATH_MESSAGE)) - typeFlags |= CREATURE_TYPEFLAGS_NO_DEATH_MSG; + typeFlags |= CreatureTypeFlags::NO_DEATH_MSG; if (staticFlags2 & uint32(CreatureStaticFlags2::CAN_ASSIST)) - typeFlags |= CREATURE_TYPEFLAGS_CAN_ASSIST; + typeFlags |= CreatureTypeFlags::CAN_ASSIST; if (staticFlags2 & uint32(CreatureStaticFlags2::NO_PET_BAR)) - typeFlags |= CREATURE_TYPEFLAGS_NO_PET_BAR; + typeFlags |= CreatureTypeFlags::NO_PET_BAR; if (staticFlags3 & uint32(CreatureStaticFlags3::MASK_UID)) - typeFlags |= CREATURE_TYPEFLAGS_MASK_UID; + typeFlags |= CreatureTypeFlags::MASK_UID; if (staticFlags3 & uint32(CreatureStaticFlags3::SKIN_WITH_ENGINEERING)) - typeFlags |= CREATURE_TYPEFLAGS_ENGINEERLOOT; + typeFlags |= CreatureTypeFlags::ENGINEERLOOT; if (staticFlags3 & uint32(CreatureStaticFlags3::TAMEABLE_EXOTIC)) - typeFlags |= CREATURE_TYPEFLAGS_EXOTIC; + typeFlags |= CreatureTypeFlags::EXOTIC; if (staticFlags3 & uint32(CreatureStaticFlags3::NO_NAME_PLATE)) - typeFlags |= CREATURE_TYPEFLAGS_NO_NAMEPLATE; + typeFlags |= CreatureTypeFlags::NO_NAMEPLATE; if (staticFlags3 & uint32(CreatureStaticFlags3::USE_MODEL_COLLISION_SIZE)) - typeFlags |= CREATURE_TYPEFLAGS_MODEL_COLLISION_SIZE; + typeFlags |= CreatureTypeFlags::MODEL_COLLISION_SIZE; if (staticFlags3 & uint32(CreatureStaticFlags3::ALLOW_INTERACTION_WHILE_IN_COMBAT)) - typeFlags |= CREATURE_TYPEFLAGS_SIEGE_WEAPON; + typeFlags |= CreatureTypeFlags::SIEGE_WEAPON; if (staticFlags3 & uint32(CreatureStaticFlags3::COLLIDE_WITH_MISSILES)) - typeFlags |= CREATURE_TYPEFLAGS_COLLIDE_WITH_MISSILES; + typeFlags |= CreatureTypeFlags::COLLIDE_WITH_MISSILES; if (staticFlags3 & uint32(CreatureStaticFlags3::DO_NOT_PLAY_MOUNTED_ANIMATIONS)) - typeFlags |= CREATURE_TYPEFLAGS_NO_MOUNTED_ANIM; + typeFlags |= CreatureTypeFlags::NO_MOUNTED_ANIM; if (staticFlags3 & uint32(CreatureStaticFlags3::LINK_ALL)) - typeFlags |= CREATURE_TYPEFLAGS_LINK_ALL; + typeFlags |= CreatureTypeFlags::LINK_ALL; if (staticFlags4 & uint32(CreatureStaticFlags4::INTERACT_ONLY_WITH_CREATOR)) - typeFlags |= CREATURE_TYPEFLAGS_SQUIRE; + typeFlags |= CreatureTypeFlags::SQUIRE; if (staticFlags4 & uint32(CreatureStaticFlags4::DO_NOT_PLAY_UNIT_EVENT_SOUNDS)) - typeFlags |= CREATURE_TYPEFLAGS_NO_DEATH_SOUND; + typeFlags |= CreatureTypeFlags::NO_DEATH_SOUND; if (staticFlags4 & uint32(CreatureStaticFlags4::HAS_NO_SHADOW_BLOB)) - typeFlags |= CREATURE_TYPEFLAGS_NO_SHADOW_BLOB; + typeFlags |= CreatureTypeFlags::NO_SHADOW_BLOB; if (staticFlags4 & uint32(CreatureStaticFlags4::TREAT_AS_RAID_UNIT_FOR_HELPFUL_SPELLS)) - typeFlags |= CREATURE_TYPEFLAGS_TREAT_AS_IN_RAID; + typeFlags |= CreatureTypeFlags::TREAT_AS_IN_RAID; if (staticFlags4 & uint32(CreatureStaticFlags4::FORCE_GOSSIP)) - typeFlags |= CREATURE_TYPEFLAGS_FORCE_GOSSIP; + typeFlags |= CreatureTypeFlags::FORCE_GOSSIP; if (staticFlags4 & uint32(CreatureStaticFlags4::DO_NOT_SHEATHE)) - typeFlags |= CREATURE_TYPEFLAGS_DO_NOT_SHEATHE; + typeFlags |= CreatureTypeFlags::DO_NOT_SHEATHE; if (staticFlags4 & uint32(CreatureStaticFlags4::DO_NOT_TARGET_ON_INTERACTION)) - typeFlags |= CREATURE_TYPEFLAGS_NO_INTERACT_TARGET; + typeFlags |= CreatureTypeFlags::NO_INTERACT_TARGET; if (staticFlags4 & uint32(CreatureStaticFlags4::DO_NOT_RENDER_OBJECT_NAME)) - typeFlags |= CREATURE_TYPEFLAGS_DO_NOT_RENDER_NAME; + typeFlags |= CreatureTypeFlags::DO_NOT_RENDER_NAME; if (staticFlags4 & uint32(CreatureStaticFlags4::QUEST_BOSS)) - typeFlags |= CREATURE_TYPEFLAGS_QUEST_BOSS; + typeFlags |= CreatureTypeFlags::QUEST_BOSS; return typeFlags; } diff --git a/src/game/Globals/SharedDefines.h b/src/game/Globals/SharedDefines.h index 4a5f0a7b822..8abe3cf6658 100644 --- a/src/game/Globals/SharedDefines.h +++ b/src/game/Globals/SharedDefines.h @@ -1316,41 +1316,44 @@ enum CreatureFamily CREATURE_FAMILY_SPIRIT_BEAST = 46 }; +namespace CreatureTypeFlags +{ enum CreatureTypeFlags { - CREATURE_TYPEFLAGS_TAMEABLE = 0x00000001, // Tameable by any hunter - CREATURE_TYPEFLAGS_GHOST_VISIBLE = 0x00000002, // Creatures which can _also_ be seen when player is a ghost, used in CanInteract function by client, can't be attacked - CREATURE_TYPEFLAGS_BOSS_MOB = 0x00000004, // "BOSS" flag for tooltips - CREATURE_TYPEFLAGS_NO_WOUND_ANIM = 0x00000008, - CREATURE_TYPEFLAGS_NO_FACTION_TOOLTIP = 0x00000010, // controls something in client tooltip related to creature faction - CREATURE_TYPEFLAGS_MORE_AUDIBLE = 0x00000020, // may be sound related - CREATURE_TYPEFLAGS_SPELL_ATTACKABLE = 0x00000040, // may be related to attackable / not attackable creatures with spells, used together with lua_IsHelpfulSpell/lua_IsHarmfulSpell - CREATURE_TYPEFLAGS_INTERACT_DEAD = 0x00000080, // Creature can be interacted with even if it's dead - CREATURE_TYPEFLAGS_HERBLOOT = 0x00000100, // Can be looted by herbalist - CREATURE_TYPEFLAGS_MININGLOOT = 0x00000200, // Can be looted by miner - CREATURE_TYPEFLAGS_NO_DEATH_MSG = 0x00000400, // no idea, but it used by client - CREATURE_TYPEFLAGS_MOUNTED_COMBAT = 0x00000800, // possibility to attack and cast spells while mounted - CREATURE_TYPEFLAGS_CAN_ASSIST = 0x00001000, // Can aid any player (and group) in combat. Typically seen for escorting NPC's - CREATURE_TYPEFLAGS_NO_PET_BAR = 0x00002000, // checked from calls in Lua_PetHasActionBar - CREATURE_TYPEFLAGS_MASK_UID = 0x00004000, // Lua_UnitGUID, client does guid_low &= 0xFF000000 if this flag is set - CREATURE_TYPEFLAGS_ENGINEERLOOT = 0x00008000, // Can be looted by engineer - CREATURE_TYPEFLAGS_EXOTIC = 0x00010000, // Can be tamed by hunter as exotic pet - CREATURE_TYPEFLAGS_MODEL_COLLISION_SIZE = 0x00020000, // related to CreatureDisplayInfo and scaling in some way - CREATURE_TYPEFLAGS_SIEGE_WEAPON = 0x00040000, // Related to vehicle/siege weapons - CREATURE_TYPEFLAGS_COLLIDE_WITH_MISSILES = 0x00080000, // may be has something to do with missiles - CREATURE_TYPEFLAGS_NO_NAMEPLATE = 0x00100000, // no idea, but it used by client, may be related to rendering - CREATURE_TYPEFLAGS_NO_MOUNTED_ANIM = 0x00200000, // may be has something to do with animation (disable animation?) - CREATURE_TYPEFLAGS_LINK_ALL = 0x00400000, // this one probably controls some creature visual - CREATURE_TYPEFLAGS_SQUIRE = 0x00800000, // First seen in 3.2.2. Related to banner/backpack of creature/companion, used in CanInteract function by client - CREATURE_TYPEFLAGS_NO_DEATH_SOUND = 0x01000000, // pet sounds related? - CREATURE_TYPEFLAGS_NO_SHADOW_BLOB = 0x02000000, // this one probably controls some creature visual - CREATURE_TYPEFLAGS_TREAT_AS_IN_RAID = 0x04000000, // creature has no type, or forces creature to be considered as in party, may be related to creature assistance - CREATURE_TYPEFLAGS_FORCE_GOSSIP = 0x08000000, // used in Lua_ForceGossip - CREATURE_TYPEFLAGS_DO_NOT_SHEATHE = 0x10000000, // no idea, but it used by client - CREATURE_TYPEFLAGS_NO_INTERACT_TARGET = 0x20000000, - CREATURE_TYPEFLAGS_DO_NOT_RENDER_NAME = 0x40000000, - CREATURE_TYPEFLAGS_QUEST_BOSS = 0x80000000, // Lua_UnitIsQuestBoss + TAMEABLE = 0x00000001, // Tameable by any hunter + GHOST_VISIBLE = 0x00000002, // Creatures which can _also_ be seen when player is a ghost, used in CanInteract function by client, can't be attacked + BOSS_MOB = 0x00000004, // "BOSS" flag for tooltips + NO_WOUND_ANIM = 0x00000008, + NO_FACTION_TOOLTIP = 0x00000010, // controls something in client tooltip related to creature faction + MORE_AUDIBLE = 0x00000020, // may be sound related + SPELL_ATTACKABLE = 0x00000040, // may be related to attackable / not attackable creatures with spells, used together with lua_IsHelpfulSpell/lua_IsHarmfulSpell + INTERACT_DEAD = 0x00000080, // Creature can be interacted with even if it's dead + HERBLOOT = 0x00000100, // Can be looted by herbalist + MININGLOOT = 0x00000200, // Can be looted by miner + NO_DEATH_MSG = 0x00000400, // no idea, but it used by client + MOUNTED_COMBAT = 0x00000800, // possibility to attack and cast spells while mounted + CAN_ASSIST = 0x00001000, // Can aid any player (and group) in combat. Typically seen for escorting NPC's + NO_PET_BAR = 0x00002000, // checked from calls in Lua_PetHasActionBar + MASK_UID = 0x00004000, // Lua_UnitGUID, client does guid_low &= 0xFF000000 if this flag is set + ENGINEERLOOT = 0x00008000, // Can be looted by engineer + EXOTIC = 0x00010000, // Can be tamed by hunter as exotic pet + MODEL_COLLISION_SIZE = 0x00020000, // related to CreatureDisplayInfo and scaling in some way + SIEGE_WEAPON = 0x00040000, // Related to vehicle/siege weapons + COLLIDE_WITH_MISSILES = 0x00080000, // may be has something to do with missiles + NO_NAMEPLATE = 0x00100000, // no idea, but it used by client, may be related to rendering + NO_MOUNTED_ANIM = 0x00200000, // may be has something to do with animation (disable animation?) + LINK_ALL = 0x00400000, // this one probably controls some creature visual + SQUIRE = 0x00800000, // First seen in 3.2.2. Related to banner/backpack of creature/companion, used in CanInteract function by client + NO_DEATH_SOUND = 0x01000000, // pet sounds related? + NO_SHADOW_BLOB = 0x02000000, // this one probably controls some creature visual + TREAT_AS_IN_RAID = 0x04000000, // creature has no type, or forces creature to be considered as in party, may be related to creature assistance + FORCE_GOSSIP = 0x08000000, // used in Lua_ForceGossip + DO_NOT_SHEATHE = 0x10000000, // no idea, but it used by client + NO_INTERACT_TARGET = 0x20000000, + DO_NOT_RENDER_NAME = 0x40000000, + QUEST_BOSS = 0x80000000, // Lua_UnitIsQuestBoss }; +} enum CreatureEliteType { diff --git a/src/game/Mails/MailHandler.cpp b/src/game/Mails/MailHandler.cpp index d061a223e33..64bd75949aa 100644 --- a/src/game/Mails/MailHandler.cpp +++ b/src/game/Mails/MailHandler.cpp @@ -72,7 +72,7 @@ bool WorldSession::CheckMailBox(ObjectGuid guid) const return false; } - if (!(creature->GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_SQUIRE)) + if (!(creature->GetCreatureInfo()->CreatureTypeFlags & CreatureTypeFlags::SQUIRE)) { DEBUG_LOG("%s not have access to mailbox.", creature->GetGuidStr().c_str()); return false; diff --git a/src/game/PlayerBot/Base/PlayerbotAI.cpp b/src/game/PlayerBot/Base/PlayerbotAI.cpp index 7fafb0ab512..a5c2b21507c 100644 --- a/src/game/PlayerBot/Base/PlayerbotAI.cpp +++ b/src/game/PlayerBot/Base/PlayerbotAI.cpp @@ -5191,7 +5191,7 @@ void PlayerbotAI::UpdateAI(const uint32 /*p_time*/) return; if (m_bot->GetPetGuid() || spell->CheckCast(true) != SPELL_CAST_OK || !pTarget || - pTarget->IsDead() || !m_bot->IsInMap(pTarget) || !(((Creature*) pTarget)->GetCreatureInfo()->CreatureTypeFlags & CREATURE_TYPEFLAGS_TAMEABLE)) + pTarget->IsDead() || !m_bot->IsInMap(pTarget) || !(((Creature*) pTarget)->GetCreatureInfo()->CreatureTypeFlags & CreatureTypeFlags::TAMEABLE)) { MovementReset(); m_bot->SetSelectionGuid(ObjectGuid());