void instance_old_hillsbrad::Update(uint32 uiDiff)
{
    if (m_uiThrallResetTimer)
    {
        if (m_uiThrallResetTimer <= uiDiff)
        {
            HandleThrallRelocation();
            m_uiThrallResetTimer = 0;
        }
        else
            m_uiThrallResetTimer -= uiDiff;
    }
}
void instance_old_hillsbrad::SetData(uint32 uiType, uint32 uiData)
{
    switch(uiType)
    {
        case TYPE_BARREL_DIVERSION:
        {
            if (uiData == IN_PROGRESS)
            {
                if (m_uiBarrelCount >= 5)
                    return;

                ++m_uiBarrelCount;
                DoUpdateWorldState(WORLD_STATE_OH, m_uiBarrelCount);

                debug_log("SD2: Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u", m_uiBarrelCount);

                m_auiEncounter[TYPE_BARREL_DIVERSION] = IN_PROGRESS;

                if (m_uiBarrelCount == 5)
                {
                    UpdateLodgeQuestCredit();

                    if (Player* pPlayer = GetPlayerInMap())
                        pPlayer->SummonCreature(NPC_DRAKE, 2128.43f, 71.01f, 64.42f, 1.74f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 1800000);
                    else
                        debug_log("SD2: Instance Old Hillsbrad: SetData (Type: %u Data %u) cannot find any pPlayer.", uiType, uiData);

                    m_auiEncounter[TYPE_BARREL_DIVERSION] = DONE;
                }
            }
            break;
        }
        case TYPE_THRALL_EVENT:
        {
            // nothing to do if already done and thrall respawn
            if (m_auiEncounter[TYPE_THRALL_EVENT] == DONE)
                return;

            if (uiData == FAIL)
            {
                if (m_uiThrallEventCount <= 20)
                {
                    ++m_uiThrallEventCount;
                    debug_log("SD2: Instance Old Hillsbrad: Thrall event failed %u times.", m_uiThrallEventCount);

                    HandleThrallRelocation();
                }
                else if (m_uiThrallEventCount > 20)
                {
                    m_auiEncounter[TYPE_THRALL_EVENT] = uiData;
                    m_auiEncounter[TYPE_THRALL_PART1] = uiData;
                    m_auiEncounter[TYPE_THRALL_PART2] = uiData;
                    m_auiEncounter[TYPE_THRALL_PART3] = uiData;
                    m_auiEncounter[TYPE_THRALL_PART4] = uiData;
                    debug_log("SD2: Instance Old Hillsbrad: Thrall event failed %u times. Reset instance required.", m_uiThrallEventCount);
                }
            }
            else
                m_auiEncounter[TYPE_THRALL_EVENT] = uiData;

            debug_log("SD2: Instance Old Hillsbrad: Thrall escort event adjusted to data %u.",uiData);
            break;
        }
        case TYPE_THRALL_PART1:
            m_auiEncounter[TYPE_THRALL_PART1] = uiData;
            debug_log("SD2: Instance Old Hillsbrad: Thrall event part I adjusted to data %u.",uiData);
            break;
        case TYPE_THRALL_PART2:
            m_auiEncounter[TYPE_THRALL_PART2] = uiData;
            debug_log("SD2: Instance Old Hillsbrad: Thrall event part II adjusted to data %u.",uiData);
            break;
        case TYPE_THRALL_PART3:
            m_auiEncounter[TYPE_THRALL_PART3] = uiData;
            debug_log("SD2: Instance Old Hillsbrad: Thrall event part III adjusted to data %u.",uiData);
            break;
        case TYPE_THRALL_PART4:
            m_auiEncounter[TYPE_THRALL_PART4] = uiData;
            debug_log("SD2: Instance Old Hillsbrad: Thrall event part IV adjusted to data %u.",uiData);
            break;
    }
}