mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Players: Allow GMs to target npcs with UNIT_FLAG2_UNTARGETABLE_BY_CLIENT flag (#30041)
This commit is contained in:
@@ -995,7 +995,7 @@ void UnitData::WriteCreate(ByteBuffer& data, EnumFlag<UpdateFieldFlag> fieldVisi
|
||||
VirtualItems[i].WriteCreate(data, owner, receiver);
|
||||
}
|
||||
data << uint32(ViewerDependentValue<FlagsTag>::GetValue(this, owner, receiver));
|
||||
data << uint32(Flags2);
|
||||
data << uint32(ViewerDependentValue<Flags2Tag>::GetValue(this, owner, receiver));
|
||||
data << uint32(ViewerDependentValue<Flags3Tag>::GetValue(this, owner, receiver));
|
||||
data << uint32(ViewerDependentValue<AuraStateTag>::GetValue(this, owner, receiver));
|
||||
for (uint32 i = 0; i < 2; ++i)
|
||||
@@ -1388,7 +1388,7 @@ void UnitData::WriteUpdate(ByteBuffer& data, Mask const& changesMask, bool ignor
|
||||
}
|
||||
if (changesMask[43])
|
||||
{
|
||||
data << uint32(Flags2);
|
||||
data << uint32(ViewerDependentValue<Flags2Tag>::GetValue(this, owner, receiver));
|
||||
}
|
||||
if (changesMask[44])
|
||||
{
|
||||
|
||||
@@ -304,6 +304,7 @@ struct UnitData : public IsUpdateFieldStructureTag, public HasChangesMask<217>
|
||||
UpdateField<uint32, 32, 42> Flags;
|
||||
struct FlagsTag : ViewerDependentValueTag<uint32> {};
|
||||
UpdateField<uint32, 32, 43> Flags2;
|
||||
struct Flags2Tag : ViewerDependentValueTag<uint32> {};
|
||||
UpdateField<uint32, 32, 44> Flags3;
|
||||
struct Flags3Tag : ViewerDependentValueTag<uint32> {};
|
||||
UpdateField<uint32, 32, 45> AuraState;
|
||||
|
||||
@@ -240,6 +240,23 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
class ViewerDependentValue<UF::UnitData::Flags2Tag>
|
||||
{
|
||||
public:
|
||||
using value_type = UF::UnitData::Flags2Tag::value_type;
|
||||
|
||||
static value_type GetValue(UF::UnitData const* unitData, Unit const* /*unit*/, Player const* receiver)
|
||||
{
|
||||
value_type flags = unitData->Flags2;
|
||||
// Gamemasters should be always able to interact with units - remove uninteractible flag
|
||||
if (receiver->IsGameMaster())
|
||||
flags &= ~UNIT_FLAG2_UNTARGETABLE_BY_CLIENT;
|
||||
|
||||
return flags;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
class ViewerDependentValue<UF::UnitData::Flags3Tag>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user