bool SetupChain() { // Check, if instance_ script failed or encounter finished if (!m_pInstance || m_pInstance->GetData(TYPE_THADDIUS) == DONE) return true; GameObject* pNoxTeslaFeugen = m_pInstance->GetSingleGameObjectFromStorage(GO_CONS_NOX_TESLA_FEUGEN); GameObject* pNoxTeslaStalagg = m_pInstance->GetSingleGameObjectFromStorage(GO_CONS_NOX_TESLA_STALAGG); // Try again, till Tesla GOs are spawned if (!pNoxTeslaFeugen || !pNoxTeslaStalagg) return false; m_bToFeugen = m_creature->GetDistanceOrder(pNoxTeslaFeugen, pNoxTeslaStalagg); return DoCastSpellIfCan(m_creature, m_bToFeugen ? SPELL_FEUGEN_CHAIN : SPELL_STALAGG_CHAIN) == CAST_OK; }
void ReApplyChain(uint32 uiEntry) { if (uiEntry) // called from Stalagg/Feugen with their entry { // Only apply chain to own add if ((uiEntry == NPC_FEUGEN && !m_bToFeugen) || (uiEntry == NPC_STALAGG && m_bToFeugen)) return; m_bReapply = true; // Reapply Chains on next tick } else // if called from next tick, needed because otherwise the spell doesn't bind { m_bReapply = false; m_creature->InterruptNonMeleeSpells(true); GameObject* pGo = m_pInstance->GetSingleGameObjectFromStorage(m_bToFeugen ? GO_CONS_NOX_TESLA_FEUGEN : GO_CONS_NOX_TESLA_STALAGG); if (pGo && pGo->GetGoType() == GAMEOBJECT_TYPE_BUTTON && pGo->getLootState() == GO_ACTIVATED) pGo->ResetDoorOrButton(); DoCastSpellIfCan(m_creature, m_bToFeugen ? SPELL_FEUGEN_CHAIN : SPELL_STALAGG_CHAIN); } }