mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 01:59:09 +00:00
feat(Core/Unit): New helpers for UnitFlag and UnitFlag2 (#11227)
This commit is contained in:
@@ -527,9 +527,9 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo
|
||||
if (sWorld->getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_PVP || sWorld->getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_RPPVP)
|
||||
{
|
||||
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP);
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
|
||||
SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
|
||||
}
|
||||
SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);
|
||||
SetUnitFlag2(UNIT_FLAG2_REGENERATE_POWER);
|
||||
SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); // fix cast time showed in spell tooltip on client
|
||||
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f); // default for players in 3.0.3
|
||||
|
||||
@@ -2173,7 +2173,7 @@ void Player::SetGameMaster(bool on)
|
||||
if (AccountMgr::IsGMAccount(GetSession()->GetSecurity()))
|
||||
SetFaction(FACTION_FRIENDLY);
|
||||
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
|
||||
SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS);
|
||||
SetUnitFlag2(UNIT_FLAG2_ALLOW_CHEAT_SPELLS);
|
||||
|
||||
if (Pet* pet = GetPet())
|
||||
{
|
||||
@@ -2204,7 +2204,7 @@ void Player::SetGameMaster(bool on)
|
||||
m_ExtraFlags &= ~ PLAYER_EXTRA_GM_ON;
|
||||
SetFactionForRace(getRace(true));
|
||||
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
|
||||
RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS);
|
||||
RemoveUnitFlag2(UNIT_FLAG2_ALLOW_CHEAT_SPELLS);
|
||||
|
||||
if (Pet* pet = GetPet())
|
||||
{
|
||||
@@ -2649,9 +2649,9 @@ void Player::InitStatsForLevel(bool reapplyMods)
|
||||
UNIT_FLAG_STUNNED | UNIT_FLAG_IN_COMBAT | UNIT_FLAG_DISARMED |
|
||||
UNIT_FLAG_CONFUSED | UNIT_FLAG_FLEEING | UNIT_FLAG_NOT_SELECTABLE |
|
||||
UNIT_FLAG_SKINNABLE | UNIT_FLAG_MOUNT | UNIT_FLAG_TAXI_FLIGHT );
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); // must be set
|
||||
SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED); // must be set
|
||||
|
||||
SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);// must be set
|
||||
SetUnitFlag2(UNIT_FLAG2_REGENERATE_POWER);// must be set
|
||||
|
||||
// cleanup player flags (will be re-applied if need at aura load), to avoid have ghost flag without ghost aura, for example.
|
||||
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK | PLAYER_FLAGS_DND | PLAYER_FLAGS_GM | PLAYER_FLAGS_GHOST | PLAYER_ALLOW_ONLY_ABILITY);
|
||||
@@ -4332,7 +4332,7 @@ void Player::BuildPlayerRepop()
|
||||
{
|
||||
SetMovement(MOVE_UNROOT);
|
||||
}
|
||||
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // BG - remove insignia related
|
||||
RemoveUnitFlag(UNIT_FLAG_SKINNABLE); // BG - remove insignia related
|
||||
int32 corpseReclaimDelay = CalculateCorpseReclaimDelay();
|
||||
if (corpseReclaimDelay >= 0)
|
||||
{
|
||||
@@ -4431,7 +4431,7 @@ void Player::KillPlayer()
|
||||
StopMirrorTimers(); //disable timers(bars)
|
||||
|
||||
setDeathState(CORPSE);
|
||||
//SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_IN_PVP);
|
||||
//SetUnitFlag(UNIT_FLAG_NOT_IN_PVP);
|
||||
|
||||
SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE);
|
||||
ApplyModFlag(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTE_RELEASE_TIMER, !sMapStore.LookupEntry(GetMapId())->Instanceable() && !HasAuraType(SPELL_AURA_PREVENT_RESURRECTION));
|
||||
@@ -7990,7 +7990,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
||||
loot->AddLooter(GetGUID());
|
||||
|
||||
if (loot_type == LOOT_CORPSE && !guid.IsItem())
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING);
|
||||
SetUnitFlag(UNIT_FLAG_LOOTING);
|
||||
}
|
||||
else
|
||||
SendLootError(guid, LOOT_ERROR_DIDNT_KILL);
|
||||
@@ -9942,7 +9942,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
|
||||
return false;
|
||||
}
|
||||
|
||||
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
|
||||
if (HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
|
||||
return false;
|
||||
|
||||
// taximaster case
|
||||
@@ -10143,7 +10143,7 @@ void Player::CleanupAfterTaxiFlight()
|
||||
}
|
||||
m_taxi.ClearTaxiDestinations(); // not destinations, clear source node
|
||||
Dismount();
|
||||
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
|
||||
RemoveUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
|
||||
getHostileRefMgr().setOnlineOfflineState(true);
|
||||
}
|
||||
|
||||
@@ -12207,7 +12207,7 @@ bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item cons
|
||||
bool Player::CanNoReagentCast(SpellInfo const* spellInfo) const
|
||||
{
|
||||
// don't take reagents for spells with SPELL_ATTR5_NO_REAGENT_COST_WITH_AURA
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR5_NO_REAGENT_COST_WITH_AURA) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION))
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR5_NO_REAGENT_COST_WITH_AURA) && HasUnitFlag(UNIT_FLAG_PREPARATION))
|
||||
return true;
|
||||
|
||||
// Check no reagent use mask
|
||||
@@ -12517,14 +12517,14 @@ void Player::SetClientControl(Unit* target, bool allowMove, bool packetOnly /*=
|
||||
if (target->GetTypeId() != TYPEID_UNIT)
|
||||
return;
|
||||
|
||||
if (allowMove && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
|
||||
if (allowMove && target->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
|
||||
{
|
||||
target->ClearUnitState(UNIT_STATE_ROOT);
|
||||
target->SetControlled(true, UNIT_STATE_ROOT);
|
||||
}
|
||||
else if (!allowMove && target->HasUnitState(UNIT_STATE_ROOT) && !target->HasUnitTypeMask(UNIT_MASK_ACCESSORY))
|
||||
{
|
||||
if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
|
||||
if (target->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
|
||||
{
|
||||
// Xinef: restore original orientation, important for shooting vehicles!
|
||||
Position pos = target->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && target->GetTransGUID() && target->GetTransGUID().IsMOTransport() ? target->ToCreature()->GetTransportHomePosition() : target->ToCreature()->GetHomePosition();
|
||||
@@ -14954,7 +14954,7 @@ void Player::SetIsSpectator(bool on)
|
||||
m_ExtraFlags |= PLAYER_EXTRA_SPECTATOR_ON;
|
||||
AddUnitState(UNIT_STATE_ISOLATED);
|
||||
//SetFaction(1100);
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
|
||||
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||
ResetContestedPvP();
|
||||
SetDisplayId(23691);
|
||||
@@ -14965,7 +14965,7 @@ void Player::SetIsSpectator(bool on)
|
||||
if (IsSpectator())
|
||||
ClearUnitState(UNIT_STATE_ISOLATED);
|
||||
m_ExtraFlags &= ~PLAYER_EXTRA_SPECTATOR_ON;
|
||||
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
|
||||
RestoreDisplayId();
|
||||
|
||||
if (!IsGameMaster())
|
||||
|
||||
Reference in New Issue
Block a user