aboutsummaryrefslogtreecommitdiff
path: root/internal/game/action_identify.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-25 15:40:48 -0400
committerhistoria <[not public]>2026-06-25 15:40:48 -0400
commitabd612c15799f604e671e83dc7c410ed2b44185f (patch)
tree0597ca92350de73aac2a7cf26b2f2d6595dac0cc /internal/game/action_identify.go
parent2725e2927a1595c7b100d942d1f14146252adeb7 (diff)
downloadthehouseoficarus-abd612c15799f604e671e83dc7c410ed2b44185f.tar.gz
slop refactor
Diffstat (limited to 'internal/game/action_identify.go')
-rw-r--r--internal/game/action_identify.go83
1 files changed, 0 insertions, 83 deletions
diff --git a/internal/game/action_identify.go b/internal/game/action_identify.go
deleted file mode 100644
index 401ab94..0000000
--- a/internal/game/action_identify.go
+++ /dev/null
@@ -1,83 +0,0 @@
-package game
-
-import (
- "fmt"
-
- "thehouseoficarus/internal/action"
- "thehouseoficarus/internal/net"
- "thehouseoficarus/internal/player"
-)
-
-func (g *Game) advanceIdentify(sess *net.Session, p *player.Player) {
- data, ok := p.Action.Data.(*action.IdentifyData)
- if !ok {
- g.cancelAction(p)
- return
- }
- junkID := data.JunkID
- xpPer := data.XPPer
-
- scrapCount := p.CountItem("scrap")
- if scrapCount == 0 {
- sess.WriteLine("You don't have any scrap.")
- g.cancelAction(p)
- return
- }
-
- scavLevel := p.Level(player.Scavenging)
- multiplier := junkMultiplier(junkID, scavLevel)
- totalJunk := scrapCount * multiplier
-
- hasExistingStack := false
- for i := 0; i < 28; i++ {
- slot := p.InvSlot(i)
- if slot != nil && slot.ItemID == junkID {
- hasExistingStack = true
- break
- }
- }
- if !hasExistingStack && p.FirstFreeSlot() == -1 {
- sess.WriteLine("Your inventory is too full!")
- g.cancelAction(p)
- return
- }
-
- for i := 0; i < 28; i++ {
- slot := p.InvSlot(i)
- if slot != nil && slot.ItemID == "scrap" {
- p.SetInvSlot(i, nil)
- }
- }
-
- placed := false
- for i := 0; i < 28; i++ {
- slot := p.InvSlot(i)
- if slot != nil && slot.ItemID == junkID {
- slot.Quantity += totalJunk
- placed = true
- break
- }
- }
- if !placed {
- freeSlot := p.FirstFreeSlot()
- p.SetInvSlot(freeSlot, &player.InventorySlot{ItemID: junkID, Quantity: totalJunk})
- }
-
- totalXP := scrapCount * xpPer
- junkName := junkID
- if def, err := g.ItemStore.Load(junkID); err == nil {
- junkName = g.itemColorize(sess, def, def.Name)
- }
-
- msg := fmt.Sprintf("The altar hums. You identify %d scrap into %d %s.", scrapCount, totalJunk, junkName)
-
- g.awardSkillXP(sess, p, player.Scavenging, totalXP)
-
- if p.OptionBool("xp_drops") && totalXP > 0 {
- msg += g.formatXpDropSingle(sess, p, player.Scavenging, totalXP)
- }
- sess.WriteLine(msg)
-
- g.AccountStore.SaveCharacter(p)
- g.cancelAction(p)
-}