Core/Phases: Removed some phasemask handling, more to come
This commit is contained in:
1 parent
3df25bb64c
commit
558642b26e
15 files changed
+43
-87
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user