diff options
Diffstat (limited to 'internal/game/cmd_remove.go')
| -rw-r--r-- | internal/game/cmd_remove.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/internal/game/cmd_remove.go b/internal/game/cmd_remove.go index c046537..3a451af 100644 --- a/internal/game/cmd_remove.go +++ b/internal/game/cmd_remove.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" + "thehouseoficarus/internal/item" "thehouseoficarus/internal/net" - "thehouseoficarus/internal/object" "thehouseoficarus/internal/player" ) @@ -30,7 +30,7 @@ func (g *Game) doRemove(sess *net.Session, input string) { qty, itemName := parseQty(input) - var foundSlot object.EquipSlot + var foundSlot item.EquipSlot var foundItemID string for _, slot := range EquipSlots { @@ -59,7 +59,7 @@ func (g *Game) doRemove(sess *net.Session, input string) { return } - if foundSlot == object.SlotAmmo && p.AmmoQty > 0 { + if foundSlot == item.SlotAmmo && p.AmmoQty > 0 { g.removeAmmo(sess, p, qty) return } @@ -91,7 +91,7 @@ func (g *Game) doRemove(sess *net.Session, input string) { } func (g *Game) removeAmmo(sess *net.Session, p *player.Player, qty int) { - ammoID := p.Equipment[object.SlotAmmo] + ammoID := p.Equipment[item.SlotAmmo] removeQty := p.AmmoQty if qty > 0 && qty < removeQty { removeQty = qty @@ -103,7 +103,7 @@ func (g *Game) removeAmmo(sess *net.Session, p *player.Player, qty int) { s.Quantity += removeQty p.AmmoQty -= removeQty if p.AmmoQty <= 0 { - delete(p.Equipment, object.SlotAmmo) + delete(p.Equipment, item.SlotAmmo) p.AmmoQty = 0 } g.AccountStore.SaveCharacter(p) @@ -126,7 +126,7 @@ func (g *Game) removeAmmo(sess *net.Session, p *player.Player, qty int) { p.SetInvSlot(freeSlot, &player.InventorySlot{ItemID: ammoID, Quantity: removeQty}) p.AmmoQty -= removeQty if p.AmmoQty <= 0 { - delete(p.Equipment, object.SlotAmmo) + delete(p.Equipment, item.SlotAmmo) p.AmmoQty = 0 } g.AccountStore.SaveCharacter(p) @@ -148,7 +148,7 @@ func (g *Game) doRemoveAll(sess *net.Session) { } needed := len(p.Equipment) - if _, hasAmmo := p.Equipment[object.SlotAmmo]; hasAmmo { + if _, hasAmmo := p.Equipment[item.SlotAmmo]; hasAmmo { needed-- needed++ } @@ -165,7 +165,7 @@ func (g *Game) doRemoveAll(sess *net.Session) { continue } - if slot == object.SlotAmmo && p.AmmoQty > 0 { + if slot == item.SlotAmmo && p.AmmoQty > 0 { g.removeAllAmmo(sess, p, itemID) continue } @@ -198,7 +198,7 @@ func (g *Game) removeAllAmmo(sess *net.Session, p *player.Player, itemID string) s := p.InvSlot(i) if s != nil && s.ItemID == itemID { s.Quantity += p.AmmoQty - delete(p.Equipment, object.SlotAmmo) + delete(p.Equipment, item.SlotAmmo) p.AmmoQty = 0 def, _ := g.ItemStore.Load(itemID) name := itemID @@ -213,7 +213,7 @@ func (g *Game) removeAllAmmo(sess *net.Session, p *player.Player, itemID string) if freeSlot >= 0 { p.SetInvSlot(freeSlot, &player.InventorySlot{ItemID: itemID, Quantity: p.AmmoQty}) } - delete(p.Equipment, object.SlotAmmo) + delete(p.Equipment, item.SlotAmmo) p.AmmoQty = 0 def, _ := g.ItemStore.Load(itemID) name := itemID |
