maxCost = $maxCost; } /** * Get the value of the stored items * * @return float * * @since 1.0.0 */ public function getValue() : float { return $this->value; } /** * Get the cost of the stored items * * @return float * * @since 1.0.0 */ public function getCost() : float { return $this->cost; } /** * Get the max allowed costs for the items * * @return float * * @since 1.0.0 */ public function getMaxCost() : float { return $this->maxCost; } /** * Get items * * @return array * * @since 1.0.0 */ public function getItems() : array { return $this->items; } /** * Add item to backpack * * @param Item $item Item * @param mixed $quantity Quantity of the item * * @return void * * @since 1.0.0 */ public function addItem(Item $item, $quantity = 1) : void { $this->items[] = ['item' => $item, 'quantity' => $quantity]; $this->value += $item->getValue() * $quantity; $this->cost += $item->getCost() * $quantity; } }