コード例 #1
0
void CTempleGroupLevelUpData::LoadData(void)
{
    CJson jc = CJson::Load( "TempleGroupLevelUp" );

    theResDataMgr.insert(this);
    resource_clear(id_templegrouplevelup_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *ptemplegrouplevelup           = new SData;
        ptemplegrouplevelup->id                              = to_uint(aj[i]["id"]);
        ptemplegrouplevelup->level                           = to_uint(aj[i]["level"]);
        ptemplegrouplevelup->star                            = to_uint(aj[i]["star"]);
        ptemplegrouplevelup->score                           = to_uint(aj[i]["score"]);
        S2UInt32 attrs;
        for ( uint32 j = 1; j <= 6; ++j )
        {
            std::string buff = strprintf( "attrs%d", j);
            std::string value_string = aj[i][buff].asString();
            if ( 2 != sscanf( value_string.c_str(), "%u%%%u", &attrs.first, &attrs.second ) )
                break;
            ptemplegrouplevelup->attrs.push_back(attrs);
        }

        Add(ptemplegrouplevelup);
        ++count;
        LOG_DEBUG("id:%u,level:%u,star:%u,score:%u,", ptemplegrouplevelup->id, ptemplegrouplevelup->level, ptemplegrouplevelup->star, ptemplegrouplevelup->score);
    }
    LOG_INFO("TempleGroupLevelUp.xls:%d", count);
}
コード例 #2
0
void CSoldierEquipData::LoadData(void)
{
    CJson jc = CJson::Load( "SoldierEquip" );

    theResDataMgr.insert(this);
    resource_clear(id_soldierequip_list);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *psoldierequip                 = new SData;
        psoldierequip->soldier_id                      = to_uint(aj[i]["soldier_id"]);
        psoldierequip->equip_id                        = to_uint(aj[i]["equip_id"]);
        S2UInt32 effects;
        for ( uint32 j = 1; j <= 3; ++j )
        {
            std::string buff = strprintf( "effects%d", j);
            std::string value_string = aj[i][buff].asString();
            if ( 2 != sscanf( value_string.c_str(), "%u%%%u", &effects.first, &effects.second ) )
                break;
            psoldierequip->effects.push_back(effects);
        }

        Add(psoldierequip);
        ++count;
        LOG_DEBUG("soldier_id:%u,equip_id:%u,", psoldierequip->soldier_id, psoldierequip->equip_id);
    }
    LOG_INFO("SoldierEquip.xls:%d", count);
}
コード例 #3
0
void CTempleGroupData::LoadData(void)
{
    CJson jc = CJson::Load( "TempleGroup" );

    theResDataMgr.insert(this);
    resource_clear(id_templegroup_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *ptemplegroup                  = new SData;
        ptemplegroup->id                              = to_uint(aj[i]["id"]);
        ptemplegroup->init_lv                         = to_uint(aj[i]["init_lv"]);
        ptemplegroup->get_score                       = to_uint(aj[i]["get_score"]);
        S2UInt32 members;
        for ( uint32 j = 1; j <= 6; ++j )
        {
            std::string buff = strprintf( "members%d", j);
            std::string value_string = aj[i][buff].asString();
            if ( 2 != sscanf( value_string.c_str(), "%u%%%u", &members.first, &members.second ) )
                break;
            ptemplegroup->members.push_back(members);
        }

        Add(ptemplegroup);
        ++count;
        LOG_DEBUG("id:%u,init_lv:%u,get_score:%u,", ptemplegroup->id, ptemplegroup->init_lv, ptemplegroup->get_score);
    }
    LOG_INFO("TempleGroup.xls:%d", count);
}
コード例 #4
0
void CTrialRewardData::LoadData(void)
{
    CJson jc = CJson::Load( "TrialReward" );

    theResDataMgr.insert(this);
    resource_clear(id_trialreward_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *ptrialreward                  = new SData;
        ptrialreward->id                              = to_uint(aj[i]["id"]);
        ptrialreward->trial_id                        = to_uint(aj[i]["trial_id"]);
        ptrialreward->reward                          = to_uint(aj[i]["reward"]);
        std::string level_rand_string = aj[i]["level_rand"].asString();
        sscanf( level_rand_string.c_str(), "%u%%%u", &ptrialreward->level_rand.first, &ptrialreward->level_rand.second );
        ptrialreward->percent                         = to_uint(aj[i]["percent"]);
        ptrialreward->desc                            = to_str(aj[i]["desc"]);

        Add(ptrialreward);
        ++count;
        LOG_DEBUG("id:%u,trial_id:%u,reward:%u,percent:%u,desc:%s,", ptrialreward->id, ptrialreward->trial_id, ptrialreward->reward, ptrialreward->percent, ptrialreward->desc.c_str());
    }
    LOG_INFO("TrialReward.xls:%d", count);
}
コード例 #5
0
void CTempleSuitAttrData::LoadData(void)
{
    CJson jc = CJson::Load( "TempleSuitAttr" );

    theResDataMgr.insert(this);
    resource_clear(id_templesuitattr_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *ptemplesuitattr               = new SData;
        ptemplesuitattr->id                              = to_uint(aj[i]["id"]);
        ptemplesuitattr->type                            = to_uint(aj[i]["type"]);
        ptemplesuitattr->cond_exp                        = to_uint(aj[i]["cond_exp"]);
        ptemplesuitattr->cond_quality                    = to_uint(aj[i]["cond_quality"]);
        ptemplesuitattr->cond_count                      = to_uint(aj[i]["cond_count"]);
        S2UInt32 odds;
        for ( uint32 j = 1; j <= 6; ++j )
        {
            std::string buff = strprintf( "odds%d", j);
            std::string value_string = aj[i][buff].asString();
            if ( 2 != sscanf( value_string.c_str(), "%u%%%u", &odds.first, &odds.second ) )
                break;
            ptemplesuitattr->odds.push_back(odds);
        }

        Add(ptemplesuitattr);
        ++count;
        LOG_DEBUG("id:%u,type:%u,cond_exp:%u,cond_quality:%u,cond_count:%u,", ptemplesuitattr->id, ptemplesuitattr->type, ptemplesuitattr->cond_exp, ptemplesuitattr->cond_quality, ptemplesuitattr->cond_count);
    }
    LOG_INFO("TempleSuitAttr.xls:%d", count);
}
コード例 #6
0
void CVendibleData::LoadData(void)
{
    CJson jc = CJson::Load( "Vendible" );

    theResDataMgr.insert(this);
    resource_clear(id_vendible_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *pvendible                     = new SData;
        pvendible->id                              = to_uint(aj[i]["id"]);
        std::string goods_string = aj[i]["goods"].asString();
        sscanf( goods_string.c_str(), "%u%%%u%%%u", &pvendible->goods.cate, &pvendible->goods.objid, &pvendible->goods.val );
        pvendible->item_id                         = to_uint(aj[i]["item_id"]);
        pvendible->count                           = to_uint(aj[i]["count"]);
        pvendible->shop_type                       = to_uint(aj[i]["shop_type"]);
        std::string fake_price_string = aj[i]["fake_price"].asString();
        sscanf( fake_price_string.c_str(), "%u%%%u%%%u", &pvendible->fake_price.cate, &pvendible->fake_price.objid, &pvendible->fake_price.val );
        std::string price_string = aj[i]["price"].asString();
        sscanf( price_string.c_str(), "%u%%%u%%%u", &pvendible->price.cate, &pvendible->price.objid, &pvendible->price.val );
        pvendible->history_limit_count             = to_uint(aj[i]["history_limit_count"]);
        pvendible->daily_limit_count               = to_uint(aj[i]["daily_limit_count"]);
        pvendible->server_limit_count              = to_uint(aj[i]["server_limit_count"]);
        pvendible->win_times_limit                 = to_uint(aj[i]["win_times_limit"]);

        Add(pvendible);
        ++count;
        LOG_DEBUG("id:%u,item_id:%u,count:%u,shop_type:%u,history_limit_count:%u,daily_limit_count:%u,server_limit_count:%u,win_times_limit:%u,", pvendible->id, pvendible->item_id, pvendible->count, pvendible->shop_type, pvendible->history_limit_count, pvendible->daily_limit_count, pvendible->server_limit_count, pvendible->win_times_limit);
    }
    LOG_INFO("Vendible.xls:%d", count);
}
コード例 #7
0
void CSingleArenaDayRewardData::LoadData(void)
{
    CJson jc = CJson::Load( "SingleArenaDayReward" );

    theResDataMgr.insert(this);
    resource_clear(id_singlearenadayreward_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *psinglearenadayreward         = new SData;
        psinglearenadayreward->id                              = to_uint(aj[i]["id"]);
        std::string rank_string = aj[i]["rank"].asString();
        sscanf( rank_string.c_str(), "%u%%%u", &psinglearenadayreward->rank.first, &psinglearenadayreward->rank.second );
        S3UInt32 reward_;
        for ( uint32 j = 1; j <= 5; ++j )
        {
            std::string buff = strprintf( "reward_%d", j);
            std::string value_string = aj[i][buff].asString();
            if ( 3 != sscanf( value_string.c_str(), "%u%%%u%%%u", &reward_.cate, &reward_.objid, &reward_.val ) )
                break;
            psinglearenadayreward->reward_.push_back(reward_);
        }

        Add(psinglearenadayreward);
        ++count;
        LOG_DEBUG("id:%u,", psinglearenadayreward->id);
    }
    LOG_INFO("SingleArenaDayReward.xls:%d", count);
}
コード例 #8
0
void CCopyChunkData::LoadData(void)
{
    CJson jc = CJson::Load( "CopyChunk" );

    theResDataMgr.insert(this);
    resource_clear(id_copychunk_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *pcopychunk                    = new SData;
        pcopychunk->id                              = to_uint(aj[i]["id"]);
        S3UInt32 event;
        for ( uint32 j = 1; j <= 16; ++j )
        {
            std::string buff = strprintf( "event%d", j);
            std::string value_string = aj[i][buff].asString();
            if ( 3 != sscanf( value_string.c_str(), "%u%%%u%%%u", &event.cate, &event.objid, &event.val ) )
                break;
            pcopychunk->event.push_back(event);
        }

        Add(pcopychunk);
        ++count;
        LOG_DEBUG("id:%u,", pcopychunk->id);
    }
    LOG_INFO("CopyChunk.xls:%d", count);
}
コード例 #9
0
void CBuildingCoinData::LoadData(void)
{
    CJson jc = CJson::Load( "BuildingCoin" );

    theResDataMgr.insert(this);
    resource_clear(id_buildingcoin_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *pbuildingcoin                 = new SData;
        pbuildingcoin->building                        = to_uint(aj[i]["building"]);
        S3UInt32 value;
        for ( uint32 j = 1; j <= 10; ++j )
        {
            std::string buff = strprintf( "value%d", j);
            std::string value_string = aj[i][buff].asString();
            if ( 3 != sscanf( value_string.c_str(), "%u%%%u%%%u", &value.cate, &value.objid, &value.val ) )
                break;
            pbuildingcoin->value.push_back(value);
        }

        Add(pbuildingcoin);
        ++count;
        LOG_DEBUG("building:%u,", pbuildingcoin->building);
    }
    LOG_INFO("BuildingCoin.xls:%d", count);
}
コード例 #10
0
unsigned int byte_string_to_codepoint(const std::string& ch){
  unsigned int c0 = to_uint(ch[0]);
  if ((c0 & 0x80) == 0){
    return c0 & 0x7f;
  }
  else if ((c0 & 0xe0) == 0xc0){
    unsigned int value = (c0 & 0x1f) << 6;
    value |= (to_uint(ch[1]) & 0x3f);
    return value;
  }
  else if ((c0 & 0xf0) == 0xe0){
    unsigned int value = (c0 & 0xf) << 12;
    value |= (to_uint(ch[1]) & 0x3f) << 6;
    value |= (to_uint(ch[2])) & 0x3f;
    return value;
  }
  else if ((c0 & 0xf8) == 0xf0){
    return
      ((c0 & 0x7) << 18) |
      ((to_uint(ch[1]) & 0x3f) << 12) |
      ((to_uint(ch[2]) & 0x3f) << 6) |
      ((to_uint(ch[3]) & 0x3f));
  }
  assert(false);
  return 0;
}
コード例 #11
0
void CBagCountData::LoadData(void)
{
    CJson jc = CJson::Load( "BagCount" );

    theResDataMgr.insert(this);
    resource_clear(id_bagcount_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *pbagcount                     = new SData;
        pbagcount->bag_type                        = to_uint(aj[i]["bag_type"]);
        pbagcount->bag_init                        = to_uint(aj[i]["bag_init"]);

        Add(pbagcount);
        ++count;
        LOG_DEBUG("bag_type:%u,bag_init:%u,", pbagcount->bag_type, pbagcount->bag_init);
    }
    LOG_INFO("BagCount.xls:%d", count);
}
コード例 #12
0
ファイル: r_altardata.cpp プロジェクト: quinsmpang/phone-code
void CAltarData::LoadData(void)
{
    CJson jc = CJson::Load( "Altar" );

    theResDataMgr.insert(this);
    resource_clear(id_altar_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *paltar                        = new SData;
        paltar->id                              = to_uint(aj[i]["id"]);
        paltar->type                            = to_uint(aj[i]["type"]);
        paltar->lv                              = to_uint(aj[i]["lv"]);
        std::string reward_string = aj[i]["reward"].asString();
        sscanf( reward_string.c_str(), "%u%%%u%%%u", &paltar->reward.cate, &paltar->reward.objid, &paltar->reward.val );
        std::string extra_reward_string = aj[i]["extra_reward"].asString();
        sscanf( extra_reward_string.c_str(), "%u%%%u%%%u", &paltar->extra_reward.cate, &paltar->extra_reward.objid, &paltar->extra_reward.val );
        paltar->prob                            = to_uint(aj[i]["prob"]);
        paltar->is_rare                         = to_uint(aj[i]["is_rare"]);
        paltar->is_ten                          = to_uint(aj[i]["is_ten"]);

        Add(paltar);
        ++count;
        LOG_DEBUG("id:%u,type:%u,lv:%u,prob:%u,is_rare:%u,is_ten:%u,", paltar->id, paltar->type, paltar->lv, paltar->prob, paltar->is_rare, paltar->is_ten);
    }
    LOG_INFO("Altar.xls:%d", count);
}
コード例 #13
0
void CTombRewardBaseData::LoadData(void)
{
    CJson jc = CJson::Load( "TombRewardBase" );

    theResDataMgr.insert(this);
    resource_clear(id_tombrewardbase_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *ptombrewardbase               = new SData;
        ptombrewardbase->id                              = to_uint(aj[i]["id"]);
        ptombrewardbase->reward                          = to_uint(aj[i]["reward"]);
        ptombrewardbase->tomb_coin                       = to_uint(aj[i]["tomb_coin"]);
        ptombrewardbase->desc                            = to_str(aj[i]["desc"]);

        Add(ptombrewardbase);
        ++count;
        LOG_DEBUG("id:%u,reward:%u,tomb_coin:%u,desc:%s,", ptombrewardbase->id, ptombrewardbase->reward, ptombrewardbase->tomb_coin, ptombrewardbase->desc.c_str());
    }
    LOG_INFO("TombRewardBase.xls:%d", count);
}
コード例 #14
0
void CPaperCreateData::LoadData(void)
{
    CJson jc = CJson::Load( "PaperCreate" );

    theResDataMgr.insert(this);
    resource_clear(id_papercreate_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *ppapercreate                  = new SData;
        ppapercreate->item_id                         = to_uint(aj[i]["item_id"]);
        ppapercreate->active_score                    = to_uint(aj[i]["active_score"]);
        ppapercreate->level_limit                     = to_uint(aj[i]["level_limit"]);
        ppapercreate->skill_type                      = to_uint(aj[i]["skill_type"]);

        Add(ppapercreate);
        ++count;
        LOG_DEBUG("item_id:%u,active_score:%u,level_limit:%u,skill_type:%u,", ppapercreate->item_id, ppapercreate->active_score, ppapercreate->level_limit, ppapercreate->skill_type);
    }
    LOG_INFO("PaperCreate.xls:%d", count);
}
コード例 #15
0
void CSoldierStarData::LoadData(void)
{
    CJson jc = CJson::Load( "SoldierStar" );

    theResDataMgr.insert(this);
    resource_clear(id_soldierstar_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *psoldierstar                  = new SData;
        psoldierstar->lv                              = to_uint(aj[i]["lv"]);
        psoldierstar->cost                            = to_uint(aj[i]["cost"]);
        std::string need_money_string = aj[i]["need_money"].asString();
        sscanf( need_money_string.c_str(), "%u%%%u%%%u", &psoldierstar->need_money.cate, &psoldierstar->need_money.objid, &psoldierstar->need_money.val );
        psoldierstar->grow                            = to_uint(aj[i]["grow"]);

        Add(psoldierstar);
        ++count;
        LOG_DEBUG("lv:%u,cost:%u,grow:%u,", psoldierstar->lv, psoldierstar->cost, psoldierstar->grow);
    }
    LOG_INFO("SoldierStar.xls:%d", count);
}
コード例 #16
0
void COpenTargetData::LoadData(void)
{
    CJson jc = CJson::Load( "OpenTarget" );

    theResDataMgr.insert(this);
    resource_clear(id_opentarget_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *popentarget                   = new SData;
        popentarget->day                             = to_uint(aj[i]["day"]);
        popentarget->id                              = to_uint(aj[i]["id"]);
        popentarget->a_type                          = to_uint(aj[i]["a_type"]);
        popentarget->if_type                         = to_uint(aj[i]["if_type"]);
        popentarget->if_value_1                      = to_uint(aj[i]["if_value_1"]);
        popentarget->if_value_2                      = to_uint(aj[i]["if_value_2"]);
        S3UInt32 item;
        for ( uint32 j = 1; j <= 2; ++j )
        {
            std::string buff = strprintf( "item%d", j);
            std::string value_string = aj[i][buff].asString();
            if ( 3 != sscanf( value_string.c_str(), "%u%%%u%%%u", &item.cate, &item.objid, &item.val ) )
                break;
            popentarget->item.push_back(item);
        }
        std::string coin_1_string = aj[i]["coin_1"].asString();
        sscanf( coin_1_string.c_str(), "%u%%%u%%%u", &popentarget->coin_1.cate, &popentarget->coin_1.objid, &popentarget->coin_1.val );
        S3UInt32 reward;
        for ( uint32 j = 1; j <= 3; ++j )
        {
            std::string buff = strprintf( "reward%d", j);
            std::string value_string = aj[i][buff].asString();
            if ( 3 != sscanf( value_string.c_str(), "%u%%%u%%%u", &reward.cate, &reward.objid, &reward.val ) )
                break;
            popentarget->reward.push_back(reward);
        }
        popentarget->name                            = to_str(aj[i]["name"]);
        popentarget->desc                            = to_str(aj[i]["desc"]);

        Add(popentarget);
        ++count;
        LOG_DEBUG("day:%u,id:%u,a_type:%u,if_type:%u,if_value_1:%u,if_value_2:%u,name:%s,desc:%s,", popentarget->day, popentarget->id, popentarget->a_type, popentarget->if_type, popentarget->if_value_1, popentarget->if_value_2, popentarget->name.c_str(), popentarget->desc.c_str());
    }
    LOG_INFO("OpenTarget.xls:%d", count);
}
コード例 #17
0
void CEquipQualityData::LoadData(void)
{
    CJson jc = CJson::Load( "EquipQuality" );

    theResDataMgr.insert(this);
    resource_clear(id_equipquality_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *pequipquality                 = new SData;
        pequipquality->quality                         = to_uint(aj[i]["quality"]);
        pequipquality->main_min                        = to_uint(aj[i]["main_min"]);
        pequipquality->main_max                        = to_uint(aj[i]["main_max"]);
        pequipquality->slave_min                       = to_uint(aj[i]["slave_min"]);
        pequipquality->slave_max                       = to_uint(aj[i]["slave_max"]);
        pequipquality->slave_attr_num                  = to_uint(aj[i]["slave_attr_num"]);

        Add(pequipquality);
        ++count;
        LOG_DEBUG("quality:%u,main_min:%u,main_max:%u,slave_min:%u,slave_max:%u,slave_attr_num:%u,", pequipquality->quality, pequipquality->main_min, pequipquality->main_max, pequipquality->slave_min, pequipquality->slave_max, pequipquality->slave_attr_num);
    }
    LOG_INFO("EquipQuality.xls:%d", count);
}
コード例 #18
0
void CTrialMonsterLvData::LoadData(void)
{
    CJson jc = CJson::Load( "TrialMonsterLv" );

    theResDataMgr.insert(this);
    resource_clear(id_trialmonsterlv_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *ptrialmonsterlv               = new SData;
        ptrialmonsterlv->lv                              = to_uint(aj[i]["lv"]);
        ptrialmonsterlv->hp                              = to_uint(aj[i]["hp"]);
        ptrialmonsterlv->physical_ack                    = to_uint(aj[i]["physical_ack"]);
        ptrialmonsterlv->physical_def                    = to_uint(aj[i]["physical_def"]);
        ptrialmonsterlv->magic_ack                       = to_uint(aj[i]["magic_ack"]);
        ptrialmonsterlv->magic_def                       = to_uint(aj[i]["magic_def"]);
        ptrialmonsterlv->speed                           = to_uint(aj[i]["speed"]);
        ptrialmonsterlv->critper                         = to_uint(aj[i]["critper"]);
        ptrialmonsterlv->crithurt                        = to_uint(aj[i]["crithurt"]);
        ptrialmonsterlv->critper_def                     = to_uint(aj[i]["critper_def"]);
        ptrialmonsterlv->crithurt_def                    = to_uint(aj[i]["crithurt_def"]);
        ptrialmonsterlv->hitper                          = to_uint(aj[i]["hitper"]);
        ptrialmonsterlv->dodgeper                        = to_uint(aj[i]["dodgeper"]);
        ptrialmonsterlv->parryper                        = to_uint(aj[i]["parryper"]);
        ptrialmonsterlv->parryper_dec                    = to_uint(aj[i]["parryper_dec"]);
        ptrialmonsterlv->recover_critper                 = to_uint(aj[i]["recover_critper"]);
        ptrialmonsterlv->recover_critper_def             = to_uint(aj[i]["recover_critper_def"]);
        ptrialmonsterlv->recover_add_fix                 = to_uint(aj[i]["recover_add_fix"]);
        ptrialmonsterlv->recover_del_fix                 = to_uint(aj[i]["recover_del_fix"]);
        ptrialmonsterlv->recover_add_per                 = to_uint(aj[i]["recover_add_per"]);
        ptrialmonsterlv->recover_del_per                 = to_uint(aj[i]["recover_del_per"]);
        ptrialmonsterlv->rage_add_fix                    = to_uint(aj[i]["rage_add_fix"]);
        ptrialmonsterlv->rage_del_fix                    = to_uint(aj[i]["rage_del_fix"]);
        ptrialmonsterlv->rage_add_per                    = to_uint(aj[i]["rage_add_per"]);
        ptrialmonsterlv->rage_del_per                    = to_uint(aj[i]["rage_del_per"]);

        Add(ptrialmonsterlv);
        ++count;
        LOG_DEBUG("lv:%u,hp:%u,physical_ack:%u,physical_def:%u,magic_ack:%u,magic_def:%u,speed:%u,critper:%u,crithurt:%u,critper_def:%u,crithurt_def:%u,hitper:%u,dodgeper:%u,parryper:%u,parryper_dec:%u,recover_critper:%u,recover_critper_def:%u,recover_add_fix:%u,recover_del_fix:%u,recover_add_per:%u,recover_del_per:%u,rage_add_fix:%u,rage_del_fix:%u,rage_add_per:%u,rage_del_per:%u,", ptrialmonsterlv->lv, ptrialmonsterlv->hp, ptrialmonsterlv->physical_ack, ptrialmonsterlv->physical_def, ptrialmonsterlv->magic_ack, ptrialmonsterlv->magic_def, ptrialmonsterlv->speed, ptrialmonsterlv->critper, ptrialmonsterlv->crithurt, ptrialmonsterlv->critper_def, ptrialmonsterlv->crithurt_def, ptrialmonsterlv->hitper, ptrialmonsterlv->dodgeper, ptrialmonsterlv->parryper, ptrialmonsterlv->parryper_dec, ptrialmonsterlv->recover_critper, ptrialmonsterlv->recover_critper_def, ptrialmonsterlv->recover_add_fix, ptrialmonsterlv->recover_del_fix, ptrialmonsterlv->recover_add_per, ptrialmonsterlv->recover_del_per, ptrialmonsterlv->rage_add_fix, ptrialmonsterlv->rage_del_fix, ptrialmonsterlv->rage_add_per, ptrialmonsterlv->rage_del_per);
    }
    LOG_INFO("TrialMonsterLv.xls:%d", count);
}
コード例 #19
0
ファイル: r_itemdata.cpp プロジェクト: quinsmpang/phone-code
void CItemData::LoadData(void)
{
    CJson jc = CJson::Load( "Item" );

    theResDataMgr.insert(this);
    resource_clear(id_item_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *pitem                         = new SData;
        pitem->id                              = to_uint(aj[i]["id"]);
        pitem->model                           = to_uint(aj[i]["model"]);
        pitem->locale_id                       = to_uint(aj[i]["locale_id"]);
        pitem->name                            = to_str(aj[i]["name"]);
        pitem->icon                            = to_uint(aj[i]["icon"]);
        pitem->icon_resource                   = to_str(aj[i]["icon_resource"]);
        pitem->type                            = to_uint(aj[i]["type"]);
        pitem->client_type                     = to_uint(aj[i]["client_type"]);
        pitem->subclass                        = to_uint(aj[i]["subclass"]);
        pitem->equip_type                      = to_uint(aj[i]["equip_type"]);
        pitem->level                           = to_uint(aj[i]["level"]);
        pitem->limitlevel                      = to_uint(aj[i]["limitlevel"]);
        pitem->stackable                       = to_uint(aj[i]["stackable"]);
        pitem->occupation                      = to_uint(aj[i]["occupation"]);
        pitem->quality                         = to_uint(aj[i]["quality"]);
        pitem->bind                            = to_uint(aj[i]["bind"]);
        pitem->del_bind                        = to_uint(aj[i]["del_bind"]);
        pitem->due_time                        = to_uint(aj[i]["due_time"]);
        pitem->unique                          = to_uint(aj[i]["unique"]);
        pitem->drop_dead                       = to_uint(aj[i]["drop_dead"]);
        pitem->drop_logout                     = to_uint(aj[i]["drop_logout"]);
        pitem->auto_buy_gold                   = to_uint(aj[i]["auto_buy_gold"]);
        std::string coin_string = aj[i]["coin"].asString();
        sscanf( coin_string.c_str(), "%u%%%u%%%u", &pitem->coin.cate, &pitem->coin.objid, &pitem->coin.val );
        pitem->auto_sell                       = to_uint(aj[i]["auto_sell"]);
        S2UInt32 attrs;
        for ( uint32 j = 1; j <= 4; ++j )
        {
            std::string buff = strprintf( "attrs%d", j);
            std::string value_string = aj[i][buff].asString();
            if ( 2 != sscanf( value_string.c_str(), "%u%%%u", &attrs.first, &attrs.second ) )
                break;
            pitem->attrs.push_back(attrs);
        }
        S2UInt32 slave_attrs;
        for ( uint32 j = 1; j <= 6; ++j )
        {
            std::string buff = strprintf( "slave_attrs%d", j);
            std::string value_string = aj[i][buff].asString();
            if ( 2 != sscanf( value_string.c_str(), "%u%%%u", &slave_attrs.first, &slave_attrs.second ) )
                break;
            pitem->slave_attrs.push_back(slave_attrs);
        }
        pitem->multiuse                        = to_uint(aj[i]["multiuse"]);
        std::string buff_string = aj[i]["buff"].asString();
        sscanf( buff_string.c_str(), "%u%%%u%%%u", &pitem->buff.cate, &pitem->buff.objid, &pitem->buff.val );
        pitem->bias_id                         = to_uint(aj[i]["bias_id"]);
        pitem->can_exchange                    = to_uint(aj[i]["can_exchange"]);
        pitem->can_sell                        = to_uint(aj[i]["can_sell"]);
        pitem->can_drop                        = to_uint(aj[i]["can_drop"]);
        pitem->can_grant                       = to_uint(aj[i]["can_grant"]);
        pitem->cooltime                        = to_uint(aj[i]["cooltime"]);
        pitem->oddid                           = to_uint(aj[i]["oddid"]);
        pitem->marktype                        = to_uint(aj[i]["marktype"]);
        pitem->desc                            = to_str(aj[i]["desc"]);
        pitem->soul_score                      = to_uint(aj[i]["soul_score"]);
        pitem->open_cost                       = to_uint(aj[i]["open_cost"]);
        pitem->src_item_id                     = to_uint(aj[i]["src_item_id"]);
        S2UInt32 sources;
        for ( uint32 j = 1; j <= 10; ++j )
        {
            std::string buff = strprintf( "sources%d", j);
            std::string value_string = aj[i][buff].asString();
            if ( 2 != sscanf( value_string.c_str(), "%u%%%u", &sources.first, &sources.second ) )
                break;
            pitem->sources.push_back(sources);
        }

        Add(pitem);
        ++count;
        LOG_DEBUG("id:%u,model:%u,locale_id:%u,name:%s,icon:%u,icon_resource:%s,type:%u,client_type:%u,subclass:%u,equip_type:%u,level:%u,limitlevel:%u,stackable:%u,occupation:%u,quality:%u,bind:%u,del_bind:%u,due_time:%u,unique:%u,drop_dead:%u,drop_logout:%u,auto_buy_gold:%u,auto_sell:%u,multiuse:%u,bias_id:%u,can_exchange:%u,can_sell:%u,can_drop:%u,can_grant:%u,cooltime:%u,oddid:%u,marktype:%u,desc:%s,soul_score:%u,open_cost:%u,src_item_id:%u,", pitem->id, pitem->model, pitem->locale_id, pitem->name.c_str(), pitem->icon, pitem->icon_resource.c_str(), pitem->type, pitem->client_type, pitem->subclass, pitem->equip_type, pitem->level, pitem->limitlevel, pitem->stackable, pitem->occupation, pitem->quality, pitem->bind, pitem->del_bind, pitem->due_time, pitem->unique, pitem->drop_dead, pitem->drop_logout, pitem->auto_buy_gold, pitem->auto_sell, pitem->multiuse, pitem->bias_id, pitem->can_exchange, pitem->can_sell, pitem->can_drop, pitem->can_grant, pitem->cooltime, pitem->oddid, pitem->marktype, pitem->desc.c_str(), pitem->soul_score, pitem->open_cost, pitem->src_item_id);
    }
    LOG_INFO("Item.xls:%d", count);
}
コード例 #20
0
void CMonsterData::LoadData(void)
{
    CJson jc = CJson::Load( "Monster" );

    theResDataMgr.insert(this);
    resource_clear(id_monster_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *pmonster                      = new SData;
        pmonster->id                              = to_uint(aj[i]["id"]);
        pmonster->local_id                        = to_uint(aj[i]["local_id"]);
        pmonster->class_id                        = to_uint(aj[i]["class_id"]);
        pmonster->name                            = to_str(aj[i]["name"]);
        pmonster->type                            = to_uint(aj[i]["type"]);
        pmonster->equip_type                      = to_uint(aj[i]["equip_type"]);
        pmonster->level                           = to_uint(aj[i]["level"]);
        pmonster->animation_name                  = to_str(aj[i]["animation_name"]);
        pmonster->music                           = to_str(aj[i]["music"]);
        pmonster->avatar                          = to_uint(aj[i]["avatar"]);
        pmonster->occupation                      = to_uint(aj[i]["occupation"]);
        pmonster->quality                         = to_uint(aj[i]["quality"]);
        uint32 packets;
        for ( uint32 j = 1; j <= 5; ++j )
        {
            std::string buff = strprintf( "packets%d", j);
            packets = to_uint(aj[i][buff]);
            pmonster->packets.push_back(packets);
        }
        pmonster->fight_value                     = to_uint(aj[i]["fight_value"]);
        pmonster->initial_rage                    = to_uint(aj[i]["initial_rage"]);
        pmonster->hp                              = to_uint(aj[i]["hp"]);
        pmonster->physical_ack                    = to_uint(aj[i]["physical_ack"]);
        pmonster->physical_def                    = to_uint(aj[i]["physical_def"]);
        pmonster->magic_ack                       = to_uint(aj[i]["magic_ack"]);
        pmonster->magic_def                       = to_uint(aj[i]["magic_def"]);
        pmonster->speed                           = to_uint(aj[i]["speed"]);
        pmonster->critper                         = to_uint(aj[i]["critper"]);
        pmonster->crithurt                        = to_uint(aj[i]["crithurt"]);
        pmonster->critper_def                     = to_uint(aj[i]["critper_def"]);
        pmonster->crithurt_def                    = to_uint(aj[i]["crithurt_def"]);
        pmonster->hitper                          = to_uint(aj[i]["hitper"]);
        pmonster->dodgeper                        = to_uint(aj[i]["dodgeper"]);
        pmonster->parryper                        = to_uint(aj[i]["parryper"]);
        pmonster->parryper_dec                    = to_uint(aj[i]["parryper_dec"]);
        pmonster->stun_def                        = to_uint(aj[i]["stun_def"]);
        pmonster->silent_def                      = to_uint(aj[i]["silent_def"]);
        pmonster->weak_def                        = to_uint(aj[i]["weak_def"]);
        pmonster->fire_def                        = to_uint(aj[i]["fire_def"]);
        pmonster->rebound_physical_ack            = to_uint(aj[i]["rebound_physical_ack"]);
        pmonster->rebound_magic_ack               = to_uint(aj[i]["rebound_magic_ack"]);
        S2UInt32 odds;
        for ( uint32 j = 1; j <= 7; ++j )
        {
            std::string buff = strprintf( "odds%d", j);
            std::string value_string = aj[i][buff].asString();
            if ( 2 != sscanf( value_string.c_str(), "%u%%%u", &odds.first, &odds.second ) )
                break;
            pmonster->odds.push_back(odds);
        }
        S2UInt32 skills;
        for ( uint32 j = 1; j <= 6; ++j )
        {
            std::string buff = strprintf( "skills%d", j);
            std::string value_string = aj[i][buff].asString();
            if ( 2 != sscanf( value_string.c_str(), "%u%%%u", &skills.first, &skills.second ) )
                break;
            pmonster->skills.push_back(skills);
        }
        pmonster->money                           = to_uint(aj[i]["money"]);
        pmonster->exp                             = to_uint(aj[i]["exp"]);
        pmonster->desc                            = to_str(aj[i]["desc"]);
        pmonster->hp_layer                        = to_uint(aj[i]["hp_layer"]);
        uint32 fight_monster;
        for ( uint32 j = 1; j <= 5; ++j )
        {
            std::string buff = strprintf( "fight_monster%d", j);
            fight_monster = to_uint(aj[i][buff]);
            pmonster->fight_monster.push_back(fight_monster);
        }
        pmonster->help_monster                    = to_uint(aj[i]["help_monster"]);
        pmonster->strength                        = to_uint(aj[i]["strength"]);
        pmonster->recover_critper                 = to_uint(aj[i]["recover_critper"]);
        pmonster->recover_critper_def             = to_uint(aj[i]["recover_critper_def"]);
        pmonster->recover_add_fix                 = to_uint(aj[i]["recover_add_fix"]);
        pmonster->recover_del_fix                 = to_uint(aj[i]["recover_del_fix"]);
        pmonster->recover_add_per                 = to_uint(aj[i]["recover_add_per"]);
        pmonster->recover_del_per                 = to_uint(aj[i]["recover_del_per"]);
        pmonster->rage_add_fix                    = to_uint(aj[i]["rage_add_fix"]);
        pmonster->rage_del_fix                    = to_uint(aj[i]["rage_del_fix"]);
        pmonster->rage_add_per                    = to_uint(aj[i]["rage_add_per"]);
        pmonster->rage_del_per                    = to_uint(aj[i]["rage_del_per"]);

        Add(pmonster);
        ++count;
        LOG_DEBUG("id:%u,local_id:%u,class_id:%u,name:%s,type:%u,equip_type:%u,level:%u,animation_name:%s,music:%s,avatar:%u,occupation:%u,quality:%u,fight_value:%u,initial_rage:%u,hp:%u,physical_ack:%u,physical_def:%u,magic_ack:%u,magic_def:%u,speed:%u,critper:%u,crithurt:%u,critper_def:%u,crithurt_def:%u,hitper:%u,dodgeper:%u,parryper:%u,parryper_dec:%u,stun_def:%u,silent_def:%u,weak_def:%u,fire_def:%u,rebound_physical_ack:%u,rebound_magic_ack:%u,money:%u,exp:%u,desc:%s,hp_layer:%u,help_monster:%u,strength:%u,recover_critper:%u,recover_critper_def:%u,recover_add_fix:%u,recover_del_fix:%u,recover_add_per:%u,recover_del_per:%u,rage_add_fix:%u,rage_del_fix:%u,rage_add_per:%u,rage_del_per:%u,", pmonster->id, pmonster->local_id, pmonster->class_id, pmonster->name.c_str(), pmonster->type, pmonster->equip_type, pmonster->level, pmonster->animation_name.c_str(), pmonster->music.c_str(), pmonster->avatar, pmonster->occupation, pmonster->quality, pmonster->fight_value, pmonster->initial_rage, pmonster->hp, pmonster->physical_ack, pmonster->physical_def, pmonster->magic_ack, pmonster->magic_def, pmonster->speed, pmonster->critper, pmonster->crithurt, pmonster->critper_def, pmonster->crithurt_def, pmonster->hitper, pmonster->dodgeper, pmonster->parryper, pmonster->parryper_dec, pmonster->stun_def, pmonster->silent_def, pmonster->weak_def, pmonster->fire_def, pmonster->rebound_physical_ack, pmonster->rebound_magic_ack, pmonster->money, pmonster->exp, pmonster->desc.c_str(), pmonster->hp_layer, pmonster->help_monster, pmonster->strength, pmonster->recover_critper, pmonster->recover_critper_def, pmonster->recover_add_fix, pmonster->recover_del_fix, pmonster->recover_add_per, pmonster->recover_del_per, pmonster->rage_add_fix, pmonster->rage_del_fix, pmonster->rage_add_per, pmonster->rage_del_per);
    }
    LOG_INFO("Monster.xls:%d", count);
}
コード例 #21
0
void CSoldierLvData::LoadData(void)
{
    CJson jc = CJson::Load( "SoldierLv" );

    theResDataMgr.insert(this);
    resource_clear(id_soldierlv_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *psoldierlv                    = new SData;
        psoldierlv->lv                              = to_uint(aj[i]["lv"]);
        std::string cost_string = aj[i]["cost"].asString();
        sscanf( cost_string.c_str(), "%u%%%u%%%u", &psoldierlv->cost.cate, &psoldierlv->cost.objid, &psoldierlv->cost.val );
        psoldierlv->hp                              = to_uint(aj[i]["hp"]);
        psoldierlv->physical_ack                    = to_uint(aj[i]["physical_ack"]);
        psoldierlv->physical_def                    = to_uint(aj[i]["physical_def"]);
        psoldierlv->magic_ack                       = to_uint(aj[i]["magic_ack"]);
        psoldierlv->magic_def                       = to_uint(aj[i]["magic_def"]);
        psoldierlv->speed                           = to_uint(aj[i]["speed"]);
        psoldierlv->critper                         = to_uint(aj[i]["critper"]);
        psoldierlv->crithurt                        = to_uint(aj[i]["crithurt"]);
        psoldierlv->critper_def                     = to_uint(aj[i]["critper_def"]);
        psoldierlv->crithurt_def                    = to_uint(aj[i]["crithurt_def"]);
        psoldierlv->hitper                          = to_uint(aj[i]["hitper"]);
        psoldierlv->dodgeper                        = to_uint(aj[i]["dodgeper"]);
        psoldierlv->parryper                        = to_uint(aj[i]["parryper"]);
        psoldierlv->parryper_dec                    = to_uint(aj[i]["parryper_dec"]);
        psoldierlv->recover_critper                 = to_uint(aj[i]["recover_critper"]);
        psoldierlv->recover_critper_def             = to_uint(aj[i]["recover_critper_def"]);
        psoldierlv->recover_add_fix                 = to_uint(aj[i]["recover_add_fix"]);
        psoldierlv->recover_del_fix                 = to_uint(aj[i]["recover_del_fix"]);
        psoldierlv->recover_add_per                 = to_uint(aj[i]["recover_add_per"]);
        psoldierlv->recover_del_per                 = to_uint(aj[i]["recover_del_per"]);
        psoldierlv->rage_add_fix                    = to_uint(aj[i]["rage_add_fix"]);
        psoldierlv->rage_del_fix                    = to_uint(aj[i]["rage_del_fix"]);
        psoldierlv->rage_add_per                    = to_uint(aj[i]["rage_add_per"]);
        psoldierlv->rage_del_per                    = to_uint(aj[i]["rage_del_per"]);

        Add(psoldierlv);
        ++count;
        LOG_DEBUG("lv:%u,hp:%u,physical_ack:%u,physical_def:%u,magic_ack:%u,magic_def:%u,speed:%u,critper:%u,crithurt:%u,critper_def:%u,crithurt_def:%u,hitper:%u,dodgeper:%u,parryper:%u,parryper_dec:%u,recover_critper:%u,recover_critper_def:%u,recover_add_fix:%u,recover_del_fix:%u,recover_add_per:%u,recover_del_per:%u,rage_add_fix:%u,rage_del_fix:%u,rage_add_per:%u,rage_del_per:%u,", psoldierlv->lv, psoldierlv->hp, psoldierlv->physical_ack, psoldierlv->physical_def, psoldierlv->magic_ack, psoldierlv->magic_def, psoldierlv->speed, psoldierlv->critper, psoldierlv->crithurt, psoldierlv->critper_def, psoldierlv->crithurt_def, psoldierlv->hitper, psoldierlv->dodgeper, psoldierlv->parryper, psoldierlv->parryper_dec, psoldierlv->recover_critper, psoldierlv->recover_critper_def, psoldierlv->recover_add_fix, psoldierlv->recover_del_fix, psoldierlv->recover_add_per, psoldierlv->recover_del_per, psoldierlv->rage_add_fix, psoldierlv->rage_del_fix, psoldierlv->rage_add_per, psoldierlv->rage_del_per);
    }
    LOG_INFO("SoldierLv.xls:%d", count);
}
コード例 #22
0
void
findcenter (gsl_matrix * m, unsigned int *i_max_ptr, unsigned int *j_max_ptr,
            double *max_ptr)
{
    double masstotal = 0, mass = 0;

    double ci = 0.;
    double cj = 0.;

    //sometimes a negative atom number shows up in the column density
    //this affects the center of mass calculation, so whenever a pixel
    //with a negative number of atoms is found it is taken as zero
    //for the center of mass estimate

    for (unsigned int i = 0; i < m->size1; i++)
        for (unsigned int j = 0; j < m->size2; j++)
        {
            mass = gsl_matrix_get (m, i, j);
            mass = mass > 0 ? mass : 0.;
            masstotal += mass;
            ci += mass * i;
            cj += mass * j;
        }
    ci = ci / masstotal;
    cj = cj / masstotal;

    if (VERBOSE)
    {
        cout << endl << "Center of mass results:  ci = " << ci << ",  cj = "
             << cj << endl;
    }

    unsigned int i_max = 0;
    unsigned int j_max = 0;
    double max = -1.e4;


    i_max = to_uint (ci);
    j_max = to_uint (cj);

    if (VERBOSE)
    {
        cout << "Conversion to unsigned int:  ci = " << i_max << ",  cj = "
             << j_max << endl;
    }

    max = gsl_matrix_get (m, i_max, j_max);

    if (i_max == 0 || j_max == 0)
    {
        cout << "error finding center: could not find center" << endl;
        return;
    }
    if (max <= 0.)
    {
        if (VERBOSE)
            cout << endl <<
                 "Warning: center pixel has negative atom number, max overridden" <<
                 endl;
        max = 10.;
    }
    *i_max_ptr = i_max;
    *j_max_ptr = j_max;
    *max_ptr = max;
    if (VERBOSE)
    {
        cout << "\tCenter found at ( " << i_max << ", " << j_max <<
             " ) = " << max << endl;;
    }
    return;
}
コード例 #23
0
ファイル: Value.hpp プロジェクト: jtfrom9/cppv
 operator unsigned int() const {
     return to_uint();
 }
コード例 #24
0
void CSoldierData::LoadData(void)
{
    CJson jc = CJson::Load( "Soldier" );

    theResDataMgr.insert(this);
    resource_clear(id_soldier_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *psoldier                      = new SData;
        psoldier->id                              = to_uint(aj[i]["id"]);
        psoldier->locale_id                       = to_uint(aj[i]["locale_id"]);
        psoldier->name                            = to_str(aj[i]["name"]);
        psoldier->star                            = to_uint(aj[i]["star"]);
        psoldier->quality                         = to_uint(aj[i]["quality"]);
        psoldier->gender                          = to_uint(aj[i]["gender"]);
        psoldier->equip_type                      = to_uint(aj[i]["equip_type"]);
        psoldier->animation_name                  = to_str(aj[i]["animation_name"]);
        psoldier->avatar                          = to_uint(aj[i]["avatar"]);
        psoldier->occupation                      = to_uint(aj[i]["occupation"]);
        psoldier->formation                       = to_uint(aj[i]["formation"]);
        psoldier->race                            = to_uint(aj[i]["race"]);
        psoldier->source                          = to_uint(aj[i]["source"]);
        std::string star_cost_string = aj[i]["star_cost"].asString();
        sscanf( star_cost_string.c_str(), "%u%%%u%%%u", &psoldier->star_cost.cate, &psoldier->star_cost.objid, &psoldier->star_cost.val );
        std::string exist_give_string = aj[i]["exist_give"].asString();
        sscanf( exist_give_string.c_str(), "%u%%%u%%%u", &psoldier->exist_give.cate, &psoldier->exist_give.objid, &psoldier->exist_give.val );
        S2UInt32 get_attr;
        for ( uint32 j = 1; j <= 6; ++j )
        {
            std::string buff = strprintf( "get_attr%d", j);
            std::string value_string = aj[i][buff].asString();
            if ( 2 != sscanf( value_string.c_str(), "%u%%%u", &get_attr.first, &get_attr.second ) )
                break;
            psoldier->get_attr.push_back(get_attr);
        }
        psoldier->get_score                       = to_uint(aj[i]["get_score"]);
        S2UInt32 skills;
        for ( uint32 j = 1; j <= 6; ++j )
        {
            std::string buff = strprintf( "skills%d", j);
            std::string value_string = aj[i][buff].asString();
            if ( 2 != sscanf( value_string.c_str(), "%u%%%u", &skills.first, &skills.second ) )
                break;
            psoldier->skills.push_back(skills);
        }
        S2UInt32 odds;
        for ( uint32 j = 1; j <= 4; ++j )
        {
            std::string buff = strprintf( "odds%d", j);
            std::string value_string = aj[i][buff].asString();
            if ( 2 != sscanf( value_string.c_str(), "%u%%%u", &odds.first, &odds.second ) )
                break;
            psoldier->odds.push_back(odds);
        }
        std::string sounds;
        for ( uint32 j = 1; j <= 3; ++j )
        {
            std::string buff = strprintf( "sounds%d", j);
            sounds = to_str(aj[i][buff]);
            psoldier->sounds.push_back(sounds);
        }
        psoldier->desc                            = to_str(aj[i]["desc"]);

        Add(psoldier);
        ++count;
        LOG_DEBUG("id:%u,locale_id:%u,name:%s,star:%u,quality:%u,gender:%u,equip_type:%u,animation_name:%s,avatar:%u,occupation:%u,formation:%u,race:%u,source:%u,get_score:%u,desc:%s,", psoldier->id, psoldier->locale_id, psoldier->name.c_str(), psoldier->star, psoldier->quality, psoldier->gender, psoldier->equip_type, psoldier->animation_name.c_str(), psoldier->avatar, psoldier->occupation, psoldier->formation, psoldier->race, psoldier->source, psoldier->get_score, psoldier->desc.c_str());
    }
    LOG_INFO("Soldier.xls:%d", count);
}
コード例 #25
0
ファイル: r_leveldata.cpp プロジェクト: quinsmpang/phone-code
void CLevelData::LoadData(void)
{
    CJson jc = CJson::Load( "Level" );

    theResDataMgr.insert(this);
    resource_clear(id_level_map);
    int32 count = 0;
    const Json::Value aj = jc["Array"];
    for ( uint32 i = 0; i != aj.size(); ++i)
    {
        SData *plevel                        = new SData;
        plevel->level                           = to_uint(aj[i]["level"]);
        plevel->team_xp                         = to_uint(aj[i]["team_xp"]);
        plevel->vip_xp                          = to_uint(aj[i]["vip_xp"]);
        plevel->strength                        = to_uint(aj[i]["strength"]);
        plevel->strength_buy                    = to_uint(aj[i]["strength_buy"]);
        plevel->strength_price                  = to_uint(aj[i]["strength_price"]);
        plevel->strength_give                   = to_uint(aj[i]["strength_give"]);
        plevel->formation_count                 = to_uint(aj[i]["formation_count"]);
        plevel->formation_totem_count            = to_uint(aj[i]["formation_totem_count"]);
        plevel->soldier_lv                      = to_uint(aj[i]["soldier_lv"]);
        plevel->active_score_max                = to_uint(aj[i]["active_score_max"]);
        plevel->building_gold_times             = to_uint(aj[i]["building_gold_times"]);
        plevel->building_water_times            = to_uint(aj[i]["building_water_times"]);
        plevel->singlearena_times               = to_uint(aj[i]["singlearena_times"]);
        plevel->singlearena_price               = to_uint(aj[i]["singlearena_price"]);
        std::string task_30001_string = aj[i]["task_30001"].asString();
        sscanf( task_30001_string.c_str(), "%u%%%u%%%u", &plevel->task_30001.cate, &plevel->task_30001.objid, &plevel->task_30001.val );
        std::string task_30002_string = aj[i]["task_30002"].asString();
        sscanf( task_30002_string.c_str(), "%u%%%u%%%u", &plevel->task_30002.cate, &plevel->task_30002.objid, &plevel->task_30002.val );
        plevel->copy_normal_reset_times            = to_uint(aj[i]["copy_normal_reset_times"]);
        plevel->copy_elite_reset_times            = to_uint(aj[i]["copy_elite_reset_times"]);
        plevel->copy_normal_reset_price            = to_uint(aj[i]["copy_normal_reset_price"]);
        plevel->copy_elite_reset_price            = to_uint(aj[i]["copy_elite_reset_price"]);
        plevel->open_desc                       = to_str(aj[i]["open_desc"]);
        plevel->tomb_ratio                      = to_uint(aj[i]["tomb_ratio"]);
        plevel->vip_rights_desc                 = to_str(aj[i]["vip_rights_desc"]);
        plevel->glyph_lv                        = to_uint(aj[i]["glyph_lv"]);

        Add(plevel);
        ++count;
        LOG_DEBUG("level:%u,team_xp:%u,vip_xp:%u,strength:%u,strength_buy:%u,strength_price:%u,strength_give:%u,formation_count:%u,formation_totem_count:%u,soldier_lv:%u,active_score_max:%u,building_gold_times:%u,building_water_times:%u,singlearena_times:%u,singlearena_price:%u,copy_normal_reset_times:%u,copy_elite_reset_times:%u,copy_normal_reset_price:%u,copy_elite_reset_price:%u,open_desc:%s,tomb_ratio:%u,vip_rights_desc:%s,glyph_lv:%u,", plevel->level, plevel->team_xp, plevel->vip_xp, plevel->strength, plevel->strength_buy, plevel->strength_price, plevel->strength_give, plevel->formation_count, plevel->formation_totem_count, plevel->soldier_lv, plevel->active_score_max, plevel->building_gold_times, plevel->building_water_times, plevel->singlearena_times, plevel->singlearena_price, plevel->copy_normal_reset_times, plevel->copy_elite_reset_times, plevel->copy_normal_reset_price, plevel->copy_elite_reset_price, plevel->open_desc.c_str(), plevel->tomb_ratio, plevel->vip_rights_desc.c_str(), plevel->glyph_lv);
    }
    LOG_INFO("Level.xls:%d", count);
}