diff options
Diffstat (limited to 'internal/game/cmd_farm.go')
| -rw-r--r-- | internal/game/cmd_farm.go | 76 |
1 files changed, 3 insertions, 73 deletions
diff --git a/internal/game/cmd_farm.go b/internal/game/cmd_farm.go index 19cdf12..aaa3779 100644 --- a/internal/game/cmd_farm.go +++ b/internal/game/cmd_farm.go @@ -373,76 +373,6 @@ func (g *Game) doCure(sess *net.Session, input string) { g.AccountStore.SaveCharacter(p) } -func (g *Game) doInspect(sess *net.Session, input string) { - p := sess.Player - - objInstances := g.World.AllObjInstances(p.RoomID) - var farmPatches []struct { - prefix string - defID string - index int - } - - for _, obj := range objInstances { - if !farmPatchDefIDs[obj.DefID] { - continue - } - pref := farmFlagPrefix(obj.DefID, obj.Index) - if pref == "" { - continue - } - farmPatches = append(farmPatches, struct { - prefix string - defID string - index int - }{pref, obj.DefID, obj.Index}) - } - - if len(farmPatches) == 0 { - sess.WriteLine("There are no farming patches here.") - return - } - - if input != "" { - lower := strings.ToLower(input) - var filtered []struct { - prefix string - defID string - index int - } - for _, fp := range farmPatches { - def, _ := g.ObjectStore.Load(fp.defID) - if def != nil && strings.Contains(strings.ToLower(def.Name), lower) { - filtered = append(filtered, fp) - } - } - if len(filtered) == 0 { - for _, fp := range farmPatches { - if strings.Contains(fp.prefix, lower) || strings.Contains(strings.ToLower(fp.defID), lower) { - filtered = append(filtered, fp) - } - } - } - farmPatches = filtered - } - - for _, fp := range farmPatches { - g.ensureFarmState(p, fp.prefix) - def, _ := g.ObjectStore.Load(fp.defID) - patchName := fp.defID - if def != nil { - patchName = def.Name - } - indexStr := "" - if len(farmPatches) > 1 || fp.index > 0 { - indexStr = fmt.Sprintf(" %d", fp.index+1) - } - - sess.WriteLine(fmt.Sprintf("=== %s%s ===", patchName, indexStr)) - g.ShowFarmPatchDetail(sess, p, fp.prefix, fp.defID, fp.index) - } -} - func (g *Game) ShowFarmPatchDetail(sess *net.Session, p *player.Player, prefix, defID string, index int) { weeds, _ := p.Flags[prefix+"_weeds"].(bool) if weeds { @@ -465,7 +395,7 @@ func (g *Game) ShowFarmPatchDetail(sess *net.Session, p *player.Player, prefix, dead, _ := p.Flags[prefix+"_dead"].(bool) if dead { - sess.WriteLine(fmt.Sprintf(" Status: Dead")) + sess.WriteLine(" Status: Dead") sess.WriteLine(fmt.Sprintf(" Planted: %s", seedName)) sess.WriteLine(" (Rake to clear)") return @@ -473,7 +403,7 @@ func (g *Game) ShowFarmPatchDetail(sess *net.Session, p *player.Player, prefix, diseased, _ := p.Flags[prefix+"_diseased"].(bool) if diseased { - sess.WriteLine(fmt.Sprintf(" Status: Diseased!")) + sess.WriteLine(" Status: Diseased!") sess.WriteLine(fmt.Sprintf(" Planted: %s", seedName)) sess.WriteLine(" (Use plant cure to save it)") return @@ -481,7 +411,7 @@ func (g *Game) ShowFarmPatchDetail(sess *net.Session, p *player.Player, prefix, ready, _ := p.Flags[prefix+"_ready"].(bool) if ready { - sess.WriteLine(fmt.Sprintf(" Status: Ready to harvest!")) + sess.WriteLine(" Status: Ready to harvest!") sess.WriteLine(fmt.Sprintf(" Planted: %s", seedName)) return } |
