mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 10:30:27 +00:00
feat(Core/Unit): New helpers for UnitFlag and UnitFlag2 (#11227)
This commit is contained in:
@@ -630,7 +630,7 @@ void SmartAI::EnterEvadeMode()
|
||||
return;
|
||||
}
|
||||
|
||||
if (me->GetCharmerGUID().IsPlayer() || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED))
|
||||
if (me->GetCharmerGUID().IsPlayer() || me->HasUnitFlag(UNIT_FLAG_POSSESSED))
|
||||
{
|
||||
me->AttackStop();
|
||||
return;
|
||||
@@ -802,7 +802,7 @@ void SmartAI::SummonedCreatureDies(Creature* summon, Unit* /*killer*/)
|
||||
void SmartAI::AttackStart(Unit* who)
|
||||
{
|
||||
// xinef: dont allow charmed npcs to act on their own
|
||||
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED))
|
||||
if (me->HasUnitFlag(UNIT_FLAG_POSSESSED))
|
||||
{
|
||||
if (who && mCanAutoAttack)
|
||||
me->Attack(who, true);
|
||||
|
||||
@@ -719,7 +719,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(e.action.cast.spell);
|
||||
int32 currentPower = me->GetPower(GetCasterPowerType());
|
||||
|
||||
if ((spellInfo && (currentPower < spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask()) || me->IsSpellProhibited(spellInfo->GetSchoolMask()))) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
|
||||
if ((spellInfo && (currentPower < spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask()) || me->IsSpellProhibited(spellInfo->GetSchoolMask()))) || me->HasUnitFlag(UNIT_FLAG_SILENCED))
|
||||
{
|
||||
SetCasterActualDist(0);
|
||||
CAST_AI(SmartAI, me->AI())->SetForcedCombatMove(0);
|
||||
@@ -863,13 +863,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
{
|
||||
if (!e.action.unitFlag.type)
|
||||
{
|
||||
(*itr)->ToUnit()->SetFlag(UNIT_FIELD_FLAGS, e.action.unitFlag.flag);
|
||||
(*itr)->ToUnit()->SetUnitFlag(UnitFlags(e.action.unitFlag.flag));
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit {} added flag {} to UNIT_FIELD_FLAGS",
|
||||
(*itr)->GetGUID().ToString(), e.action.unitFlag.flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*itr)->ToUnit()->SetFlag(UNIT_FIELD_FLAGS_2, e.action.unitFlag.flag);
|
||||
(*itr)->ToUnit()->SetUnitFlag2(UnitFlags2(e.action.unitFlag.flag));
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit {} added flag {} to UNIT_FIELD_FLAGS_2",
|
||||
(*itr)->GetGUID().ToString(), e.action.unitFlag.flag);
|
||||
}
|
||||
@@ -891,13 +891,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
{
|
||||
if (!e.action.unitFlag.type)
|
||||
{
|
||||
(*itr)->ToUnit()->RemoveFlag(UNIT_FIELD_FLAGS, e.action.unitFlag.flag);
|
||||
(*itr)->ToUnit()->RemoveUnitFlag(UnitFlags(e.action.unitFlag.flag));
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit {} removed flag {} to UNIT_FIELD_FLAGS",
|
||||
(*itr)->GetGUID().ToString(), e.action.unitFlag.flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*itr)->ToUnit()->RemoveFlag(UNIT_FIELD_FLAGS_2, e.action.unitFlag.flag);
|
||||
(*itr)->ToUnit()->RemoveUnitFlag2(UnitFlags2(e.action.unitFlag.flag));
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit {} removed flag {} to UNIT_FIELD_FLAGS_2",
|
||||
(*itr)->GetGUID().ToString(), e.action.unitFlag.flag);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user