Пример #1
0
void Character::GetCharBuildInfo(BitStream &src)
{
    src.GetString(m_char_data.m_class_name);
    src.GetString(m_char_data.m_origin_name);

    qInfo() << "Loading Starting Character Settings...";
    QSettings config(Settings::getSettingsPath(),QSettings::IniFormat,nullptr);

    config.beginGroup("StartingCharacter");
        QRegExp space("\\s");
        QStringList inherent_and_preorders = config.value(QStringLiteral("inherent_powers"), "Brawl").toString().remove(space).split(',');
        QStringList starting_temps = config.value(QStringLiteral("starting_temps"), "EMP_Glove").toString().remove(space).split(',');
        QStringList starting_insps = config.value(QStringLiteral("starting_inspirations"), "Resurgence").toString().remove(space).split(',');
        uint startlevel = config.value(QStringLiteral("starting_level"), "1").toUInt() -1; //convert from 1-50 to 0-49
        uint startinf = config.value(QStringLiteral("starting_inf"), "0").toUInt();
    config.endGroup();

    m_char_data.m_level = startlevel;
    m_char_data.m_influence = startinf;

    // Temporary Powers MUST come first (must be idx 0)
    addStartingPowers(QStringLiteral("Temporary_Powers"), QStringLiteral("Temporary_Powers"), starting_temps);
    addStartingPowers(QStringLiteral("Inherent"), QStringLiteral("Inherent"), inherent_and_preorders);
    getPowerFromBuildInfo(src);     // primary, secondary

    // Now that character is created. Finalize level and update hp and end
    finalizeLevel();
    setHPToMax(*this); // set max hp
    setEndToMax(*this); // set max end

    // This must come after finalize
    addStartingInspirations(starting_insps);      // resurgence and phenomenal_luck

    m_char_data.m_trays.serializefrom(src);
}
Пример #2
0
void UpdateServer::serializefrom( BitStream &src )
{
    m_build_date = src.GetPackedBits(1);
    /*uint32_t t =*/ src.GetPackedBits(1);
    src.GetString(currentVersion);
    src.GetBitArray(clientInfo,sizeof(clientInfo)*8);
    authID = src.GetPackedBits(1);
    authCookie = src.GetBits(32);
    src.GetString(accountName);
}
Пример #3
0
//TODO: use generic ReadableStructures here ?
void RecvInputState::recv_client_opts(BitStream &bs)
{
    ClientOptions opts;
    ClientOption *entry;
    glm::vec3 vec;
    int cmd_idx;

    while((cmd_idx = bs.GetPackedBits(1))!=0)
    {
        entry=opts.get(cmd_idx-1);
        if (!entry)
        {
            qWarning() << "recv_client_opts missing opt for cmd index" << cmd_idx-1;
            continue;
        }
        for(ClientOption::Arg &arg : entry->m_args)
        {
            switch ( arg.type )
            {
                case ClientOption::t_int:
                {
                    *((int32_t *)arg.tgt) = bs.GetPackedBits(1);
                    break;
                }
                case ClientOption::t_float:
                {
                    *((float *)arg.tgt)=bs.GetFloat();
                    break;
                }
                case ClientOption::t_quant_angle:
                {
                    float * tgt_angle = (float *)arg.tgt;
                    *tgt_angle = AngleDequantize(bs.GetBits(14),14);
                    qCDebug(logInput, "Quant angle res:%f", *tgt_angle); //dequantized angle
                    break;
                }
                case ClientOption::t_string:
                case ClientOption::t_sentence:
                {
                    QString v;
                    bs.GetString(v);
                    break;
                }
                case ClientOption::t_vec3:
                {
                    for (int j = 0; j < 3; ++j )
                    {
                        vec[j] = bs.GetFloat();
                    }
                    break;
                }
                default:
                    continue;
            }
        }
    }
}
Пример #4
0
//TODO: use generic ReadableStructures here ?
void InputState::recv_client_opts(BitStream &bs)
{
    ClientOptions opts;
    ClientOption *entry;
    int opt_idx=0;
    int some_idx = bs.GetPackedBits(1);
    entry=opts.get(opt_idx)-1;
    Vector3 vec;
    while(some_idx!=0)
    {
        for(size_t i=0; i<entry->m_args.size(); i++)
        {
            ClientOption::Arg &arg=entry->m_args[i];
            switch ( arg.type )
            {
                case ClientOption::t_int:
                {
                    *((int32_t *)arg.tgt) = bs.GetPackedBits(1);
                    break;
                }
                case ClientOption::t_float:
                {
                    *((float *)arg.tgt)=bs.GetFloat();
                    break;
                }
                case ClientOption::t_quant_angle:
                {
                    printf("Quant:%d\n",bs.GetBits(14)); //quantized angle
                    break;
                }
                case ClientOption::t_string:
                case 4:
                {
                    std::string v;
                    bs.GetString(v);
                    break;
                }
                case ClientOption::t_vec3:
                {
                    for (int j = 0; j < 3; ++j )
                    {
                        vec.v[j] = bs.GetFloat();
                    }
                    break;
                }
                default:
                    continue;
            }
        }
        some_idx = bs.GetPackedBits(1)-1;
        opt_idx++;
        entry=opts.get(opt_idx);
    }
}
Пример #5
0
int NetCommand::serializefrom( BitStream &bs )
{
    for(size_t i=0; i<m_arguments.size(); i++)
    {
        switch(m_arguments[i].type)
        {
            case 1:
            {
                int res=bs.GetPackedBits(1);
                if(m_arguments[i].targetvar)
                    *((int *)m_arguments[i].targetvar) = res;
                qDebug("CommRecv %s:arg%zu : %d", qPrintable(m_name),i,res);
                break;
            }
            case 2:
            case 4:
            {
                QString res;
                bs.GetString(res); // postprocessed
                qDebug("CommRecv %s:arg%zu : %s", qPrintable(m_name),i,qPrintable(res));
                break;
            }
            case 3:
            {
                float res = bs.GetFloat();
                qDebug("CommRecv %s:arg%zu : %f", qPrintable(m_name),i,res);
                break;
            }
            case 5:
            {
                float res1 = normalizedCircumferenceToFloat(bs.GetBits(14),14);
                qDebug("CommRecv %s:arg%zu : %f", qPrintable(m_name),i,res1);
                break;
            }
            case 6:
                break;
            case 7:
            {
                float res1 = bs.GetFloat();
                float res2 = bs.GetFloat();
                float res3 = bs.GetFloat();
                qDebug("CommRecv %s:arg%zu : %f,%f,%f", qPrintable(m_name),i,res1,res2,res3);
                break;
            }
        }
    }
    return 1;
}
Пример #6
0
std::string NetStructure::getCached_String( BitStream &bs )
{
    std::ostringstream strm;
    std::string tgt("");
    bool in_cache= bs.GetBits(1);
    if(in_cache)
    {
        int in_cache_idx = bs.GetPackedBits(stringcachecount_bitlength);
        std::string *kv = WorldData::instance()->strings().key_for_idx(in_cache_idx);
        if(kv)
            tgt=*kv;
        return tgt;
    }
    else
        bs.GetString(tgt);
    return tgt;
}
Пример #7
0
void GameEntryError::serializefrom( BitStream &tgt )
{
    tgt.GetString(m_error);
}