Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: detect rock garden levels #1410

Merged
merged 3 commits into from
Jan 8, 2023
Merged

Conversation

midgleyc
Copy link
Member

@midgleyc midgleyc commented Jan 6, 2023

Detect rock garden levels.

Picking is slightly unusual, haven't yet decided what the best design would be. Might want to interpret this as three "garden"s as they're all individually pickable: campground.php?action=rgarden1, rgarden2, rgarden3. No idea how to configure this in the harvest preference. Don't really know how the garden command should work either; maybe it should take a number or otherwise do all? I think it's most likely folk will either harvest anything or all on day 7, though.

@codecov
Copy link

codecov bot commented Jan 6, 2023

Codecov Report

Merging #1410 (fb56279) into main (fc6e638) will increase coverage by 0.01%.
The diff coverage is 71.42%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1410      +/-   ##
============================================
+ Coverage     33.67%   33.68%   +0.01%     
- Complexity    16803    16813      +10     
============================================
  Files          1051     1051              
  Lines        162209   162252      +43     
  Branches      34842    34859      +17     
============================================
+ Hits          54618    54649      +31     
- Misses        98222    98224       +2     
- Partials       9369     9379      +10     
Impacted Files Coverage Δ
.../net/sourceforge/kolmafia/objectpool/ItemPool.java 14.28% <ø> (ø)
...ourceforge/kolmafia/request/CampgroundRequest.java 42.54% <71.42%> (+2.17%) ⬆️
...sourceforge/kolmafia/textui/langserver/Script.java 81.91% <0.00%> (-3.20%) ⬇️
src/net/sourceforge/kolmafia/KoLCharacter.java 59.22% <0.00%> (-0.09%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fc6e638...fb56279. Read the comment docs.

@@ -0,0 +1,598 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this an intentionally commited file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in this PR. It's the Google Code style. It could be nice to have.

@Veracity0
Copy link
Contributor

Veracity0 commented Jan 6, 2023

Harvest preference is a pain. It only applies to a single garden, and if you change gardens, you have to change it.
That's why I wrote Veracity's Garden Harvester; you can make choices for all gardens and it will detect what you have and do what you asked.

Perhaps configuration options:

1 groveling gravel, 1 milestone, 1 whetstone
2 groveling gravel, 2 milestone, 2 whetstone
3 groveling gravel, 3 milestone, 3 whetstone
1 fruity pebble, 1 something, 1 something
2 fruity pebble, 2 something, 2 something
3 fruity pebble, 3 something, 3 something
1 lodestone, 1 molehill mountain, 1 strange stalagmite

Which is say - pick all three gardens on day 1, 2, 3, 4, 5, 6, or 7

Unfortunately, your three gardens CAN all be on different days.

Each plot has an item - milestone (0), milestone (1), milestone (2), milestone (3) ... - that tells you the current state of the plot. I.e., what you will get when you pick.
I see you are doing that.

This item is a poser.

I think, perhaps, the garden command should consider this as 3 gardens. We currently have:

garden
(tells state of garden. if you have a rock garden, should tell all three)
garden fertilize
(mushroom garden only. Fight's piranha plant to get in)
garden pick
(picks your garden in its current state)

For the rock garden, "garden pick" should get all three, I think
"garden pick [plot] 1" could pick plot 1 (whatever that is?)
(Much as have "telescope [look] high")

Should we have keywords to name each garden? Wiki refers to them as "Plot 1" "Plot 2" and "Plot 3"

|| findImage(responseText, "rockgarden/a5.gif", ItemPool.FRUITY_PEBBLE, 2)
|| findImage(responseText, "rockgarden/a6.gif", ItemPool.FRUITY_PEBBLE, 3)
|| findImage(responseText, "rockgarden/a7.gif", ItemPool.LODESTONE, 1)) {
CampgroundRequest.setCampgroundItem(ItemPool.ROCK_SEEDS, 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Plot 1 has from 1-7 days of growth, you add the harvestable crop ITEM (COUNT) - and also rock seeds (1).

CampgroundRequest.setCampgroundItem(ItemPool.ROCK_SEEDS, 1);
} else {
findImage(
responseText, "rockgarden/a0.gif", ItemPool.GROVELING_GRAVEL, 0, ItemPool.ROCK_SEEDS, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Plot 1 has been harvested today - image 0 - you add ITEM(0) and also rock seeds (0).
Why not rock seeds (1)? That seems like the general indicator of "having a rock garden".

|| findImage(responseText, "rockgarden/b7.gif", ItemPool.MOLEHILL_MOUNTAIN, 1)) {
CampgroundRequest.setCampgroundItem(ItemPool.ROCK_SEEDS, 1);
} else {
findImage(responseText, "rockgarden/b0.gif", ItemPool.MILESTONE, 0, ItemPool.ROCK_SEEDS, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And that comes into play here.
What if Plot 1 is still growing but Plot 2 has been harvested to the ground?
The first one added rock seeds (1) and this is now adding rock seeds (0)?

|| findImage(responseText, "rockgarden/c7.gif", ItemPool.STRANGE_STALAGMITE, 1)) {
CampgroundRequest.setCampgroundItem(ItemPool.ROCK_SEEDS, 1);
} else {
findImage(responseText, "rockgarden/c0.gif", ItemPool.WHETSTONE, 0, ItemPool.ROCK_SEEDS, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

I think you should look for 3 plots images 0-7, add the appropriate plot item, and always add rock seeds (1)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other gardens use the count as the number of days the garden has been planted. We can't do that here because it's actually three gardens.

What I was trying for was to do rock seeds = 0 if the rock garden was present but empty and 1 otherwise. However, I did it wrong :P

@midgleyc midgleyc merged commit 5809617 into kolmafia:main Jan 8, 2023
@midgleyc midgleyc deleted the rock-garden branch January 8, 2023 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants