예제 #1
0
void Battlenet::Session::HandleListSubscribeRequest(WoWRealm::ListSubscribeRequest const& /*listSubscribeRequest*/)
{
    WoWRealm::ListSubscribeResponse* listSubscribeResponse = new WoWRealm::ListSubscribeResponse();

    PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_CHARACTER_COUNTS);
    stmt->setUInt32(0, _gameAccountId);

    if (PreparedQueryResult countResult = LoginDatabase.Query(stmt))
    {
        do
        {
            Field* fields = countResult->Fetch();
            uint32 build = fields[4].GetUInt32();
            listSubscribeResponse->CharacterCounts.push_back({ RealmId(fields[2].GetUInt8(), fields[3].GetUInt8(), fields[1].GetUInt32(), (_build != build ? build : 0)), fields[0].GetUInt8() });
        } while (countResult->NextRow());
    }

    for (RealmList::RealmMap::value_type const& i : sRealmList->GetRealms())
        listSubscribeResponse->RealmData.push_back(BuildListUpdate(&i.second));

    listSubscribeResponse->RealmData.push_back(new WoWRealm::ListComplete());

    AsyncWrite(listSubscribeResponse);
    _subscribedToRealmListUpdates = true;
}
예제 #2
0
void Battlenet::Session::HandleListSubscribeRequestCallback(PreparedQueryResult result)
{
    WoWRealm::ListSubscribeResponse* listSubscribeResponse = new WoWRealm::ListSubscribeResponse();

    if (result)
    {
        do
        {
            Field* fields = result->Fetch();
            uint32 build = fields[4].GetUInt32();
            listSubscribeResponse->CharacterCounts.push_back({ RealmId(fields[2].GetUInt8(), fields[3].GetUInt8(), fields[1].GetUInt32(), (_build != build ? build : 0)), fields[0].GetUInt8() });
        } while (result->NextRow());
    }

    for (RealmList::RealmMap::value_type const& i : sRealmList->GetRealms())
        listSubscribeResponse->RealmData.push_back(BuildListUpdate(&i.second));

    listSubscribeResponse->RealmData.push_back(new WoWRealm::ListComplete());

    AsyncWrite(listSubscribeResponse);
    _subscribedToRealmListUpdates = true;
}