Пример #1
0
InstanceSaveManager::~InstanceSaveManager()
{
    // it is undefined whether this or objectmgr will be unloaded first
    // so we must be prepared for both cases
    lock_instLists = true;
    for (InstanceSaveHashMap::iterator itr = m_instanceSaveById.begin(); itr != m_instanceSaveById.end(); ++itr)
    {
        InstanceSave* save = itr->second;

        for (InstanceSave::PlayerListType::iterator itr2 = save->m_playerList.begin(), next = itr2; itr2 != save->m_playerList.end(); itr2 = next)
        {
            ++next;
            (*itr2)->UnbindInstance(save->GetMapId(), save->GetDifficulty(), true);
        }
        save->m_playerList.clear();

        for (InstanceSave::GroupListType::iterator itr2 = save->m_groupList.begin(), next = itr2; itr2 != save->m_groupList.end(); itr2 = next)
        {
            ++next;
            (*itr2)->UnbindInstance(save->GetMapId(), save->GetDifficulty(), true);
        }
        save->m_groupList.clear();
        delete save;
    }
}
Пример #2
0
void WorldSession::HandleCalendarGetCalendar(WorldPacket &/*recv_data*/)
{
    DEBUG_LOG("WORLD: CMSG_CALENDAR_GET_CALENDAR");     // empty

    time_t cur_time = time(NULL);

    WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 500);

    // TODO: calendar invite event output
    data << (uint32) 0;                                     //invite node count
    // TODO: calendar event output
    data << (uint32) 0;                                     //event count

    data << (uint32) cur_time;                              // server time
    data << (uint32) secsToTimeBitFields(cur_time);         // current client time

    uint32 counter = 0;
    size_t p_counter = data.wpos();
    data << uint32(counter);                                // instance save count

    for(int i = 0; i < MAX_DIFFICULTY; ++i)
    {
        for (Player::BoundInstancesMap::const_iterator itr = _player->m_boundInstances[i].begin(); itr != _player->m_boundInstances[i].end(); ++itr)
        {
            if (itr->second->IsPermanent())
            {
                InstanceSave *save = itr->second;
                data << uint32(save->GetMapId());
                data << uint32(save->GetDifficulty());
                data << uint32(save->GetResetTime() - cur_time);
                data << uint64(save->GetObjectGuid().GetRawValue());
                ++counter;
            }
        }
    }
    data.put<uint32>(p_counter,counter);

    data << (uint32) sWorld.getConfig(CONFIG_UINT32_INSTANCE_RESET_CONSTANT);                            //Raid reset time is computed from this unix time, 1135753200 on offi
    
    p_counter = data.wpos();
    counter = 0;
    data << (uint32) counter;                               // raid resets

    MapEntry const *entry = NULL;
    for(uint32 i = 0; i < sMapStore.GetNumRows(); ++i)
    {
        entry = sMapStore.LookupEntry(i);
        if(!entry || !entry->IsRaid())
            continue;
        data << uint32(entry->MapID);
        data << uint32(GetMapDifficultyData(entry->MapID, Difficulty(0))->resetTime);
        data << uint32(entry->unkTime);
        ++counter;
    }
    data.put<uint32>(p_counter,counter);

    data << (uint32) 0;                                     // holidays
    SendPacket(&data);
}
Пример #3
0
void InstanceSaveManager::Unload()
{
    lock_instLists = true;
    for (InstanceSaveHashMap::iterator itr = m_instanceSaveById.begin(); itr != m_instanceSaveById.end(); ++itr)
    {
        InstanceSave* save = itr->second;

        for (InstanceSave::PlayerListType::iterator itr2 = save->m_playerList.begin(), next = itr2; itr2 != save->m_playerList.end(); itr2 = next)
        {
            ++next;
            (*itr2)->UnbindInstance(save->GetMapId(), save->GetDifficultyID(), true);
        }

        for (InstanceSave::GroupListType::iterator itr2 = save->m_groupList.begin(), next = itr2; itr2 != save->m_groupList.end(); itr2 = next)
        {
            ++next;
            (*itr2)->UnbindInstance(save->GetMapId(), save->GetDifficultyID(), true);
        }

        delete save;
    }
}
Пример #4
0
void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data)
{
    sLog.outDebug("WORLD: CMSG_CALENDAR_GET_CALENDAR");
    recv_data.hexlike();

    time_t cur_time = time(NULL);

    WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR,4+4*0+4+4*0+4+4);

    // TODO: calendar invite event output
    data << (uint32) 0;                                     //invite node count
    // TODO: calendar event output
    data << (uint32) 0;                                     //event count

    data << (uint32) 0;                                     //wtf??
    data << (uint32) secsToTimeBitFields(cur_time);         // current time

    uint32 counter = 0;
    size_t p_counter = data.wpos();
    data << uint32(counter);                                // instance save count

    for(int i = 0; i < TOTAL_DIFFICULTIES; ++i)
    {
        for (Player::BoundInstancesMap::const_iterator itr = _player->m_boundInstances[i].begin(); itr != _player->m_boundInstances[i].end(); ++itr)
        {
            if(itr->second.perm)
            {
                InstanceSave *save = itr->second.save;
                data << uint32(save->GetMapId());
                data << uint32(save->GetDifficulty());
                data << uint32(save->GetResetTime() - cur_time);
                data << uint64(save->GetInstanceId());      // instance save id as unique instance copy id
                ++counter;
            }
        }
    }
    data.put<uint32>(p_counter,counter);

    data << (uint32) 1135753200;                            //wtf?? (28.12.2005 12:00)
    data << (uint32) 0;                                     //  unk counter 4
    data << (uint32) 0;                                     // unk counter 5
    //sLog.outDebug("Sending calendar");
    //data.hexlike();
    SendPacket(&data);
}
Пример #5
0
void WorldSession::HandleCalendarGetCalendar(WorldPacket & /*recv_data*/)
{
    sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_GET_CALENDAR");     // empty

    time_t cur_time = time(NULL);

    WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 4+4*0+4+4*0+4+4);

    data << uint32(0);                                      // invite count
    /*
    for (;;)
    {
        uint64 inviteId;
        uint64 unkGuid0;
        uint8 unk1, unk2, unk3;
        uint64 creatorGuid;
    }
    */

    data << uint32(0);                                      // event count
    /*
    for (;;)
    {
        uint64 eventId;
        std::string title;                                  // 128 chars
        uint32 type;
        uint32 occurrenceTime;
        uint32 flags;
        uint32 unk4; -- possibly mapid for dungeon/raid
        uint64 creatorGuid;
    }
    */

    data << uint32(0);                                      // unk
    data << uint32(secsToTimeBitFields(cur_time));          // current time

    uint32 counter = 0;
    size_t p_counter = data.wpos();
    data << uint32(counter);                                // instance save count

    for (int i = 0; i < MAX_DIFFICULTY; ++i)
    {
        for (Player::BoundInstancesMap::const_iterator itr = _player->m_boundInstances[i].begin(); itr != _player->m_boundInstances[i].end(); ++itr)
        {
            if (itr->second.perm)
            {
                InstanceSave *save = itr->second.save;
                data << uint32(save->GetMapId());
                data << uint32(save->GetDifficulty());
                data << uint32(save->GetResetTime() - cur_time);
                data << uint64(save->GetInstanceId());      // instance save id as unique instance copy id
                ++counter;
            }
        }
    }

    data.put<uint32>(p_counter, counter);

    data << uint32(1135753200);                             // unk (28.12.2005 12:00)

    counter = 0;
    p_counter = data.wpos();
    data << uint32(counter);                                // raid reset count

    ResetTimeByMapDifficultyMap const& resets = sInstanceSaveMgr->GetResetTimeMap();
    for (ResetTimeByMapDifficultyMap::const_iterator itr = resets.begin(); itr != resets.end(); ++itr)
    {
        uint32 mapid = PAIR32_LOPART(itr->first);
        MapEntry const* mapEnt = sMapStore.LookupEntry(mapid);
        if (!mapEnt || !mapEnt->IsRaid())
            continue;

        data << uint32(mapid);
        data << uint32(itr->second - cur_time);
        data << uint32(mapEnt->unk_time);
        ++counter;
    }

    data.put<uint32>(p_counter, counter);

    data << uint32(0);                                      // holiday count?
    /*
    for (;;)
    {
        uint32 unk5, unk6, unk7, unk8, unk9;
        for (uint32 j = 0; j < 26; ++j)
        {
            uint32 unk10;
        }
        for (uint32 j = 0; j < 10; ++j)
        {
            uint32 unk11;
        }
        for (uint32 j = 0; j < 10; ++j)
        {
            uint32 unk12;
        }
        std::string holidayName;                            // 64 chars
    }
    */

    sLog->outDebug(LOG_FILTER_NETWORKIO, "Sending calendar");
    data.hexlike();
    SendPacket(&data);
}