From 5c7dbbce6ab3c570077cb936a238d27bc1969a0b Mon Sep 17 00:00:00 2001 From: insunaa Date: Fri, 9 Aug 2024 15:19:50 +0200 Subject: [PATCH] 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 13e70e73fc5..f6338e40007 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -753,6 +753,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()); @@ -1038,6 +1040,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 7c25c9a1f53..f66dd179cda 100644 --- a/src/game/Globals/ObjectMgr.h +++ b/src/game/Globals/ObjectMgr.h @@ -1300,6 +1300,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 256bf2aae96..5698c99d550 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_UNK20 = 0x00080000, // may be has something to do with missiles - 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