Core/Creatures: Implemented UNIT_FLAG_PASSIVE

This commit is contained in:
Shauren
2011-03-06 12:22:04 +01:00
parent 222df58340
commit 4b4d3e7450
5 changed files with 19 additions and 20 deletions
@@ -1425,6 +1425,9 @@ bool Creature::canStartAttack(Unit const* who, bool force) const
if (isCivilian()) if (isCivilian())
return false; return false;
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE))
return false;
if (!canFly() && (GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE + m_CombatDistance)) if (!canFly() && (GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE + m_CombatDistance))
//|| who->IsControlledByPlayer() && who->IsFlying())) //|| who->IsControlledByPlayer() && who->IsFlying()))
// we cannot check flying for other creatures, too much map/vmap calculation // we cannot check flying for other creatures, too much map/vmap calculation
@@ -1923,6 +1926,9 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /
if (isCivilian()) if (isCivilian())
return false; return false;
if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PASSIVE))
return false;
// skip fighting creature // skip fighting creature
if (isInCombat()) if (isInCombat())
return false; return false;
+2 -1
View File
@@ -2994,10 +2994,11 @@ void Player::InitStatsForLevel(bool reapplyMods)
// cleanup unit flags (will be re-applied if need at aura load). // cleanup unit flags (will be re-applied if need at aura load).
RemoveFlag(UNIT_FIELD_FLAGS, RemoveFlag(UNIT_FIELD_FLAGS,
UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_ATTACKABLE_1 |
UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE | UNIT_FLAG_LOOTING |
UNIT_FLAG_PET_IN_COMBAT | UNIT_FLAG_SILENCED | UNIT_FLAG_PACIFIED | UNIT_FLAG_PET_IN_COMBAT | UNIT_FLAG_SILENCED | UNIT_FLAG_PACIFIED |
UNIT_FLAG_STUNNED | UNIT_FLAG_IN_COMBAT | UNIT_FLAG_DISARMED | UNIT_FLAG_STUNNED | UNIT_FLAG_IN_COMBAT | UNIT_FLAG_DISARMED |
UNIT_FLAG_CONFUSED | UNIT_FLAG_FLEEING | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_CONFUSED | UNIT_FLAG_FLEEING | UNIT_FLAG_NOT_SELECTABLE |
UNIT_FLAG_SKINNABLE | UNIT_FLAG_MOUNT | UNIT_FLAG_TAXI_FLIGHT); UNIT_FLAG_SKINNABLE | UNIT_FLAG_MOUNT | UNIT_FLAG_TAXI_FLIGHT );
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); // must be set SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); // must be set
SetFlag(UNIT_FIELD_FLAGS_2,UNIT_FLAG2_REGENERATE_POWER);// must be set SetFlag(UNIT_FIELD_FLAGS_2,UNIT_FLAG2_REGENERATE_POWER);// must be set
+1 -1
View File
@@ -556,7 +556,7 @@ enum UnitFlags
UNIT_FLAG_UNK_6 = 0x00000040, UNIT_FLAG_UNK_6 = 0x00000040,
UNIT_FLAG_NOT_ATTACKABLE_1 = 0x00000080, // ?? (UNIT_FLAG_PVP_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1) is NON_PVP_ATTACKABLE UNIT_FLAG_NOT_ATTACKABLE_1 = 0x00000080, // ?? (UNIT_FLAG_PVP_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1) is NON_PVP_ATTACKABLE
UNIT_FLAG_OOC_NOT_ATTACKABLE = 0x00000100, // 2.0.8 - (OOC Out Of Combat) Can not be attacked when not in combat. Removed if unit for some reason enter combat. UNIT_FLAG_OOC_NOT_ATTACKABLE = 0x00000100, // 2.0.8 - (OOC Out Of Combat) Can not be attacked when not in combat. Removed if unit for some reason enter combat.
UNIT_FLAG_UNK_9 = 0x00000200, // 3.0.3 - makes you unable to attack everything UNIT_FLAG_PASSIVE = 0x00000200, // makes you unable to attack everything. Almost identical to our "civilian"-term. Will ignore it's surroundings and not engage in combat unless "called upon" or engaged by another unit.
UNIT_FLAG_LOOTING = 0x00000400, // loot animation UNIT_FLAG_LOOTING = 0x00000400, // loot animation
UNIT_FLAG_PET_IN_COMBAT = 0x00000800, // in combat?, 2.0.8 UNIT_FLAG_PET_IN_COMBAT = 0x00000800, // in combat?, 2.0.8
UNIT_FLAG_PVP = 0x00001000, // changed in 3.0.3 UNIT_FLAG_PVP = 0x00001000, // changed in 3.0.3
@@ -413,7 +413,7 @@ public:
if (Creature* pTemp = me->SummonCreature((uint32)RiftAndSpawnsLocations[i][0],RiftAndSpawnsLocations[timeRiftID][1],RiftAndSpawnsLocations[timeRiftID][2],RiftAndSpawnsLocations[timeRiftID][3],RiftAndSpawnsLocations[timeRiftID][4],TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) if (Creature* pTemp = me->SummonCreature((uint32)RiftAndSpawnsLocations[i][0],RiftAndSpawnsLocations[timeRiftID][1],RiftAndSpawnsLocations[timeRiftID][2],RiftAndSpawnsLocations[timeRiftID][3],RiftAndSpawnsLocations[timeRiftID][4],TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000))
{ {
guidVector[i-timeRiftID-1] = pTemp->GetGUID(); guidVector[i-timeRiftID-1] = pTemp->GetGUID();
pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE);
pTemp->SetReactState(REACT_PASSIVE); pTemp->SetReactState(REACT_PASSIVE);
pTemp->GetMotionMaster()->MovePoint(0, RiftAndSpawnsLocations[i][1],RiftAndSpawnsLocations[i][2],RiftAndSpawnsLocations[i][3]); pTemp->GetMotionMaster()->MovePoint(0, RiftAndSpawnsLocations[i][1],RiftAndSpawnsLocations[i][2],RiftAndSpawnsLocations[i][3]);
if ((uint32)RiftAndSpawnsLocations[i][0] == NPC_EPOCH) if ((uint32)RiftAndSpawnsLocations[i][0] == NPC_EPOCH)
@@ -998,7 +998,7 @@ public:
{ {
pDisguised2->UpdateEntry(NPC_INFINITE_HUNTER, 0); pDisguised2->UpdateEntry(NPC_INFINITE_HUNTER, 0);
//Make them unattackable //Make them unattackable
pDisguised2->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); pDisguised2->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE);
pDisguised2->SetReactState(REACT_PASSIVE); pDisguised2->SetReactState(REACT_PASSIVE);
} }
JumpToNextStep(2000); JumpToNextStep(2000);
@@ -1008,7 +1008,7 @@ public:
{ {
pDisguised1->UpdateEntry(NPC_INFINITE_AGENT, 0); pDisguised1->UpdateEntry(NPC_INFINITE_AGENT, 0);
//Make them unattackable //Make them unattackable
pDisguised1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); pDisguised1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE);
pDisguised1->SetReactState(REACT_PASSIVE); pDisguised1->SetReactState(REACT_PASSIVE);
} }
JumpToNextStep(2000); JumpToNextStep(2000);
@@ -1018,7 +1018,7 @@ public:
{ {
pDisguised0->UpdateEntry(NPC_INFINITE_ADVERSARY, 0); pDisguised0->UpdateEntry(NPC_INFINITE_ADVERSARY, 0);
//Make them unattackable //Make them unattackable
pDisguised0->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); pDisguised0->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE);
pDisguised0->SetReactState(REACT_PASSIVE); pDisguised0->SetReactState(REACT_PASSIVE);
} }
JumpToNextStep(2000); JumpToNextStep(2000);
@@ -1032,7 +1032,7 @@ public:
for (uint32 i = 0; i< ENCOUNTER_DRACONIAN_NUMBER; ++i) for (uint32 i = 0; i< ENCOUNTER_DRACONIAN_NUMBER; ++i)
if (Creature* pTemp = Unit::GetCreature(*me, uiInfiniteDraconianGUID[i])) if (Creature* pTemp = Unit::GetCreature(*me, uiInfiniteDraconianGUID[i]))
{ {
pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE);
pTemp->SetReactState(REACT_AGGRESSIVE); pTemp->SetReactState(REACT_AGGRESSIVE);
} }
JumpToNextStep(5000); JumpToNextStep(5000);
@@ -1090,7 +1090,7 @@ public:
if (Creature* pEpoch = Unit::GetCreature(*me, uiEpochGUID)) if (Creature* pEpoch = Unit::GetCreature(*me, uiEpochGUID))
{ {
//Make Epoch attackable //Make Epoch attackable
pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE);
pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
pEpoch->SetReactState(REACT_AGGRESSIVE); pEpoch->SetReactState(REACT_AGGRESSIVE);
} }
@@ -1145,7 +1145,7 @@ public:
case 87: case 87:
if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID))
{ {
pMalganis->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_6 | UNIT_FLAG_UNK_9 | UNIT_FLAG_UNK_15); pMalganis->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_6 | UNIT_FLAG_PASSIVE | UNIT_FLAG_UNK_15);
pMalganis->SetReactState(REACT_AGGRESSIVE); pMalganis->SetReactState(REACT_AGGRESSIVE);
} }
JumpToNextStep(1000); JumpToNextStep(1000);
@@ -81,14 +81,6 @@ public:
coreEnergizeOrientation = 0.0f; coreEnergizeOrientation = 0.0f;
} }
void AttackStart(Unit* attacker)
{
if (me->HasFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_UNK_9))
return;
BossAI::AttackStart(attacker);
}
void EnterCombat(Unit* /*who*/) void EnterCombat(Unit* /*who*/)
{ {
_EnterCombat(); _EnterCombat();
@@ -259,10 +251,10 @@ class spell_varos_centrifuge_shield : public SpellScriptLoader
// flags taken from sniffs // flags taken from sniffs
// UNIT_FLAG_UNK_9 -> means passive but it is not yet implemented in core // UNIT_FLAG_UNK_9 -> means passive but it is not yet implemented in core
if (GetCaster()->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_UNK_9|UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_UNK_6)) if (GetCaster()->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_PASSIVE|UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_UNK_6))
{ {
GetCaster()->ToCreature()->SetReactState(REACT_PASSIVE); GetCaster()->ToCreature()->SetReactState(REACT_PASSIVE);
GetCaster()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_UNK_9|UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_UNK_6); GetCaster()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_PASSIVE|UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_UNK_6);
} }
} }
@@ -272,7 +264,7 @@ class spell_varos_centrifuge_shield : public SpellScriptLoader
return; return;
GetCaster()->ToCreature()->SetReactState(REACT_AGGRESSIVE); GetCaster()->ToCreature()->SetReactState(REACT_AGGRESSIVE);
GetCaster()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_UNK_9|UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_UNK_6); GetCaster()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_PASSIVE|UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_UNK_6);
} }
void Register() void Register()