blob: b7b52eda36ace3898e324db193464c0321316ca3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package game
import (
"fmt"
"thehouseoficarus/internal/net"
)
func (g *Game) executeInventory(sess *net.Session, args []string, rawInput string) {
g.doInventory(sess)
}
func (g *Game) doInventory(sess *net.Session) {
p := sess.Player
sess.WriteLine(fmt.Sprintf("Inventory (%d free):", p.FreeSlots()))
num := 0
for i := 0; i < 28; i++ {
slot := p.InvSlot(i)
if slot == nil {
continue
}
num++
def, err := g.ItemStore.Load(slot.ItemID)
name := slot.ItemID
if err == nil {
name = def.Name
}
coloredName := g.itemColorize(sess, def, name)
if slot.Quantity > 1 {
sess.WriteLine(fmt.Sprintf(" %2d) %d x %s", num, slot.Quantity, coloredName))
} else {
sess.WriteLine(fmt.Sprintf(" %2d) %s", num, coloredName))
}
}
}
|