Basic inventory class for managing player items.
More...
#include <Bag.hpp>
|
struct | Item |
| Simple struct representing a set of items in the bag. More...
|
|
Basic inventory class for managing player items.
Definition at line 18 of file Bag.hpp.
◆ addItem()
void core::player::Bag::addItem |
( |
item::Id |
item, |
|
|
unsigned int |
qty = 1 |
|
) |
| |
Adds the given item to the bag.
- Parameters
-
item | The item to add |
qty | How many to add |
Definition at line 44 of file Bag.cpp.
◆ clear()
void core::player::Bag::clear |
( |
| ) |
|
Removes all items.
Definition at line 64 of file Bag.cpp.
◆ getAll()
void core::player::Bag::getAll |
( |
std::vector< Item > & |
result | ) |
const |
Returns all owned items.
- Parameters
-
result | Populated with all owned items |
Definition at line 31 of file Bag.cpp.
◆ getByCategory()
void core::player::Bag::getByCategory |
( |
item::Category |
category, |
|
|
std::vector< Item > & |
result |
|
) |
| const |
Returns the set of owned items in the given category.
- Parameters
-
category | The category to search for |
result | Vector to populate with results |
Definition at line 17 of file Bag.cpp.
◆ getByType()
void core::player::Bag::getByType |
( |
item::Type |
type, |
|
|
std::vector< Item > & |
result |
|
) |
| const |
Returns the set of owned items of the given type.
- Parameters
-
category | The type to search for |
result | Vector to populate with results |
Definition at line 24 of file Bag.cpp.
◆ hasItem()
bool core::player::Bag::hasItem |
( |
item::Id |
item | ) |
const |
Returns true if at least one of the given items is owned.
- Parameters
-
item | The item to search for |
- Returns
- True if owned, false if none
Definition at line 42 of file Bag.cpp.
◆ itemCount()
unsigned int core::player::Bag::itemCount |
( |
item::Id |
item | ) |
const |
Returns the number of the given item owned.
- Parameters
-
item | The item to search for |
- Returns
- unsigned int The amount of that item that is owned
Definition at line 37 of file Bag.cpp.
◆ removeItem()
bool core::player::Bag::removeItem |
( |
item::Id |
item, |
|
|
unsigned int |
qty = 1 |
|
) |
| |
Removes the given item from the bag.
- Parameters
-
item | The item to remove |
qty | How many to remove |
- Returns
- True if the item was removed, false if not enough to remove
Definition at line 52 of file Bag.cpp.
◆ bl::serial::SerializableObject< Bag >
friend struct bl::serial::SerializableObject< Bag > |
|
friend |
The documentation for this class was generated from the following files: