• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ item_t类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: states

std::vector<int>
galleryd::queue::status(item_t &items, const std::string &category)
{
    std::vector<int> states (items.size());

    // build sql statement
    auto stmt = category.empty()
        ? query_status_(items)
        : query_status_with_category_(items, category);

    // insert all found items into a map
    std::map<std::string, int> lookup;
    for(auto&& row : stmt)
        lookup.emplace(row.as_string(0), row.as_int(1));

    // build array with state-values for each item in the request.
    // if the item doesn't exist, the value is '0'.
    std::map<std::string, int>::const_iterator iter, end = lookup.end();
    for(size_t i = 0, e = items.size(); i < e; ++i)
    {
        iter      = lookup.find(items[i]);
        states[i] = iter == end ? 0 : iter->second;
    }

    return states;
}
开发者ID:mikf,项目名称:galleryd,代码行数:26,代码来源:queue.cpp


示例2: getWLocation

bool Item3D::IsAboveBelow( item_t other )
{

//        cout << "IsAboveBelow " << progid() <<" "<< other->progid() << "\n";

    // boxes at the same height cannot overlap each other
    if( getHLocation() == other->getHLocation() )
        return false;

    double mw1 = getWLocation();
    double mw2 = mw1 + side_1()->size() - 1;
    double ml1 = getLLocation();
    double ml2 = ml1 + side_3()->size() - 1;
    double ow1 = other->getWLocation();
    double ow2 = ow1 + other->side_1()->size() - 1;
    double ol1 = other->getLLocation();
    double ol2 = ow2 + other->side_3()->size() - 1;


//    cout << mw1 <<" "<< mw2 <<" "<< ml1 <<" "<< ml2 <<"\n"<<
//         ow1 <<" "<< ow2 <<" "<< ol1 <<" "<< ol2 <<"\n";

    // http://stackoverflow.com/a/306379/16582

    bool wOverlap = valueInRange(mw1, ow1, ow2) ||
                    valueInRange(ow1, mw1, mw2);
    bool lOverlap = valueInRange(ml1, ol1, ol2) ||
                    valueInRange(ol1, ml1, ml2);

    return wOverlap && lOverlap;


}
开发者ID:rockiey,项目名称:Pack,代码行数:33,代码来源:Item3D.cpp


示例3: decode_by_shell

bool set_bonus_t::decode_by_shell( const item_t& item ) const
{
  if ( ! item.name() )
    return false;

  std::string s = item.name();

  return decode( s , shell_filters );

}
开发者ID:simulationcraft,项目名称:simulationcraft-swtor,代码行数:10,代码来源:sc_set_bonus.cpp


示例4: sub_binY

void BoxPacker3D::splitBinHeight(bin_t bin, item_t item)
{


    map<string, double> sides = findSubBinSizes( bin, item );
    double dy_w = sides["dy_w"];
    double dy_h = sides["dy_h"];
    double dy_l = sides["dy_l"];


    if (dy_h <= 0)
        bin->set_y_sub_bin(NULL);
    else
    {

        bin_t sub_binY( new Bin3D() );
        sub_binY->set_side_1(bin->side_1()->size_side_to(dy_w));
        sub_binY->set_side_2(bin->side_2()->size_side_to(dy_h));
        sub_binY->set_side_3(bin->side_3()->size_side_to(dy_l));
        sub_binY->set_parent_bin(bin);
        sub_binY->set_id(bin->id());
        sub_binY->setLocationHeight( bin->getLocationHeight() + item->side_2()->size() );
        sub_binY->setLocationWidth( bin->getLocationWidth() );
        sub_binY->setLocationLength( bin->getLocationLength() );
        bin->set_y_sub_bin(sub_binY);


    }

}
开发者ID:rockiey,项目名称:Pack,代码行数:30,代码来源:BoxPacker3D.cpp


示例5: IN

sqlite3pp::statement
galleryd::queue::query_status_with_category_(
    item_t            &items,
    const std::string &category)
{
    // build query string
    std::string q {
        "SELECT item, state "
        "FROM   queue JOIN category "
        "ON     queue.category_id = category.id "
        "WHERE  category.name=? AND item IN (?"
    };

    for(size_t i = 1, e = items.size(); i < e; ++i)
        q += ",?";
    q += ')';

    // bind values to statement
    int  idx  = 1;
    auto stmt = db.prepare(q);

    stmt.bind(1, category);
    for(auto&& item : items)
        stmt.bind(++idx, item);

    return stmt;
}
开发者ID:mikf,项目名称:galleryd,代码行数:27,代码来源:queue.cpp


示例6:

void
galleryd::queue::query_add_with_category_(
    item_t            &items,
    const std::string &category)
{
    // get id from name
    const auto category_id = query_category_id_(category);

    // build query
    auto stmt = db.prepare(
        "INSERT INTO queue "
        "(item, category_id) "
        "VALUES (?, ?)"
    );
    stmt.bind(2, category_id);

    // add items
    auto tr = db.begin_transaction();
    for(size_t i = 0, len = items.size(); i < len; ++i)
    {
        stmt.bind(1, items[i]);
        stmt.exec();
    }
    tr.commit();
}
开发者ID:mikf,项目名称:galleryd,代码行数:25,代码来源:queue.cpp


示例7: match

sqlite3pp::statement
galleryd::queue::query_status_(item_t &items)
{
    // get category-ids for items
    const auto len = items.size();
    const auto categories = match(items);

    // build query string
    std::string q {
        "SELECT item, state "
        "FROM   queue "
        "WHERE (item=? AND category_id=?)"
    };
    for(size_t i = 1; i < len; ++i)
        q += " OR (item=? AND category_id=?)";

    // bind values to statement
    auto stmt = db.prepare(q);
    for(size_t i = 0; i < len; ++i)
    {
        stmt.bind(2*i+1, items[i]);
        stmt.bind(2*i+2, categories[i]);
    }

    return stmt;
}
开发者ID:mikf,项目名称:galleryd,代码行数:26,代码来源:queue.cpp


示例8: 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


示例9: categories

galleryd::queue::category_t
galleryd::queue::match(
    item_t &items)
{
    std::smatch match;
    const auto len = items.size();
    category_t categories (len);

    for(size_t i = 0; i < len; ++i)
    {
        // test with the last successfull regex first
        if(std::regex_match(items[i], match, re_list[re_last].first))
        {
            items[i] = match[1];
            categories[i] = re_list[re_last].second;
            continue;
        }

        for(size_t j = 0; j < re_list.size(); ++j)
        {
            if(j == re_last)
                continue;

            if(std::regex_match(items[i], match, re_list[j].first))
            {
                items[i] = match[1];
                categories[i] = re_list[j].second;
                re_last = j;
            }
        }
    }

    return categories;
}
开发者ID:mikf,项目名称:galleryd,代码行数:34,代码来源:queue.cpp


示例10: random_suffix_type

int item_database_t::random_suffix_type( const item_t& item )
{
  if ( weapon_t* w = item.weapon() )
  {
    switch ( w -> type )
    {
    // Two-hand weapons use the first point allocation budget
    case WEAPON_AXE_2H:
    case WEAPON_MACE_2H:
    case WEAPON_POLEARM:
    case WEAPON_SWORD_2H:
    case WEAPON_STAFF:
      return 0;

    // Various ranged types use the fifth point allocation budget
    case WEAPON_BOW:
    case WEAPON_CROSSBOW:
    case WEAPON_GUN:
    case WEAPON_THROWN:
    case WEAPON_WAND:
      return 4;

    // One-hand/Off-hand/Main-hand weapons use the fourth point allocation budget
    default:
      return 3;
    }
  }

  // Armor handling goes by slot
  switch ( item.slot )
  {
  case SLOT_HEAD:
  case SLOT_CHEST:
  case SLOT_LEGS:
    return 0;

  case SLOT_SHOULDERS:
  case SLOT_WAIST:
  case SLOT_FEET:
  case SLOT_HANDS:
  case SLOT_TRINKET_1:
  case SLOT_TRINKET_2:
    return 1;

  case SLOT_NECK:
  case SLOT_WRISTS:
  case SLOT_FINGER_1:
  case SLOT_FINGER_2:
  case SLOT_OFF_HAND: // Shields, off hand items
  case SLOT_BACK:
    return 2;

  // Ranged non-weapons are relics, which do not have a point allocation
  case SLOT_RANGED:
  case SLOT_TABARD:
  default:
    return -1;
  }
}
开发者ID:coleb,项目名称:Raid-Sim,代码行数:59,代码来源:sc_item_data.cpp


示例11: 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


示例12: scaled_stat

int item_database::scaled_stat( const item_t& item, const dbc_t& dbc, size_t idx, unsigned new_ilevel )
{
  // Safeguard against array overflow, should never happen in any case
  if ( idx >= sizeof_array( item.parsed.data.stat_val ) - 1 )
    return -1;

  if ( item.parsed.data.level == 0 )
    return item.parsed.data.stat_val[ idx ];

  //if ( item.level == ( int ) new_ilevel )
  //  return item.stat_val[ idx ];

  int slot_type = random_suffix_type( &item.parsed.data );
  double item_budget = 0/*, orig_budget = 0*/;

  if ( slot_type != -1 && item.parsed.data.quality > 0 )
  {
    const random_prop_data_t& ilevel_data = dbc.random_property( new_ilevel );
    //const random_prop_data_t& orig_data = dbc.random_property( item.level );

    // Epic/Legendary
    if ( item.parsed.data.quality == 4 || item.parsed.data.quality == 5 )
    {
      item_budget = ilevel_data.p_epic[ slot_type ];
      //orig_budget = orig_data.p_epic[ slot_type ];
    }
    // Rare/Heirloom
    else if ( item.parsed.data.quality == 3 || item.parsed.data.quality == 7 )
    {
      item_budget = ilevel_data.p_rare[ slot_type ];
      //orig_budget = orig_data.p_rare[ slot_type ];
    }
    // Rest
    else
    {
      item_budget = ilevel_data.p_uncommon[ slot_type ];
      //orig_budget = orig_data.p_uncommon[ slot_type ];
    }
  }

  // Precise stat scaling formula for ilevel increase, stats should be
  // spot on.
  if ( item.parsed.data.stat_alloc[ idx ] > 0 /* && orig_budget > 0 */ && item_budget > 0 )
  {
    double v_raw = util::round( item.parsed.data.stat_alloc[ idx ] * item_budget / 10000.0 );
    // Socket penalty is supposedly gone in Warlords of Draenor, but it really does not seem so in the latest alpha.
    // NOTENOTENOTENOTE: Item socket cost penalty multiplier _seems_ to be based on _BASE_ itemlevel, not the upgraded one
    double v_socket_penalty = util::round( item.parsed.data.stat_socket_mul[ idx ] * dbc.item_socket_cost( item.base_item_level() ) );
    return static_cast<int>( v_raw - v_socket_penalty );
  }
  // TODO(?): Should we warn the user that we are using an approximation of
  // the upgraded stats, and that certain stats may be off by one?
  else
    return static_cast<int>( floor( item.parsed.data.stat_val[ idx ] * approx_scale_coefficient( item.parsed.data.level, new_ilevel ) ) );
}
开发者ID:JamesWR,项目名称:simc,代码行数:55,代码来源:sc_item_data.cpp


示例13: apply_item_bonus

bool item_database::apply_item_bonus( item_t& item, const item_bonus_entry_t& entry )
{
  switch ( entry.type )
  {
    // Adjust ilevel, value is in 'value_1' field
    case ITEM_BONUS_ILEVEL:
      if ( item.sim -> debug )
        item.player -> sim -> out_debug.printf( "Player %s item '%s' adjusting ilevel by %d (old=%d new=%d)",
            item.player -> name(), item.name(), entry.value_1, item.parsed.data.level, item.parsed.data.level + entry.value_1 );
      item.parsed.data.level += entry.value_1;
      break;
    // Add new item stats. Value_1 has the item modifier, value_2 has the
    // allocation percent. This bonus type is the reason we don't really
    // support the bonus id stuff outside of our local item database.
    case ITEM_BONUS_MOD:
    {
      // First, check if the item already has that stat
      int found = -1;
      int offset = -1;
      for ( size_t i = 0, end = sizeof_array( item.parsed.data.stat_type_e ); i < end; i++ )
      {
        // Put the new stat in first available slot
        if ( offset == -1 && item.parsed.data.stat_type_e[ i ] == ITEM_MOD_NONE )
          offset = static_cast< int >( i );

        // Stat already found
        if ( found == -1 && item.parsed.data.stat_type_e[ i ] == entry.value_1 )
          found = static_cast< int >( i );
      }

      // New stat, and there's room.
      if ( found == -1 && offset != -1 )
      {
        if ( item.sim -> debug )
          item.player -> sim -> out_debug.printf( "Player %s item '%s' adding new stat %s offset=%d (allocation %u)", 
              item.player -> name(), item.name(), util::stat_type_string( util::translate_item_mod( entry.value_1 ) ), offset, entry.value_2 );
        item.parsed.data.stat_type_e[ offset ] = entry.value_1;
        item.parsed.data.stat_alloc[ offset ] = entry.value_2;
      }
      // Existing stat, set (?) new allocation percent
      else if ( found != -1 )
        item.parsed.data.stat_alloc[ offset ] = entry.value_2;
      // New stat but no room, this should never happen.
      else
      {
        item.player -> sim -> errorf( "Player %s item '%s' unable to add item modifier, stats full", item.player -> name(), item.name() );
        return false;
      }
      break;
    }
    // Item name description. We should do flagging here, I suppose. We don't
    // have the name descriptions exported at the moment though ..
    case ITEM_BONUS_DESC:
      break;
    // WoD random suffix name string; stats are in other options for that item
    // bonus id. Again, we don't export item name descriptions so we cannot
    // apply the name
    case ITEM_BONUS_SUFFIX:
      break;
    // Adjust required level of the item. Value in 'value_1'
    case ITEM_BONUS_REQ_LEVEL:
      if ( item.sim -> debug )
        item.player -> sim -> out_debug.printf( "Player %s item '%s' required level by %d (old=%d new=%d)",
            item.player -> name(), item.name(), entry.value_1, item.parsed.data.req_level, item.parsed.data.req_level + entry.value_1 );
      item.parsed.data.req_level += entry.value_1;
      break;
    // Number of sockets is in value 1, type (color) of sockets is in value 2
    case ITEM_BONUS_SOCKET:
    {
      if ( item.sim -> debug )
        item.player -> sim -> out_debug.printf( "Player %s item '%s' adding %d socket(s) (type=%d)",
            item.player -> name(), item.name(), entry.value_1, entry.value_2 );
      int n_added = 0;
      for ( size_t i = 0, end = sizeof_array( item.parsed.data.socket_color ); i < end && n_added < entry.value_1; i++ )
      {
        if ( item.parsed.data.socket_color[ i ] != SOCKET_COLOR_NONE )
          continue;

        item.parsed.data.socket_color[ i ] = entry.value_2;
        n_added++;
      }

      if ( n_added < entry.value_1 )
      {
        item.player -> sim -> errorf( "Player %s item '%s' unable to fit %d new sockets into the item (could only fit %d)",
            item.player -> name(), item.name(), entry.value_1, n_added );
        return false;
      }
      break;
    }
    // This is backed up by some unknown (to us) client data at the moment. Just hardcode the values
    // based on the given bonus IDs, and hope for the best.
    case ITEM_BONUS_SCALING:
    {
      if ( ! item_database::apply_item_scaling( item, entry.value_1 ) )
      {
        item.player -> sim -> errorf( "Player %s item '%s' unable to initialize item scaling for bonus id %u",
            item.player -> name(), item.name(), entry.id );
        return false;
      }
//.........这里部分代码省略.........
开发者ID:JamesWR,项目名称:simc,代码行数:101,代码来源:sc_item_data.cpp


示例14: apply_item_scaling

// TODO: Needs some way to figure what value to pass, for now presume min of player level, max
// level. Also presumes we are only scaling itemlevel for now, this is almost certainly not 100%
// true in all cases for the use of curve data.
bool item_database::apply_item_scaling( item_t& item, unsigned scaling_id )
{
  // No scaling needed
  if ( scaling_id == 0 )
  {
    return true;
  }

  const scaling_stat_distribution_t* data = item.player -> dbc.scaling_stat_distribution( scaling_id );
  // Unable to find the scaling stat distribution
  if ( data == nullptr )
  {
    item.sim -> errorf( "%s: Unable to find scaling information for %s scaling id %u",
        item.player -> name(), item.name(), item.parsed.data.id_scaling_distribution );
    return false;
  }

  // Player level lower than item minimum scaling level, shouldnt happen but let item init go
  // through
  if ( static_cast<unsigned>( item.player -> level() ) < data -> min_level )
  {
    return true;
  }

  double base_value = std::min( static_cast<double>( item.player -> level() ),
                                static_cast<double>( data -> max_level ) );

  std::pair<const curve_point_t*, const curve_point_t*> curve_data = item.player -> dbc.curve_point( data -> curve_id, base_value );
  // No data found, this really should not happen.
  if ( ! curve_data.first || ! curve_data.second )
  {
    item.sim -> errorf( "%s: Unable to find scaling information for %s curve_id %u",
        item.player -> name(), item.name(), data -> curve_id );
    return false;
  }

  double scaled_result = 0;
  // Lands on a value, use data
  if ( curve_data.first -> val1 == base_value )
  {
    scaled_result = curve_data.first -> val2;
  }
  else if ( curve_data.second -> val1 == base_value )
  {
    // Should never happen
    assert( 0 );
  }
  else
  {
    // Linear interpolation
    scaled_result = curve_data.first -> val2 + ( curve_data.second -> val2 - curve_data.first -> val2 ) *
      ( base_value - curve_data.first -> val1 ) / ( curve_data.second -> val1 - curve_data.first -> val1 );
  }

  item.parsed.data.level = static_cast<unsigned>( util::round( scaled_result, 0 ) );

  if ( item.sim -> debug )
  {
    item.sim -> out_debug.printf( "%s: Scaling %s to ilevel %u (%.3f), curve data: x=%.3f, x0=%.3f, y0=%.3f, x1=%.3f, y1=%.3f",
        item.player -> name(), item.name(), item.parsed.data.level,
        scaled_result, base_value,
        curve_data.first -> val1, curve_data.first -> val2,
        curve_data.second -> val1, curve_data.second -> val2 );
  }

  return true;
}
开发者ID:JamesWR,项目名称:simc,代码行数:70,代码来源:sc_item_data.cpp


示例15: weapon_dmg_max

uint32_t item_database::weapon_dmg_max( item_t& item )
{
  return ( uint32_t ) ceil( item.player -> dbc.weapon_dps( &item.parsed.data, item.item_level() ) *
                            item.parsed.data.delay / 1000.0 * ( 1 + item.parsed.data.dmg_range / 2 ) + 0.5 );
}
开发者ID:JamesWR,项目名称:simc,代码行数:5,代码来源:sc_item_data.cpp


示例16: weapon_dmg_min

uint32_t item_database::weapon_dmg_min( item_t& item )
{
  return ( uint32_t ) floor( item.player -> dbc.weapon_dps( &item.parsed.data, item.item_level() ) *
                             item.parsed.data.delay / 1000.0 * ( 1 - item.parsed.data.dmg_range / 2 ) );
}
开发者ID:JamesWR,项目名称:simc,代码行数:5,代码来源:sc_item_data.cpp


示例17: armor_value

uint32_t item_database::armor_value( const item_t& item )
{
  return armor_value( &item.parsed.data, item.player -> dbc, item.item_level() );
}
开发者ID:JamesWR,项目名称:simc,代码行数:4,代码来源:sc_item_data.cpp


示例18: download_item_tooltip

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


示例19: splitBinWidth

bool BoxPacker3D::Fit( bin_t bin,  item_t item, bin_v_t &bins )
{
//    cout << "BoxPacker3D::Fit\n";
//    bin->Print();
//    item->Print();

    if( bin->Fit( item ) )
    {
        // item fits without rotation
    }
    else
    {
        // item does not fit
        // try rotating it

        item->Spin( 1 );
        if( bin->Fit( item ) )
        {
            //cout << "spin 1";
        }
        else
        {
            item->Spin( 1 );
            item->Spin( 2 );
            if( bin->Fit( item ) )
            {
                //cout << "spin 2";
            }
            else
            {
                item->Spin( 2 );
                item->Spin( 3 );
                if( bin->Fit( item ) )
                {
                    //cout << "spin 3";
                }
                else
                {
                    // Does not fit in any orientation
                    // spin back to original and give up
                    //cout << "No fit\n";
                    item->Spin( 3 );
                    return false;
                }
            }
        }
    }

    // packing item

    bin->set_item(item);
    item->setBin( bin->Root( bin )->progid() );
    item->setHLocation( bin->getLocationHeight() );
    item->setWLocation( bin->getLocationWidth() );
    item->setLLocation( bin->getLocationLength() );
    item->SpinAxisCalculate();

//   item->Print();

    splitBinWidth(bin, item);
    splitBinHeight(bin, item);
    splitBinLength(bin, item);


    if (bin->get_x_sub_bin() != NULL)
    {
        // we have created a new bin from the unused space when the item was added to the bin
        // check if this space could be merged with any previously unused space in the user specified bin
        if( ! merger( bin, bin->get_x_sub_bin(), bins ) )
        {

            bins.push_back(bin->get_x_sub_bin());
        }
        else
        {
            // unused space was merged, so forget about it
            bin->set_x_sub_bin( NULL );
        }

    }
    if (bin->get_y_sub_bin() != NULL)
    {
        // we have created a new bin from the unused space when the item was added to the bin
        // check if this space could be merged with any previously unused space in the user specified bin
        if( ! merger( bin, bin->get_y_sub_bin(), bins ) )
        {

            bins.push_back(bin->get_y_sub_bin());
        }
        else
        {
            // unused space was merged, so forget about it
            bin->set_y_sub_bin( NULL );
        }


    }
    if (bin->get_z_sub_bin() != NULL)
    {
        // we have created a new bin from the unused space when the item was added to the bin
//.........这里部分代码省略.........
开发者ID:rockiey,项目名称:Pack,代码行数:101,代码来源:BoxPacker3D.cpp


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ itemstack_vector类代码示例发布时间:2022-05-31
下一篇:
C++ item_map_t类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap