item_location game::get_item_from_inventory( player &p, const std::string &title ) { const std::string msg = p.is_npc() ? string_format( _( "%s's inventory is empty." ), p.name.c_str() ) : std::string( _( "Your inventory is empty." ) ); return inv_internal( p, inventory_filter_preset( convert_filter( [ &p ]( const item & it ) { return !p.is_worn( it ) && &p.weapon != ⁢ } ) ), title, -1, msg ); }
item_location game_menus::inv::saw_barrel( player &p, item &tool ) { const auto actor = dynamic_cast<const saw_barrel_actor *> ( tool.type->get_use( "saw_barrel" )->get_actor_ptr() ); if( !actor ) { debugmsg( "Tried to use a wrong item." ); return item_location(); } return inv_internal( p, saw_barrel_inventory_preset( p, tool, *actor ), _( "Saw barrel" ), 1, _( "You don't have any guns." ), string_format( _( "Choose a weapon to use your %s on" ), tool.tname( 1, false ).c_str() ) ); }
item *game::inv_map_for_liquid( const item &liquid, const std::string &title, int radius ) { const auto filter = [ this, &liquid ]( const item_location & location ) { if( location.where() == item_location::type::character ) { Character *character = dynamic_cast<Character *>( critter_at( location.position() ) ); if( character == nullptr ) { debugmsg( "Invalid location supplied to the liquid filter: no character found." ); return false; } return location->get_remaining_capacity_for_liquid( liquid, *character ) > 0; } const bool allow_buckets = location.where() == item_location::type::map; return location->get_remaining_capacity_for_liquid( liquid, allow_buckets ) > 0; }; return inv_internal( u, inventory_filter_preset( filter ), title, radius, string_format( _( "You don't have a suitable container for carrying %s." ), liquid.tname().c_str() ) ).get_item(); }
item_location game_menus::inv::container_for( player &p, const item &liquid, int radius ) { const auto filter = [ &liquid ]( const item_location & location ) { if( location.where() == item_location::type::character ) { Character *character = dynamic_cast<Character *>( g->critter_at( location.position() ) ); if( character == nullptr ) { debugmsg( "Invalid location supplied to the liquid filter: no character found." ); return false; } return location->get_remaining_capacity_for_liquid( liquid, *character ) > 0; } const bool allow_buckets = location.where() == item_location::type::map; return location->get_remaining_capacity_for_liquid( liquid, allow_buckets ) > 0; }; return inv_internal( p, inventory_filter_preset( filter ), string_format( _( "Container for %s" ), liquid.display_name( liquid.charges ).c_str() ), radius, string_format( _( "You don't have a suitable container for carrying %s." ), liquid.tname().c_str() ) ); }
item_location game_menus::inv::holster( player &p, item &holster ) { const std::string holster_name = holster.tname( 1, false ); const auto actor = dynamic_cast<const holster_actor *> ( holster.type->get_use( "holster" )->get_actor_ptr() ); if( !actor ) { const std::string msg = string_format( _( "You can't put anything into your %s." ), holster_name.c_str() ); popup( msg, PF_GET_KEY ); return item_location(); } const std::string title = actor->holster_prompt.empty() ? _( "Holster item" ) : _( actor->holster_prompt.c_str() ); const std::string hint = string_format( _( "Choose a weapon to put into your %s" ), holster_name.c_str() ); return inv_internal( p, holster_inventory_preset( p, *actor ), title, 1, string_format( _( "You have no weapons you could put into your %s." ), holster_name.c_str() ), hint ); }
item_location game::inv_for_activatables( const std::string &title ) { return inv_internal( u, activatable_inventory_preset( u ), title, 1, _( "You don't have any items you can use." ) ); }
item_location game::inv_map_splice( item_filter filter, const std::string &title, int radius, const std::string &none_message ) { return inv_internal( u, inventory_filter_preset( convert_filter( filter ) ), title, radius, none_message ); }
item_location game_menus::inv::steal( player &p, player &victim ) { return inv_internal( victim, steal_inventory_preset( p, victim ), string_format( _( "Steal from %s" ), victim.name.c_str() ), -1, string_format( _( "%s's inventory is empty." ), victim.name.c_str() ) ); }
item_location game_menus::inv::read( player &p ) { return inv_internal( p, read_inventory_preset( p ), _( "Read" ), 1, _( "You have nothing to read." ) ); }
item_location game_menus::inv::take_off( player &p ) { return inv_internal( p, take_off_inventory_preset( p, "color_red" ), _( "Take off item" ), 1, _( "You don't wear anything." ) ); }
item_location game_menus::inv::wield( player &p ) { return inv_internal( p, weapon_inventory_preset( p ), _( "Wield item" ), 1, _( "You have nothing to wield." ) ); }
item_location game_menus::inv::consume( player &p ) { return inv_internal( p, comestible_inventory_preset( p ), _( "Consume item" ), 1, _( "You have nothing to consume." ) ); }
item_location game_menus::inv::disassemble( player &p ) { return inv_internal( p, disassemble_inventory_preset( p, p.crafting_inventory() ), _( "Disassemble item" ), 1, _( "You don't have any items you could disassemble." ) ); };
item_location game::inv_for_gunmod( const item &gunmod, const std::string &title ) { return inv_internal( u, gunmod_inventory_preset( u, gunmod ), title, -1, _( "You don't have any guns to modify." ) ); }
item_location game_menus::inv::use( player &p ) { return inv_internal( p, activatable_inventory_preset( p ), _( "Use item" ), 1, _( "You don't have any items you can use." ) ); }
item_location game::inv_for_books( const std::string &title ) { return inv_internal( u, read_inventory_preset( u ), title, 1, _( "You have nothing to read." ) ); }
item_location game_menus::inv::gun_to_modify( player &p, const item &gunmod ) { return inv_internal( p, gunmod_inventory_preset( p, gunmod ), _( "Select gun to modify" ), -1, _( "You don't have any guns to modify." ) ); }
int game::inv_for_all( const std::string &title, const std::string &none_message ) { const std::string msg = ( none_message.empty() ) ? _( "Your inventory is empty." ) : none_message; return u.get_item_position( inv_internal( u, inventory_selector_preset(), title, -1, none_message ).get_item() ); }
item_location game_menus::inv::wear( player &p ) { return inv_internal( p, wear_inventory_preset( p, "color_yellow" ), _( "Wear item" ), 1, _( "You have nothing to wear." ) ); }