diff options
author | Shauren <shauren.trinity@gmail.com> | 2011-07-15 12:33:03 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2011-07-15 12:33:03 +0200 |
commit | 1e3c23a4e8de3ea1ee99d159f0ca34c9cc055ed3 (patch) | |
tree | e979780ed1c3adb4e6bed316ccf0cba4fdb3b9b9 /src | |
parent | 944fb4c1b77ca2a021c135100219fdc2bc62f0a8 (diff) |
Core/Spells: Set UNIT_FIELD_TARGET to current spell cast target for proper facing the target
Diffstat (limited to 'src')
27 files changed, 125 insertions, 96 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 73f09dcf43e..6b53576cb19 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1489,7 +1489,7 @@ void Creature::setDeathState(DeathState s) if (sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY) || isWorldBoss()) SaveRespawnTime(); - SetUInt64Value(UNIT_FIELD_TARGET, 0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState) + SetTarget(0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState) SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); setActive(false); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 6baccfd5a4f..0f43e94efbb 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -235,6 +235,9 @@ m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), m_HostileRefManager(this) m_duringRemoveFromWorld = false; m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE); + + _focusSpell = NULL; + _targetLocked = false; } //////////////////////////////////////////////////////////// @@ -9579,7 +9582,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack) m_attacking->_addAttacker(this); // Set our target - SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID()); + SetTarget(victim->GetGUID()); if (meleeAttack) AddUnitState(UNIT_STAT_MELEE_ATTACKING); @@ -9621,7 +9624,7 @@ bool Unit::AttackStop() m_attacking = NULL; // Clear our target - SetUInt64Value(UNIT_FIELD_TARGET, 0); + SetTarget(0); ClearUnitState(UNIT_STAT_MELEE_ATTACKING); @@ -14334,7 +14337,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag, // no more charges to use, prevent proc if (useCharges && !i->aura->GetCharges()) continue; - + bool takeCharges = false; SpellEntry const* spellInfo = i->aura->GetSpellProto(); uint32 Id = i->aura->GetId(); @@ -15729,7 +15732,7 @@ void Unit::SetStunned(bool apply) { if (apply) { - SetUInt64Value(UNIT_FIELD_TARGET, 0); + SetTarget(0); SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); // MOVEMENTFLAG_ROOT cannot be used in conjunction with @@ -15755,7 +15758,7 @@ void Unit::SetStunned(bool apply) else { if (isAlive() && getVictim()) - SetUInt64Value(UNIT_FIELD_TARGET, getVictim()->GetGUID()); + SetTarget(getVictim()->GetGUID()); // don't remove UNIT_FLAG_STUNNED for pet when owner is mounted (disabled pet's interface) Unit* pOwner = GetOwner(); @@ -15830,7 +15833,7 @@ void Unit::SetFeared(bool apply) { if (apply) { - SetUInt64Value(UNIT_FIELD_TARGET, 0); + SetTarget(0); Unit* caster = NULL; Unit::AuraEffectList const& fearAuras = GetAuraEffectsByType(SPELL_AURA_MOD_FEAR); @@ -15847,7 +15850,7 @@ void Unit::SetFeared(bool apply) if (GetMotionMaster()->GetCurrentMovementGeneratorType() == FLEEING_MOTION_TYPE) GetMotionMaster()->MovementExpired(); if (getVictim()) - SetUInt64Value(UNIT_FIELD_TARGET, getVictim()->GetGUID()); + SetTarget(getVictim()->GetGUID()); } } @@ -15859,7 +15862,7 @@ void Unit::SetConfused(bool apply) { if (apply) { - SetUInt64Value(UNIT_FIELD_TARGET, 0); + SetTarget(0); GetMotionMaster()->MoveConfused(); } else @@ -15869,7 +15872,7 @@ void Unit::SetConfused(bool apply) if (GetMotionMaster()->GetCurrentMovementGeneratorType() == CONFUSED_MOTION_TYPE) GetMotionMaster()->MovementExpired(); if (getVictim()) - SetUInt64Value(UNIT_FIELD_TARGET, getVictim()->GetGUID()); + SetTarget(getVictim()->GetGUID()); } } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 6f5ca9c3aa3..9ccf0859245 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -2128,6 +2128,37 @@ class Unit : public WorldObject TempSummon* ToTempSummon() { if (isSummon()) return reinterpret_cast<TempSummon*>(this); else return NULL; } const TempSummon* ToTempSummon() const { if (isSummon()) return reinterpret_cast<const TempSummon*>(this); else return NULL; } + void SetTarget(uint64 guid) + { + if (!_targetLocked) + SetUInt64Value(UNIT_FIELD_TARGET, guid); + } + + void FocusTarget(Spell const* focusSpell, uint64 target) + { + // already focused + if (_focusSpell) + return; + + _focusSpell = focusSpell; + _targetLocked = true; + SetUInt64Value(UNIT_FIELD_TARGET, target); + } + + void ReleaseFocus(Spell const* focusSpell) + { + // focused to something else + if (focusSpell != _focusSpell) + return; + + _focusSpell = NULL; + _targetLocked = false; + if (Unit* victim = getVictim()) + SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID()); + else + SetUInt64Value(UNIT_FIELD_TARGET, 0); + } + protected: explicit Unit (); @@ -2244,6 +2275,9 @@ class Unit : public WorldObject bool m_cleanupDone; // lock made to not add stuff after cleanup before delete bool m_duringRemoveFromWorld; // lock made to not add stuff after begining removing from world + + Spell const* _focusSpell; + bool _targetLocked; // locks the target during spell cast for proper facing }; namespace Trinity diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp index 59c624519e2..4e8b4b13ffa 100755 --- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp @@ -85,7 +85,7 @@ ConfusedMovementGenerator<T>::Initialize(T &unit) } } - unit.SetUInt64Value(UNIT_FIELD_TARGET, 0); + unit.SetTarget(0); unit.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED); unit.CastStop(); unit.StopMoving(); @@ -170,7 +170,7 @@ ConfusedMovementGenerator<T>::Finalize(T &unit) unit.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED); unit.ClearUnitState(UNIT_STAT_CONFUSED); if (unit.GetTypeId() == TYPEID_UNIT && unit.getVictim()) - unit.SetUInt64Value(UNIT_FIELD_TARGET, unit.getVictim()->GetGUID()); + unit.SetTarget(unit.getVictim()->GetGUID()); } template void ConfusedMovementGenerator<Player>::Initialize(Player &player); diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp index 74ee5b74a4f..2721235aa23 100755 --- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp @@ -304,7 +304,7 @@ FleeingMovementGenerator<T>::Initialize(T &owner) owner.CastStop(); owner.AddUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING); owner.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING); - owner.SetUInt64Value(UNIT_FIELD_TARGET, 0); + owner.SetTarget(0); owner.RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); if (Unit* fright = ObjectAccessor::GetUnit(owner, i_frightGUID)) @@ -353,7 +353,7 @@ FleeingMovementGenerator<T>::Finalize(T &owner) owner.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING); owner.ClearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING); if (owner.GetTypeId() == TYPEID_UNIT && owner.getVictim()) - owner.SetUInt64Value(UNIT_FIELD_TARGET, owner.getVictim()->GetGUID()); + owner.SetTarget(owner.getVictim()->GetGUID()); } template<class T> diff --git a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp index 885165244b3..e6368a94471 100755 --- a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp @@ -489,22 +489,6 @@ void WorldSession::HandleZoneUpdateOpcode(WorldPacket & recv_data) //GetPlayer()->SendInitWorldStates(true, newZone); } -void WorldSession::HandleSetTargetOpcode(WorldPacket & recv_data) -{ - uint64 guid; - recv_data >> guid; - - _player->SetUInt32Value(UNIT_FIELD_TARGET, uint32(guid)); - - // update reputation list if need - Unit* unit = ObjectAccessor::GetUnit(*_player, guid); - if (!unit) - return; - - if (FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->getFaction())) - _player->GetReputationMgr().SetVisible(factionTemplateEntry); -} - void WorldSession::HandleSetSelectionOpcode(WorldPacket & recv_data) { uint64 guid; diff --git a/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp b/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp index 6f766057cce..b080a0fee48 100755 --- a/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp @@ -326,7 +326,7 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recv_data) sLog->outDetail("WORLD: CMSG_NPC_TEXT_QUERY ID '%u'", textID); recv_data >> guid; - GetPlayer()->SetUInt64Value(UNIT_FIELD_TARGET, guid); + GetPlayer()->SetSelection(guid); GossipText const* pGossip = sObjectMgr->GetGossipText(textID); diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index f45ee79847c..ef1b87d37da 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -467,7 +467,6 @@ class WorldSession void HandleTogglePvP(WorldPacket& recvPacket); void HandleZoneUpdateOpcode(WorldPacket& recvPacket); - void HandleSetTargetOpcode(WorldPacket& recvPacket); void HandleSetSelectionOpcode(WorldPacket& recvPacket); void HandleStandStateChangeOpcode(WorldPacket& recvPacket); void HandleEmoteOpcode(WorldPacket& recvPacket); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 1759f8bae08..97dfc8bd188 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -528,7 +528,7 @@ m_caster(Caster), m_spellValue(new SpellValue(m_spellInfo)) // Determine if spell can be reflected back to the caster // Patch 1.2 notes: Spell Reflection no longer reflects abilities - m_canReflect = m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !(m_spellInfo->Attributes & SPELL_ATTR0_ABILITY) + m_canReflect = m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !(m_spellInfo->Attributes & SPELL_ATTR0_ABILITY) && !(m_spellInfo->AttributesEx & SPELL_ATTR1_CANT_BE_REFLECTED) && !(m_spellInfo->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY) && !IsPassiveSpell(m_spellInfo) && !IsPositiveSpell(m_spellInfo->Id); @@ -2944,6 +2944,12 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered m_caster->SetCurrentCastedSpell(this); SendSpellStart(); + // set target for proper facing + if (m_casttime && !m_IsTriggeredSpell) + if (uint64 target = m_targets.GetUnitTargetGUID()) + if (m_caster->GetGUID() != target && m_caster->GetTypeId() == TYPEID_UNIT) + m_caster->FocusTarget(this, target); + TriggerGlobalCooldown(); //item: first cast may destroy item and second cast causes crash @@ -3578,6 +3584,9 @@ void Spell::finish(bool ok) ((Puppet*)charm)->UnSummon(); } + if (m_caster->GetTypeId() == TYPEID_UNIT) + m_caster->ReleaseFocus(this); + if (!ok) return; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index 4fc4d56d912..5483b5f6a3f 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -183,7 +183,7 @@ public: if (pAttumen->getVictim()) { pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim()); - pAttumen->SetUInt64Value(UNIT_FIELD_TARGET, pAttumen->getVictim()->GetGUID()); + pAttumen->SetTarget(pAttumen->getVictim()->GetGUID()); } pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X, 1); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index f9f26bcd2c4..0d4e2edb813 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -397,7 +397,7 @@ public: return; if (me->GetUInt64Value(UNIT_FIELD_TARGET) != me->getVictim()->GetGUID()) - me->SetUInt64Value(UNIT_FIELD_TARGET, me->getVictim()->GetGUID()); + me->SetTarget(me->getVictim()->GetGUID()); if (phase == 1) { diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index 5a881a9151e..9f758edbba7 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -535,7 +535,7 @@ public: me->ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->ClearAllReactives(); - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->SetTarget(0); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); me->SetStandState(UNIT_STAND_STATE_DEAD); diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index bfef149dbe6..14d8d23de4e 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -590,7 +590,7 @@ public: me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); me->SetSpeed(MOVE_RUN, 0.4f); me->GetMotionMaster()->MoveChase(who); - me->SetUInt64Value(UNIT_FIELD_TARGET, TargetGUID); + me->SetTarget(TargetGUID); Intro = true; } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp index e6cd684de6c..a948ffa53cd 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp @@ -80,7 +80,7 @@ public: player->GetClosePoint(x, y, z, me->GetObjectSize()); z += 2.5; x -= 2; y -= 1.5; me->GetMotionMaster()->MovePoint(0, x, y, z); - me->SetUInt64Value(UNIT_FIELD_TARGET, player->GetGUID()); + me->SetTarget(player->GetGUID()); me->SetVisible(true); FlyBackTimer = 4500; break; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index 013de745585..b1d627c565f 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -571,7 +571,7 @@ public: { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoCast(me, SPELL_TRAIL_TRIGGER, true); - me->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + me->SetTarget(me->GetGUID()); me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 0.01f); // core bug } void Reset() {} diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp index c37b0205603..f557354192a 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp @@ -204,7 +204,7 @@ public: uiOutroTimer = 8000; break; case 2: - me->SetUInt64Value(UNIT_FIELD_TARGET, pInstance ? pInstance->GetData64(DATA_ARTHAS) : 0); + me->SetTarget(pInstance ? pInstance->GetData64(DATA_ARTHAS) : 0); me->HandleEmoteCommand(29); DoScriptText(SAY_ESCAPE_SPEECH_2, me); ++uiOutroStep; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index a5fbc964e11..2159d4bafd5 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -488,9 +488,9 @@ public: if (Unit* pDisguised2 = me->SummonCreature(NPC_CITY_MAN, 2400.82f, 1201.69f, 134.01f, 1.534082f, TEMPSUMMON_DEAD_DESPAWN, 180000)) { uiInfiniteDraconianGUID[2] = pDisguised2->GetGUID(); - pDisguised0->SetUInt64Value(UNIT_FIELD_TARGET, uiInfiniteDraconianGUID[1]); - pDisguised1->SetUInt64Value(UNIT_FIELD_TARGET, uiInfiniteDraconianGUID[0]); - pDisguised2->SetUInt64Value(UNIT_FIELD_TARGET, uiInfiniteDraconianGUID[1]); + pDisguised0->SetTarget(uiInfiniteDraconianGUID[1]); + pDisguised1->SetTarget(uiInfiniteDraconianGUID[0]); + pDisguised2->SetTarget(uiInfiniteDraconianGUID[1]); } } } @@ -594,8 +594,8 @@ public: uiUtherGUID = pUther->GetGUID(); pUther->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); pUther->GetMotionMaster()->MovePoint(0, 1897.018f, 1287.487f, 143.481f); - pUther->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiUtherGUID); + pUther->SetTarget(me->GetGUID()); + me->SetTarget(uiUtherGUID); } JumpToNextStep(17000); break; @@ -620,7 +620,7 @@ public: //After waypoint 1 case 5: if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) - pJaina->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + pJaina->SetTarget(me->GetGUID()); DoScriptText(SAY_PHASE104, me); JumpToNextStep(10000); break; @@ -685,7 +685,7 @@ public: case 18: if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) { - me->SetUInt64Value(UNIT_FIELD_TARGET, uiJainaGUID); + me->SetTarget(uiJainaGUID); pJaina->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); pJaina->GetMotionMaster()->MovePoint(0, 1794.357f, 1272.183f, 140.558f); } @@ -703,13 +703,13 @@ public: case 21: SetEscortPaused(false); bStepping = false; - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->SetTarget(0); JumpToNextStep(0); break; //After waypoint 3 case 22: DoScriptText(SAY_PHASE118, me); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiJainaGUID); + me->SetTarget(uiJainaGUID); JumpToNextStep(10000); break; case 23: @@ -723,7 +723,7 @@ public: if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) pUther->DisappearAndDie(); - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->SetTarget(0); JumpToNextStep(0); break; //After Gossip 1 (waypoint 8) @@ -731,7 +731,7 @@ public: if (Unit* pStalker = me->SummonCreature(NPC_INVIS_TARGET, 2026.469f, 1287.088f, 143.596f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 14000)) { uiStalkerGUID = pStalker->GetGUID(); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); + me->SetTarget(uiStalkerGUID); } JumpToNextStep(1000); break; @@ -743,15 +743,15 @@ public: SetEscortPaused(false); bStepping = false; SetRun(false); - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->SetTarget(0); JumpToNextStep(0); break; //After waypoint 9 case 27: - me->SetUInt64Value(UNIT_FIELD_TARGET, uiCitymenGUID[0]); + me->SetTarget(uiCitymenGUID[0]); if (Creature* pCityman = Unit::GetCreature(*me, uiCitymenGUID[0])) { - pCityman->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + pCityman->SetTarget(me->GetGUID()); pCityman->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); pCityman->GetMotionMaster()->MovePoint(0, 2088.625f, 1279.191f, 140.743f); } @@ -779,10 +779,10 @@ public: if (Creature* pCityman1 = Unit::GetCreature(*me, uiCitymenGUID[1])) { DoScriptText(SAY_PHASE204, pCityman1); - pCityman1->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + pCityman1->SetTarget(me->GetGUID()); if (Creature* pCityman0 = Unit::GetCreature(*me, uiCitymenGUID[0])) pCityman0->Kill(pCityman0); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiCitymenGUID[1]); + me->SetTarget(uiCitymenGUID[1]); } JumpToNextStep(0); break; @@ -800,7 +800,7 @@ public: if (Unit* pStalker = me->SummonCreature(NPC_INVIS_TARGET, 2081.447f, 1287.770f, 141.3241f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 10000)) { uiStalkerGUID = pStalker->GetGUID(); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); + me->SetTarget(uiStalkerGUID); } DoScriptText(SAY_PHASE205, me); JumpToNextStep(3000); @@ -809,7 +809,7 @@ public: if (Unit* pStalkerM = me->SummonCreature(NPC_INVIS_TARGET, 2117.349f, 1288.624f, 136.271f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 60000)) { uiStalkerGUID = pStalkerM->GetGUID(); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); + me->SetTarget(uiStalkerGUID); } JumpToNextStep(1000); break; @@ -821,7 +821,7 @@ public: uiMalganisGUID = pMalganis->GetGUID(); DoScriptText(SAY_PHASE206, pMalganis); - pMalganis->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + pMalganis->SetTarget(me->GetGUID()); pMalganis->SetReactState(REACT_PASSIVE); } JumpToNextStep(11000); @@ -855,7 +855,7 @@ public: if (Unit* pStalker = me->SummonCreature(NPC_INVIS_TARGET, 2081.447f, 1287.770f, 141.3241f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 10000)) { uiStalkerGUID = pStalker->GetGUID(); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); + me->SetTarget(uiStalkerGUID); } DoScriptText(SAY_PHASE209, me); @@ -957,11 +957,11 @@ public: case 61: me->SetReactState(REACT_AGGRESSIVE); if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) - pDisguised0->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + pDisguised0->SetTarget(me->GetGUID()); if (Creature* pDisguised1 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[1])) - pDisguised1->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + pDisguised1->SetTarget(me->GetGUID()); if (Creature* pDisguised2 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[2])) - pDisguised2->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + pDisguised2->SetTarget(me->GetGUID()); JumpToNextStep(1000); break; case 62: @@ -1074,7 +1074,7 @@ public: SpawnTimeRift(17, &uiEpochGUID); if (Creature* pEpoch = Unit::GetCreature(*me, uiEpochGUID)) DoScriptText(SAY_PHASE314, pEpoch); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiEpochGUID); + me->SetTarget(uiEpochGUID); } JumpToNextStep(18000); break; @@ -1141,7 +1141,7 @@ public: case 86: DoScriptText(SAY_PHASE502, me); JumpToNextStep(6000); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiMalganisGUID); + me->SetTarget(uiMalganisGUID); break; case 87: if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) @@ -1168,7 +1168,7 @@ public: //After waypoint 56 case 89: SetRun(true); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiMalganisGUID); + me->SetTarget(uiMalganisGUID); DoScriptText(SAY_PHASE503, me); JumpToNextStep(7000); break; @@ -1176,7 +1176,7 @@ public: if (pInstance) { pInstance->SetData(DATA_ARTHAS_EVENT, DONE); //Rewards: Achiev & Chest ;D - me->SetUInt64Value(UNIT_FIELD_TARGET, pInstance->GetData64(DATA_MAL_GANIS_GATE_2)); //Look behind + me->SetTarget(pInstance->GetData64(DATA_MAL_GANIS_GATE_2)); //Look behind } DoScriptText(SAY_PHASE504, me); bStepping = false; diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index 81167dd0ad2..1a939123779 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -290,7 +290,7 @@ public: DoCast(target, SPELL_GREEN_BEAM); //Correctly update our target - me->SetUInt64Value(UNIT_FIELD_TARGET, target->GetGUID()); + me->SetTarget(target->GetGUID()); } //Beam every 3 seconds @@ -325,7 +325,7 @@ public: me->SetReactState(REACT_PASSIVE); //Remove any target - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->SetTarget(0); //Select random target for dark beam to start on if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) @@ -402,7 +402,7 @@ public: //Transition phase case PHASE_CTHUN_TRANSITION: //Remove any target - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->SetTarget(0); me->SetHealth(0); me->SetVisible(false); break; @@ -442,7 +442,7 @@ public: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); //Remove Target field - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->SetTarget(0); //Death animation/respawning; pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_TRANSITION); @@ -628,7 +628,7 @@ public: return; } - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->SetTarget(0); //No instance if (!pInst) @@ -706,7 +706,7 @@ public: //Body Phase case PHASE_CTHUN_STOMACH: //Remove Target field - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->SetTarget(0); //Weaken if (FleshTentaclesKilled > 1) diff --git a/src/server/scripts/Kalimdor/silithus.cpp b/src/server/scripts/Kalimdor/silithus.cpp index 607499dc71d..d57bb932479 100644 --- a/src/server/scripts/Kalimdor/silithus.cpp +++ b/src/server/scripts/Kalimdor/silithus.cpp @@ -544,11 +544,11 @@ public: DoScriptText(ANACHRONOS_SAY_1, me , Fandral); break; case 1: - Fandral->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + Fandral->SetTarget(me->GetGUID()); DoScriptText(FANDRAL_SAY_1, Fandral, me); break; case 2: - Fandral->SetUInt64Value(UNIT_FIELD_TARGET, 0); + Fandral->SetTarget(0); DoScriptText(MERITHRA_EMOTE_1, Merithra); break; case 3: @@ -558,14 +558,14 @@ public: DoScriptText(ARYGOS_EMOTE_1, Arygos); break; case 5: - Caelestrasz->SetUInt64Value(UNIT_FIELD_TARGET, Fandral->GetGUID()); + Caelestrasz->SetTarget(Fandral->GetGUID()); DoScriptText(CAELESTRASZ_SAY_1, Caelestrasz); break; case 6: DoScriptText(MERITHRA_SAY_2, Merithra); break; case 7: - Caelestrasz->SetUInt64Value(UNIT_FIELD_TARGET, 0); + Caelestrasz->SetTarget(0); Merithra->GetMotionMaster()->MoveCharge(-8065, 1530, 2.61f, 10); break; case 8: diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index c8d4139cbe0..f8b831972cb 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -828,7 +828,7 @@ public: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true)) { m_uiTrampleTargetGUID = target->GetGUID(); - me->SetUInt64Value(UNIT_FIELD_TARGET, m_uiTrampleTargetGUID); + me->SetTarget(m_uiTrampleTargetGUID); DoScriptText(SAY_TRAMPLE_STARE, me, target); m_bTrampleCasted = false; SetCombatMovement(false); @@ -859,7 +859,7 @@ public: case 4: DoScriptText(SAY_TRAMPLE_START, me); me->GetMotionMaster()->MoveCharge(m_fTrampleTargetX, m_fTrampleTargetY, m_fTrampleTargetZ+2, 42, 1); - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->SetTarget(0); m_uiStage = 5; break; case 5: diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp index 24c27099891..ffe940acb27 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -474,7 +474,7 @@ class npc_fizzlebang_toc : public CreatureScript break; case 1142: if (Creature* pTemp = Unit::GetCreature(*me, m_pInstance->GetData64(NPC_JARAXXUS))) - pTemp->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + pTemp->SetTarget(me->GetGUID()); if (Creature* pTrigger = Unit::GetCreature(*me, m_uiTriggerGUID)) pTrigger->DespawnOrUnsummon(); if (Creature* pPortal = Unit::GetCreature(*me, m_uiPortalGUID)) diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp index 734ee535031..1400c022ce6 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp @@ -315,7 +315,7 @@ class boss_devourer_of_souls : public CreatureScript me->SetReactState(REACT_PASSIVE); //Remove any target - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->SetTarget(0); me->GetMotionMaster()->Clear(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 10509de0266..fe2c068909d 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -754,7 +754,7 @@ public: Trigger->GetMotionMaster()->MovePoint(0, final.x, final.y, final.z); //Trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetUInt64Value(UNIT_FIELD_TARGET, Trigger->GetGUID()); + me->SetTarget(Trigger->GetGUID()); DoCast(Trigger, SPELL_EYE_BLAST); } void SummonFlamesOfAzzinoth() @@ -1235,7 +1235,7 @@ public: me->InterruptNonMeleeSpells(false); me->GetMotionMaster()->Clear(false); me->AttackStop(); - me->SetUInt64Value(UNIT_FIELD_TARGET, IllidanGUID); + me->SetTarget(IllidanGUID); MaxTimer = 0; break; case PHASE_TRANSFORM_SEQUENCE: diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index 2d09088edc8..852f69597b9 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -356,7 +356,7 @@ public: CAST_AI(mob_ashtongue_sorcerer::mob_ashtongue_sorcererAI, Sorcerer->AI())->ShadeGUID = me->GetGUID(); Sorcerer->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); Sorcerer->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); - Sorcerer->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + Sorcerer->SetTarget(me->GetGUID()); Sorcerers.push_back(Sorcerer->GetGUID()); --DeathCount; ++SorcererCount; @@ -661,7 +661,7 @@ public: Shade->AddThreat(me, 1000000.0f); me->CombatStart(Shade); Shade->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); - Shade->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + Shade->SetTarget(me->GetGUID()); if (pl) Shade->AddThreat(pl, 1.0f); DoZoneInCombat(Shade); EventBegun = true; @@ -680,7 +680,7 @@ public: case 1: if (Creature* Shade = Unit::GetCreature(*me, ShadeGUID)) { - me->SetUInt64Value(UNIT_FIELD_TARGET, ShadeGUID); + me->SetTarget(ShadeGUID); DoCast(Shade, SPELL_AKAMA_SOUL_RETRIEVE); EndingTalkCount = 0; SoulRetrieveTimer = 16000; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index 97010fdefaa..d25d10cc6a7 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -182,7 +182,7 @@ class boss_alar : public CreatureScript me->RemoveAllAuras(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->AttackStop(); - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->SetTarget(0); me->SetSpeed(MOVE_RUN, 5.0f); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MovePoint(0, waypoint[5][0], waypoint[5][1], waypoint[5][2]); diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index 7fd0641a945..ff3c3199d31 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -236,7 +236,7 @@ struct advisorbase_ai : public ScriptedAI me->ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->ClearAllReactives(); - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->SetTarget(0); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); me->SetStandState(UNIT_STAND_STATE_DEAD); diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp index 6edeb3563db..87a279a8113 100644 --- a/src/server/scripts/Outland/shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/shadowmoon_valley.cpp @@ -782,8 +782,8 @@ public: Illi->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); return 350; break; case 6: Illi->CastSpell(Illi, SPELL_ONE, true); - Illi->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - me->SetUInt64Value(UNIT_FIELD_TARGET, IllidanGUID); + Illi->SetTarget(me->GetGUID()); + me->SetTarget(IllidanGUID); return 2000; break; case 7: DoScriptText(OVERLORD_YELL_2, me); return 4500; break; case 8: me->SetUInt32Value(UNIT_FIELD_BYTES_1, 8); return 2500; break; @@ -792,7 +792,7 @@ public: case 11: DoScriptText(OVERLORD_SAY_4, me, player); return 6000; break; case 12: DoScriptText(LORD_ILLIDAN_SAY_2, Illi); return 5500; break; case 13: DoScriptText(LORD_ILLIDAN_SAY_3, Illi); return 4000; break; - case 14: Illi->SetUInt64Value(UNIT_FIELD_TARGET, PlayerGUID); return 1500; break; + case 14: Illi->SetTarget(PlayerGUID); return 1500; break; case 15: DoScriptText(LORD_ILLIDAN_SAY_4, Illi); return 1500; break; case 16: if (player) @@ -818,7 +818,7 @@ public: Illi->setDeathState(JUST_DIED); return 1000; break; case 23: me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); return 2000; break; - case 24: me->SetUInt64Value(UNIT_FIELD_TARGET, PlayerGUID); return 5000; break; + case 24: me->SetTarget(PlayerGUID); return 5000; break; case 25: DoScriptText(OVERLORD_SAY_6, me); return 2000; break; case 26: if (player) @@ -828,7 +828,7 @@ public: { Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50); if (Yarzill) - Yarzill->SetUInt64Value(UNIT_FIELD_TARGET, PlayerGUID); + Yarzill->SetTarget(PlayerGUID); return 500; } break; case 28: @@ -848,7 +848,7 @@ public: { Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50); if (Yarzill) - Yarzill->SetUInt64Value(UNIT_FIELD_TARGET, 0); + Yarzill->SetTarget(0); return 5000; } break; case 31: @@ -1193,7 +1193,7 @@ public: me->AddUnitState(UNIT_STAT_ROOT); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->SetTarget(0); } void EnterCombat(Unit* /*who*/){} @@ -1226,7 +1226,7 @@ public: case 5: if (Player* AggroTarget = (Unit::GetPlayer(*me, AggroTargetGUID))) { - me->SetUInt64Value(UNIT_FIELD_TARGET, AggroTarget->GetGUID()); + me->SetTarget(AggroTarget->GetGUID()); me->AddThreat(AggroTarget, 1); me->HandleEmoteCommand(EMOTE_ONESHOT_POINT); } |