From f70a5817e1c07891185d716611d45f50b1c73b78 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 30 Jan 2024 21:29:55 +0100 Subject: Core/Creatures: Move immunities to separate table and implemented setting immunties to dispel, spell effects, aura types, aoe and chain targeting --- src/server/scripts/Commands/cs_npc.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index df1e28ffada..ed6e2014ead 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -43,6 +43,7 @@ EndScriptData */ #include "Player.h" #include "RBAC.h" #include "SmartEnum.h" +#include "SpellMgr.h" #include "Transport.h" #include "World.h" #include "WorldSession.h" @@ -482,7 +483,9 @@ public: uint32 faction = target->GetFaction(); uint64 npcflags; memcpy(&npcflags, target->m_unitData->NpcFlags.begin(), sizeof(npcflags)); - uint32 mechanicImmuneMask = cInfo->MechanicImmuneMask; + uint64 mechanicImmuneMask = 0; + if (CreatureImmunities const* immunities = SpellMgr::GetCreatureImmunities(cInfo->CreatureImmunitiesId)) + mechanicImmuneMask = immunities->Mechanic.to_ullong(); uint32 displayid = target->GetDisplayId(); uint32 nativeid = target->GetNativeDisplayId(); uint32 entry = target->GetEntry(); @@ -557,9 +560,9 @@ public: if (target->HasNpcFlag2(flag)) handler->PSendSysMessage("* %s (0x%X)", EnumUtils::ToTitle(flag), flag); - handler->PSendSysMessage(LANG_NPCINFO_MECHANIC_IMMUNE, mechanicImmuneMask); + handler->PSendSysMessage(LANG_NPCINFO_MECHANIC_IMMUNE, Trinity::StringFormat("0x{:X}", mechanicImmuneMask).c_str()); for (Mechanics m : EnumUtils::Iterate()) - if (m && (mechanicImmuneMask & (1 << (m - 1)))) + if (m && (mechanicImmuneMask & (UI64LIT(1) << m))) handler->PSendSysMessage("%s (0x%X)", EnumUtils::ToTitle(m), m); return true; -- cgit v1.2.3