feat(Core/Unit): New helpers for DynamicFlags (#11230)

* feat(Core/Unit): New helpers for DynamicFlags

* cherry-pick commit (d611925dc7)

Co-Authored-By: Shauren <shauren.trinity@gmail.com>

* oopsie

Co-authored-by: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
Kitzunu
2022-04-01 12:14:29 +02:00
committed by GitHub
parent 45577d30ca
commit 535c7451a2
38 changed files with 85 additions and 73 deletions

View File

@@ -504,7 +504,7 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data, bool changele
ReplaceAllUnitFlags(UnitFlags(unit_flags));
ReplaceAllUnitFlags2(UnitFlags2(cInfo->unit_flags2));
SetUInt32Value(UNIT_DYNAMIC_FLAGS, dynamicflags);
ReplaceAllDynamicFlags(dynamicflags);
SetAttackTime(BASE_ATTACK, cInfo->BaseAttackTime);
SetAttackTime(OFF_ATTACK, cInfo->BaseAttackTime);
@@ -1214,7 +1214,7 @@ void Creature::SetLootRecipient(Unit* unit, bool withGroup)
{
m_lootRecipient.Clear();
m_lootRecipientGroup = 0;
RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE | UNIT_DYNFLAG_TAPPED);
RemoveDynamicFlag(UNIT_DYNFLAG_LOOTABLE | UNIT_DYNFLAG_TAPPED);
ResetAllowedLooters();
return;
}
@@ -1261,7 +1261,7 @@ void Creature::SetLootRecipient(Unit* unit, bool withGroup)
else
m_lootRecipientGroup = 0;
SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED);
SetDynamicFlag(UNIT_DYNFLAG_TAPPED);
}
// return true if this creature is tapped by the player or by a member of his group.
@@ -1303,7 +1303,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
uint32 displayId = GetNativeDisplayId();
uint32 npcflag = GetUInt32Value(UNIT_NPC_FLAGS);
uint32 unit_flags = GetUnitFlags();
uint32 dynamicflags = GetUInt32Value(UNIT_DYNAMIC_FLAGS);
uint32 dynamicflags = GetDynamicFlags();
// check if it's a custom model and if not, use 0 for displayId
CreatureTemplate const* cinfo = GetCreatureTemplate();