当前位置: 首页>>代码示例>>C++>>正文


C++ item_t::slot_name方法代码示例

本文整理汇总了C++中item_t::slot_name方法的典型用法代码示例。如果您正苦于以下问题:C++ item_t::slot_name方法的具体用法?C++ item_t::slot_name怎么用?C++ item_t::slot_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在item_t的用法示例。


在下文中一共展示了item_t::slot_name方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: parse_item_stats

bool armory_t::parse_item_stats( item_t& item,
                                 xml_node_t* xml )
{
    std::string& s = item.armory_stats_str;
    s.clear();

    std::string value;
    if ( xml_t::get_value( value, xml, "bonusStrength/."  ) ) s += "_" + value + "str";
    if ( xml_t::get_value( value, xml, "bonusAgility/."   ) ) s += "_" + value + "agi";
    if ( xml_t::get_value( value, xml, "bonusStamina/."   ) ) s += "_" + value + "sta";
    if ( xml_t::get_value( value, xml, "bonusIntellect/." ) ) s += "_" + value + "int";
    if ( xml_t::get_value( value, xml, "bonusSpirit/."    ) ) s += "_" + value + "spi";

    if ( xml_t::get_value( value, xml, "bonusSpellPower/."       ) ) s += "_" + value + "sp";
    if ( xml_t::get_value( value, xml, "bonusSpellPenetration/." ) ) s += "_" + value + "spen";
    if ( xml_t::get_value( value, xml, "bonusManaRegen/."        ) ) s += "_" + value + "mp5";

    if ( xml_t::get_value( value, xml, "bonusAttackPower/."      ) ) s += "_" + value + "ap";
    if ( xml_t::get_value( value, xml, "bonusExpertiseRating/."  ) ) s += "_" + value + "exp";
    if ( xml_t::get_value( value, xml, "bonusArmorPenetration/." ) ) s += "_" + value + "arpen";

    if ( xml_t::get_value( value, xml, "bonusHitRating/."   ) ) s += "_" + value + "hit";
    if ( xml_t::get_value( value, xml, "bonusCritRating/."  ) ) s += "_" + value + "crit";
    if ( xml_t::get_value( value, xml, "bonusHasteRating/." ) ) s += "_" + value + "haste";

    if ( xml_t::get_value( value, xml, "armor/."                   ) ) s += "_" + value + "armor";
    if ( xml_t::get_value( value, xml, "bonusDefenseSkillRating/." ) ) s += "_" + value + "def";
    if ( xml_t::get_value( value, xml, "bonusDodgeRating/."        ) ) s += "_" + value + "dodge";
    if ( xml_t::get_value( value, xml, "bonusParryRating/."        ) ) s += "_" + value + "parry";
    if ( xml_t::get_value( value, xml, "bonusBlockRating/."        ) ) s += "_" + value + "block";
    if ( xml_t::get_value( value, xml, "blockValue/."              ) ) s += "_" + value + "blockv";

    xml_node_t* spell_data = xml_t::get_node( xml, "spellData" );
    if ( spell_data )
    {
        std::vector<xml_node_t*> spell_nodes;
        int num_spells = xml_t::get_nodes( spell_nodes, spell_data, "spell" );
        for ( int i=0; i < num_spells; i++ )
        {
            if ( xml_t::get_value( value, spell_nodes[ i ], "trigger/." ) && ( value == "1" ) )
            {
                if ( xml_t::get_value( value, spell_nodes[ i ], "desc/." ) )
                {
                    armory_t::fuzzy_stats( s, value );
                }
            }
        }
    }

    if ( ! s.empty() )
    {
        s.erase( 0, 1 );
        armory_t::format( s );
    }

    if ( item.sim -> debug && ! s.empty() )
        log_t::output( item.sim, "%s %s %s armory_stats=%s", item.player -> name(), item.slot_name(), item.name(), s.c_str() );

    return true;
}
开发者ID:shunter,项目名称:SimcraftGearOptimizer,代码行数:60,代码来源:sc_armory.cpp

示例2: download_slot

bool item_database_t::download_slot( item_t&            item,
                                     const std::string& item_id,
                                     const std::string& enchant_id,
                                     const std::string& addon_id,
                                     const std::string& reforge_id,
                                     const std::string& rsuffix_id,
                                     const std::string  gem_ids[ 3 ] )
{
  const item_data_t* item_data = download_common( item, item_id );
  if ( ! item_data )
    return false;

  parse_gems( item, item_data, gem_ids );

  if ( ! parse_enchant( item, enchant_id ) )
  {
    item.sim -> errorf( "Player %s unable to parse enchant id %s for item \"%s\" at slot %s.\n",
                        item.player -> name(), enchant_id.c_str(), item.name(), item.slot_name() );
  }

  if ( ! enchant_t::download_addon( item, addon_id ) )
  {
    item.sim -> errorf( "Player %s unable to parse addon id %s for item \"%s\" at slot %s.\n",
                        item.player -> name(), addon_id.c_str(), item.name(), item.slot_name() );
  }

  if ( ! enchant_t::download_reforge( item, reforge_id ) )
  {
    item.sim -> errorf( "Player %s unable to parse reforge id %s for item \"%s\" at slot %s.\n",
                        item.player -> name(), reforge_id.c_str(), item.name(), item.slot_name() );
  }

  if ( ! enchant_t::download_rsuffix( item, rsuffix_id ) )
  {
    item.sim -> errorf( "Player %s unable to determine random suffix '%s' for item '%s' at slot %s.\n",
                        item.player -> name(), rsuffix_id.c_str(), item.name(), item.slot_name() );
  }

  log_item( item );

  return true;
}
开发者ID:coleb,项目名称:Raid-Sim,代码行数:42,代码来源:sc_item_data.cpp

示例3: download_item_data

bool wowhead::download_item_data( item_t&            item,
                                  cache::behavior_e  caching,
                                  wowhead_e          source )
{
    std::shared_ptr<xml_node_t> xml = item.xml = download_id( item.sim, item.parsed.data.id, caching, source );

    if ( ! xml )
    {
        if ( caching != cache::ONLY )
            item.sim -> errorf( "Player %s unable to download item id '%u' from wowhead at slot %s.\n", item.player -> name(), item.parsed.data.id, item.slot_name() );
        return false;
    }

    try
    {
        int id;
        if ( ! xml -> get_value( id, "item/id" ) ) throw( "id" );
        item.parsed.data.id = id;

        if ( ! xml -> get_value( item.name_str, "name/cdata" ) ) throw( "name" );
        util::tokenize( item.name_str );

        xml -> get_value( item.icon_str, "icon/cdata" );

        if ( ! xml -> get_value( item.parsed.data.level, "level/." ) ) throw( "level" );

        if ( ! xml -> get_value( item.parsed.data.quality, "quality/id" ) ) throw( "quality" );

        std::string jsonequipdata, jsondata;
        xml -> get_value( jsonequipdata, "jsonEquip/cdata" );
        jsonequipdata = "{" + jsonequipdata + "}";
        xml -> get_value( jsondata, "json/cdata" );
        jsondata = "{" + jsondata + "}";

        rapidjson::Document json, jsonequip;
        json.Parse< 0 >( jsondata.c_str() );
        jsonequip.Parse< 0 >( jsonequipdata.c_str() );

        if ( json.HasParseError() )
        {
            item.sim -> errorf( "Unable to parse JSON data for item id '%u': %s",
                                id, json.GetParseError() );
            return false;
        }

        if ( jsonequip.HasParseError() )
        {
            item.sim -> errorf( "Unable to parse JSON data for item id '%u': %s",
                                id, jsonequip.GetParseError() );
            return false;
        }

        if ( item.sim -> debug )
        {
            rapidjson::StringBuffer b;
            rapidjson::PrettyWriter< rapidjson::StringBuffer > writer( b );

            json.Accept( writer );
            item.sim -> out_debug.raw() << b.GetString();

            jsonequip.Accept( writer );
            item.sim -> out_debug.raw() << b.GetString();
        }

        if ( ! json.HasMember( "slot" ) )
            throw( "inventory type" );

        if ( ! json.HasMember( "classs" ) )
            throw( "item class" );

        if ( ! json.HasMember( "subclass" ) )
            throw( "item subclass" );

        item.parsed.data.inventory_type = json[ "slot" ].GetInt();
        item.parsed.data.item_class = json[ "classs" ].GetInt();
        item.parsed.data.item_subclass = json[ "subclass" ].GetInt();
        if ( item.parsed.data.item_subclass < 0 )
            item.parsed.data.item_subclass = 0;

        if ( json.HasMember( "reqlevel" ) )
            item.parsed.data.req_level = json[ "reqlevel" ].GetInt();

        if ( json.HasMember( "raidfinder" ) )
            item.parsed.data.type_flags |= RAID_TYPE_LFR;

        if ( json.HasMember( "heroic" ) )
            item.parsed.data.type_flags |= RAID_TYPE_HEROIC;

        if ( json.HasMember( "mythic" ) )
            item.parsed.data.type_flags |= RAID_TYPE_MYTHIC;

        if ( json.HasMember( "warforged" ) )
            item.parsed.data.type_flags |= RAID_TYPE_WARFORGED;

        if ( item.parsed.data.item_class == ITEM_CLASS_WEAPON )
        {
            if ( ! jsonequip.HasMember( "dmgrange" ) )
                throw( "weapon damage range" );

            if ( ! jsonequip.HasMember( "speed" ) )
//.........这里部分代码省略.........
开发者ID:Razlopp,项目名称:simc,代码行数:101,代码来源:sc_wowhead.cpp

示例4: download_item

bool armory_t::download_item( item_t& item,
                              const std::string& id_str,
                              int cache_only )
{
    player_t* p = item.player;

    xml_node_t* item_xml = download_item_tooltip( p, id_str, cache_only );
    if ( ! item_xml )
    {
        if ( ! cache_only )
            item.sim -> errorf( "Player %s unable to download item %s from armory at slot %s.\n", p -> name(), id_str.c_str(), item.slot_name() );
        return false;
    }

    if ( ! armory_t::parse_item_name( item, item_xml ) )
    {
        item.sim -> errorf( "Player %s unable to parse name for item %s at slot %s.\n", p -> name(), id_str.c_str(), item.slot_name() );
        return false;
    }

    if ( ! parse_item_heroic( item, item_xml ) )
    {
        item.sim -> errorf( "Player %s unable to parse heroic flag for item %s at slot %s.\n", p -> name(), id_str.c_str(), item.slot_name() );
        return false;
    }

    if ( ! armory_t::parse_item_stats( item, item_xml ) )
    {
        item.sim -> errorf( "Player %s unable to parse stats for item \"%s\" at slot %s.\n", p -> name(), item.name(), item.slot_name() );
        return false;
    }

    if ( ! armory_t::parse_item_weapon( item, item_xml ) )
    {
        item.sim -> errorf( "Player %s unable to parse weapon info for item \"%s\" at slot %s.\n", p -> name(), item.name(), item.slot_name() );
        return false;
    }

    return true;
}
开发者ID:shunter,项目名称:SimcraftGearOptimizer,代码行数:40,代码来源:sc_armory.cpp

示例5: parse_item_gems

bool armory_t::parse_item_gems( item_t& item,
                                xml_node_t* xml )
{
    item.armory_gems_str.clear();

    xml_node_t* socket_data = xml_t::get_node( xml, "socketData" );

    if ( socket_data )
    {
        std::string& s = item.armory_gems_str;

        std::vector<xml_node_t*> socket_nodes;
        int num_sockets = xml_t::get_nodes( socket_nodes, socket_data, "socket" );
        bool socket_bonus = true;

        for ( int i=0; i < num_sockets; i++ )
        {
            xml_node_t* socket = socket_nodes[ i ];
            std::string enchant, color, match;

            if ( ! xml_t::get_value( enchant, socket, "enchant" ) ||
                    ! xml_t::get_value( color,   socket, "color"   ) )
                continue;

            if ( color == "Meta" )
            {
                int meta_gem_type = armory_t::parse_meta_gem( enchant );

                if ( meta_gem_type != META_GEM_NONE )
                {
                    s += "_";
                    s += util_t::meta_gem_type_string( meta_gem_type );
                }
                else
                {
                    armory_t::fuzzy_stats( s, enchant );
                }
            }
            else
            {
                armory_t::fuzzy_stats( s, enchant );
            }

            if ( ! xml_t::get_value( match, socket, "match" ) || ( match != "1" ) ) socket_bonus = false;
        }

        if ( socket_bonus )
        {
            std::string enchant;
            if ( xml_t::get_value( enchant, socket_data, "socketMatchEnchant/." ) )
            {
                armory_t::fuzzy_stats( s, enchant );
            }
        }

        if ( ! s.empty() )
        {
            s.erase( 0, 1 );
            armory_t::format( s );
        }

        if ( item.sim -> debug && ! s.empty() )
        {
            log_t::output( item.sim, "%s %s %s armory_gems=%s", item.player -> name(), item.slot_name(), item.name(), s.c_str() );
        }
    }

    return true;
}
开发者ID:shunter,项目名称:SimcraftGearOptimizer,代码行数:69,代码来源:sc_armory.cpp

示例6: download_slot

bool wowhead_t::download_slot( item_t&            item,
                               const std::string& item_id,
                               const std::string& enchant_id,
                               const std::string& addon_id,
                               const std::string& reforge_id,
                               const std::string& rsuffix_id,
                               const std::string  gem_ids[ 3 ],
                               bool               ptr,
                               cache::behavior_t  caching )
{
  player_t* p = item.player;

  xml_node_t* node = download_id( item.sim, item_id, caching, ptr );
  if ( ! node )
  {
    if ( caching != cache::ONLY )
      item.sim -> errorf( "Player %s unable to download item id '%s' from wowhead at slot %s.\n", p -> name(), item_id.c_str(), item.slot_name() );
    return false;
  }

  if ( ! parse_item_name( item, node ) )
  {
    item.sim -> errorf( "Player %s unable to determine item name for id '%s' at slot %s.\n", p -> name(), item_id.c_str(), item.slot_name() );
    return false;
  }

  if ( ! parse_item_quality( item, node ) )
  {
    item.sim -> errorf( "Player %s unable to determine item quality for id '%s' at slot %s.\n", p -> name(), item_id.c_str(), item.slot_name() );
    return false;
  }

  if ( ! parse_item_level( item, node ) )
  {
    item.sim -> errorf( "Player %s unable to determine item level for id '%s' at slot %s.\n", p -> name(), item_id.c_str(), item.slot_name() );
    return false;
  }

  if ( ! parse_item_heroic( item, node ) )
  {
    item.sim -> errorf( "Player %s unable to determine heroic flag for id '%s' at slot %s.\n", p -> name(), item_id.c_str(), item.slot_name() );
    return false;
  }

  if ( ! parse_item_lfr( item, node ) )
  {
    item.sim -> errorf( "Player %s unable to determine LFR flag for id '%s' at slot %s.\n", p -> name(), item_id.c_str(), item.slot_name() );
    return false;
  }

  if ( ! parse_item_armor_type( item, node ) )
  {
    item.sim -> errorf( "Player %s unable to determine armor type for id %s at slot %s.\n", p -> name(), item_id.c_str(), item.slot_name() );
    return false;
  }

  if ( ! parse_item_stats( item, node ) )
  {
    item.sim -> errorf( "Player %s unable to determine stats for item '%s' at slot %s.\n", p -> name(), item.name(), item.slot_name() );
    return false;
  }

  if ( ! parse_weapon( item, node ) )
  {
    item.sim -> errorf( "Player %s unable to determine weapon info for item '%s' at slot %s.\n", p -> name(), item.name(), item.slot_name() );
    return false;
  }

  if ( ! parse_item_reforge( item, node ) )
  {
    item.sim -> errorf( "Player %s unable to determine reforge for item '%s' at slot %s.\n", p -> name(), item.name(), item.slot_name() );
    return false;
  }

  if ( ! parse_gems( item, node, gem_ids ) )
  {
    item.sim -> errorf( "Player %s unable to determine gems for item '%s' at slot %s.\n", p -> name(), item.name(), item.slot_name() );
    return false;
  }

  if ( ! enchant_t::download( item, enchant_id ) )
  {
    item.sim -> errorf( "Player %s unable to parse enchant id %s for item \"%s\" at slot %s.\n", p -> name(), enchant_id.c_str(), item.name(), item.slot_name() );
    //return false;
  }

  if ( ! enchant_t::download_addon( item, addon_id ) )
  {
    item.sim -> errorf( "Player %s unable to parse addon id %s for item \"%s\" at slot %s.\n", p -> name(), addon_id.c_str(), item.name(), item.slot_name() );
    //return false;
  }

  if ( ! enchant_t::download_reforge( item, reforge_id ) )
  {
    item.sim -> errorf( "Player %s unable to parse reforge id %s for item \"%s\" at slot %s.\n", p -> name(), reforge_id.c_str(), item.name(), item.slot_name() );
    //return false;
  }

  if ( ! enchant_t::download_rsuffix( item, rsuffix_id ) )
  {
//.........这里部分代码省略.........
开发者ID:coleb,项目名称:Raid-Sim,代码行数:101,代码来源:sc_wowhead.cpp

示例7: download_item

bool wowhead_t::download_item( item_t&            item,
                               const std::string& item_id,
                               bool               ptr,
                               cache::behavior_t  caching )
{
  player_t* p = item.player;

  xml_node_t* node = download_id( item.sim, item_id, caching, ptr );
  if ( ! node )
  {
    if ( caching != cache::ONLY )
      item.sim -> errorf( "Player %s unable to download item id '%s'' from wowhead at slot %s.\n", p -> name(), item_id.c_str(), item.slot_name() );
    return false;
  }

  if ( ! parse_item_name( item, node ) )
  {
    item.sim -> errorf( "Player %s unable to determine item name for id '%s'' at slot %s.\n", p -> name(), item_id.c_str(), item.slot_name() );
    return false;
  }

  if ( ! parse_item_quality( item, node ) )
  {
    item.sim -> errorf( "Player %s unable to determine item quality for id '%s' at slot %s.\n", p -> name(), item_id.c_str(), item.slot_name() );
    return false;
  }

  if ( ! parse_item_level( item, node ) )
  {
    item.sim -> errorf( "Player %s unable to determine item level for id '%s' at slot %s.\n", p -> name(), item_id.c_str(), item.slot_name() );
    return false;
  }

  if ( ! parse_item_heroic( item, node ) )
  {
    item.sim -> errorf( "Player %s unable to determine heroic flag for id %s at slot %s.\n", p -> name(), item_id.c_str(), item.slot_name() );
    return false;
  }

  if ( ! parse_item_lfr( item, node ) )
  {
    item.sim -> errorf( "Player %s unable to determine LFR flag for id %s at slot %s.\n", p -> name(), item_id.c_str(), item.slot_name() );
    return false;
  }

  if ( ! parse_item_armor_type( item, node ) )
  {
    item.sim -> errorf( "Player %s unable to determine armor type for id %s at slot %s.\n", p -> name(), item_id.c_str(), item.slot_name() );
    return false;
  }

  if ( ! parse_item_stats( item, node ) )
  {
    item.sim -> errorf( "Player %s unable to determine stats for item '%s' at slot %s.\n", p -> name(), item.name(), item.slot_name() );
    return false;
  }

  if ( ! parse_weapon( item, node ) )
  {
    item.sim -> errorf( "Player %s unable to determine weapon info for item '%s' at slot %s.\n", p -> name(), item.name(), item.slot_name() );
    return false;
  }

  return true;
}
开发者ID:coleb,项目名称:Raid-Sim,代码行数:65,代码来源:sc_wowhead.cpp


注:本文中的item_t::slot_name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。