std::string get_denial( const item_location &loc ) const override { if( !p.has_enough_charges( *loc, false ) ) { return string_format( ngettext( _( "Needs at least %d charge" ), _( "Needs at least %d charges" ), loc->ammo_required() ), loc->ammo_required() ); } return pickup_inventory_preset::get_denial( loc ); }
std::string get_action_name( const item_location &loc ) const { const auto &uses = loc->type->use_methods; if( uses.empty() ) { if( loc->is_food() || loc->is_food_container() ) { return _( "Consume" ); } else if( loc->is_book() ) { return _( "Read" ); } else if( loc->is_bionic() ) { return _( "Install bionic" ); } } else if( uses.size() == 1 ) { return uses.begin()->second.get_name(); } else { return _( "..." ); } return std::string(); }
std::string get_denial( const item_location &loc ) const override { const auto &uses = loc->type->use_methods; if( uses.size() == 1 ) { const auto ret = uses.begin()->second.can_call( p, *loc, false, p.pos() ); if( !ret.success() ) { return trim_punctuation_marks( ret.str() ); } } if( !p.has_enough_charges( *loc, false ) ) { return string_format( ngettext( _( "Needs at least %d charge" ), _( "Needs at least %d charges" ), loc->ammo_required() ), loc->ammo_required() ); } return pickup_inventory_preset::get_denial( loc ); }
std::string get_denial( const item_location &loc ) const override { if( !p.has_item( *loc ) ) { if( loc->made_of( LIQUID ) ) { return _( "Can't pick up liquids" ); } else if( !p.can_pickVolume( *loc ) ) { return _( "Too big to pick up" ); } else if( !p.can_pickWeight( *loc ) ) { return _( "Too heavy to pick up" ); } } return std::string(); }
std::string get_denial( const item_location &loc ) const override { if( loc->made_of( LIQUID ) ) { return _( "Can't drink spilt liquids" ); } const auto &it = get_comestible_item( loc ); const auto res = p.can_eat( it ); const auto cbm = p.get_cbm_rechargeable_with( it ); if( !res.success() && cbm == rechargeable_cbm::none ) { return res.str(); } else if( cbm == rechargeable_cbm::battery && p.power_level >= p.max_power_level ) { return _( "You're fully charged" ); } return inventory_selector_preset::get_denial( loc ); }
std::string get_denial( const item_location &loc ) const override { std::string incompatability; if( !loc->gunmod_compatible( gunmod, &incompatability ) ) { return incompatability; } if( !p.meets_requirements( gunmod, *loc ) ) { return string_format( _( "requires at least %s" ), p.enumerate_unmet_requirements( gunmod, *loc ).c_str() ); } if( get_odds( loc ).first <= 0 ) { return _( "is too difficult for you to modify" ); } return std::string(); }
std::string get_denial( const item_location &loc ) const override { const auto ret = loc->is_gunmod_compatible( gunmod ); if( !ret.success() ) { return ret.str(); } if( !p.meets_requirements( gunmod, *loc ) ) { return string_format( _( "requires at least %s" ), p.enumerate_unmet_requirements( gunmod, *loc ).c_str() ); } if( get_odds( loc ).first <= 0 ) { return _( "is too difficult for you to modify" ); } return std::string(); }
bool is_known( const item_location &loc ) const { return p.has_identified( loc->typeId() ); }
bool is_shown( const item_location &loc ) const override { return loc->is_book(); }
bool is_shown( const item_location &loc ) const override { return loc->is_gun() && !loc->is_gunmod(); }
bool is_shown( const item_location &loc ) const override { if( loc->typeId() == "1st_aid" ) { return false; // temporary fix for #12991 } return p.can_consume( *loc ); }
bool is_shown( const item_location &loc ) const override { return loc->is_armor() && p.is_worn( *loc ); }