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

items display message only if used from GUI #1859

Merged
merged 2 commits into from
Jul 28, 2023
Merged

items display message only if used from GUI #1859

merged 2 commits into from
Jul 28, 2023

Conversation

Veracity0
Copy link
Contributor

@Veracity0 Veracity0 commented Jul 28, 2023

Items with the "message" type display an amusing message when used and are not consumed.

  1. Allow "message" as a secondary attribute.
  2. A "drink with a fly in it", N. O. Beer, Otarian Battle Scar are all drinks that are undrinkable. Make them drink, message
  3. gloomy black mushroom and oily golden mushroom are foods that are inedible. Make them food, message
  4. Add showHTML field of a UseItemRequest to control whether we'll pop up a documentation frame to display KoL's funny message. This defaults to true.
  5. The "use" command (and its synonyms: eat, drink, chew) - as well as functions in the RuntimeLibrary which are implemented using the CLI command - get a UseItemRequest (or subclasses) and specify that showHTML is false.

The end result is that if you "use" an item from the Item Manager, you see the amusing message, but if you "use" an item from a script, you do not.

@Veracity0 Veracity0 requested a review from a team as a code owner July 28, 2023 14:25
@codecov
Copy link

codecov bot commented Jul 28, 2023

Codecov Report

Merging #1859 (307af2e) into main (83fb513) will increase coverage by 0.00%.
The diff coverage is 45.45%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##               main    #1859   +/-   ##
=========================================
  Coverage     36.32%   36.32%           
- Complexity    18756    18757    +1     
=========================================
  Files          1081     1081           
  Lines        166316   166332   +16     
  Branches      35387    35391    +4     
=========================================
+ Hits          60417    60424    +7     
- Misses        96026    96032    +6     
- Partials       9873     9876    +3     
Files Changed Coverage Δ
...ourceforge/kolmafia/request/SpleenItemRequest.java 19.04% <0.00%> (-0.68%) ⬇️
...t/sourceforge/kolmafia/request/EatItemRequest.java 24.48% <25.00%> (-0.13%) ⬇️
...sourceforge/kolmafia/request/DrinkItemRequest.java 21.21% <40.00%> (+0.03%) ⬆️
...t/sourceforge/kolmafia/request/UseItemRequest.java 16.58% <62.50%> (+0.16%) ⬆️
...sourceforge/kolmafia/persistence/ItemDatabase.java 48.27% <100.00%> (+0.05%) ⬆️
...eforge/kolmafia/textui/command/UseItemCommand.java 28.80% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

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

@jaadams5
Copy link
Contributor

What is the expected behavior when an item is used from the relay browser? I would expect it to be the same as using it from the (KoLmafia) GUI but figured I would ask.

@Veracity0
Copy link
Contributor Author

What is the expected behavior when an item is used from the relay browser? I would expect it to be the same as using it from the (KoLmafia) GUI but figured I would ask.

We only show the HTML if you use the item with a UseItemRequest. The Relay Browser submits RelayRequests. Therefore, no window is popped up. Which is, I hope, expected, since if you use the item in the Relay Browser, you will see KoL's response in the Browser.

(Yes, ResponseTextParser will call UseItemRequest.parseConsumption - but it explicitly passes "false" for showHTML.)

@Veracity0 Veracity0 merged commit bc0246c into main Jul 28, 2023
8 checks passed
@Veracity0 Veracity0 deleted the item-messages branch July 28, 2023 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants