diff options
Diffstat (limited to 'src')
9 files changed, 61 insertions, 62 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 7628906f0fc..ddf450d2d56 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -279,16 +279,9 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) condMeets = player->HasTitle(ConditionValue1); break; } - case CONDITION_MAP_DIFFICULTY: + case CONDITION_SPAWNMASK: { - if (Unit* unit = object->ToUnit()) - { - if (unit->GetMap()->IsRaid()) - if (unit->GetMap()->Is25ManRaid() != ((ConditionValue1 & RAID_DIFFICULTY_MASK_25MAN) != 0)) - return false; - - condMeets = unit->GetMap()->GetSpawnMode() >= ConditionValue1; - } + condMeets = ((1 << object->GetMap()->GetSpawnMode()) & ConditionValue1); break; } default: @@ -442,7 +435,7 @@ uint32 Condition::GetSearcherTypeMaskForCondition() case CONDITION_TITLE: mask |= GRID_MAP_TYPE_MASK_PLAYER; break; - case CONDITION_MAP_DIFFICULTY: + case CONDITION_SPAWNMASK: mask |= GRID_MAP_TYPE_MASK_ALL; break; default: @@ -1857,11 +1850,11 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) } break; } - case CONDITION_MAP_DIFFICULTY: + case CONDITION_SPAWNMASK: { - if (cond->ConditionValue1 >= MAX_DIFFICULTY) + if (cond->ConditionValue1 > SPAWNMASK_RAID_ALL) { - sLog->outError(LOG_FILTER_SQL, "Map Difficulty condition has non existing map difficulty in value1 (%u), skipped", cond->ConditionValue1); + sLog->outError(LOG_FILTER_SQL, "SpawnMask condition has non existing SpawnMask in value1 (%u), skipped", cond->ConditionValue1); return false; } break; diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 3b0e6cc69f3..bd72015d76f 100755 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -49,7 +49,7 @@ enum ConditionTypes CONDITION_RACE = 16, // race 0 0 true if player's race is equal to race CONDITION_ACHIEVEMENT = 17, // achievement_id 0 0 true if achievement is complete CONDITION_TITLE = 18, // title id 0 0 true if player has title - CONDITION_MAP_DIFFICULTY = 19, // difficulty 0 0 + CONDITION_SPAWNMASK = 19, // spawnMask 0 0 true if in spawnMask CONDITION_UNUSED_20 = 20, // CONDITION_UNUSED_21 = 21, // CONDITION_MAPID = 22, // map_id 0 0 true if in map_id diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 06919a43a4d..39e4c7bbe53 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -267,7 +267,6 @@ Unit::Unit(bool isWorldObject): WorldObject(isWorldObject) m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE); _focusSpell = NULL; - _targetLocked = false; _lastLiquid = NULL; _isWalkingBeforeCharm = false; } @@ -423,6 +422,9 @@ void Unit::UpdateSplineMovement(uint32 t_diff) transport->CalculatePassengerPosition(loc.x, loc.y, loc.z, loc.orientation); } + if (HasUnitState(UNIT_STATE_CANNOT_TURN)) + loc.orientation = GetOrientation(); + UpdatePosition(loc.x, loc.y, loc.z, loc.orientation); } } @@ -17731,3 +17733,31 @@ void Unit::SendMovementCanFlyChange() BuildMovementPacket(&data); SendMessageToSet(&data, false); } + +void Unit::FocusTarget(Spell const* focusSpell, uint64 target) +{ + // already focused + if (_focusSpell) + return; + + _focusSpell = focusSpell; + SetUInt64Value(UNIT_FIELD_TARGET, target); + if (focusSpell->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_DONT_TURN_DURING_CAST) + AddUnitState(UNIT_STATE_ROTATING); +} + +void Unit::ReleaseFocus(Spell const* focusSpell) +{ + // focused to something else + if (focusSpell != _focusSpell) + return; + + _focusSpell = NULL; + if (Unit* victim = getVictim()) + SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID()); + else + SetUInt64Value(UNIT_FIELD_TARGET, 0); + + if (focusSpell->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_DONT_TURN_DURING_CAST) + ClearUnitState(UNIT_STATE_ROTATING); +} diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 88a8fe0865b..4971685fe1c 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -2208,34 +2208,13 @@ class Unit : public WorldObject void SetTarget(uint64 guid) { - if (!_targetLocked) + if (!_focusSpell) 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); - } + // Handling caster facing during spellcast + void FocusTarget(Spell const* focusSpell, uint64 target); + void ReleaseFocus(Spell const* focusSpell); // Movement info Movement::MoveSpline * movespline; @@ -2359,8 +2338,7 @@ 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 + Spell const* _focusSpell; ///> Locks the target during spell cast for proper facing bool _isWalkingBeforeCharm; // Are we walking before we were charmed? }; diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index cffd3faeb8d..39cc06cec14 100755 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -466,7 +466,7 @@ enum SpellAttr5 SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK = 0x00010000, // 16 this allows spells with EquippedItemClass to affect spells from other items if the required item is equipped SPELL_ATTR5_USABLE_WHILE_FEARED = 0x00020000, // 17 usable while feared SPELL_ATTR5_USABLE_WHILE_CONFUSED = 0x00040000, // 18 usable while confused - SPELL_ATTR5_UNK19 = 0x00080000, // 19 + SPELL_ATTR5_DONT_TURN_DURING_CAST = 0x00080000, // 19 Blocks caster's turning when casting (client does not automatically turn caster's model to face UNIT_FIELD_TARGET) SPELL_ATTR5_UNK20 = 0x00100000, // 20 SPELL_ATTR5_UNK21 = 0x00200000, // 21 SPELL_ATTR5_UNK22 = 0x00400000, // 22 diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp index 145251ec4aa..c275c33032f 100755 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp @@ -79,6 +79,7 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T* owner) Movement::MoveSplineInit init(owner); init.MovebyPath(i_path->GetPath()); + init.SetFacing(i_target.getTarget()); init.SetWalk(((D*)this)->EnableWalking()); init.Launch(); } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index bffca8f5cee..121e702bfa7 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3070,10 +3070,9 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered SendSpellStart(); // set target for proper facing - if (m_casttime && !(_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING)) - if (uint64 target = m_targets.GetUnitTargetGUID()) - if (m_caster->GetGUID() != target && m_caster->GetTypeId() == TYPEID_UNIT) - m_caster->FocusTarget(this, target); + if ((m_casttime || m_spellInfo->IsChanneled()) && !(_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING)) + if (m_caster->GetGUID() != m_targets.GetObjectTargetGUID() && m_caster->GetTypeId() == TYPEID_UNIT) + m_caster->FocusTarget(this, m_targets.GetObjectTargetGUID()); if (!(_triggeredCastFlags & TRIGGERED_IGNORE_GCD)) TriggerGlobalCooldown(); 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 4792a9c4e58..0476b2cbacb 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 @@ -120,11 +120,8 @@ class npc_announcer_toc10 : public CreatureScript { npc_announcer_toc10AI(Creature* creature) : ScriptedAI(creature) { - instance = creature->GetInstanceScript(); } - InstanceScript* instance; - void Reset() { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -274,7 +271,7 @@ class boss_lich_king_toc : public CreatureScript void MovementInform(uint32 uiType, uint32 uiId) { - if (uiType != POINT_MOTION_TYPE) + if (uiType != POINT_MOTION_TYPE || !instance) return; switch (uiId) { @@ -338,20 +335,18 @@ class boss_lich_king_toc : public CreatureScript if (GameObject* go = instance->instance->GetGameObject(instance->GetData64(GO_ARGENT_COLISEUM_FLOOR))) go->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED); me->CastSpell(me, 69016, false); - if (instance) - { - instance->SetData(TYPE_LICH_KING, DONE); - Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_ANUBARAK)); - if (!temp || !temp->isAlive()) - temp = me->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); + instance->SetData(TYPE_LICH_KING, DONE); + Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_ANUBARAK)); + if (!temp || !temp->isAlive()) + temp = me->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); - instance->SetData(TYPE_EVENT, 0); - } + instance->SetData(TYPE_EVENT, 0); me->DespawnOrUnsummon(); m_uiUpdateTimer = 20000; break; } } else m_uiUpdateTimer -= uiDiff; + instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer); } }; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp index f53020a72c4..b987b00fa5b 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp @@ -125,7 +125,8 @@ public: void Reset() { - instance->SetData(DATA_PRINCEKELESETH_EVENT, NOT_STARTED); + if (instance) + instance->SetData(DATA_PRINCEKELESETH_EVENT, NOT_STARTED); events.Reset(); events.ScheduleEvent(EVENT_SHADOWBOLT, urand(2,3)*IN_MILLISECONDS); @@ -140,13 +141,15 @@ public: void EnterCombat(Unit* /*who*/) { me->SetInCombatWithZone(); - instance->SetData(DATA_PRINCEKELESETH_EVENT, IN_PROGRESS); + if (instance) + instance->SetData(DATA_PRINCEKELESETH_EVENT, IN_PROGRESS); Talk(SAY_START_COMBAT); } void JustDied(Unit* /*killer*/) { - instance->SetData(DATA_PRINCEKELESETH_EVENT, DONE); + if (instance) + instance->SetData(DATA_PRINCEKELESETH_EVENT, DONE); summons.DespawnAll(); Talk(SAY_DEATH); } |