diff options
Diffstat (limited to 'src')
15 files changed, 43 insertions, 87 deletions
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 59633f87058..046af770aff 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -479,14 +479,12 @@ 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->SetPhaseMask(2, true); creature->DisappearAndDie(); creature->SetVisible(false); } void Battlefield::ShowNpc(Creature* creature, bool aggressive) { - creature->SetPhaseMask(1, true); creature->SetVisible(true); creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); if (!creature->IsAlive()) diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index 2fa82acdaf5..b6b46ff45df 100644 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -187,7 +187,6 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields) // place SetLocationInstanceId(instanceId); SetLocationMapId(mapId); - SetPhaseMask(phaseMask, false); Relocate(posX, posY, posZ, o); if (!IsPositionValid()) diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 51d2646b1c3..7ca34f02963 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -738,8 +738,7 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 entry, { ASSERT(map); SetMap(map); - SetPhaseMask(phaseMask, false); - + if (data && data->phaseid) SetInPhase(data->phaseid, false, true); @@ -1505,8 +1504,6 @@ void Creature::setDeathState(DeathState s) SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool)); LoadCreaturesAddon(true); Motion_Initialize(); - if (GetCreatureData() && GetPhaseMask() != GetCreatureData()->phaseMask) - SetPhaseMask(GetCreatureData()->phaseMask, false); Unit::setDeathState(ALIVE); } } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 736c39461cd..8cf12405969 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -188,8 +188,6 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa return false; } - SetPhaseMask(phaseMask, false); - SetZoneScript(); if (m_zoneScript) { diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 54d6f4436ea..07f62adfc44 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2898,7 +2898,6 @@ void Player::SetGameMaster(bool on) getHostileRefManager().setOnlineOfflineState(false); CombatStopWithPets(); - SetPhaseMask(uint32(PHASEMASK_ANYWHERE), false); // see and visible in all phases m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GM, GetSession()->GetSecurity()); } else diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp index 7de319df07f..13609f8e949 100644 --- a/src/server/game/Globals/ObjectAccessor.cpp +++ b/src/server/game/Globals/ObjectAccessor.cpp @@ -371,7 +371,6 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia // bones->m_time = m_time; // don't overwrite time // bones->m_type = m_type; // don't overwrite type bones->Relocate(corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetOrientation()); - bones->SetPhaseMask(corpse->GetPhaseMask(), false); bones->SetUInt32Value(CORPSE_FIELD_FLAGS, CORPSE_FLAG_UNK2 | CORPSE_FLAG_BONES); bones->SetUInt64Value(CORPSE_FIELD_OWNER, 0); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 8c80c7687d5..ff7c650a8cf 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1606,22 +1606,6 @@ void AuraEffect::HandlePhase(AuraApplication const* aurApp, uint8 mode, bool app Unit* target = aurApp->GetTarget(); - uint32 newPhase = 0; - Unit::AuraEffectList const& phases = target->GetAuraEffectsByType(SPELL_AURA_PHASE); - if (!phases.empty()) - for (Unit::AuraEffectList::const_iterator itr = phases.begin(); itr != phases.end(); ++itr) - newPhase |= (*itr)->GetMiscValue(); - - if (!newPhase) - { - newPhase = PHASEMASK_NORMAL; - if (Creature* creature = target->ToCreature()) - if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetDBTableGUIDLow())) - newPhase = data->phaseMask; - } - - target->SetPhaseMask(newPhase, false); - target->SetInPhase(GetMiscValueB(), false, apply); // call functions which may have additional effects after chainging state of unit @@ -1634,6 +1618,7 @@ void AuraEffect::HandlePhase(AuraApplication const* aurApp, uint8 mode, bool app if (Player* player = target->ToPlayer()) player->UpdatePhasing(); + // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases) if (target->IsVisible()) target->UpdateObjectVisibility(); @@ -1646,9 +1631,6 @@ void AuraEffect::HandlePhaseGroup(AuraApplication const* aurApp, uint8 mode, boo Unit* target = aurApp->GetTarget(); - if (target->GetTypeId() != TYPEID_PLAYER) - return; - std::set<uint32> const& phases = GetPhasesForGroup(GetMiscValueB()); for (auto phase : phases) target->SetInPhase(phase, false, apply); diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 37961b040b3..b2b4235c1a3 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -510,7 +510,7 @@ public: //set phasemask for selected object static bool HandleGameObjectSetPhaseCommand(ChatHandler* handler, char const* args) { - // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r + /*// number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r char* id = handler->extractKeyFromLink((char*)args, "Hgameobject"); if (!id) return false; @@ -542,7 +542,7 @@ public: } object->SetPhaseMask(phaseMask, true); - object->SaveToDB(); + object->SaveToDB();*/ return true; } diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index bff12d4330e..1d812a8f4eb 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -370,7 +370,8 @@ public: target->GetContactPoint(_player, x, y, z); _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE); - _player->SetPhaseMask(target->GetPhaseMask(), true); + for (auto phase : target->GetPhases()) + _player->SetInPhase(phase, true, true); } else { @@ -494,7 +495,8 @@ public: float x, y, z; handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, target->GetObjectSize()); target->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, target->GetOrientation()); - target->SetPhaseMask(handler->GetSession()->GetPlayer()->GetPhaseMask(), true); + for (auto phase : handler->GetSession()->GetPlayer()->GetPhases()) + target->SetInPhase(phase, true, true); } else { diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 83b799f46bb..8d44068a00d 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -1267,19 +1267,19 @@ public: return true; } - //set temporary phase mask for player + // Toggles a phaseid on a player static bool HandleModifyPhaseCommand(ChatHandler* handler, const char* args) { if (!*args) return false; - uint32 phasemask = (uint32)atoi((char*)args); + uint32 phase = (uint32)atoi((char*)args); Unit* target = handler->getSelectedUnit(); if (target) - target->SetPhaseMask(phasemask, true); + target->SetInPhase(phase, true, !target->IsInPhase(phase)); else - handler->GetSession()->GetPlayer()->SetPhaseMask(phasemask, true); + handler->GetSession()->GetPlayer()->SetInPhase(phase, true, !handler->GetSession()->GetPlayer()->IsInPhase(phase)); return true; } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp index f7aedb42561..a3804f8b35a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp @@ -178,7 +178,6 @@ public: _Reset(); me->SetVisible(true); - me->SetPhaseMask(1, true); me->SetUInt32Value(UNIT_NPC_FLAGS, 1); me->setFaction(35); me->SetStandState(UNIT_STAND_STATE_SIT_HIGH_CHAIR); diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp index 1c042f4d185..4b352b98af2 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp @@ -111,8 +111,14 @@ public: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetControlled(true, UNIT_STATE_STUNNED); } - // phase mask - target->CastSpell(target, SPELL_INSANITY_TARGET+insanityHandled, true); + + // phase the player + target->CastSpell(target, SPELL_INSANITY_TARGET + insanityHandled, true); + + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_INSANITY_TARGET + insanityHandled); + if (!spellInfo) + return; + // summon twisted party members for this target Map::PlayerList const &players = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) @@ -125,21 +131,22 @@ public: { // clone player->CastSpell(summon, SPELL_CLONE_PLAYER, true); - // set phase - summon->SetPhaseMask((1<<(4+insanityHandled)), true); + // phase the summon + summon->SetInPhase(spellInfo->Effects[EFFECT_0].MiscValueB, true, true); } } ++insanityHandled; } } - void ResetPlayersPhaseMask() + void ResetPlayersPhase() { Map::PlayerList const &players = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { Player* player = i->GetSource(); - player->RemoveAurasDueToSpell(GetSpellForPhaseMask(player->GetPhaseMask())); + for (uint32 index = 0; index <= 4; ++index) + player->RemoveAurasDueToSpell(SPELL_INSANITY_TARGET + index); } } @@ -153,11 +160,14 @@ public: instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_QUICK_DEMISE_START_EVENT); // Visible for all players in insanity - me->SetPhaseMask((1|16|32|64|128|256), true); + me->SetInPhase(169, true, true); + for (uint32 i = 173; i <= 177; ++i) + me->SetInPhase(i, true, true); + // Used for Insanity handling insanityHandled = 0; - ResetPlayersPhaseMask(); + ResetPlayersPhase(); // Cleanup Summons.DespawnAll(); @@ -178,33 +188,8 @@ public: Summons.Summon(summon); } - uint32 GetSpellForPhaseMask(uint32 phase) - { - uint32 spell = 0; - switch (phase) - { - case 16: - spell = SPELL_INSANITY_PHASING_1; - break; - case 32: - spell = SPELL_INSANITY_PHASING_2; - break; - case 64: - spell = SPELL_INSANITY_PHASING_3; - break; - case 128: - spell = SPELL_INSANITY_PHASING_4; - break; - case 256: - spell = SPELL_INSANITY_PHASING_5; - break; - } - return spell; - } - void SummonedCreatureDespawn(Creature* summon) override { - uint32 phase = summon->GetPhaseMask(); uint32 nextPhase = 0; Summons.Despawn(summon); @@ -214,16 +199,17 @@ public: if (Creature* visage = ObjectAccessor::GetCreature(*me, *iter)) { // Not all are dead - if (phase == visage->GetPhaseMask()) + if (visage->IsInPhase(summon)) return; else - nextPhase = visage->GetPhaseMask(); + { + nextPhase = *visage->GetPhases().begin(); + break; + } } } // Roll Insanity - uint32 spell = GetSpellForPhaseMask(phase); - uint32 spell2 = GetSpellForPhaseMask(nextPhase); Map* map = me->GetMap(); if (!map) return; @@ -235,12 +221,9 @@ public: { if (Player* player = i->GetSource()) { - if (player->HasAura(spell)) - { - player->RemoveAurasDueToSpell(spell); - if (spell2) // if there is still some different mask cast spell for it - player->CastSpell(player, spell2, true); - } + for (uint32 index = 0; index <= 4; ++index) + player->RemoveAurasDueToSpell(SPELL_INSANITY_TARGET + index); + player->CastSpell(player, SPELL_INSANITY_TARGET + nextPhase - 173, true); } } } @@ -292,7 +275,7 @@ public: instance->SetBossState(DATA_HERALD_VOLAZJ, DONE); Summons.DespawnAll(); - ResetPlayersPhaseMask(); + ResetPlayersPhase(); } void KilledUnit(Unit* who) override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index 0c504842c08..68344593434 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -618,7 +618,7 @@ class npc_the_lich_king_controller : public CreatureScript void JustSummoned(Creature* summon) override { // must not be in dream phase - summon->SetPhaseMask((summon->GetPhaseMask() & ~0x10), true); + summon->SetInPhase(173, true, false); if (summon->GetEntry() != NPC_SUPPRESSER) if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) summon->AI()->AttackStart(target); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index 8b3ac64fb89..bbef671483d 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -305,7 +305,7 @@ public: if (GameObject* trigger = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_TRIGGER))) { trigger->ResetDoorOrButton(); - trigger->SetPhaseMask(1, true); + trigger->SetLootState(GO_READY); } for (uint8 i = 0; i <= 3; ++i) @@ -398,7 +398,7 @@ public: break; case EVENT_TRIGGER: if (GameObject* trigger = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_KELTHUZAD_TRIGGER))) - trigger->SetPhaseMask(2, true); + trigger->SetLootState(GO_JUST_DEACTIVATED); events.PopEvent(); break; case EVENT_PHASE: diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp index 38d73e0673d..08936df4589 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -1853,7 +1853,7 @@ public: me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); break; case 20: - me->SetPhaseMask(1, true); + me->SetInPhase(170, true, false); Talk(SAY_5); me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); player->GroupEventHappens(QUEST_ESCAPING_THE_MIST, me); |