inventory and its ui

Former-commit-id: b1a073c5636ac4516e6c9cf41bb97a844057de3f
This commit is contained in:
Song Minjae
2017-03-17 03:28:47 +09:00
parent 3d91023011
commit 2491a03c99
15 changed files with 364 additions and 63 deletions

View File

@@ -35,11 +35,11 @@ internal object Inventory : ConsoleCommand {
Echo("(inventory empty)")
}
else {
target.inventory.forEach { refId, amount ->
if (amount == 0) {
EchoError("Unexpected zero-amounted item: ID $refId")
target.inventory.forEach {
if (it.amount == 0) {
EchoError("Unexpected zero-amounted item: ID ${it.item.id}")
}
Echo("ID $refId${if (amount > 1) " ($amount)" else ""}")
Echo("ID ${it.item.id}${if (it.amount > 1) " ($it.second)" else ""}")
}
}
}
@@ -62,7 +62,7 @@ internal object Inventory : ConsoleCommand {
val item = ItemCodex[refId]
// if the item does not exist, add it first
if (!target.inventory.contains(item)) {
if (!target.inventory.hasItem(item)) {
target.inventory.add(item)
}