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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
243 changed files with 1205 additions and 1191 deletions

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!

View file

@ -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

View file

@ -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 = {}",

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);

View file

@ -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);
}

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);
}
}

View file

@ -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))
{

View file

@ -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);
}
}

View file

@ -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)
{

View file

@ -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

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)

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 */)

View file

@ -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);

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;

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())

View file

@ -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);

View file

@ -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)

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;

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);

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();

View file

@ -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;

View file

@ -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();

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;

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);
}
}

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))

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

View file

@ -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());

View file

@ -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());

View file

@ -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*)

View file

@ -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);

View file

@ -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());

View file

@ -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();

View file

@ -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;
}

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;

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));

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)

View file

@ -265,7 +265,7 @@ public:
if (!factionID)
{
uint32 factionid = target->GetFaction();
uint32 flag = target->GetUInt32Value(UNIT_FIELD_FLAGS);
uint32 flag = target->GetUnitFlags();
uint32 npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS);
uint32 dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS);
handler->PSendSysMessage(LANG_CURRENT_FACTION, target->GetGUID().GetCounter(), factionid, flag, npcflag, dyflag);
@ -273,15 +273,15 @@ public:
}
uint32 factionid = factionID.value();
uint32 flag;
UnitFlags flag;
uint32 npcflag;
uint32 dyflag;
auto pflag = flagID;
if (!pflag)
flag = target->GetUInt32Value(UNIT_FIELD_FLAGS);
flag = target->GetUnitFlags();
else
flag = *pflag;
flag = UnitFlags(*pflag);
auto pnpcflag = npcFlagID;
if (!pnpcflag)
@ -305,7 +305,7 @@ public:
handler->PSendSysMessage(LANG_YOU_CHANGE_FACTION, target->GetGUID().GetCounter(), factionid, flag, npcflag, dyflag);
target->SetFaction(factionid);
target->SetUInt32Value(UNIT_FIELD_FLAGS, flag);
target->ReplaceAllUnitFlags(flag);
target->SetUInt32Value(UNIT_NPC_FLAGS, npcflag);
target->SetUInt32Value(UNIT_DYNAMIC_FLAGS, dyflag);

View file

@ -614,7 +614,7 @@ public:
handler->PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel());
handler->PSendSysMessage(LANG_NPCINFO_EQUIPMENT, target->GetCurrentEquipmentId(), target->GetOriginalEquipmentId());
handler->PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth());
handler->PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS), target->GetUInt32Value(UNIT_FIELD_FLAGS_2), target->GetUInt32Value(UNIT_DYNAMIC_FLAGS), target->GetFaction());
handler->PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUnitFlags(), target->GetUnitFlags2(), target->GetUInt32Value(UNIT_DYNAMIC_FLAGS), target->GetFaction());
handler->PSendSysMessage(LANG_COMMAND_RAWPAWNTIMES, defRespawnDelayStr.c_str(), curRespawnDelayStr.c_str());
handler->PSendSysMessage(LANG_NPCINFO_LOOT, cInfo->lootid, cInfo->pickpocketLootId, cInfo->SkinLootId);
handler->PSendSysMessage(LANG_NPCINFO_DUNGEON_ID, target->GetInstanceId());

View file

@ -116,7 +116,7 @@ public:
player->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP);
player->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
player->ReplaceAllUnitFlags(UNIT_FLAG_PLAYER_CONTROLLED);
//-1 is default value
player->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1));

View file

@ -219,7 +219,7 @@ public:
void Reset() override
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
}
void JustSummoned(Creature* summon) override

View file

@ -176,12 +176,10 @@ public:
void Reset() override
{
Voidwalkers = false;
// Reset his gossip menu
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_NPC_FLAG_GOSSIP);
me->SetFaction(FACTION_FRIENDLY);
// was set before event start, so set again
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
if (instance->GetData(TYPE_TOMB_OF_SEVEN) == DONE) // what is this trying to do? Probably some kind of crash recovery
{

View file

@ -752,7 +752,7 @@ public:
{
++TombEventCounter;
boss->SetFaction(FACTION_DARK_IRON_DWARVES);
boss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
boss->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
// find suitable target here.
Player* target = boss->SelectNearestPlayer(130);
@ -786,7 +786,7 @@ public:
boss->SetLootRecipient(nullptr);
}
boss->SetFaction(FACTION_FRIENDLY);
boss->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); // think this is useless
boss->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); // think this is useless
if (i == 6) // doomrel needs explicit reset
{
boss->AI()->Reset();

View file

@ -63,7 +63,7 @@ public:
BossAI::Reset();
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
frenzy40 = false;
frenzy15 = false;
@ -95,7 +95,7 @@ public:
void StartTalking(uint32 talkGroupId, uint32 timer)
{
me->SetReactState(REACT_PASSIVE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->AttackStop();
Talk(talkGroupId);
@ -109,7 +109,7 @@ public:
events.SetPhase(EVENT_PHASE_FIGHT);
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
DoZoneInCombat();
}

View file

@ -79,7 +79,7 @@ public:
void Reset() override
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
events.Reset();
// Apply auras on spawn and reset
// DoCast(me, SPELL_FIRE_SHIELD_TRIGGER); // Need to find this in old DBC if possible
@ -157,7 +157,7 @@ public:
me->CastSpell(me, SPELL_EMBERSEER_FULL_STRENGTH);
Talk(EMOTE_FREE_OF_BONDS);
Talk(YELL_FREE_OF_BONDS);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
events.ScheduleEvent(EVENT_ENTER_COMBAT, 2000);
}
}
@ -338,7 +338,7 @@ public:
void Reset() override
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
if (Creature* Emberseer = me->FindNearestCreature(NPC_PYROGAURD_EMBERSEER, 30.0f, true))
Emberseer->AI()->SetData(1, 3);
@ -364,7 +364,7 @@ public:
{
if (data == 1 && value == 1)
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->InterruptSpell(CURRENT_CHANNELED_SPELL);
DoZoneInCombat();
_events.CancelEvent(EVENT_ENCAGED_EMBERSEER);

View file

@ -114,11 +114,11 @@ public:
if (instance->GetBossState(DATA_GYTH) == IN_PROGRESS)
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_PREPARATION);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_PREPARATION);
return;
}
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_PREPARATION);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_PREPARATION);
gythEvent = false;
victorGUID.Clear();
waveDoorGUID.Clear();

View file

@ -255,7 +255,7 @@ public:
me->SetFaction(FACTION_FRIENDLY);
me->SetStandState(UNIT_STAND_STATE_SIT_HIGH_CHAIR);
me->RemoveAura(SPELL_NEFARIANS_BARRIER);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
}
}
@ -467,7 +467,7 @@ public:
me->SetFaction(FACTION_DRAGONFLIGHT_BLACK);
me->SetUInt32Value(UNIT_NPC_FLAGS, 0);
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
// Due to Nefarius despawning himself on Vael, we need to update the guid on instance to prevent unwanted behaviours as encounter not resetting at all.
instance->SetGuidData(DATA_LORD_VICTOR_NEFARIUS, me->GetGUID());
}
@ -501,7 +501,7 @@ struct boss_nefarian : public BossAI
{
Initialize();
me->SetReactState(REACT_PASSIVE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetCanFly(true);
me->SetDisableGravity(true);
if (_introDone) // already in combat, reset properly.
@ -569,7 +569,7 @@ struct boss_nefarian : public BossAI
me->SetDisableGravity(false);
Position land = me->GetPosition();
me->GetMotionMaster()->MoveLand(0, land, 8.5f);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->GetMotionMaster()->MoveIdle();
me->SetReactState(REACT_AGGRESSIVE);
@ -703,7 +703,7 @@ struct boss_nefarian : public BossAI
{
(*itr)->Respawn();
DoZoneInCombat((*itr));
(*itr)->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
(*itr)->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
(*itr)->SetReactState(REACT_AGGRESSIVE);
(*itr)->SetStandState(UNIT_STAND_STATE_STAND);
}

View file

@ -92,7 +92,7 @@ public:
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
me->SetFaction(FACTION_FRIENDLY);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
}
void Reset() override
@ -160,7 +160,7 @@ public:
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SummonCreature(NPC_VICTOR_NEFARIUS, aNefariusSpawnLoc[0], aNefariusSpawnLoc[1], aNefariusSpawnLoc[2], aNefariusSpawnLoc[3], TEMPSUMMON_TIMED_DESPAWN, 26000);
_eventsIntro.ScheduleEvent(EVENT_SPEECH_2, 1000);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
break;
case EVENT_SPEECH_2:
if (Creature* nefarius = me->GetMap()->GetCreature(m_nefariusGuid))
@ -190,7 +190,7 @@ public:
Talk(SAY_LINE3);
me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
_eventsIntro.ScheduleEvent(EVENT_SPEECH_7, 17000);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
break;
case EVENT_SPEECH_7:
me->SetFaction(FACTION_DRAGONFLIGHT_BLACK);
@ -265,7 +265,7 @@ public:
if (summoned->GetEntry() == NPC_VICTOR_NEFARIUS)
{
// Set not selectable, so players won't interact with it
summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
summoned->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
m_nefariusGuid = summoned->GetGUID();
}
}

View file

@ -396,7 +396,7 @@ public:
if (Creature* summon = unit->ToCreature())
{
summon->UpdateEntry(NPC_BONE_CONSTRUCT);
summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
summon->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
summon->SetReactState(REACT_PASSIVE);
summon->SetStandState(UNIT_STAND_STATE_DEAD);

View file

@ -151,7 +151,7 @@ public:
{
summon->CastSpell(summon, SPELL_RAGNAROS_FADE);
summon->CastSpell(summon, SPELL_RAGNAROS_SUBMERGE_EFFECT, true);
summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
summon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
summon->SetReactState(REACT_PASSIVE);
}
}
@ -180,7 +180,7 @@ public:
else
{
events.SetPhase(PHASE_NONE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC);
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
me->SetFaction(FACTION_MAJORDOMO_FRIENDLY);
}
@ -282,7 +282,7 @@ public:
instance->SetBossState(DATA_MAJORDOMO_EXECUTUS, DONE);
events.CancelEventGroup(PHASE_COMBAT);
me->GetMap()->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, me->GetEntry(), me);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC);
me->SetFaction(FACTION_MAJORDOMO_FRIENDLY);
EnterEvadeMode();
Talk(SAY_DEFEAT);

View file

@ -137,7 +137,7 @@ public:
extraEvents.Reset();
extraEvents.SetPhase(PHASE_EMERGED);
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_NOT_SELECTABLE);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE);
}
@ -276,7 +276,7 @@ public:
_isIntroDone = true;
extraEvents.SetPhase(PHASE_EMERGED);
me->RemoveAurasDueToSpell(SPELL_RAGNAROS_SUBMERGE_EFFECT);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
me->SetReactState(REACT_AGGRESSIVE);
DoZoneInCombat();
break;
@ -409,7 +409,7 @@ public:
me->InterruptNonMeleeSpells(false);
me->AttackStop();
DoResetThreat();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_SUBMERGED);
DoCastSelf(SPELL_RAGNA_SUBMERGE_VISUAL, true);
//me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE);
@ -460,7 +460,7 @@ public:
extraEvents.SetPhase(PHASE_EMERGED);
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE);

View file

@ -133,8 +133,8 @@ public:
creatureTarget->CastSpell(creatureTarget, SPELL_PLAY_DEAD_PACIFY, true);
creatureTarget->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
creatureTarget->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH);
//creatureTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
creatureTarget->SetUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
//creatureTarget->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
creatureTarget->SetReactState(REACT_PASSIVE);
creatureTarget->SetControlled(true, UNIT_STATE_ROOT);
@ -151,8 +151,8 @@ public:
creatureTarget->RemoveAurasDueToSpell(SPELL_PLAY_DEAD_PACIFY);
creatureTarget->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
creatureTarget->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH);
//creatureTarget->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
creatureTarget->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
//creatureTarget->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
creatureTarget->SetControlled(false, UNIT_STATE_ROOT);
creatureTarget->SetReactState(REACT_AGGRESSIVE);

View file

@ -67,7 +67,7 @@ public:
me->LoadEquipment(EQUIP_SWORD);
me->SetCanDualWield(false);
me->SetStandState(UNIT_STAND_STATE_STAND);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED);
me->RemoveUnitFlag(UNIT_FLAG_PACIFIED);
me->SetReactState(REACT_AGGRESSIVE);
}
@ -94,7 +94,7 @@ public:
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MovePoint(EQUIP_TWO_SWORDS, 1.859f, -780.72f, 9.831f);
Talk(SAY_SWAP1);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED);
me->SetUnitFlag(UNIT_FLAG_PACIFIED);
me->SetReactState(REACT_PASSIVE);
health67 = true;
break;
@ -109,7 +109,7 @@ public:
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MovePoint(EQUIP_MACE, 1.859f, -780.72f, 9.831f);
Talk(SAY_SWAP2);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED);
me->SetUnitFlag(UNIT_FLAG_PACIFIED);
me->SetReactState(REACT_PASSIVE);
health34 = true;
break;
@ -135,7 +135,7 @@ public:
break;
case EVENT_RESTORE_COMBAT:
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED);
me->RemoveUnitFlag(UNIT_FLAG_PACIFIED);
me->SetStandState(UNIT_STAND_STATE_STAND);
if (me->GetVictim())
{

View file

@ -144,7 +144,7 @@ public:
if (spell->Id == SPELL_INFERNAL_RELAY)
{
me->SetDisplayId(me->GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID));
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
HellfireTimer = 4000;
CleanupTimer = 170000;
}
@ -477,7 +477,7 @@ public:
void Initialize()
{
AxesTargetSwitchTimer = 7500;
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetCanDualWield(true);
}

View file

@ -106,8 +106,8 @@ void SummonCroneIfReady(InstanceScript* instance, Creature* creature)
{
if (creature->GetVictim())
pCrone->AI()->AttackStart(creature->GetVictim());
pCrone->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
pCrone->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
pCrone->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
pCrone->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
}
}
}
@ -179,7 +179,7 @@ public:
void AttackStart(Unit* who) override
{
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::AttackStart(who);
@ -188,7 +188,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::MoveInLineOfSight(who);
@ -200,7 +200,7 @@ public:
{
if (AggroTimer <= diff)
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
AggroTimer = 0;
}
else
@ -342,7 +342,7 @@ public:
void AttackStart(Unit* who) override
{
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::AttackStart(who);
@ -351,7 +351,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::MoveInLineOfSight(who);
@ -399,7 +399,7 @@ public:
{
if (AggroTimer <= diff)
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
AggroTimer = 0;
}
else
@ -478,7 +478,7 @@ public:
void AttackStart(Unit* who) override
{
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::AttackStart(who);
@ -487,7 +487,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::MoveInLineOfSight(who);
@ -511,7 +511,7 @@ public:
{
if (AggroTimer <= diff)
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
AggroTimer = 0;
}
else
@ -582,7 +582,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::MoveInLineOfSight(who);
@ -590,7 +590,7 @@ public:
void AttackStart(Unit* who) override
{
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::AttackStart(who);
@ -625,7 +625,7 @@ public:
{
if (AggroTimer <= diff)
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
AggroTimer = 0;
}
else
@ -688,7 +688,7 @@ public:
void Reset() override
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
CycloneTimer = 22000;
ChainLightningTimer = 8000;
}
@ -1014,7 +1014,7 @@ void PretendToDie(Creature* creature)
creature->InterruptNonMeleeSpells(true);
creature->RemoveAllAuras();
creature->SetHealth(0);
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
creature->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
creature->GetMotionMaster()->MovementExpired(false);
creature->GetMotionMaster()->MoveIdle();
creature->SetStandState(UNIT_STAND_STATE_DEAD);
@ -1022,7 +1022,7 @@ void PretendToDie(Creature* creature)
void Resurrect(Creature* target)
{
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
target->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
target->SetFullHealth();
target->SetStandState(UNIT_STAND_STATE_STAND);
target->CastSpell(target, SPELL_RES_VISUAL, true);
@ -1107,7 +1107,7 @@ public:
void AttackStart(Unit* who) override
{
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::AttackStart(who);
@ -1116,7 +1116,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::MoveInLineOfSight(who);
@ -1239,7 +1239,7 @@ public:
{
if (Creature* Julianne = (ObjectAccessor::GetCreature((*me), JulianneGUID)))
{
Julianne->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Julianne->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
Julianne->GetMotionMaster()->Clear();
Julianne->setDeathState(JUST_DIED);
Julianne->CombatStop(true);
@ -1281,7 +1281,7 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::MoveInLineOfSight(who);
@ -1382,7 +1382,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(uint32 diff)
if (AggroYellTimer <= diff)
{
Talk(SAY_JULIANNE_AGGRO);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetFaction(FACTION_MONSTER_2);
AggroYellTimer = 0;
}
@ -1542,7 +1542,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32& dama
{
if (Creature* Romulo = (ObjectAccessor::GetCreature((*me), RomuloGUID)))
{
Romulo->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Romulo->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
Romulo->GetMotionMaster()->Clear();
Romulo->setDeathState(JUST_DIED);
Romulo->CombatStop(true);

View file

@ -189,7 +189,7 @@ public:
me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f,
TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000))
{
spotlight->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
spotlight->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
spotlight->CastSpell(spotlight, SPELL_SPOTLIGHT, false);
m_uiSpotlightGUID = spotlight->GetGUID();
}
@ -265,11 +265,7 @@ public:
float PosX = Spawns[index][1];
if (Creature* creature = me->SummonCreature(entry, PosX, SPAWN_Y, SPAWN_Z, SPAWN_O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR * 2 * IN_MILLISECONDS))
{
// In case database has bad flags
creature->SetUInt32Value(UNIT_FIELD_FLAGS, 0);
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
creature->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
}
RaidWiped = false;

View file

@ -106,7 +106,7 @@ public:
summons.DespawnAll();
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, false);
instance->SetData(DATA_KAELTHAS_EVENT, NOT_STARTED);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
}
void JustSummoned(Creature* summon) override
@ -120,7 +120,7 @@ public:
void InitializeAI() override
{
ScriptedAI::InitializeAI();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
}
void JustDied(Unit*) override
@ -162,7 +162,7 @@ public:
if (me->isRegeneratingHealth())
{
me->SetRegeneratingHealth(false);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->CombatStop();
me->SetReactState(REACT_PASSIVE);
LapseAction(ACTION_REMOVE_FLY);
@ -200,7 +200,7 @@ public:
switch (events2.ExecuteEvent())
{
case EVENT_INIT_COMBAT:
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
if (Unit* target = SelectTargetFromPlayerList(50.0f))
AttackStart(target);
return;

View file

@ -167,7 +167,7 @@ public:
if (Unit* crystal = ObjectAccessor::GetUnit(*me, CrystalGUID))
{
Talk(EMOTE_CRYSTAL);
crystal->SetUInt32Value(UNIT_FIELD_FLAGS, 0);
crystal->ReplaceAllUnitFlags(UNIT_FLAG_NONE);
crystal->CastSpell(me, SPELL_MANA_RAGE, true);
me->CastSpell(crystal, SPELL_FEL_CRYSTAL_COSMETIC, true);
events.SetPhase(1);

View file

@ -102,7 +102,7 @@ public:
case EVENT_REMOVE_CONTROL:
if (Player* player = me->GetCharmerOrOwnerPlayerOrPlayerItself())
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
me->SetUnitFlag(UNIT_FLAG_STUNNED);
SetControl(player, false);
}
break;
@ -131,7 +131,7 @@ public:
case EVENT_REGAIN_CONTROL:
if (Player* player = me->GetCharmerOrOwnerPlayerOrPlayerItself())
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
me->RemoveUnitFlag(UNIT_FLAG_STUNNED);
me->SetSpeed(MOVE_FLIGHT, 3.3f, true);
SetControl(player, true);
@ -206,8 +206,8 @@ public:
if (creature->AI()->GetData(DATA_IN_PROGRESS))
return true;
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SWIMMING);
creature->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
creature->RemoveUnitFlag(UNIT_FLAG_SWIMMING);
player->CastSpell(creature, SPELL_DUEL, false);
player->CastSpell(player, SPELL_DUEL_FLAG, true);
@ -263,7 +263,7 @@ public:
me->RestoreFaction();
CombatAI::Reset();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SWIMMING);
me->SetUnitFlag(UNIT_FLAG_SWIMMING);
}
void SpellHit(Unit* caster, SpellInfo const* pSpell) override
@ -474,7 +474,7 @@ public:
void InitializeAI() override
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
me->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE);
ScriptedAI::InitializeAI();
me->SetReactState(REACT_PASSIVE);
@ -519,7 +519,7 @@ public:
break;
case EVENT_GHOUL_RESTORE_STATE:
me->SetReactState(REACT_DEFENSIVE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
me->RemoveUnitFlag(UNIT_FLAG_DISABLE_MOVE);
if (Player* owner = me->GetCharmerOrOwnerPlayerOrPlayerItself())
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, frand(0.0f, 2 * M_PI));
events.ScheduleEvent(EVENT_GHOUL_CHECK_COMBAT, 1000);
@ -571,7 +571,7 @@ public:
{
ScriptedAI::MoveInLineOfSight(who);
if (!who->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC) && who->GetEntry() == NPC_GHOUL && me->IsWithinDistInMap(who, 10.0f))
if (!who->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC) && who->GetEntry() == NPC_GHOUL && me->IsWithinDistInMap(who, 10.0f))
if (Unit* owner = who->GetOwner())
if (Player* player = owner->ToPlayer())
{
@ -580,7 +580,7 @@ public:
creature->CastSpell(owner, 52517, true);
creature->AI()->SetGUID(me->GetGUID());
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
creature->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
}
}
@ -730,7 +730,7 @@ public:
phase = PHASE_CHAINED;
events.Reset();
me->SetFaction(FACTION_CREATURE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetUInt32Value(UNIT_FIELD_BYTES_1, 8);
me->LoadEquipment(0, true);
}
@ -831,7 +831,7 @@ public:
else
{
me->SetFaction(FACTION_MONSTER);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
phase = PHASE_ATTACKING;
if (Player* target = ObjectAccessor::GetPlayer(*me, playerGUID))
@ -951,7 +951,7 @@ public:
{
npc_scarlet_miner_cartAI(Creature* creature) : PassiveAI(creature)
{
me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->ReplaceAllUnitFlags(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetFaction(FACTION_FRIENDLY);
me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); // Modelid2 is a horse.
}
@ -974,7 +974,7 @@ public:
me->SetSpeed(MOVE_RUN, 1.25f);
me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0);
me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->ReplaceAllUnitFlags(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetFaction(FACTION_FRIENDLY);
}
}
@ -1084,7 +1084,7 @@ public:
{
me->SetFacingToObject(car);
// xinef: add some flags
car->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
car->ReplaceAllUnitFlags(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
car->SetFaction(FACTION_FRIENDLY);
}
Talk(SAY_SCARLET_MINER_0);

View file

@ -233,7 +233,7 @@ public:
m_uiWave = 0;
m_uiWave_Timer = 3000;
m_uiValrothGUID.Clear();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->LoadEquipment(0, true);
me->RemoveAllAuras();
summons.DespawnAll();
@ -255,7 +255,7 @@ public:
else
{
me->GetMotionMaster()->MoveTargetedHome();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
Reset();
}
}
@ -274,7 +274,7 @@ public:
{
case 0:
Talk(SAY_BREAKOUT1);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
break;
case 1:
me->SetStandState(UNIT_STAND_STATE_KNEEL);
@ -313,7 +313,7 @@ public:
m_uiValrothGUID = summoned->GetGUID();
summoned->AddThreat(me, 0.0f);
summoned->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
summoned->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
summons.Summon(summoned);
}
@ -666,7 +666,7 @@ public:
ExecuteSpeech_Counter = 0;
PlayerGUID.Clear();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
}
bool MeetQuestCondition(Player* player)
@ -780,7 +780,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_6, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);
@ -826,7 +826,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_8, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);
@ -872,7 +872,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_3, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);
@ -918,7 +918,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_7, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);
@ -964,7 +964,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_4, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);
@ -1010,7 +1010,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_9, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);
@ -1056,7 +1056,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_5, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);
@ -1102,7 +1102,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_10, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);
@ -1146,7 +1146,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_1, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);
@ -1192,7 +1192,7 @@ public:
case 9:
Talk(SAY_EXEC_TIME_2, player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
Talk(SAY_EXEC_WAITING, player);

View file

@ -465,7 +465,7 @@ public:
if (battleStarted == ENCOUNTER_STATE_OUTRO && cr->GetEntry() == NPC_DEFENDER_OF_THE_LIGHT)
{
cr->SetReactState(REACT_PASSIVE);
cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H);
cr->HandleEmoteCommand(EMOTE_STATE_READY1H);
}
@ -546,7 +546,7 @@ public:
events.Reset();
summons.DespawnAll();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER);
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetVisible(true);
@ -670,7 +670,7 @@ public:
break;
}
case EVENT_START_COUNTDOWN_14:
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SummonCreatureGroup(5);
return;
case EVENT_FINISH_FIGHT_1:
@ -698,13 +698,13 @@ public:
{
summon->CombatStop(true);
summon->DeleteThreatList();
summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
summon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
summon->SetReactState(REACT_PASSIVE);
summon->GetMotionMaster()->Clear(false);
}
me->CombatStop(true);
me->DeleteThreatList();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetReactState(REACT_PASSIVE);
me->GetMotionMaster()->Clear(false);
@ -769,7 +769,7 @@ public:
case EVENT_OUTRO_SCENE_6:
if (Creature* alex = me->SummonCreature(NPC_HIGHLORD_ALEXANDROS_MOGRAINE, LightOfDawnPos[7].GetPositionX(), LightOfDawnPos[7].GetPositionY(), LightOfDawnPos[7].GetPositionZ(), LightOfDawnPos[7].GetOrientation(), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000))
{
alex->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
alex->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
alex->GetMotionMaster()->MovePoint(0, LightOfDawnPos[8].GetPositionX(), LightOfDawnPos[8].GetPositionY(), LightOfDawnPos[8].GetPositionZ());
alex->CastSpell(alex, SPELL_ALEXANDROS_MOGRAINE_SPAWN, true);
//alex->AI()->Talk(EMOTE_LIGHT_OF_DAWN06);
@ -778,7 +778,7 @@ public:
case EVENT_OUTRO_SCENE_7:
if (Creature* alex = GetEntryFromSummons(NPC_HIGHLORD_ALEXANDROS_MOGRAINE))
{
alex->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
alex->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
alex->AI()->Talk(SAY_LIGHT_OF_DAWN32);
me->SetFacingToObject(alex);
}
@ -1027,7 +1027,7 @@ public:
{
tirion->CastSpell(tirion, SPELL_TIRION_CHARGE, true);
tirion->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
tirion->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
tirion->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
}
break;
case EVENT_OUTRO_SCENE_44:

View file

@ -56,7 +56,7 @@ public:
{
me->setActive(true);
me->SetVisible(false);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetCanFly(true);
FlyBackTimer = 500;
phase = 0;

View file

@ -360,8 +360,8 @@ public:
void Reset() override
{
//Incase wipe during phase that mograine fake death
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->RemoveAurasDueToSpell(SPELL_PERMANENT_FEIGN_DEATH);
SayAshbringer = false;
timer = 0;
@ -416,7 +416,7 @@ public:
me->ClearComboPointHolders();
me->RemoveAllAuras();
me->ClearAllReactives();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->CastSpell(me, SPELL_PERMANENT_FEIGN_DEATH, true);
hasDied = true;
@ -463,8 +463,8 @@ public:
if (Unit* Whitemane = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_WHITEMANE)))
{
//Incase wipe during phase that mograine fake death
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->RemoveAurasDueToSpell(SPELL_PERMANENT_FEIGN_DEATH);
me->CastSpell(me, SPELL_RETRIBUTION_AURA, true);
me->CastSpell(Whitemane, SPELL_LAY_ON_HANDS, true);

View file

@ -112,9 +112,9 @@ public:
events2.ScheduleEvent(INTRO_1, 1000);
me->SetDisableGravity(true);
me->SetReactState(REACT_PASSIVE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); // for some reason he aggroes if we don't have this.
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); // might not be needed, but guardians and stuff like that could mess up.
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC); // for some reason he aggroes if we don't have this.
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC); // might not be needed, but guardians and stuff like that could mess up.
}
void MovementInform(uint32 type, uint32 id) override
@ -153,9 +153,9 @@ public:
case INTRO_5:
me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_KIRTONOS_STAFF));
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
me->SetReactState(REACT_AGGRESSIVE);
break;
case INTRO_6:

View file

@ -139,7 +139,7 @@ public:
})
.Schedule(12s, [this](TaskContext context)
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
_phase = PHASE_COMBAT;
DoZoneInCombat();
@ -185,7 +185,7 @@ public:
}
});
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetFaction(FACTION_MONSTER);
summons.DoAction(ACTION_START_EVENT);
}
@ -203,7 +203,7 @@ public:
_isDead = true;
me->RemoveAurasDueToSpell(SPELL_ALLURING_PERFUME);
DoCastSelf(SPELL_PERMANENT_FEIGN_DEATH, true);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
Talk(SAY_HUMMEL_DEATH);
}
}
@ -231,7 +231,7 @@ public:
}
_scheduler.CancelAll();
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
instance->SetBossState(DATA_APOTHECARY_HUMMEL, DONE);
Map::PlayerList const& players = me->GetMap()->GetPlayers();
@ -293,13 +293,13 @@ struct npc_apothecary_genericAI : public ScriptedAI
{
if (action == ACTION_START_EVENT)
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetFaction(FACTION_MONSTER);
me->GetMotionMaster()->MovePoint(1, _movePos);
}
else if (action == ACTION_START_FIGHT)
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
DoZoneInCombat();
}
}

View file

@ -111,7 +111,7 @@ struct boss_jarien : public BossAI
});
me->SetReactState(REACT_PASSIVE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC);
_talked = false;
_phase = PHASE_TALK;
}
@ -145,7 +145,7 @@ struct boss_jarien : public BossAI
_talked = true;
_phase = PHASE_FIGHT;
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC);
});
}
@ -234,7 +234,7 @@ struct boss_sothos : public BossAI
});
me->SetReactState(REACT_PASSIVE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC);
_talked = false;
_phase = PHASE_TALK;
}
@ -261,7 +261,7 @@ struct boss_sothos : public BossAI
_talked = true;
_phase = PHASE_FIGHT;
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_NPC);
})
.Schedule(3s, [this](TaskContext /*context*/)
{

View file

@ -51,7 +51,7 @@ public:
break;
case NPC_SHADE_OF_ERANIKUS:
_shadeOfEranikusGUID = creature->GetGUID();
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
creature->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
break;
}
@ -66,7 +66,7 @@ public:
if (unit->GetEntry() == NPC_JAMMAL_AN_THE_PROPHET)
{
if (Creature* cr = instance->GetCreature(_shadeOfEranikusGUID))
cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
cr->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
}
}

View file

@ -371,7 +371,7 @@ public:
events.ScheduleEvent(EVENT_MAD_20, 7000);
break;
case EVENT_MAD_20:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetFaction(FACTION_FRIENDLY);
if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_BRUTALLUS)))
{

View file

@ -145,7 +145,7 @@ public:
if (param == ACTION_START_EVENT)
{
me->SetVisible(true);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
events2.ScheduleEvent(EVENT_INTRO_1, 3000);
}
}
@ -153,7 +153,7 @@ public:
void Reset() override
{
BossAI::Reset();
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetReactState(REACT_PASSIVE);
me->SetDisableGravity(false);
events2.Reset();
@ -163,7 +163,7 @@ public:
void EnterCombat(Unit* who) override
{
BossAI::EnterCombat(who);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
if (events.Empty() && events2.Empty())
events2.ScheduleEvent(EVENT_INTRO_2, 3000);
}
@ -262,7 +262,7 @@ public:
events.ScheduleEvent(EVENT_LAND, 3000, 1);
events.ScheduleEvent(EVENT_SPELL_BERSERK, 600000);
me->SetInCombatWithZone();
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->CastSpell(me, SPELL_NOXIOUS_FUMES, true);
me->GetMotionMaster()->MovePoint(POINT_MISC, 1472.18f, 603.38f, 34.0f, false, true);
break;

View file

@ -143,7 +143,7 @@ public:
me->SetStandState(UNIT_STAND_STATE_SLEEP);
me->SetDisableGravity(false);
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
events2.Reset();
sathBanished = false;
@ -240,7 +240,7 @@ public:
me->RemoveAllAuras();
me->SetReactState(REACT_PASSIVE);
me->CombatStop();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetFaction(FACTION_FRIENDLY);
events2.ScheduleEvent(EVENT_TALK_GOOD_2, 1000);
break;
@ -269,7 +269,7 @@ public:
me->SetReactState(REACT_PASSIVE);
me->CombatStop();
me->RemoveAllAuras();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
Talk(SAY_EVIL_ENRAGE);
events2.ScheduleEvent(EVENT_TALK_BAD_2, 3000);
break;

View file

@ -293,7 +293,7 @@ public:
void InitializeAI() override
{
ScriptedAI::InitializeAI();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
phase = PHASE_NORMAL;
events.Reset();
@ -331,7 +331,7 @@ public:
me->RemoveAllAuras();
me->DeleteThreatList();
me->SetRegeneratingHealth(false);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->HandleEmoteCommand(EMOTE_ONESHOT_DROWN);
me->resetAttackTimer();
events.Reset();
@ -421,7 +421,7 @@ public:
break;
case EVENT_INIT_FIGHT:
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetInCombatWithZone();
return;
case EVENT_TEXT_SPEACH11:
@ -478,7 +478,7 @@ public:
{
anveena->CastSpell(anveena, SPELL_SACRIFICE_OF_ANVEENA, true);
me->CastSpell(me, SPELL_CUSTOM_08_STATE, true);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED);
me->SetUnitFlag(UNIT_FLAG_PACIFIED);
events.DelayEvents(7001);
events2.ScheduleEvent(EVENT_RESTORE_MELEE, 7000);
}
@ -486,7 +486,7 @@ public:
break;
case EVENT_RESTORE_MELEE:
me->RemoveAurasDueToSpell(SPELL_CUSTOM_08_STATE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED);
me->RemoveUnitFlag(UNIT_FLAG_PACIFIED);
break;
}

View file

@ -82,7 +82,7 @@ public:
{
BossAI::Reset();
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetVisible(true);
}
@ -102,9 +102,9 @@ public:
if (damage >= me->GetHealth())
{
damage = 0;
if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))
if (!me->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->RemoveAllAuras();
me->CastSpell(me, SPELL_OPEN_ALL_PORTALS, true);
events.ScheduleEvent(EVENT_SUMMON_ENTROPIUS, 7000);

View file

@ -201,14 +201,14 @@ public:
{
Creature* target = GetUnitOwner()->ToCreature();
target->SetReactState(REACT_PASSIVE);
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
target->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Creature* target = GetUnitOwner()->ToCreature();
target->SetReactState(REACT_AGGRESSIVE);
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
target->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
}
void Register() override

View file

@ -189,7 +189,7 @@ public:
trigger->SetFaction(FACTION_FRIENDLY);
trigger->SetMaxHealth(100000);
trigger->SetHealth(100000);
trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
trigger->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
if (Cloud)
Cloud->CastCustomSpell(trigger, /*43661*/SPELL_ZAP, &bp0, nullptr, nullptr, true, 0, 0, Cloud->GetGUID());
}
@ -284,7 +284,7 @@ public:
Cloud->SetFaction(FACTION_FRIENDLY);
Cloud->SetMaxHealth(9999999);
Cloud->SetHealth(9999999);
Cloud->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Cloud->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
}
StormCount = 1;
events.ScheduleEvent(EVENT_ELECTRICAL_STORM, 60000); // 60 seconds(bosskillers)

View file

@ -176,7 +176,7 @@ public:
if (Unit* pLynx = ObjectAccessor::GetUnit(*me, LynxGUID))
{
Talk(SAY_MERGE);
pLynx->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
pLynx->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
pLynx->GetMotionMaster()->Clear();
pLynx->GetMotionMaster()->MoveFollow(me, 0, 0);
me->GetMotionMaster()->Clear();
@ -347,7 +347,7 @@ public:
void AttackStart(Unit* who) override
{
if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (!me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
ScriptedAI::AttackStart(who);
}

View file

@ -438,7 +438,7 @@ public:
else
{
trigger->SetDisplayId(11686);
trigger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
trigger->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
trigger->CastSpell(target, SPELL_SIPHON_SOUL, true);
trigger->GetMotionMaster()->MoveChase(me);

View file

@ -274,9 +274,9 @@ public:
{
if (Unit* FireBomb = ObjectAccessor::GetUnit(*me, FireBombGUIDs[BombCount]))
{
FireBomb->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
FireBomb->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
DoCast(FireBomb, SPELL_FIRE_BOMB_THROW, true);
FireBomb->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
FireBomb->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
}
++BombCount;
if (BombCount == 40)

View file

@ -117,8 +117,8 @@ public:
{
if (MoveEvent)
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
inMove = false;
waitTimer = 0;
me->SetSpeed(MOVE_RUN, 2);
@ -268,8 +268,8 @@ public:
Talk(SAY_WAVE4);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
MoveEvent = false;
}

View file

@ -269,8 +269,8 @@ public:
if (creature)
{
creature->CastSpell(creature, SPELL_SPIRIT_AURA, true);
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
creature->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
creature->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
SpiritGUID[i] = creature->GetGUID();
}
}
@ -336,7 +336,7 @@ public:
{
Vortex->CastSpell(Vortex, SPELL_CYCLONE_PASSIVE, true);
Vortex->CastSpell(Vortex, SPELL_CYCLONE_VISUAL, true);
Vortex->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Vortex->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
Vortex->SetSpeed(MOVE_RUN, 1.0f);
Vortex->AI()->AttackStart(SelectTarget(SelectTargetMethod::Random, 0));
DoZoneInCombat(Vortex);

View file

@ -194,7 +194,7 @@ public:
{
if (Unit* Hostage = i_pl->SummonCreature(HostageInfo[num].npc, HostageInfo[num].x, HostageInfo[num].y, HostageInfo[num].z, HostageInfo[num].o, TEMPSUMMON_DEAD_DESPAWN, 0))
{
Hostage->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
Hostage->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
Hostage->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
}

View file

@ -724,13 +724,13 @@ public:
if (ptarget->GetPositionX() > 120)
{
ptarget->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(WEAPON_SPEAR));
ptarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
ptarget->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
ptarget->SetReactState(REACT_PASSIVE);
ptarget->AI()->SetData(0, 1);
}
else
{
ptarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
ptarget->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
ptarget->SetReactState(REACT_PASSIVE);
ptarget->AI()->SetData(0, 2);
}

View file

@ -233,7 +233,7 @@ public:
me->AttackStop();
DoResetThreat();
me->SetReactState(REACT_PASSIVE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
DoCast(me, SPELL_VANISH_VISUAL);
DoCast(me, SPELL_VANISH);
events.ScheduleEvent(EVENT_VANISH, 1000, 0, PHASE_ONE);
@ -252,7 +252,7 @@ public:
break;
case EVENT_VISIBLE:
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
AttackStart(target);
me->RemoveAura(SPELL_SUPER_INVIS);

View file

@ -220,7 +220,7 @@ public:
void Reset() override
{
Bomb_Timer = 2000;
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->AddUnitState(UNIT_STATE_ROOT);
}

View file

@ -124,7 +124,7 @@ public:
killCount = 0;
me->RemoveAurasDueToSpell(SPELL_FRENZY);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
summons.DespawnAll();
instance->SetBossState(DATA_OHGAN, NOT_STARTED);
me->Mount(MODEL_OHGAN_MOUNT);
@ -214,7 +214,7 @@ public:
events.ScheduleEvent(EVENT_CHECK_START, 1000);
break;
case EVENT_STARTED:
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
break;
default:
break;

View file

@ -91,7 +91,7 @@ public:
SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
me->SetDisplayId(11686);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
Invisible = true;
Invisible_Timer = urand(15000, 30000);
@ -124,7 +124,7 @@ public:
me->SetDisplayId(15268);
SetEquipmentSlots(false, EQUIP_ID_MAIN_HAND, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
Invisible = false;
Visible_Timer = 4000;

View file

@ -146,7 +146,7 @@ public:
DoCast(me, SPELL_TIGER_FORM); // SPELL_AURA_TRANSFORM
me->SetObjectScale(2.00f);
me->SetStandState(UNIT_STAND_STATE_STAND);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
/*
const CreatureTemplate* cinfo = me->GetCreatureTemplate();
me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 40)));
@ -175,7 +175,7 @@ public:
{
pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pLorKhan->SetFaction(FACTION_MONSTER);
pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pLorKhan->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
pLorKhan->SetFullHealth();
instance->SetData(DATA_LORKHAN, DONE);
}
@ -188,7 +188,7 @@ public:
{
pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pZath->SetFaction(FACTION_MONSTER);
pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pZath->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
pZath->SetFullHealth();
instance->SetBossState(DATA_ZATH, DONE);
}
@ -237,7 +237,7 @@ public:
me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
me->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetStandState(UNIT_STAND_STATE_SLEEP);
me->AttackStop();
instance->SetBossState(DATA_THEKAL, SPECIAL);
@ -290,7 +290,7 @@ public:
instance->SetBossState(DATA_LORKHAN, NOT_STARTED);
me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
}
void EnterCombat(Unit* /*who*/) override
@ -360,7 +360,7 @@ public:
if (Unit* pThekal = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THEKAL)))
{
pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pThekal->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
pThekal->SetFaction(FACTION_MONSTER);
pThekal->SetFullHealth();
}
@ -372,7 +372,7 @@ public:
if (Unit* pZath = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_ZATH)))
{
pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pZath->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
pZath->SetFaction(FACTION_MONSTER);
pZath->SetFullHealth();
}
@ -387,7 +387,7 @@ public:
me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
me->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetStandState(UNIT_STAND_STATE_SLEEP);
me->SetFaction(FACTION_FRIENDLY);
me->AttackStop();
@ -448,7 +448,7 @@ public:
instance->SetBossState(DATA_ZATH, NOT_STARTED);
me->SetStandState(UNIT_STAND_STATE_STAND);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
}
void EnterCombat(Unit* /*who*/) override
@ -513,7 +513,7 @@ public:
if (Unit* pLorKhan = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LORKHAN)))
{
pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pLorKhan->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
pLorKhan->SetFaction(FACTION_MONSTER);
pLorKhan->SetFullHealth();
}
@ -525,7 +525,7 @@ public:
if (Unit* pThekal = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_THEKAL)))
{
pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pThekal->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
pThekal->SetFaction(FACTION_MONSTER);
pThekal->SetFullHealth();
}
@ -540,7 +540,7 @@ public:
me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
me->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetStandState(UNIT_STAND_STATE_SLEEP);
me->SetFaction(FACTION_FRIENDLY);
me->AttackStop();

View file

@ -175,7 +175,7 @@ public:
float z = 159.65f;
creature->SetWalk(true);
creature->GetMotionMaster()->MovePoint(0, x, y, z);
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
creature->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
}
}

View file

@ -77,7 +77,7 @@ public:
{
_IsByOutrunner = false;
spawnId = 0;
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE);
}
void Reset() override
@ -136,7 +136,7 @@ public:
void sQuestAccept(Player* player, Quest const* quest) override
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE);
if (quest->GetQuestId() == QUEST_RINJI_TRAPPED)
{
if (GameObject* go = me->FindNearestGameObject(GO_RINJI_CAGE, INTERACTION_DISTANCE))

View file

@ -372,7 +372,7 @@ public:
continue;
else
c->AI()->Talk(SAY_MORLEN_4);
c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
c->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
c->AI()->AttackStart(me);
}
break;

View file

@ -53,7 +53,7 @@ public:
phase = 0;
mockingBlowTimer = 5000;
shieldBashTimer = 8000;
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
}
void sQuestAccept(Player* player, Quest const* quest) override
@ -62,7 +62,7 @@ public:
{
Talk(SAY_CORPORAL_1, player);
npc_escortAI::Start(true, false, player->GetGUID(), quest);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE);
}
}

View file

@ -53,7 +53,7 @@ public:
if (quest->GetQuestId() == QUEST_590)
{
creature->SetFaction(FACTION_ENEMY);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
creature->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
CAST_AI(npc_calvin_montague::npc_calvin_montagueAI, creature->AI())->AttackStart(player);
}
return true;
@ -80,8 +80,8 @@ public:
me->RestoreFaction();
if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC))
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
if (!me->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_PC))
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
}
void EnterCombat(Unit* /*who*/) override { }
@ -104,7 +104,7 @@ public:
uiDamage = 0;
me->RestoreFaction();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->CombatStop(true);
m_uiPhase = 1;

View file

@ -1113,7 +1113,7 @@ public:
switch (summonedCreature->GetEntry())
{
case NPC_GENERATOR:
summonedCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
summonedCreature->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
summonedCreature->ApplySpellImmune(0, IMMUNITY_ID, SPELL_WRYNN_BUFF, true);
summonedCreature->ApplySpellImmune(0, IMMUNITY_ID, SPELL_THRALL_BUFF, true);
summonedCreature->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SYLVANAS_BUFF, true);
@ -1416,8 +1416,8 @@ public:
{
thrallGUID = temp->GetGUID();
temp->SetReactState(REACT_PASSIVE);
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
temp->CastSpell(temp, SPELL_THRALL_BUFF);
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
}
@ -1425,8 +1425,8 @@ public:
{
sylvanasGUID = temp->GetGUID();
temp->SetReactState(REACT_PASSIVE);
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
}
for (uint8 i = 0; i < HORDE_FORCE_MAXCOUNT; ++i)
@ -1435,8 +1435,8 @@ public:
{
hordeForcesGUID[i] = temp->GetGUID();
temp->SetReactState(REACT_PASSIVE);
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
}
}
@ -1447,8 +1447,8 @@ public:
if (Unit* temp = me->SummonCreature(NPC_SW_SOLDIER, AllianceSpawn[i + 25].x, AllianceSpawn[i + 25].y, AllianceSpawn[i + 25].z, AllianceSpawn[i + 25].o, TEMPSUMMON_MANUAL_DESPAWN))
{
allianceForcesGUID[i] = temp->GetGUID();
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
}
}
@ -1472,7 +1472,7 @@ public:
if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID))
{
jaina->GetMotionMaster()->Clear();
jaina->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
jaina->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
jaina->SetReactState(REACT_AGGRESSIVE);
}
SetHoldState(true);
@ -1816,8 +1816,8 @@ public:
case 53:
if (Creature* putress = ObjectAccessor::GetCreature(*me, putressGUID))
{
putress->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
putress->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
putress->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
putress->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
putress->AddThreat(me, 100.0f);
me->AddThreat(putress, 100.0f);
putress->RemoveAura(SPELL_PUTRESS_CASTING_STATE);
@ -1890,7 +1890,7 @@ public:
case 66:
if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID))
jaina->AI()->Talk(JAINA_SAY_THRONE_1);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
bStepping = false;
JumpToNextStep(0);
break;
@ -1903,8 +1903,8 @@ public:
if (Creature* jaina = ObjectAccessor::GetCreature(*me, jainaGUID))
{
jaina->GetMotionMaster()->MovePoint(0, AllianceWP[8].x, AllianceWP[8].y, AllianceWP[8].z);
jaina->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
jaina->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
jaina->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
jaina->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
}
SetEscortPaused(false);
bStepping = false;
@ -1929,12 +1929,12 @@ public:
break;
case 73:
Talk(WRYNN_SAY_THRONE_9);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
if (Creature* thrall = ObjectAccessor::GetCreature(*me, thrallGUID))
{
thrall->SetReactState(REACT_AGGRESSIVE);
thrall->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
thrall->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
thrall->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
thrall->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
thrall->AddThreat(me, 100.0f);
me->AddThreat(thrall, 100.0f);
thrall->AI()->AttackStart(me);
@ -1942,8 +1942,8 @@ public:
if (Creature* sylvanas = ObjectAccessor::GetCreature(*me, sylvanasGUID))
{
sylvanas->SetReactState(REACT_AGGRESSIVE);
sylvanas->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
sylvanas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
sylvanas->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
sylvanas->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
sylvanas->AddThreat(me, 100.0f);
sylvanas->AI()->AttackStart(me);
me->AddThreat(sylvanas, 100.0f);
@ -1953,8 +1953,8 @@ public:
if (Creature* temp = ObjectAccessor::GetCreature(*me, hordeForcesGUID[i]))
{
temp->SetReactState(REACT_AGGRESSIVE);
temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
temp->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
}
}
for (uint8 i = 0; i < ALLIANCE_FORCE_MAXCOUNT; ++i)
@ -1965,8 +1965,8 @@ public:
{
temp->SetReactState(REACT_AGGRESSIVE);
temp2->SetReactState(REACT_AGGRESSIVE);
temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
temp2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
temp->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
temp2->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
temp->AddThreat(temp2, 100.0f);
temp->AI()->AttackStart(temp2);
temp2->AddThreat(temp, 100.0f);
@ -2440,12 +2440,12 @@ public:
summoned->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
break;
case NPC_VARIMATHRAS_PORTAL:
summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
summoned->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
summoned->ApplySpellImmune(0, IMMUNITY_ID, SPELL_THRALL_BUFF, true);
summoned->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SYLVANAS_BUFF, true);
break;
case NPC_CAVE_DUMMY:
summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
summoned->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
summoned->ApplySpellImmune(0, IMMUNITY_ID, SPELL_THRALL_BUFF, true);
summoned->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SYLVANAS_BUFF, true);
summoned->AddAura(SPELL_CYCLONE_FALL, summoned);
@ -2560,7 +2560,7 @@ public:
if (Creature* sylvanas = ObjectAccessor::GetCreature(*me, sylvanasfollowGUID))
{
sylvanas->GetMotionMaster()->Clear();
sylvanas->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
sylvanas->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
sylvanas->SetReactState(REACT_AGGRESSIVE);
sylvanas->SetFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE);
sylvanas->GetMotionMaster()->MoveFollow(me, 1, M_PI * 0.1f);
@ -2602,7 +2602,7 @@ public:
if (Unit* temp = me->SummonCreature(NPC_VARIMATHRAS, ThrallSpawn[23].x, ThrallSpawn[23].y, ThrallSpawn[23].z, ThrallSpawn[23].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900 * IN_MILLISECONDS))
{
ValimathrasGUID = temp->GetGUID();
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
}
break;
case 3:
@ -2725,7 +2725,7 @@ public:
if (Unit* temp = me->SummonCreature(NPC_VARIMATHRAS, ThrallSpawn[63].x, ThrallSpawn[63].y, ThrallSpawn[63].z, ThrallSpawn[63].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 300 * IN_MILLISECONDS))
{
ValimathrasGUID = temp->GetGUID();
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
}
break;
case 13:
@ -2816,7 +2816,7 @@ public:
if (Creature* temp = me->SummonCreature(NPC_VARIMATHRAS, ThrallSpawn[73].x, ThrallSpawn[73].y, ThrallSpawn[73].z, ThrallSpawn[73].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 1200 * IN_MILLISECONDS))
{
ValimathrasGUID = temp->GetGUID();
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
temp->CastSpell(me, SPELL_AURA_OF_VARIMATHRAS);
temp->CastSpell(me, SPELL_OPENING_LEGION_PORTALS);
temp->AI()->Talk(SAY_CLOSE_DOOR);
@ -3667,7 +3667,7 @@ public:
case 137:
if (Creature* valimathras = ObjectAccessor::GetCreature(*me, ValimathrasGUID))
{
valimathras->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
valimathras->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
valimathras->RemoveAura(SPELL_AURA_OF_VARIMATHRAS);
valimathras->RemoveAura(SPELL_OPENING_LEGION_PORTALS);
valimathras->AI()->Talk(SAY_VALIMATHRAS_ATTACK);
@ -3736,8 +3736,8 @@ public:
if (Creature* temp = me->SummonCreature(NPC_SW_SOLDIER, AllianceSpawn[i + 25].x, AllianceSpawn[i + 25].y, AllianceSpawn[i + 25].z, AllianceSpawn[i + 25].o, TEMPSUMMON_MANUAL_DESPAWN))
{
allianceForcesGUID[i] = temp->GetGUID();
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
temp->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SYLVANAS_BUFF, true);
temp->SetReactState(REACT_PASSIVE);
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
@ -3746,8 +3746,8 @@ public:
if (Creature* wrynn = me->SummonCreature(NPC_WRYNN, 1308.862f, 381.809f, -66.044243f, TEMPSUMMON_MANUAL_DESPAWN))
{
WrynnGUID = wrynn->GetGUID();
wrynn->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
wrynn->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
wrynn->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
wrynn->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
wrynn->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
wrynn->SetReactState(REACT_PASSIVE);
wrynn->GetMotionMaster()->MovePoint(0, 1302.543f, 359.472f, -67.295f, true);
@ -3755,8 +3755,8 @@ public:
if (Creature* jaina = me->SummonCreature(NPC_JAINA, 1308.862f, 381.809f, -66.044243f, TEMPSUMMON_MANUAL_DESPAWN))
{
JainaGUID = jaina->GetGUID();
jaina->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
jaina->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
jaina->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
jaina->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
jaina->SetReactState(REACT_PASSIVE);
}
JumpToNextStep(6 * IN_MILLISECONDS);
@ -3784,11 +3784,11 @@ public:
break;
// Wrynn Fight
case 152:
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
if (Creature* wrynn = ObjectAccessor::GetCreature(*me, WrynnGUID))
{
wrynn->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
wrynn->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
wrynn->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC);
wrynn->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
wrynn->SetReactState(REACT_AGGRESSIVE);
wrynn->AddThreat(me, 100.0f);
me->AddThreat(wrynn, 100.0f);
@ -3799,7 +3799,7 @@ public:
{
if (Creature* temp = ObjectAccessor::GetCreature(*me, allianceForcesGUID[i]))
{
temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
temp->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
temp->SetReactState(REACT_AGGRESSIVE);
temp->AddThreat(me, 100.0f);
temp->AI()->AttackStart(me);

View file

@ -1557,7 +1557,7 @@ struct npc_coren_direbrew : public ScriptedAI
{
_events.Reset();
_summons.DespawnAll();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetFaction(FACTION_FRIENDLY);
_events.SetPhase(PHASE_ALL);
@ -1596,7 +1596,7 @@ struct npc_coren_direbrew : public ScriptedAI
if (action == ACTION_START_FIGHT)
{
_events.SetPhase(PHASE_ONE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON);
DoZoneInCombat();
@ -1830,7 +1830,7 @@ struct npc_direbrew_antagonist : public ScriptedAI
Talk(SAY_ANTAGONIST_2);
break;
case ACTION_ANTAGONIST_HOSTILE:
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC);
me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON);
DoZoneInCombat();
break;

View file

@ -654,7 +654,7 @@ struct npc_hallows_end_soh : public ScriptedAI
events.ScheduleEvent(3, 63000);
me->SetReactState(REACT_PASSIVE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetCanFly(true);
me->SetDisableGravity(true);
@ -733,7 +733,7 @@ struct npc_hallows_end_soh : public ScriptedAI
}
case 4:
{
me->SetUInt32Value(UNIT_FIELD_FLAGS, 0);
me->ReplaceAllUnitFlags(UNIT_FLAG_NONE);
me->SetReactState(REACT_AGGRESSIVE);
if (Unit* target = me->SelectNearestPlayer(30.0f))
AttackStart(target);
@ -1038,7 +1038,7 @@ struct boss_headless_horseman : public ScriptedAI
me->CastSpell(me, SPELL_HEAD_VISUAL, true);
else if (point == 11)
{
me->SetUInt32Value(UNIT_FIELD_FLAGS, 0);
me->ReplaceAllUnitFlags(UNIT_FLAG_NONE);
me->StopMoving();
me->SetInCombatWithZone();
@ -1255,7 +1255,7 @@ struct boss_headless_horseman_head : public ScriptedAI
if (Player* player = me->SelectNearestPlayer(50.0f))
me->GetMotionMaster()->MoveFleeing(player);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
timer = 26000;
break;
}

View file

@ -124,7 +124,7 @@ public:
ArchimondeGUID = instance->GetGuidData(DATA_ARCHIMONDE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
}
void EnterCombat(Unit* /*who*/) override { }
@ -464,8 +464,8 @@ public:
else
{
summoned->SetFaction(me->GetFaction());
summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
summoned->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
summoned->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
}
if (summoned->GetEntry() == CREATURE_DOOMFIRE_SPIRIT)
@ -576,7 +576,7 @@ public:
if (Unit* Nordrassil = ObjectAccessor::GetUnit(*me, WorldTreeGUID))
{
Nordrassil->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Nordrassil->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
Nordrassil->SetDisplayId(11686);
DoCast(Nordrassil, SPELL_DRAIN_WORLD_TREE);
IsChanneling = true;

View file

@ -989,7 +989,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
{
(*itr)->CastSpell(*itr, SPELL_TELEPORT_VISUAL, true);
(*itr)->SetFaction(FACTION_FRIENDLY); // make them friendly so mobs won't attack them
(*itr)->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
(*itr)->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
}
}
DoCast(me, SPELL_TELEPORT_VISUAL);

View file

@ -416,8 +416,8 @@ public:
meteor = false;//call once!
CanMove = false;
Delay = rand() % 30000;
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetDisplayId(MODEL_INVIS);
go = false;
Reset();
@ -482,8 +482,8 @@ public:
{
if (spawnTimer <= diff)
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetDisplayId(me->GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID));
CanMove = true;
if (instance->GetData(DATA_ALLIANCE_RETREAT) && !instance->GetData(DATA_HORDE_RETREAT))

View file

@ -112,8 +112,8 @@ public:
damage = 0;
finished = true;
me->SetRegeneratingHealth(false);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetReactState(REACT_PASSIVE);
if (InstanceScript* pInstance = me->GetInstanceScript())
{

View file

@ -479,8 +479,8 @@ public:
{
summons.Despawn(cr);
summons.Summon(cr);
cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
cr->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
}
Talk(SAY_PHASE501);
SetEscortPaused(false);
@ -979,7 +979,7 @@ public:
if (Creature* cr = GetEventNpc(NPC_CITY_MAN))
{
cr->UpdateEntry(NPC_INFINITE_HUNTER, nullptr, false);
cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetReactState(REACT_PASSIVE);
}
ScheduleNextEvent(currentEvent, 2000);
@ -988,7 +988,7 @@ public:
if (Creature* cr = GetEventNpc(NPC_CITY_MAN4))
{
cr->UpdateEntry(NPC_INFINITE_AGENT, nullptr, false);
cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetReactState(REACT_PASSIVE);
}
ScheduleNextEvent(currentEvent, 2000);
@ -1003,14 +1003,14 @@ public:
}
if (Creature* cr = GetEventNpc(NPC_INFINITE_AGENT)) // it is infinite agent now :)
{
cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetReactState(REACT_AGGRESSIVE);
cr->SetInCombatWithZone();
cr->AddThreat(me, 0.0f);
}
if (Creature* cr = GetEventNpc(NPC_INFINITE_HUNTER)) // it is infinite hunter now :)
{
cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetReactState(REACT_AGGRESSIVE);
cr->SetInCombatWithZone();
cr->AddThreat(me, 0.0f);
@ -1083,8 +1083,8 @@ public:
me->SummonCreature(NPC_TIME_RIFT, EventPos[EVENT_SRC_EPOCH], TEMPSUMMON_TIMED_DESPAWN, 20000);
if (Creature* cr = me->SummonCreature(NPC_EPOCH, EventPos[EVENT_SRC_EPOCH]))
{
cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
cr->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetTarget(cr->GetGUID());
cr->GetMotionMaster()->MovePoint(0, EventPos[EVENT_DST_EPOCH]);
}
@ -1104,8 +1104,8 @@ public:
case EVENT_ACTION_PHASE3+18:
if (Creature* cr = GetEventNpc(NPC_EPOCH))
{
cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
cr->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
cr->SetReactState(REACT_AGGRESSIVE);
cr->AddThreat(me, 0.0f);
cr->SetInCombatWithZone();
@ -1129,8 +1129,8 @@ public:
case EVENT_ACTION_PHASE5:
if (Creature* cr = GetEventNpc(NPC_MAL_GANIS))
{
cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
cr->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
cr->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
cr->SetInCombatWithZone();
cr->AddThreat(me, 0.0f);
AttackStart(cr);

View file

@ -82,7 +82,7 @@ public:
summons.Summon(summon);
if (Creature* thrall = ObjectAccessor::GetCreature(*me, me->GetInstanceScript()->GetGuidData(DATA_THRALL_GUID)))
thrall->AI()->JustSummoned(summon);
summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
summon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
if (summon->GetEntry() == NPC_SKARLOC_MOUNT)
return;
@ -103,7 +103,7 @@ public:
path.push_back(G3D::Vector3(startPath[i].GetPositionX(), startPath[i].GetPositionY(), startPath[i].GetPositionZ()));
me->GetMotionMaster()->MoveSplinePath(&path);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->Mount(SKARLOC_MOUNT_MODEL);
}
@ -168,13 +168,13 @@ public:
Talk(SAY_ENTER);
break;
case EVENT_START_FIGHT:
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetInCombatWithZone();
for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr))
if (summon->GetEntry() != NPC_SKARLOC_MOUNT)
{
summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
summon->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
summon->SetInCombatWithZone();
}
break;

View file

@ -620,7 +620,7 @@ public:
case EVENT_SUMMON_CHRONO:
if (Creature* epoch = me->SummonCreature(NPC_EPOCH_HUNTER, 2640.49f, 696.15f, 64.31f, 4.51f, TEMPSUMMON_MANUAL_DESPAWN))
{
epoch->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
epoch->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
epoch->AI()->Talk(SAY_EPOCH_ENTER1);
}
break;
@ -703,7 +703,7 @@ public:
case EVENT_CALL_EPOCH:
if (Creature* epoch = summons.GetCreatureWithEntry(NPC_EPOCH_HUNTER))
{
epoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
epoch->RemoveUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
epoch->GetMotionMaster()->MovePoint(0, *me, false, true);
}
break;
@ -759,7 +759,7 @@ public:
Talk(SAY_EVENT_COMPLETE);
break;
case EVENT_THRALL_RUN_AWAY:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetReactState(REACT_PASSIVE);
SetEscortPaused(false);
break;

Some files were not shown because too many files have changed in this diff Show more