\Inventory

An inventory item.

Represents an object from the table 'inventory'.

Summary

Methods
Properties
Constants
__construct()
get_image()
$db
$uid
$id
$name
$type
$amount
$is_monster_pices
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$db

$db : resource

Type

resource — Database connection.

$uid

$uid : integer

Type

integer — Owner identifier.

$id

$id : integer|\K_Unit

Type

integer|\K_Unit — Item identifier. If its a monster piece, a K_Unit entity.

$name

$name : string

Type

string — Item name.

$type

$type : string

Type

string — Item type name.

$amount

$amount : integer

Type

integer — Item owned amount.

$is_monster_pices

$is_monster_pices : boolean

Type

boolean — Indicates if the item are monster pieces.

Methods

__construct()

__construct(resource  $db, integer  $id, integer  $type = null) 

Constructor.

Searches the database and retrieves the information about the building, populating it and it's items.

Parameters

resource $db

Connection to the database.

integer $id

Item identifier.

integer $type

Item type identifier. Optional, will try to guess if null.

get_image()

get_image() : string

Gets the path to the item image. The image must be in the img/content/inventory/ directory, and its name must be the item id, padded with '0' to 9 digites, and the extension must be '.png'.

Returns

string —

Image URL, or a fixed unknown image.