feat(Core/Unit): New helpers for UnitFlag and UnitFlag2 (#11227)

This commit is contained in:
Kitzunu
2022-03-30 12:59:42 +02:00
committed by GitHub
parent 54c06eb72e
commit 856aed6fc6
243 changed files with 1205 additions and 1191 deletions
+3 -3
View File
@@ -587,9 +587,9 @@ void PetAI::DoAttack(Unit* target, bool chase)
{
// xinef: properly fix fake combat after pet is sent to attack
if (Unit* owner = me->GetOwner())
owner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
owner->SetUnitFlag(UNIT_FLAG_PET_IN_COMBAT);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
me->SetUnitFlag(UNIT_FLAG_PET_IN_COMBAT);
// Play sound to let the player know the pet is attacking something it picked on its own
if (me->HasReactState(REACT_AGGRESSIVE) && !me->GetCharmInfo()->IsCommandAttack())
@@ -676,7 +676,7 @@ bool PetAI::CanAttack(Unit* target, SpellInfo const* spellInfo)
return false;
// xinef: pets of mounted players have stunned flag only, check this also
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED))
if (me->HasUnitFlag(UNIT_FLAG_STUNNED))
return false;
// pussywizard: TEMP!
@@ -298,7 +298,7 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec
return nullptr;
//Silenced so we can't cast
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
if (me->HasUnitFlag(UNIT_FLAG_SILENCED))
return nullptr;
//Using the extended script system we first create a list of viable spells
@@ -215,7 +215,7 @@ void npc_escortAI::EnterEvadeMode()
{
me->GetMotionMaster()->MoveTargetedHome();
if (HasImmuneToNPCFlags)
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
Reset();
}
}
@@ -497,10 +497,10 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
//disable npcflags
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC))
if (me->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC))
{
HasImmuneToNPCFlags = true;
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
}
LOG_DEBUG("scripts.ai", "EscortAI started with {} waypoints. ActiveAttacker = {}, Run = {}, PlayerGUID = {}",
+2 -2
View File
@@ -630,7 +630,7 @@ void SmartAI::EnterEvadeMode()
return;
}
if (me->GetCharmerGUID().IsPlayer() || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED))
if (me->GetCharmerGUID().IsPlayer() || me->HasUnitFlag(UNIT_FLAG_POSSESSED))
{
me->AttackStop();
return;
@@ -802,7 +802,7 @@ void SmartAI::SummonedCreatureDies(Creature* summon, Unit* /*killer*/)
void SmartAI::AttackStart(Unit* who)
{
// xinef: dont allow charmed npcs to act on their own
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED))
if (me->HasUnitFlag(UNIT_FLAG_POSSESSED))
{
if (who && mCanAutoAttack)
me->Attack(who, true);
@@ -719,7 +719,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(e.action.cast.spell);
int32 currentPower = me->GetPower(GetCasterPowerType());
if ((spellInfo && (currentPower < spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask()) || me->IsSpellProhibited(spellInfo->GetSchoolMask()))) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
if ((spellInfo && (currentPower < spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask()) || me->IsSpellProhibited(spellInfo->GetSchoolMask()))) || me->HasUnitFlag(UNIT_FLAG_SILENCED))
{
SetCasterActualDist(0);
CAST_AI(SmartAI, me->AI())->SetForcedCombatMove(0);
@@ -863,13 +863,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (!e.action.unitFlag.type)
{
(*itr)->ToUnit()->SetFlag(UNIT_FIELD_FLAGS, e.action.unitFlag.flag);
(*itr)->ToUnit()->SetUnitFlag(UnitFlags(e.action.unitFlag.flag));
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit {} added flag {} to UNIT_FIELD_FLAGS",
(*itr)->GetGUID().ToString(), e.action.unitFlag.flag);
}
else
{
(*itr)->ToUnit()->SetFlag(UNIT_FIELD_FLAGS_2, e.action.unitFlag.flag);
(*itr)->ToUnit()->SetUnitFlag2(UnitFlags2(e.action.unitFlag.flag));
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit {} added flag {} to UNIT_FIELD_FLAGS_2",
(*itr)->GetGUID().ToString(), e.action.unitFlag.flag);
}
@@ -891,13 +891,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (!e.action.unitFlag.type)
{
(*itr)->ToUnit()->RemoveFlag(UNIT_FIELD_FLAGS, e.action.unitFlag.flag);
(*itr)->ToUnit()->RemoveUnitFlag(UnitFlags(e.action.unitFlag.flag));
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit {} removed flag {} to UNIT_FIELD_FLAGS",
(*itr)->GetGUID().ToString(), e.action.unitFlag.flag);
}
else
{
(*itr)->ToUnit()->RemoveFlag(UNIT_FIELD_FLAGS_2, e.action.unitFlag.flag);
(*itr)->ToUnit()->RemoveUnitFlag2(UnitFlags2(e.action.unitFlag.flag));
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit {} removed flag {} to UNIT_FIELD_FLAGS_2",
(*itr)->GetGUID().ToString(), e.action.unitFlag.flag);
}
+3 -3
View File
@@ -488,7 +488,7 @@ void Battlefield::HideNpc(Creature* creature)
{
creature->CombatStop();
creature->SetReactState(REACT_PASSIVE);
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
creature->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
creature->SetPhaseMask(2, false); // pussywizard: false because UpdateObjectVisibility(true) is called below in SetVisible(), no need to have it here
creature->DisappearAndDie();
creature->SetVisible(false);
@@ -498,14 +498,14 @@ void Battlefield::ShowNpc(Creature* creature, bool aggressive)
{
creature->SetPhaseMask(1, false); // pussywizard: false because UpdateObjectVisibility(true) is called below in SetVisible(), no need to have it here
creature->SetVisible(true);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
creature->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
if (!creature->IsAlive())
creature->Respawn(true);
if (aggressive)
creature->SetReactState(REACT_AGGRESSIVE);
else
{
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
creature->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
creature->SetReactState(REACT_PASSIVE);
}
}
@@ -718,7 +718,7 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
// Xinef: Allow to Skin non-released corpse
if (victim->GetTypeId() == TYPEID_PLAYER)
victim->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
victim->SetUnitFlag(UNIT_FLAG_SKINNABLE);
}
else if (victim->IsVehicle() && !killer->IsFriendlyTo(victim))
{
@@ -1764,7 +1764,7 @@ void Battleground::HandleKillPlayer(Player* victim, Player* killer)
if (!isArena())
{
// To be able to remove insignia -- ONLY IN Battlegrounds
victim->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
victim->SetUnitFlag(UNIT_FLAG_SKINNABLE);
RewardXPAtKill(killer, victim);
}
}
@@ -740,7 +740,7 @@ void BattlegroundIC::HandleContestedNodes(ICNodePoint* nodePoint)
for (std::list<Creature*>::const_iterator itr = cannons.begin(); itr != cannons.end(); ++itr)
{
(*itr)->GetVehicleKit()->RemoveAllPassengers();
(*itr)->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
(*itr)->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
}
}
else if (nodePoint->nodeType == NODE_TYPE_WORKSHOP)
@@ -775,7 +775,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
gunshipHorde->GetCreatureListWithEntryInGrid(cannons, NPC_HORDE_GUNSHIP_CANNON, 150.0f);
for (std::list<Creature*>::const_iterator itr = cannons.begin(); itr != cannons.end(); ++itr)
(*itr)->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
(*itr)->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
for (uint8 u = 0; u < MAX_HANGAR_TELEPORTERS_SPAWNS; ++u)
{
@@ -699,18 +699,18 @@ void BattlegroundSA::DemolisherStartState(bool start)
if (Creature* dem = GetBGCreature(i))
{
if (start)
dem->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
dem->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
else
dem->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
dem->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
}
for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10; i++)
if (Creature* gun = GetBGCreature(i))
{
if (start)
gun->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
gun->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
else
gun->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
gun->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
}
// xinef: enable first gates damaging at start
+1 -1
View File
@@ -295,7 +295,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
case CONDITION_OBJECT_ENTRY_GUID:
{
if (ConditionValue3 == 1 && object->ToUnit()) // pussywizard: if == 1, ignore not attackable/selectable targets
if (object->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
if (object->ToUnit()->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
break;
if (uint32(object->GetTypeId()) == ConditionValue1)
+18 -18
View File
@@ -501,8 +501,8 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data, bool changele
if (IsInCombat())
unit_flags |= UNIT_FLAG_IN_COMBAT;
SetUInt32Value(UNIT_FIELD_FLAGS, unit_flags);
SetUInt32Value(UNIT_FIELD_FLAGS_2, cInfo->unit_flags2);
ReplaceAllUnitFlags(UnitFlags(unit_flags));
ReplaceAllUnitFlags2(UnitFlags2(cInfo->unit_flags2));
SetUInt32Value(UNIT_DYNAMIC_FLAGS, dynamicflags);
@@ -564,7 +564,7 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data, bool changele
// trigger creature is always not selectable and can not be attacked
if (IsTrigger())
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
InitializeReactState();
@@ -847,7 +847,7 @@ void Creature::Regenerate(Powers power)
uint32 maxValue = GetMaxPower(power);
// Xinef: implement power regeneration flag
if (!HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER) && !GetOwnerGUID().IsPlayer())
if (!HasUnitFlag2(UNIT_FLAG2_REGENERATE_POWER) && !GetOwnerGUID().IsPlayer())
return;
if (curValue >= maxValue)
@@ -1302,7 +1302,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
uint32 displayId = GetNativeDisplayId();
uint32 npcflag = GetUInt32Value(UNIT_NPC_FLAGS);
uint32 unit_flags = GetUInt32Value(UNIT_FIELD_FLAGS);
uint32 unit_flags = GetUnitFlags();
uint32 dynamicflags = GetUInt32Value(UNIT_DYNAMIC_FLAGS);
// check if it's a custom model and if not, use 0 for displayId
@@ -1789,14 +1789,14 @@ bool Creature::CanStartAttack(Unit const* who) const
return false;
// This set of checks is should be done only for creatures
if ((HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC) && who->GetTypeId() != TYPEID_PLAYER) || // flag is valid only for non player characters
(HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) && who->GetTypeId() == TYPEID_PLAYER)) // immune to PC and target is a player, return false
if ((HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC) && who->GetTypeId() != TYPEID_PLAYER) || // flag is valid only for non player characters
(HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC) && who->GetTypeId() == TYPEID_PLAYER)) // immune to PC and target is a player, return false
{
return false;
}
if (Unit* owner = who->GetOwner())
if (owner->GetTypeId() == TYPEID_PLAYER && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) // immune to PC and target has player owner
if (owner->GetTypeId() == TYPEID_PLAYER && HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC)) // immune to PC and target has player owner
return false;
// Do not attack non-combat pets
@@ -2159,9 +2159,9 @@ SpellInfo const* Creature::reachWithSpellAttack(Unit* victim)
float dist = GetDistance(victim);
if (dist > range || dist < minrange)
continue;
if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasUnitFlag(UNIT_FLAG_SILENCED))
continue;
if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED))
if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY && HasUnitFlag(UNIT_FLAG_PACIFIED))
continue;
return spellInfo;
}
@@ -2206,9 +2206,9 @@ SpellInfo const* Creature::reachWithSpellCure(Unit* victim)
// continue;
if (dist > range || dist < minrange)
continue;
if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasUnitFlag(UNIT_FLAG_SILENCED))
continue;
if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED))
if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY && HasUnitFlag(UNIT_FLAG_PACIFIED))
continue;
return spellInfo;
}
@@ -2339,7 +2339,7 @@ bool Creature::CanAssistTo(Unit const* u, Unit const* enemy, bool checkfaction /
if (IsCivilian())
return false;
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC))
if (HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC))
return false;
// skip fighting creature
@@ -2388,7 +2388,7 @@ bool Creature::_IsTargetAcceptable(Unit const* target) const
if (target->HasUnitState(UNIT_STATE_DIED))
{
// some creatures can detect fake death
if (CanIgnoreFeignDeath() && target->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH))
if (CanIgnoreFeignDeath() && target->HasUnitFlag2(UNIT_FLAG2_FEIGN_DEATH))
return true;
else
return false;
@@ -2475,7 +2475,7 @@ bool Creature::CanCreatureAttack(Unit const* victim, bool skipDistCheck) const
}
// if victim is in FD and we can't see that
if (victim->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH) && !CanIgnoreFeignDeath())
if (victim->HasUnitFlag2(UNIT_FLAG2_FEIGN_DEATH) && !CanIgnoreFeignDeath())
{
return false;
}
@@ -2785,7 +2785,7 @@ void Creature::AllLootRemovedFromCorpse()
{
if (LootTemplates_Skinning.HaveLootFor(GetCreatureTemplate()->SkinLootId))
{
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
SetUnitFlag(UNIT_FLAG_SKINNABLE);
}
}
@@ -3056,12 +3056,12 @@ bool Creature::CanEnterWater() const
void Creature::RefreshSwimmingFlag(bool recheck)
{
if (!_isMissingSwimmingFlagOutOfCombat || recheck)
_isMissingSwimmingFlagOutOfCombat = !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SWIMMING);
_isMissingSwimmingFlagOutOfCombat = !HasUnitFlag(UNIT_FLAG_SWIMMING);
// Check if the creature has UNIT_FLAG_SWIMMING and add it if it's missing
// Creatures must be able to chase a target in water if they can enter water
if (_isMissingSwimmingFlagOutOfCombat && CanEnterWater())
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SWIMMING);
SetUnitFlag(UNIT_FLAG_SWIMMING);
}
bool Creature::SetCanFly(bool enable, bool /*packetOnly*/ /* = false */)
@@ -2057,13 +2057,13 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
// needed for GO casts for proper target validation checks
trigger->SetOwnerGUID(owner->GetGUID());
// xinef: fixes some duel bugs with traps]
if (owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
trigger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
if (owner->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
trigger->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
if (owner->IsFFAPvP())
trigger->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
// xinef: Remove Immunity flags
trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
trigger->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
// xinef: set proper orientation, fixes cast against stealthed targets
if (target)
trigger->SetInFront(target);
+6 -6
View File
@@ -303,14 +303,14 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
else
SetUInt32Value(UNIT_FIELD_BYTES_0, 0x800); // class = mage
SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); // this enables popup window (pet dismiss, cancel)
ReplaceAllUnitFlags(UNIT_FLAG_PLAYER_CONTROLLED); // this enables popup window (pet dismiss, cancel)
break;
case HUNTER_PET:
SetUInt32Value(UNIT_FIELD_BYTES_0, 0x02020100); // class = warrior, gender = none, power = focus
SetSheath(SHEATH_STATE_MELEE);
SetByteFlag(UNIT_FIELD_BYTES_2, 2, petInfo->WasRenamed ? UNIT_CAN_BE_ABANDONED : UNIT_CAN_BE_RENAMED | UNIT_CAN_BE_ABANDONED);
SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
ReplaceAllUnitFlags(UNIT_FLAG_PLAYER_CONTROLLED);
// this enables popup window (pet abandon, cancel)
SetMaxPower(POWER_HAPPINESS, GetCreatePowers(POWER_HAPPINESS));
SetPower(POWER_HAPPINESS, petInfo->Happiness);
@@ -622,19 +622,19 @@ void Pet::setDeathState(DeathState s, bool /*despawn = false*/)
{
// pet corpse non lootable and non skinnable
SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE);
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
RemoveUnitFlag(UNIT_FLAG_SKINNABLE);
//lose happiness when died and not in BG/Arena
MapEntry const* mapEntry = sMapStore.LookupEntry(GetMapId());
if (!mapEntry || (mapEntry->map_type != MAP_ARENA && mapEntry->map_type != MAP_BATTLEGROUND))
ModifyPower(POWER_HAPPINESS, -HAPPINESS_LEVEL_SIZE);
//SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
//SetUnitFlag(UNIT_FLAG_STUNNED);
}
}
else if (getDeathState() == ALIVE)
{
//RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
//RemoveUnitFlag(UNIT_FLAG_STUNNED);
CastPetAuras(true);
}
}
@@ -2259,7 +2259,7 @@ bool Pet::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32
return false;
// Force regen flag for player pets, just like we do for players themselves
SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);
SetUnitFlag2(UNIT_FLAG2_REGENERATE_POWER);
SetSheath(SHEATH_STATE_MELEE);
return true;
+16 -16
View File
@@ -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())
@@ -5398,7 +5398,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons
SetGuidValue(PLAYER_FARSIGHT, ObjectGuid::Empty);
SetCreatorGUID(ObjectGuid::Empty);
RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
RemoveUnitFlag2(UNIT_FLAG2_FORCE_MOVEMENT);
// reset some aura modifiers before aura apply
SetUInt32Value(PLAYER_TRACK_CREATURES, 0);
@@ -94,7 +94,7 @@ void Player::Update(uint32 p_time)
// Xinef: update charm AI only if we are controlled by creature or
// non-posses player charm
if (IsCharmed() && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED))
if (IsCharmed() && !HasUnitFlag(UNIT_FLAG_POSSESSED))
{
m_charmUpdateTimer += p_time;
if (m_charmUpdateTimer >= 1000)
+68 -68
View File
@@ -2303,7 +2303,7 @@ void Unit::CalcHealAbsorb(HealInfo& healInfo)
void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType, bool extra)
{
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED))
if (HasUnitFlag(UNIT_FLAG_PACIFIED))
{
return;
}
@@ -9635,9 +9635,9 @@ ReputationRank Unit::GetReactionTo(Unit const* target, bool checkOriginalFaction
return *repRank;
}
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
if (HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
{
if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
{
if (selfPlayerOwner && targetPlayerOwner)
{
@@ -9666,7 +9666,7 @@ ReputationRank Unit::GetReactionTo(Unit const* target, bool checkOriginalFaction
{
if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(targetFactionTemplateEntry))
return *repRank;
if (!selfPlayerOwner->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_IGNORE_REPUTATION))
if (!selfPlayerOwner->HasUnitFlag2(UNIT_FLAG2_IGNORE_REPUTATION))
{
if (FactionEntry const* targetFactionEntry = sFactionStore.LookupEntry(targetFactionTemplateEntry->faction))
{
@@ -9751,7 +9751,7 @@ ReputationRank Unit::GetFactionReactionTo(FactionTemplateEntry const* factionTem
return REP_HOSTILE;
if (ReputationRank const* repRank = targetPlayerOwner->GetReputationMgr().GetForcedRankIfAny(factionTemplateEntry))
return *repRank;
if (!target->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_IGNORE_REPUTATION))
if (!target->HasUnitFlag2(UNIT_FLAG2_IGNORE_REPUTATION))
{
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
{
@@ -9846,7 +9846,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
return false;
}
//if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED)) // pussywizard: why having this flag prevents from entering combat? it should just prevent melee attack
//if (HasUnitFlag(UNIT_FLAG_PACIFIED)) // pussywizard: why having this flag prevents from entering combat? it should just prevent melee attack
// return false;
// nobody can attack GM in GM-mode
@@ -10229,7 +10229,7 @@ void Unit::SetMinion(Minion* minion, bool apply)
if (GetTypeId() == TYPEID_PLAYER)
{
minion->m_ControlledByPlayer = true;
minion->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
minion->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
}
// Can only have one pet. If a new one is summoned, dismiss the old one.
@@ -10417,7 +10417,7 @@ void Unit::SetCharm(Unit* charm, bool apply)
charm->m_ControlledByPlayer = true;
// TODO: maybe we can use this flag to check if controlled by player
charm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
}
else
charm->m_ControlledByPlayer = false;
@@ -10447,13 +10447,13 @@ void Unit::SetCharm(Unit* charm, bool apply)
if (charm->GetTypeId() == TYPEID_PLAYER)
{
charm->m_ControlledByPlayer = true;
charm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
charm->ToPlayer()->UpdatePvPState();
}
else if (Player* player = charm->GetCharmerOrOwnerPlayerOrPlayerItself())
{
charm->m_ControlledByPlayer = true;
charm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, player->GetByteValue(UNIT_FIELD_BYTES_2, 1));
// Xinef: skip controlled erase if charmed unit is owned by charmer
@@ -10463,7 +10463,7 @@ void Unit::SetCharm(Unit* charm, bool apply)
else
{
charm->m_ControlledByPlayer = false;
charm->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
charm->RemoveUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, 0);
}
@@ -12840,7 +12840,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
if (mount)
SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, mount);
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT);
SetUnitFlag(UNIT_FLAG_MOUNT);
if (Player* player = ToPlayer())
{
@@ -12874,7 +12874,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
Battleground* bg = ToPlayer()->GetBattleground();
// don't unsummon pet in arena but SetFlag UNIT_FLAG_STUNNED to disable pet's interface
if (bg && bg->isArena())
pet->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
pet->SetUnitFlag(UNIT_FLAG_STUNNED);
else
player->UnsummonPetTemporaryIfAny();
}
@@ -12882,7 +12882,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
// xinef: if we have charmed npc, stun him also
if (Unit* charm = player->GetCharm())
if (charm->GetTypeId() == TYPEID_UNIT)
charm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
charm->SetUnitFlag(UNIT_FLAG_STUNNED);
WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
data << GetPackGUID();
@@ -12900,7 +12900,7 @@ void Unit::Dismount()
return;
SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, 0);
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT);
RemoveUnitFlag(UNIT_FLAG_MOUNT);
if (Player* thisPlayer = ToPlayer())
{
@@ -12938,8 +12938,8 @@ void Unit::Dismount()
if (Pet* pPet = player->GetPet())
{
if (pPet->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) && !pPet->HasUnitState(UNIT_STATE_STUNNED))
pPet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
if (pPet->HasUnitFlag(UNIT_FLAG_STUNNED) && !pPet->HasUnitState(UNIT_STATE_STUNNED))
pPet->RemoveUnitFlag(UNIT_FLAG_STUNNED);
}
else
player->ResummonPetTemporaryUnSummonedIfAny();
@@ -12947,7 +12947,7 @@ void Unit::Dismount()
// xinef: if we have charmed npc, remove stun also
if (Unit* charm = player->GetCharm())
if (charm->GetTypeId() == TYPEID_UNIT && !charm->HasUnitState(UNIT_STATE_STUNNED))
charm->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
charm->RemoveUnitFlag(UNIT_FLAG_STUNNED);
}
}
@@ -13090,13 +13090,13 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy, uint32 duration)
return;
// xinef: if we somehow engage in combat (scripts, dunno) with player, remove this flag so he can fight back
if (GetTypeId() == TYPEID_UNIT && enemy && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) && enemy->GetCharmerOrOwnerPlayerOrPlayerItself())
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); // unit has engaged in combat, remove immunity so players can fight back
if (GetTypeId() == TYPEID_UNIT && enemy && HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC) && enemy->GetCharmerOrOwnerPlayerOrPlayerItself())
RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); // unit has engaged in combat, remove immunity so players can fight back
if (IsInCombat())
return;
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
SetUnitFlag(UNIT_FLAG_IN_COMBAT);
if (Creature* creature = ToCreature())
{
@@ -13151,13 +13151,13 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy, uint32 duration)
void Unit::ClearInCombat()
{
m_CombatTimer = 0;
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
RemoveUnitFlag(UNIT_FLAG_IN_COMBAT);
// Player's state will be cleared in Player::UpdateContestedPvP
if (Creature* creature = ToCreature())
{
if (creature->GetCreatureTemplate() && creature->GetCreatureTemplate()->unit_flags & UNIT_FLAG_IMMUNE_TO_PC)
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); // set immunity state to the one from db on evade
SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); // set immunity state to the one from db on evade
ClearUnitState(UNIT_STATE_ATTACK_PLAYER);
if (HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED))
@@ -13185,11 +13185,11 @@ void Unit::ClearInCombat()
void Unit::ClearInPetCombat()
{
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
RemoveUnitFlag(UNIT_FLAG_PET_IN_COMBAT);
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_LEAVE_COMBAT);
if (Unit* owner = GetOwner())
{
owner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
owner->RemoveUnitFlag(UNIT_FLAG_PET_IN_COMBAT);
}
}
@@ -13198,10 +13198,10 @@ bool Unit::isTargetableForAttack(bool checkFakeDeath, Unit const* byWho) const
if (!IsAlive())
return false;
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
if (HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
return false;
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) && byWho && byWho->GetCharmerOrOwnerPlayerOrPlayerItself())
if (HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC) && byWho && byWho->GetCharmerOrOwnerPlayerOrPlayerItself())
return false;
if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->IsGameMaster())
@@ -13246,7 +13246,7 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo
// can't attack untargetable
if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE))
&& target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))
&& target->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
return false;
if (Player const* playerAttacker = ToPlayer())
@@ -13255,16 +13255,16 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo
return false;
}
// check flags
if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_TAXI_FLIGHT | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_NON_ATTACKABLE_2)
|| (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC))
|| (!target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC))
|| (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC))
if (target->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_TAXI_FLIGHT | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_NON_ATTACKABLE_2)
|| (!HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC))
|| (!target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC))
|| (HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC))
// check if this is a world trigger cast - GOs are using world triggers to cast their spells, so we need to ignore their immunity flag here, this is a temp workaround, needs removal when go cast is implemented properly
|| ((GetEntry() != WORLD_TRIGGER && (!obj || !obj->isType(TYPEMASK_GAMEOBJECT | TYPEMASK_DYNAMICOBJECT))) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)))
|| ((GetEntry() != WORLD_TRIGGER && (!obj || !obj->isType(TYPEMASK_GAMEOBJECT | TYPEMASK_DYNAMICOBJECT))) && target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC)))
return false;
// CvC case - can attack each other only when one of them is hostile
if (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && !target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
if (!HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && !target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
return GetReactionTo(target) <= REP_HOSTILE || target->GetReactionTo(this) <= REP_HOSTILE;
// PvP, PvC, CvP case
@@ -13303,8 +13303,8 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo
if (creatureAttacker && creatureAttacker->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT)
return false;
Player const* playerAffectingAttacker = HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) ? GetAffectingPlayer() : nullptr;
Player const* playerAffectingTarget = target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) ? target->GetAffectingPlayer() : nullptr;
Player const* playerAffectingAttacker = HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) ? GetAffectingPlayer() : nullptr;
Player const* playerAffectingTarget = target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) ? target->GetAffectingPlayer() : nullptr;
// check duel - before sanctuary checks
if (playerAffectingAttacker && playerAffectingTarget)
@@ -13313,7 +13313,7 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo
// PvP case - can't attack when attacker or target are in sanctuary
// however, 13850 client doesn't allow to attack when one of the unit's has sanctuary flag and is pvp
if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && (target->IsInSanctuary() || IsInSanctuary()))
if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && (target->IsInSanctuary() || IsInSanctuary()))
return false;
// additional checks - only PvP case
@@ -13364,23 +13364,23 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co
// can't assist untargetable
if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE))
&& target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))
&& target->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
return false;
if (!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC))
{
// xinef: do not allow to assist non attackable units
if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (target->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
return false;
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
if (HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
{
if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC))
if (target->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC))
return false;
}
else
{
if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC))
if (target->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC))
return false;
}
}
@@ -13392,10 +13392,10 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co
return false;
// PvP case
if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
{
Player const* targetPlayerOwner = target->GetAffectingPlayer();
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
if (HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
{
Player const* selfPlayerOwner = GetAffectingPlayer();
if (selfPlayerOwner && targetPlayerOwner)
@@ -13416,8 +13416,8 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co
}
}
// PvC case - player can assist creature only if has specific type flags
// !target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) &&
else if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)
// !target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) &&
else if (HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED)
&& (!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC))
&& !target->IsPvP())
{
@@ -13818,7 +13818,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced)
pet = GetCharm();
// xinef: do not affect vehicles and possesed pets
if (pet && (pet->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED) || pet->IsVehicle()))
if (pet && (pet->HasUnitFlag(UNIT_FLAG_POSSESSED) || pet->IsVehicle()))
pet = nullptr;
if (pet && pet->GetTypeId() == TYPEID_UNIT && !pet->IsInCombat() && pet->GetMotionMaster()->GetCurrentMovementGeneratorType() == FOLLOW_MOTION_TYPE)
@@ -16900,7 +16900,7 @@ bool Unit::InitTamedPet(Pet* pet, uint8 level, uint32 spell_id)
pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id);
if (GetTypeId() == TYPEID_PLAYER)
pet->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
pet->ReplaceAllUnitFlags(UNIT_FLAG_PLAYER_CONTROLLED);
if (!pet->InitStatsForLevel(level))
{
@@ -17605,7 +17605,7 @@ void Unit::SetStunned(bool apply)
if (apply)
{
SetTarget();
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
SetUnitFlag(UNIT_FLAG_STUNNED);
if (GetTypeId() == TYPEID_PLAYER)
{
@@ -17626,15 +17626,15 @@ void Unit::SetStunned(bool apply)
// don't remove UNIT_FLAG_STUNNED for pet when owner is mounted (disabled pet's interface)
Unit* owner = GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER || !owner->ToPlayer()->IsMounted())
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
RemoveUnitFlag(UNIT_FLAG_STUNNED);
// Xinef: same for charmed npcs
owner = GetCharmer();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER || !owner->ToPlayer()->IsMounted())
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
RemoveUnitFlag(UNIT_FLAG_STUNNED);
}
else
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
RemoveUnitFlag(UNIT_FLAG_STUNNED);
if (!HasUnitState(UNIT_STATE_ROOT)) // prevent moving if it also has root effect
{
@@ -17720,9 +17720,9 @@ void Unit::DisableRotate(bool apply)
return;
if (apply)
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED);
SetUnitFlag(UNIT_FLAG_POSSESSED);
else if (!HasUnitState(UNIT_STATE_POSSESSED))
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED);
RemoveUnitFlag(UNIT_FLAG_POSSESSED);
}
void Unit::SetFeared(bool apply)
@@ -17949,7 +17949,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
switch (type)
{
case CHARM_TYPE_VEHICLE:
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED);
SetUnitFlag(UNIT_FLAG_POSSESSED);
AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD);
playerCharmer->SetClientControl(this, true); // verified
playerCharmer->VehicleSpellInitialize();
@@ -17957,8 +17957,8 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
case CHARM_TYPE_POSSESS:
AddUnitState(UNIT_STATE_POSSESSED);
AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD);
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED);
charmer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
SetUnitFlag(UNIT_FLAG_POSSESSED);
charmer->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE);
playerCharmer->SetClientControl(this, true); // verified
playerCharmer->PossessSpellInitialize();
break;
@@ -18049,7 +18049,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
// xinef: remove stunned flag if owner was mounted
if (GetTypeId() == TYPEID_UNIT && !HasUnitState(UNIT_STATE_STUNNED))
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
RemoveUnitFlag(UNIT_FLAG_STUNNED);
// If charmer still exists
if (!charmer)
@@ -18068,14 +18068,14 @@ void Unit::RemoveCharmedBy(Unit* charmer)
case CHARM_TYPE_VEHICLE:
playerCharmer->SetClientControl(this, false);
playerCharmer->SetClientControl(charmer, true); // verified
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED);
RemoveUnitFlag(UNIT_FLAG_POSSESSED);
ClearUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD);
break;
case CHARM_TYPE_POSSESS:
playerCharmer->SetClientControl(this, false);
playerCharmer->SetClientControl(charmer, true); // verified
charmer->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED);
charmer->RemoveUnitFlag(UNIT_FLAG_DISABLE_MOVE);
RemoveUnitFlag(UNIT_FLAG_POSSESSED);
ClearUnitState(UNIT_STATE_POSSESSED);
ClearUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD);
break;
@@ -19366,15 +19366,15 @@ bool Unit::IsFalling() const
bool Unit::CanSwim() const
{
// Mirror client behavior, if this method returns false then client will not use swimming animation and for players will apply gravity as if there was no water
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CANNOT_SWIM))
if (HasUnitFlag(UNIT_FLAG_CANNOT_SWIM))
return false;
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED)) // is player
if (HasUnitFlag(UNIT_FLAG_POSSESSED)) // is player
return true;
if (HasFlag(UNIT_FIELD_FLAGS_2, 0x1000000))
if (HasUnitFlag2(UNIT_FLAG2_UNUSED_6))
return false;
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT))
if (HasUnitFlag(UNIT_FLAG_PET_IN_COMBAT))
return true;
return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_RENAME | UNIT_FLAG_SWIMMING);
return HasUnitFlag(UNIT_FLAG_RENAME | UNIT_FLAG_SWIMMING);
}
void Unit::NearTeleportTo(float x, float y, float z, float orientation, bool casting /*= false*/, bool vehicleTeleport /*= false*/, bool withPet /*= false*/, bool removeTransport /*= false*/)
@@ -20035,12 +20035,12 @@ bool Unit::SetSwim(bool enable)
if (enable)
{
AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SWIMMING);
SetUnitFlag(UNIT_FLAG_SWIMMING);
}
else
{
RemoveUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SWIMMING);
RemoveUnitFlag(UNIT_FLAG_SWIMMING);
}
return true;
+31 -11
View File
@@ -19,6 +19,7 @@
#define __UNIT_H
#include "EventProcessor.h"
#include "EnumFlag.h"
#include "FollowerRefMgr.h"
#include "FollowerReference.h"
#include "HostileRefMgr.h"
@@ -437,8 +438,9 @@ enum DamageEffectType
// Value masks for UNIT_FIELD_FLAGS
// EnumUtils: DESCRIBE THIS
enum UnitFlags
enum UnitFlags : uint32
{
UNIT_FLAG_NONE = 0x00000000,
UNIT_FLAG_SERVER_CONTROLLED = 0x00000001, // set only when unit movement is controlled by server - by SPLINE/MONSTER_MOVE packets, together with UNIT_FLAG_STUNNED; only set to units controlled by client; client function CGUnit_C::IsClientControlled returns false when set for owner
UNIT_FLAG_NON_ATTACKABLE = 0x00000002, // not attackable
UNIT_FLAG_DISABLE_MOVE = 0x00000004,
@@ -473,15 +475,18 @@ enum UnitFlags
UNIT_FLAG_IMMUNE = 0x80000000, // Immune to damage
};
DEFINE_ENUM_FLAG(UnitFlags);
// Value masks for UNIT_FIELD_FLAGS_2
enum UnitFlags2
enum UnitFlags2 : uint32
{
UNIT_FLAG2_NONE = 0x00000000,
UNIT_FLAG2_FEIGN_DEATH = 0x00000001,
UNIT_FLAG2_HIDE_BODY = 0x00000002, // Hide unit model (show only player equip)
UNIT_FLAG2_HIDE_BODY = 0x00000002, // Hide unit model (show only player equip)
UNIT_FLAG2_IGNORE_REPUTATION = 0x00000004,
UNIT_FLAG2_COMPREHEND_LANG = 0x00000008,
UNIT_FLAG2_MIRROR_IMAGE = 0x00000010,
UNIT_FLAG2_DO_NOT_FADE_IN = 0x00000020, // Unit model instantly appears when summoned (does not fade in)
UNIT_FLAG2_DO_NOT_FADE_IN = 0x00000020, // Unit model instantly appears when summoned (does not fade in)
UNIT_FLAG2_FORCE_MOVEMENT = 0x00000040,
UNIT_FLAG2_DISARM_OFFHAND = 0x00000080,
UNIT_FLAG2_DISABLE_PRED_STATS = 0x00000100, // Player has disabled predicted stats (Used by raid frames)
@@ -490,12 +495,15 @@ enum UnitFlags2
UNIT_FLAG2_RESTRICT_PARTY_INTERACTION = 0x00001000, // Restrict interaction to party or raid
UNIT_FLAG2_PREVENT_SPELL_CLICK = 0x00002000, // Prevent spellclick
UNIT_FLAG2_ALLOW_ENEMY_INTERACT = 0x00004000,
UNIT_FLAG2_CANNOT_TURN = 0x00008000,
UNIT_FLAG2_CANNOT_TURN = 0x00008000,
UNIT_FLAG2_UNK2 = 0x00010000,
UNIT_FLAG2_PLAY_DEATH_ANIM = 0x00020000, // Plays special death animation upon death
UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000, // Allows casting spells with AttributesEx7 & SPELL_ATTR7_DEBUG_SPELL
UNIT_FLAG2_UNUSED_6 = 0x01000000,
};
DEFINE_ENUM_FLAG(UnitFlags2);
/// Non Player Character flags
// EnumUtils: DESCRIBE THIS
enum NPCFlags : uint32
@@ -1432,6 +1440,18 @@ public:
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply);
void ApplyCastTimePercentMod(float val, bool apply);
UnitFlags GetUnitFlags() const { return UnitFlags(GetUInt32Value(UNIT_FIELD_FLAGS)); }
bool HasUnitFlag(UnitFlags flags) const { return HasFlag(UNIT_FIELD_FLAGS, flags); }
void SetUnitFlag(UnitFlags flags) { SetFlag(UNIT_FIELD_FLAGS, flags); }
void RemoveUnitFlag(UnitFlags flags) { RemoveFlag(UNIT_FIELD_FLAGS, flags); }
void ReplaceAllUnitFlags(UnitFlags flags) { SetUInt32Value(UNIT_FIELD_FLAGS, flags); }
UnitFlags2 GetUnitFlags2() const { return UnitFlags2(GetUInt32Value(UNIT_FIELD_FLAGS_2)); }
bool HasUnitFlag2(UnitFlags2 flags) const { return HasFlag(UNIT_FIELD_FLAGS_2, flags); }
void SetUnitFlag2(UnitFlags2 flags) { SetFlag(UNIT_FIELD_FLAGS_2, flags); }
void RemoveUnitFlag2(UnitFlags2 flags) { RemoveFlag(UNIT_FIELD_FLAGS_2, flags); }
void ReplaceAllUnitFlags2(UnitFlags2 flags) { SetUInt32Value(UNIT_FIELD_FLAGS_2, flags); }
[[nodiscard]] SheathState GetSheath() const { return SheathState(GetByteValue(UNIT_FIELD_BYTES_2, 0)); }
virtual void SetSheath(SheathState sheathed) { SetByteValue(UNIT_FIELD_BYTES_2, 0, sheathed); }
@@ -1482,7 +1502,7 @@ public:
void SetStandFlags(uint8 flags) { SetByteFlag(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_VIS_FLAG, flags); }
void RemoveStandFlags(uint8 flags) { RemoveByteFlag(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_VIS_FLAG, flags); }
[[nodiscard]] bool IsMounted() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT); }
[[nodiscard]] bool IsMounted() const { return HasUnitFlag(UNIT_FLAG_MOUNT); }
[[nodiscard]] uint32 GetMountID() const { return GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID); }
void Mount(uint32 mount, uint32 vehicleId = 0, uint32 creatureEntry = 0);
void Dismount();
@@ -1550,11 +1570,11 @@ public:
switch (attacktype)
{
case BASE_ATTACK:
return !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED);
return !HasUnitFlag(UNIT_FLAG_DISARMED);
case OFF_ATTACK:
return !HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISARM_OFFHAND);
return !HasUnitFlag2(UNIT_FLAG2_DISARM_OFFHAND);
case RANGED_ATTACK:
return !HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISARM_RANGED);
return !HasUnitFlag2(UNIT_FLAG2_DISARM_RANGED);
}
return true;
}
@@ -1610,10 +1630,10 @@ public:
[[nodiscard]] bool IsInFlight() const { return HasUnitState(UNIT_STATE_IN_FLIGHT); }
[[nodiscard]] bool IsInCombat() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); }
[[nodiscard]] bool IsInCombat() const { return HasUnitFlag(UNIT_FLAG_IN_COMBAT); }
bool IsInCombatWith(Unit const* who) const;
[[nodiscard]] bool IsPetInCombat() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); }
[[nodiscard]] bool IsPetInCombat() const { return HasUnitFlag(UNIT_FLAG_PET_IN_COMBAT); }
void CombatStart(Unit* target, bool initialAggro = true);
void CombatStartOnCast(Unit* target, bool initialAggro = true, uint32 duration = 0);
void SetInCombatState(bool PvP, Unit* enemy = nullptr, uint32 duration = 0);
+3 -3
View File
@@ -346,7 +346,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
unit->GetName(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUID().ToString(), (int32)seat->first);
seat->second.Passenger.Guid = unit->GetGUID();
seat->second.Passenger.IsUnselectable = unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
seat->second.Passenger.IsUnselectable = unit->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
if (seat->second.SeatInfo->CanEnterOrExit())
{
@@ -369,7 +369,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
unit->ToPlayer()->UnsummonPetTemporaryIfAny();
if (seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE)
unit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
unit->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
unit->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
VehicleSeatEntry const* veSeat = seat->second.SeatInfo;
@@ -464,7 +464,7 @@ void Vehicle::RemovePassenger(Unit* unit)
// Remove UNIT_FLAG_NOT_SELECTABLE if passenger did not have it before entering vehicle
if (seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE && !seat->second.Passenger.IsUnselectable)
unit->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
unit->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
seat->second.Passenger.Reset();
@@ -1037,7 +1037,7 @@ namespace Acore
{}
bool operator()(Unit* u)
{
if (!u->IsAlive() || u->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE) || (u->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) && !u->IsInCombat()))
if (!u->IsAlive() || u->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE) || (u->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC) && !u->IsInCombat()))
return false;
if (u->GetGUID() == i_funit->GetGUID())
return false;
@@ -1151,7 +1151,7 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar)
// Xinef: fix possible problem with flag UNIT_FLAG_STUNNED added during logout
if (!pCurrChar->HasUnitState(UNIT_STATE_STUNNED))
pCurrChar->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
pCurrChar->RemoveUnitFlag(UNIT_FLAG_STUNNED);
pCurrChar->SendInitialPacketsBeforeAddToMap();
+1 -1
View File
@@ -262,7 +262,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
player->SetLootGUID(ObjectGuid::Empty);
player->SendLootRelease(lguid);
player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING);
player->RemoveUnitFlag(UNIT_FLAG_LOOTING);
if (!player->IsInWorld())
return;
+2 -2
View File
@@ -463,7 +463,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPackets::Character::LogoutRequ
}
GetPlayer()->SetRooted(true);
GetPlayer()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
GetPlayer()->SetUnitFlag(UNIT_FLAG_STUNNED);
}
SetLogoutStartTime(GameTime::GetGameTime().count());
@@ -485,7 +485,7 @@ void WorldSession::HandleLogoutCancelOpcode(WorldPackets::Character::LogoutCance
GetPlayer()->SetRooted(false);
GetPlayer()->SetStandState(UNIT_STAND_STATE_STAND);
GetPlayer()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
GetPlayer()->RemoveUnitFlag(UNIT_FLAG_STUNNED);
}
}
+1 -1
View File
@@ -373,7 +373,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
}
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
if (mover->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
if (mover->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
{
// Xinef: skip moving packets
if (movementInfo.HasMovementFlag(MOVEMENTFLAG_MASK_MOVING))
+16 -16
View File
@@ -242,7 +242,7 @@ void MotionMaster::MoveIdle()
void MotionMaster::MoveRandom(float wanderDistance)
{
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return;
if (_owner->GetTypeId() == TYPEID_UNIT)
@@ -265,7 +265,7 @@ void MotionMaster::MoveTargetedHome()
{
_owner->ClearUnitState(UNIT_STATE_EVADE);
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return;
LOG_DEBUG("movement.motionmaster", "Pet or controlled creature ({}) targeting home", _owner->GetGUID().ToString());
@@ -285,7 +285,7 @@ void MotionMaster::MoveTargetedHome()
void MotionMaster::MoveConfused()
{
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return;
if (_owner->GetTypeId() == TYPEID_PLAYER)
@@ -304,7 +304,7 @@ void MotionMaster::MoveChase(Unit* target, std::optional<ChaseRange> dist, std:
{
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
// ignore movement request if target not exist
if (!target || target == _owner || _owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
if (!target || target == _owner || _owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return;
//_owner->ClearUnitState(UNIT_STATE_FOLLOW);
@@ -372,7 +372,7 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo
{
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
// ignore movement request if target not exist
if (!target || target == _owner || _owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
if (!target || target == _owner || _owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
{
return;
}
@@ -395,7 +395,7 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo
void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generatePath, bool forceDestination, MovementSlot slot, float orientation /* = 0.0f*/)
{
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return;
if (_owner->GetTypeId() == TYPEID_PLAYER)
@@ -413,7 +413,7 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generate
void MotionMaster::MoveSplinePath(Movement::PointsArray* path)
{
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return;
if (_owner->GetTypeId() == TYPEID_PLAYER)
@@ -429,7 +429,7 @@ void MotionMaster::MoveSplinePath(Movement::PointsArray* path)
void MotionMaster::MoveLand(uint32 id, Position const& pos, float speed /* = 0.0f*/)
{
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return;
float x, y, z;
@@ -459,7 +459,7 @@ void MotionMaster::MoveLand(uint32 id, float x, float y, float z, float speed /*
void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed /* = 0.0f*/)
{
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return;
float x, y, z;
@@ -549,7 +549,7 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee
void MotionMaster::MoveFall(uint32 id /*=0*/, bool addFlagForNPC)
{
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return;
// use larger distance for vmap height search than in most other cases
@@ -590,7 +590,7 @@ void MotionMaster::MoveFall(uint32 id /*=0*/, bool addFlagForNPC)
void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id, const Movement::PointsArray* path, bool generatePath, float orientation /* = 0.0f*/, ObjectGuid targetGUID /*= ObjectGuid::Empty*/)
{
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return;
if (Impl[MOTION_SLOT_CONTROLLED] && Impl[MOTION_SLOT_CONTROLLED]->GetMovementGeneratorType() != DISTRACT_MOTION_TYPE)
@@ -611,7 +611,7 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id,
void MotionMaster::MoveSeekAssistance(float x, float y, float z)
{
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return;
if (_owner->GetTypeId() == TYPEID_PLAYER)
@@ -631,7 +631,7 @@ void MotionMaster::MoveSeekAssistance(float x, float y, float z)
void MotionMaster::MoveSeekAssistanceDistract(uint32 time)
{
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return;
if (_owner->GetTypeId() == TYPEID_PLAYER)
@@ -651,7 +651,7 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
return;
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return;
if (_owner->GetTypeId() == TYPEID_PLAYER)
@@ -700,7 +700,7 @@ void MotionMaster::MoveDistract(uint32 timer)
return;
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return;
/*if (_owner->GetTypeId() == TYPEID_PLAYER)
@@ -752,7 +752,7 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable)
return;
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
if (_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
if (_owner->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
return;
//We set waypoint movement as new default movement generator
@@ -94,7 +94,7 @@ void ConfusedMovementGenerator<T>::DoInitialize(T* unit)
i_nextMove = urand(1, MAX_CONF_WAYPOINTS);
DoUpdate(unit, 1);
unit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
unit->SetUnitFlag(UNIT_FLAG_CONFUSED);
unit->AddUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_CONFUSED_MOVE);
}
@@ -163,7 +163,7 @@ bool ConfusedMovementGenerator<T>::DoUpdate(T* unit, uint32 diff)
template<>
void ConfusedMovementGenerator<Player>::DoFinalize(Player* unit)
{
unit->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
unit->RemoveUnitFlag(UNIT_FLAG_CONFUSED);
unit->ClearUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_CONFUSED_MOVE);
unit->StopMoving();
}
@@ -171,7 +171,7 @@ void ConfusedMovementGenerator<Player>::DoFinalize(Player* unit)
template<>
void ConfusedMovementGenerator<Creature>::DoFinalize(Creature* unit)
{
unit->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
unit->RemoveUnitFlag(UNIT_FLAG_CONFUSED);
unit->ClearUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_CONFUSED_MOVE);
if (unit->GetVictim())
unit->SetTarget(unit->GetVictim()->GetGUID());
@@ -277,7 +277,7 @@ void FleeingMovementGenerator<T>::DoInitialize(T* owner)
if (!owner)
return;
owner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
owner->SetUnitFlag(UNIT_FLAG_FLEEING);
owner->AddUnitState(UNIT_STATE_FLEEING | UNIT_STATE_FLEEING_MOVE);
_Init(owner);
@@ -323,14 +323,14 @@ void FleeingMovementGenerator<Player>::_Init(Player* )
template<>
void FleeingMovementGenerator<Player>::DoFinalize(Player* owner)
{
owner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
owner->RemoveUnitFlag(UNIT_FLAG_FLEEING);
owner->ClearUnitState(UNIT_STATE_FLEEING | UNIT_STATE_FLEEING_MOVE);
}
template<>
void FleeingMovementGenerator<Creature>::DoFinalize(Creature* owner)
{
owner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
owner->RemoveUnitFlag(UNIT_FLAG_FLEEING);
owner->ClearUnitState(UNIT_STATE_FLEEING | UNIT_STATE_FLEEING_MOVE);
if (owner->GetVictim())
owner->SetTarget(owner->GetVictim()->GetGUID());
@@ -376,7 +376,7 @@ template bool FleeingMovementGenerator<Creature>::DoUpdate(Creature*, uint32);
void TimedFleeingMovementGenerator::Finalize(Unit* owner)
{
owner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
owner->RemoveUnitFlag(UNIT_FLAG_FLEEING);
owner->ClearUnitState(UNIT_STATE_FLEEING | UNIT_STATE_FLEEING_MOVE);
if (owner->GetVictim())
owner->SetTarget(owner->GetVictim()->GetGUID());
@@ -39,7 +39,7 @@ void HomeMovementGenerator<Creature>::DoFinalize(Creature* owner)
}
if (!owner->HasSwimmingFlagOutOfCombat())
owner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SWIMMING);
owner->RemoveUnitFlag(UNIT_FLAG_SWIMMING);
}
void HomeMovementGenerator<Creature>::DoReset(Creature*)
@@ -280,7 +280,7 @@ bool RandomMovementGenerator<Creature>::DoUpdate(Creature* creature, const uint3
}
// xinef: if we got disable move flag, do not remove default generator - just prevent movement
if (creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
if (creature->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
{
_nextMoveTime.Reset(0); // Expire the timer
creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE);
@@ -264,7 +264,7 @@ void ChaseMovementGenerator<T>::MovementInform(T* owner)
static Optional<float> GetVelocity(Unit* owner, Unit* target, G3D::Vector3 const& dest, bool playerPet)
{
Optional<float> speed = {};
if (!owner->IsInCombat() && !owner->IsVehicle() && !owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED) &&
if (!owner->IsInCombat() && !owner->IsVehicle() && !owner->HasUnitFlag(UNIT_FLAG_POSSESSED) &&
(owner->IsPet() || owner->IsGuardian() || owner->GetGUID() == target->GetCritterGUID() || owner->GetCharmerOrOwnerGUID() == target->GetGUID()))
{
UnitMoveType moveType = Movement::SelectSpeedType(target->GetUnitMovementFlags());
@@ -316,7 +316,7 @@ void FlightPathMovementGenerator::DoFinalize(Player* player)
// xinef: this should be cleaned by CleanupAfterTaxiFlight(); function!
player->Dismount();
player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
player->RemoveUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
if (player->m_taxi.empty())
{
@@ -337,7 +337,7 @@ void FlightPathMovementGenerator::DoReset(Player* player)
{
player->getHostileRefMgr().setOnlineOfflineState(false);
player->AddUnitState(UNIT_STATE_IN_FLIGHT);
player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
player->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
Movement::MoveSplineInit init(player);
uint32 end = GetPathAtMapEnd();
@@ -2372,12 +2372,12 @@ void AuraEffect::HandleAuraCloneCaster(AuraApplication const* aurApp, uint8 mode
// What must be cloned? at least display and scale
target->SetDisplayId(caster->GetDisplayId());
target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_MIRROR_IMAGE);
target->SetUnitFlag2(UNIT_FLAG2_MIRROR_IMAGE);
}
else
{
target->SetDisplayId(target->GetNativeDisplayId());
target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_MIRROR_IMAGE);
target->RemoveUnitFlag2(UNIT_FLAG2_MIRROR_IMAGE);
}
}
@@ -2479,9 +2479,9 @@ void AuraEffect::HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, boo
if (aurApp->GetRemoveMode())
return;
// blizz like 2.0.x
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT);
target->SetUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT);
// blizz like 2.0.x
target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH);
target->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
// blizz like 2.0.x
target->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
@@ -2496,9 +2496,9 @@ void AuraEffect::HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, boo
target->SendMessageToSet(&data, true);
*/
// blizz like 2.0.x
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT);
target->RemoveUnitFlag(UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT);
// blizz like 2.0.x
target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH);
target->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
// blizz like 2.0.x
target->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
@@ -2603,7 +2603,7 @@ void AuraEffect::HandleAuraModSilence(AuraApplication const* aurApp, uint8 mode,
if (apply)
{
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED);
target->SetUnitFlag(UNIT_FLAG_SILENCED);
// call functions which may have additional effects after chainging state of unit
// Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE
@@ -2619,7 +2619,7 @@ void AuraEffect::HandleAuraModSilence(AuraApplication const* aurApp, uint8 mode,
if (target->HasAuraType(SPELL_AURA_MOD_SILENCE) || target->HasAuraType(SPELL_AURA_MOD_PACIFY_SILENCE))
return;
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED);
target->RemoveUnitFlag(UNIT_FLAG_SILENCED);
}
}
@@ -2632,7 +2632,7 @@ void AuraEffect::HandleAuraModPacify(AuraApplication const* aurApp, uint8 mode,
if (apply)
{
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED);
target->SetUnitFlag(UNIT_FLAG_PACIFIED);
//target->AttackStop(); // pussywizard: why having this flag prevents from being in combat? it should just prevent melee attack
}
else
@@ -2640,7 +2640,7 @@ void AuraEffect::HandleAuraModPacify(AuraApplication const* aurApp, uint8 mode,
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
if (target->HasAuraType(SPELL_AURA_MOD_PACIFY) || target->HasAuraType(SPELL_AURA_MOD_PACIFY_SILENCE))
return;
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED);
target->RemoveUnitFlag(UNIT_FLAG_PACIFIED);
}
}
@@ -2999,13 +2999,13 @@ void AuraEffect::HandleForceMoveForward(AuraApplication const* aurApp, uint8 mod
Unit* target = aurApp->GetTarget();
if (apply)
target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
target->SetUnitFlag2(UNIT_FLAG2_FORCE_MOVEMENT);
else
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
if (target->HasAuraType(GetAuraType()))
return;
target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
target->RemoveUnitFlag2(UNIT_FLAG2_FORCE_MOVEMENT);
}
}
@@ -4961,13 +4961,13 @@ void AuraEffect::HandleArenaPreparation(AuraApplication const* aurApp, uint8 mod
Unit* target = aurApp->GetTarget();
if (apply)
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION);
target->SetUnitFlag(UNIT_FLAG_PREPARATION);
else
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
if (target->HasAuraType(GetAuraType()))
return;
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION);
target->RemoveUnitFlag(UNIT_FLAG_PREPARATION);
}
}
@@ -5598,13 +5598,13 @@ void AuraEffect::HandleAuraModFaction(AuraApplication const* aurApp, uint8 mode,
{
target->SetFaction(GetMiscValue());
if (target->GetTypeId() == TYPEID_PLAYER)
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
target->RemoveUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
}
else
{
target->RestoreFaction();
if (target->GetTypeId() == TYPEID_PLAYER)
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
target->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
}
}
@@ -5616,13 +5616,13 @@ void AuraEffect::HandleComprehendLanguage(AuraApplication const* aurApp, uint8 m
Unit* target = aurApp->GetTarget();
if (apply)
target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_COMPREHEND_LANG);
target->SetUnitFlag2(UNIT_FLAG2_COMPREHEND_LANG);
else
{
if (target->HasAuraType(GetAuraType()))
return;
target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_COMPREHEND_LANG);
target->RemoveUnitFlag2(UNIT_FLAG2_COMPREHEND_LANG);
}
}
@@ -5890,7 +5890,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
if (GetId() == 52179) // Astral Shift
{
// Periodic need for remove visual on stun/fear/silence lost
if (!(target->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED | UNIT_FLAG_FLEEING | UNIT_FLAG_SILENCED)))
if (!(target->GetUnitFlags() & (UNIT_FLAG_STUNNED | UNIT_FLAG_FLEEING | UNIT_FLAG_SILENCED)))
target->RemoveAurasDueToSpell(52179);
break;
}
+6 -6
View File
@@ -2832,7 +2832,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
if (unit->GetTypeId() == TYPEID_UNIT && unit->ToCreature()->IsInEvadeMode())
return SPELL_MISS_EVADE;
if (unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID())
if (unit->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE) && unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID())
return SPELL_MISS_EVADE;
}
@@ -5385,7 +5385,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_NOT_READY;
}
if (m_spellInfo->HasAttribute(SPELL_ATTR7_DEBUG_SPELL) && !m_caster->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS))
if (m_spellInfo->HasAttribute(SPELL_ATTR7_DEBUG_SPELL) && !m_caster->HasUnitFlag2(UNIT_FLAG2_ALLOW_CHEAT_SPELLS))
{
m_customError = SPELL_CUSTOM_ERROR_GM_ONLY;
return SPELL_FAILED_CUSTOM_ERROR;
@@ -5934,7 +5934,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_caster->GetTypeId() != TYPEID_PLAYER || !m_targets.GetUnitTarget() || m_targets.GetUnitTarget()->GetTypeId() != TYPEID_UNIT)
return SPELL_FAILED_BAD_TARGETS;
if (!(m_targets.GetUnitTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & UNIT_FLAG_SKINNABLE))
if (!(m_targets.GetUnitTarget()->GetUnitFlags() & UNIT_FLAG_SKINNABLE))
return SPELL_FAILED_TARGET_UNSKINNABLE;
Creature* creature = m_targets.GetUnitTarget()->ToCreature();
@@ -6532,7 +6532,7 @@ SpellCastResult Spell::CheckCasterAuras(bool preventionOnly) const
// Check whether the cast should be prevented by any state you might have.
SpellCastResult prevented_reason = SPELL_CAST_OK;
// Have to check if there is a stun aura. Otherwise will have problems with ghost aura apply while logging out
uint32 unitflag = m_caster->GetUInt32Value(UNIT_FIELD_FLAGS); // Get unit state
uint32 unitflag = m_caster->GetUnitFlags(); // Get unit state
// Xinef: if spell is triggered check preventionType only
if (!preventionOnly)
@@ -7584,7 +7584,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const
// xinef: skip los checking if spell has appropriate attribute, or target requires specific entry
// this is only for target addition and target has to have unselectable flag, this is valid for FLAG_EXTRA_TRIGGER and quest triggers however there are some without this flag, used not_selectable
if (m_spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) || (target->GetTypeId() == TYPEID_UNIT && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) && (m_spellInfo->Effects[eff].TargetA.GetCheckType() == TARGET_CHECK_ENTRY || m_spellInfo->Effects[eff].TargetB.GetCheckType() == TARGET_CHECK_ENTRY)))
if (m_spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_LINE_OF_SIGHT) || (target->GetTypeId() == TYPEID_UNIT && target->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE) && (m_spellInfo->Effects[eff].TargetA.GetCheckType() == TARGET_CHECK_ENTRY || m_spellInfo->Effects[eff].TargetB.GetCheckType() == TARGET_CHECK_ENTRY)))
return true;
// if spell is triggered, need to check for LOS disable on the aura triggering it and inherit that behaviour
@@ -7620,7 +7620,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const
{
if (!m_targets.GetCorpseTargetGUID())
{
if (target->IsWithinLOSInMap(m_caster, LINEOFSIGHT_ALL_CHECKS) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE))
if (target->IsWithinLOSInMap(m_caster, LINEOFSIGHT_ALL_CHECKS) && target->HasUnitFlag(UNIT_FLAG_SKINNABLE))
return true;
return false;
+3 -3
View File
@@ -2414,7 +2414,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
summon->SelectLevel(); // some summoned creaters have different from 1 DB data for level/hp
summon->SetUInt32Value(UNIT_NPC_FLAGS, summon->GetCreatureTemplate()->npcflag);
summon->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
summon->ReplaceAllUnitFlags(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
summon->SetReactState(REACT_PASSIVE);
// Xinef: Pet can have some auras in creature_addon or in scripts, do not remove them instantly
@@ -4894,7 +4894,7 @@ void Spell::EffectSkinning(SpellEffIndex /*effIndex*/)
uint32 skill = creature->GetCreatureTemplate()->GetRequiredLootSkill();
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
creature->RemoveUnitFlag(UNIT_FLAG_SKINNABLE);
creature->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
m_caster->ToPlayer()->SendLoot(creature->GetGUID(), LOOT_SKINNING);
@@ -5246,7 +5246,7 @@ void Spell::EffectResurrectPet(SpellEffIndex /*effIndex*/)
pet->NearTeleportTo(x, y, z, player->GetOrientation());
pet->Relocate(x, y, z, player->GetOrientation()); // This is needed so SaveStayPosition() will get the proper coords.
pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE);
pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
pet->RemoveUnitFlag(UNIT_FLAG_SKINNABLE);
pet->setDeathState(ALIVE);
pet->ClearUnitState(uint32(UNIT_STATE_ALL_STATE & ~(UNIT_STATE_POSSESSED))); // xinef: just in case
pet->SetHealth(pet->CountPctFromMaxHealth(damage));
+1 -1
View File
@@ -1835,7 +1835,7 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
return SPELL_FAILED_BAD_TARGETS;
// checked in Unit::IsValidAttack/AssistTarget, shouldn't be checked for ENTRY targets
//if (!(AttributesEx6 & SPELL_ATTR6_CAN_TARGET_UNTARGETABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))
//if (!(AttributesEx6 & SPELL_ATTR6_CAN_TARGET_UNTARGETABLE) && target->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
// return SPELL_FAILED_BAD_TARGETS;
//if (!(AttributesEx6 & SPELL_ATTR6_NO_AURA_LOG)