diff options
| author | historia <[not public]> | 2026-06-28 02:40:30 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-28 02:40:30 -0400 |
| commit | a1b6613c6c6a2f8d6e1ecd47e766bd40f92ac295 (patch) | |
| tree | 4ff8fefb029c93f2aa3db7361658b0b4e9805b66 /internal/game/cmd_farm.go | |
| parent | 87dacfbb3dd16e7f55a82361eace98f9a39d75c8 (diff) | |
| download | thehouseoficarus-a1b6613c6c6a2f8d6e1ecd47e766bd40f92ac295.tar.gz | |
feat: admin accounts, god mode, OLC commands like dig/room, 'inline' objects changed to 'local' objects
Diffstat (limited to 'internal/game/cmd_farm.go')
| -rw-r--r-- | internal/game/cmd_farm.go | 105 |
1 files changed, 50 insertions, 55 deletions
diff --git a/internal/game/cmd_farm.go b/internal/game/cmd_farm.go index 87d3d81..19cdf12 100644 --- a/internal/game/cmd_farm.go +++ b/internal/game/cmd_farm.go @@ -59,14 +59,6 @@ func (g *Game) executeCure(sess *net.Session, args []string, rawInput string) { } } -func (g *Game) executeInspect(sess *net.Session, args []string, rawInput string) { - if len(args) == 0 { - g.doInspect(sess, "") - } else { - g.doInspect(sess, strings.Join(args, " ")) - } -} - func (g *Game) doPlant(sess *net.Session, input string) { p := sess.Player @@ -447,61 +439,64 @@ func (g *Game) doInspect(sess *net.Session, input string) { } sess.WriteLine(fmt.Sprintf("=== %s%s ===", patchName, indexStr)) + g.ShowFarmPatchDetail(sess, p, fp.prefix, fp.defID, fp.index) + } +} - weeds, _ := p.Flags[fp.prefix+"_weeds"].(bool) - if weeds { - sess.WriteLine(" Status: Weeds") - sess.WriteLine(" (Rake to clear before planting)") - continue - } - - seedID, _ := p.Flags[fp.prefix+"_seed"].(string) - if seedID == "" { - sess.WriteLine(" Status: Empty") - sess.WriteLine(" (Ready to plant)") - continue - } - - seedName := seedID - if def, err := g.ItemStore.Load(seedID); err == nil { - seedName = def.Name - } +func (g *Game) ShowFarmPatchDetail(sess *net.Session, p *player.Player, prefix, defID string, index int) { + weeds, _ := p.Flags[prefix+"_weeds"].(bool) + if weeds { + sess.WriteLine(" Status: Weeds") + sess.WriteLine(" (Rake to clear before planting)") + return + } - dead, _ := p.Flags[fp.prefix+"_dead"].(bool) - if dead { - sess.WriteLine(fmt.Sprintf(" Status: Dead")) - sess.WriteLine(fmt.Sprintf(" Planted: %s", seedName)) - sess.WriteLine(" (Rake to clear)") - continue - } + seedID, _ := p.Flags[prefix+"_seed"].(string) + if seedID == "" { + sess.WriteLine(" Status: Empty") + sess.WriteLine(" (Ready to plant)") + return + } - diseased, _ := p.Flags[fp.prefix+"_diseased"].(bool) - if diseased { - sess.WriteLine(fmt.Sprintf(" Status: Diseased!")) - sess.WriteLine(fmt.Sprintf(" Planted: %s", seedName)) - sess.WriteLine(" (Use plant cure to save it)") - continue - } + seedName := seedID + if def, err := g.ItemStore.Load(seedID); err == nil { + seedName = def.Name + } - ready, _ := p.Flags[fp.prefix+"_ready"].(bool) - if ready { - sess.WriteLine(fmt.Sprintf(" Status: Ready to harvest!")) - sess.WriteLine(fmt.Sprintf(" Planted: %s", seedName)) - continue - } + dead, _ := p.Flags[prefix+"_dead"].(bool) + if dead { + sess.WriteLine(fmt.Sprintf(" Status: Dead")) + sess.WriteLine(fmt.Sprintf(" Planted: %s", seedName)) + sess.WriteLine(" (Rake to clear)") + return + } - stage := intFromFlag(p.Flags, fp.prefix+"_stage") - maxStages := 4 - if def, err := g.ItemStore.Load(seedID); err == nil && def.FarmStages > 0 { - maxStages = def.FarmStages - } - watered, _ := p.Flags[fp.prefix+"_watered"].(bool) + diseased, _ := p.Flags[prefix+"_diseased"].(bool) + if diseased { + sess.WriteLine(fmt.Sprintf(" Status: Diseased!")) + sess.WriteLine(fmt.Sprintf(" Planted: %s", seedName)) + sess.WriteLine(" (Use plant cure to save it)") + return + } - sess.WriteLine(fmt.Sprintf(" Status: Growing (stage %d/%d)", stage, maxStages)) + ready, _ := p.Flags[prefix+"_ready"].(bool) + if ready { + sess.WriteLine(fmt.Sprintf(" Status: Ready to harvest!")) sess.WriteLine(fmt.Sprintf(" Planted: %s", seedName)) - sess.WriteLine(fmt.Sprintf(" Watered: %s", boolToYes(watered))) - sess.WriteLine(fmt.Sprintf(" Diseased: %s", boolToYes(diseased))) + return + } + + stage := intFromFlag(p.Flags, prefix+"_stage") + maxStages := 4 + if def, err := g.ItemStore.Load(seedID); err == nil && def.FarmStages > 0 { + maxStages = def.FarmStages } + watered, _ := p.Flags[prefix+"_watered"].(bool) + + sess.WriteLine(fmt.Sprintf(" Status: Growing (stage %d/%d)", stage, maxStages)) + sess.WriteLine(fmt.Sprintf(" Planted: %s", seedName)) + sess.WriteLine(fmt.Sprintf(" Watered: %s", boolToYes(watered))) + sess.WriteLine(fmt.Sprintf(" Diseased: %s", boolToYes(diseased))) } func boolToYes(b bool) string { |
