void instance_halls_of_stone::SortFaces()
{
    std::list<Creature*> lPossibleEyes;
    GameObject* pFace = NULL;

    // FACE_MARNAK
    if (pFace = instance->GetGameObject(m_aFaces[FACE_MARNAK].m_goFaceGuid))
    {
        // Find Marnak NPCs
        GetValidNPCsOfList(instance, m_lMarnakGUIDs, lPossibleEyes);
        if (lPossibleEyes.size() > 1)
        {
            lPossibleEyes.sort(SortHelper(pFace));
            std::list<Creature*>::const_iterator itr = lPossibleEyes.begin();
            m_aFaces[FACE_MARNAK].m_leftEyeGuid = (*itr)->GetObjectGuid();
            ++itr;
            m_aFaces[FACE_MARNAK].m_speakerGuid = (*itr)->GetObjectGuid();
        }
        // Find Worldtrigger NPC
        GetValidNPCsOfList(instance, m_lWorldtriggerGUIDs, lPossibleEyes);
        if (!lPossibleEyes.empty())
        {
            lPossibleEyes.sort(SortHelper(pFace));
            m_aFaces[FACE_MARNAK].m_rightEyeGuid = (*lPossibleEyes.begin())->GetObjectGuid();
        }
    }

    // FACE_ABEDNEUM
    if (pFace = instance->GetGameObject(m_aFaces[FACE_ABEDNEUM].m_goFaceGuid))
    {
        // Find Abedneum NPCs
        GetValidNPCsOfList(instance, m_lAbedneumGUIDs, lPossibleEyes);
        if (lPossibleEyes.size() > 1)
        {
            lPossibleEyes.sort(SortHelper(pFace));
            std::list<Creature*>::const_iterator itr = lPossibleEyes.begin();
            m_aFaces[FACE_ABEDNEUM].m_leftEyeGuid = (*itr)->GetObjectGuid();
            ++itr;
            m_aFaces[FACE_ABEDNEUM].m_speakerGuid = (*itr)->GetObjectGuid();
        }
        // Find Worldtrigger NPC
        GetValidNPCsOfList(instance, m_lWorldtriggerGUIDs, lPossibleEyes);
        if (!lPossibleEyes.empty())
        {
            lPossibleEyes.sort(SortHelper(pFace));
            m_aFaces[FACE_ABEDNEUM].m_rightEyeGuid = (*lPossibleEyes.begin())->GetObjectGuid();
        }
    }

    // FACE_KADDRAK
    if (pFace = instance->GetGameObject(m_aFaces[FACE_KADDRAK].m_goFaceGuid))
    {
        // Find Marnak NPCs
        GetValidNPCsOfList(instance, m_lKaddrakGUIDs, lPossibleEyes);
        if (lPossibleEyes.size() > 1)
        {
            lPossibleEyes.sort(SortHelper(pFace));
            std::list<Creature*>::const_iterator itr = lPossibleEyes.begin();
            m_aFaces[FACE_KADDRAK].m_leftEyeGuid = (*itr)->GetObjectGuid();
            ++itr;
            m_aFaces[FACE_KADDRAK].m_speakerGuid = (*itr)->GetObjectGuid();
        }
        // Find Tribunal NPC
        GetValidNPCsOfList(instance, m_lTribunalGUIDs, lPossibleEyes);
        if (!lPossibleEyes.empty())
        {
            lPossibleEyes.sort(SortHelper(pFace));
            m_aFaces[FACE_KADDRAK].m_rightEyeGuid = (*lPossibleEyes.begin())->GetObjectGuid();
        }
    }

    // Clear GUIDs
    m_lKaddrakGUIDs.clear();
    m_lAbedneumGUIDs.clear();
    m_lMarnakGUIDs.clear();
    m_lTribunalGUIDs.clear();
    m_lWorldtriggerGUIDs.clear();
}
void instance_halls_of_stone::SortFaces()
{
    std::list<Creature*> lPossibleEyes;
    GameObject* pFace = NULL;

    // FACE_MARNAK
    pFace = instance->GetGameObject(m_aFaces[FACE_MARNAK].m_goFaceGuid);
    if (pFace)
    {
        // Find Marnak NPCs
        GetValidNPCsOfList(instance, m_lMarnakGUIDs, lPossibleEyes);
        if (lPossibleEyes.size() > 1)
        {
            lPossibleEyes.sort(SortHelper(pFace));
            std::list<Creature*>::const_iterator itr = lPossibleEyes.begin();
            m_aFaces[FACE_MARNAK].m_leftEyeGuid = (*itr)->GetObjectGuid();
            ++itr;
            m_aFaces[FACE_MARNAK].m_speakerGuid = (*itr)->GetObjectGuid();
        }
        // Find Worldtrigger NPC
        GetValidNPCsOfList(instance, m_lWorldtriggerGUIDs, lPossibleEyes);
        if (!lPossibleEyes.empty())
        {
            lPossibleEyes.sort(SortHelper(pFace));
            Creature* pDummy = (*lPossibleEyes.begin());
            if (Creature* newFace = pFace->SummonCreature(NPC_MARNAK, pDummy->GetPositionX(), pDummy->GetPositionY(), pDummy->GetPositionZ(), pDummy->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1000))
                m_aFaces[FACE_MARNAK].m_rightEyeGuid = newFace->GetObjectGuid();
            //m_aFaces[FACE_MARNAK].m_rightEyeGuid = (*lPossibleEyes.begin())->GetObjectGuid();
        }
    }

    // FACE_ABEDNEUM
    pFace = instance->GetGameObject(m_aFaces[FACE_ABEDNEUM].m_goFaceGuid);
    if (pFace)
    {
        // Find Abedneum NPCs
        GetValidNPCsOfList(instance, m_lAbedneumGUIDs, lPossibleEyes);
        if (lPossibleEyes.size() > 1)
        {
            lPossibleEyes.sort(SortHelper(pFace));
            std::list<Creature*>::const_iterator itr = lPossibleEyes.begin();
            m_aFaces[FACE_ABEDNEUM].m_leftEyeGuid = (*itr)->GetObjectGuid();
            ++itr;
            m_aFaces[FACE_ABEDNEUM].m_speakerGuid = (*itr)->GetObjectGuid();
        }
        // Find Worldtrigger NPC
        GetValidNPCsOfList(instance, m_lWorldtriggerGUIDs, lPossibleEyes);
        if (!lPossibleEyes.empty())
        {
            lPossibleEyes.sort(SortHelper(pFace));
            Creature* pDummy = (*lPossibleEyes.begin());
            if (Creature* newFace = pFace->SummonCreature(NPC_ABEDNEUM, pDummy->GetPositionX(), pDummy->GetPositionY(), pDummy->GetPositionZ(), pDummy->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1000))
                m_aFaces[FACE_ABEDNEUM].m_rightEyeGuid = newFace->GetObjectGuid();
            //m_aFaces[FACE_ABEDNEUM].m_rightEyeGuid = (*lPossibleEyes.begin())->GetObjectGuid();
        }
    }

    // FACE_KADDRAK
    pFace = instance->GetGameObject(m_aFaces[FACE_KADDRAK].m_goFaceGuid);
    if (pFace)
    {
        // Find Kaddrak NPCs
        GetValidNPCsOfList(instance, m_lKaddrakGUIDs, lPossibleEyes);
        if (lPossibleEyes.size() > 1)
        {
            lPossibleEyes.sort(SortHelper(pFace));
            std::list<Creature*>::const_iterator itr = lPossibleEyes.begin();
            m_aFaces[FACE_KADDRAK].m_leftEyeGuid = (*itr)->GetObjectGuid();
            ++itr;
            m_aFaces[FACE_KADDRAK].m_speakerGuid = (*itr)->GetObjectGuid();
        }
        // Find Tribunal NPC
        GetValidNPCsOfList(instance, m_lTribunalGUIDs, lPossibleEyes);
        if (!lPossibleEyes.empty())
        {
            lPossibleEyes.sort(SortHelper(pFace));
            Creature* pDummy = (*lPossibleEyes.begin());
            if (Creature* newFace = pFace->SummonCreature(NPC_KADDRAK, pDummy->GetPositionX(), pDummy->GetPositionY(), pDummy->GetPositionZ(), pDummy->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1000))
                m_aFaces[FACE_KADDRAK].m_rightEyeGuid = newFace->GetObjectGuid();
            //m_aFaces[FACE_KADDRAK].m_rightEyeGuid = (*lPossibleEyes.begin())->GetObjectGuid();
        }
    }

    // Clear GUIDs
    m_lKaddrakGUIDs.clear();
    m_lAbedneumGUIDs.clear();
    m_lMarnakGUIDs.clear();
    m_lTribunalGUIDs.clear();
    m_lWorldtriggerGUIDs.clear();
}