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

Unify Shops, Scrubs and Merchants price and hinting code #4321

Open
wants to merge 10 commits into
base: develop-rando
Choose a base branch
from

Conversation

Pepper0ni
Copy link
Contributor

@Pepper0ni Pepper0ni commented Sep 4, 2024

This removes HINT_TEXT_MERCHANT (something I wanted to do before upstream) and fixes a bunch of related issues at the same time as massively expanding the price options for all 3 types of check.

New Features

  • Shopsanity, Scrubsanity and Merchants now all have the same price settings, which have been significantly expanded. The new options are:
    • Vanilla Prices (Based on the slot for Shopsanity)
    • Balanced, same as old Shopsanity Balanced
    • Cheap Balanced, same as old Scrubsanity Random.
    • Fixed Price
    • Price Range
    • Setting the price by wallet, with the ability to set any combination of weights for how likely each wallet is to be chosen
    • Additionally there is an affordable tickbox for all options except fixed, which reduces the price down to the lowest level for that wallet in logic after all other calculations.
  • Bean Shuffle is now an option for Merchant shuffle, similar to how Loach is an extension of Fishanity. This makes handling derived settings easier.
  • Scrub Shuffle off now despawns the 3 vanilla One-time scrubs instead of always shuffling them. Shuffling only those scrubs as before is now the Scrubsanity setting "One-Time Only".
  • Removed the Navi hint hinting about this quirk as a result
  • Scrubs now use BUY_ versions of items when not shuffled, fitting their ability to respawn, this should mean that are now considered ammo and shield sources in logic.
  • Tycoon Wallet has been split away from Shopsanity and is now it's own tickbox. This allows for more settings combonations or the use of infinite wallets as the 3rd wallet instead.
  • Auto-Format now properly handles TWO_WAY_CHOICEs
  • A new special character is added, _, which is only changed by auto-format and denotes a whitespace that should not be used for newlines
  • Using Auto-Format, long item names in shops are more elegantly handled
  • CustomMessageManager::CreateMessage No longer manually formats, allowing for auto-format compatibility.
  • Shop and Scrub text, as well as few other text files I felt like going over while making things compatible with the above, now use Auto-Format
  • CustomMessageManager::RetrieveMessage now accepts a MessageFormat argument for formatting the retrieved message.
  • CanBuy now checks all items, not just shop items. Most checks have a price of 0 that makes it always pass.
  • CanBuyAnother allows logic to see if another check can be purchased, it is used as part of Carpet Merchant's bombchu refill logic
  • More consistent Colour tagging when shopping. Red is misc details, green is the item name, and yellow is the price.

Bugfixes

Cleanups

  • Price handling for all of Shopsanity, Scrubsanity and Merchants now uses the same code, relying on ItemLocation's GetPrice
  • All Shop, Scrub and Merchant locations now have a vanilla price in the location list
  • HINT_TYPE_MERCHANT is removed, as merchants now use all the same systems as shops and scrubs, including their hint.
  • TEXT_SHOP_ITEM_RANDOM_CONFIRM now points to the actual start of the confirms, and TEXT_SHOP_ITEM_RANDOM_CONFIRM_END exists to signify the last confirm text ID.
  • Carpet Merchant VB implantation is improved, no longer sets the INF in text replacement
  • CanBuy no longer redundantly filters out buyable bottle items before bottle, as HasItem not applies this in all contexts, this allowed for a significant cleanup
  • Removed unused 3DS function WriteIngameSpoilerLog and related structs, possibly improving seed generation time

Build Artifacts

Copy link
Contributor

@Pepe20129 Pepe20129 left a comment

Choose a reason for hiding this comment

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

Can't really comment on the hint part of this PR but there's some other stuff that could be improved.

soh/soh/Enhancements/randomizer/3drando/shops.cpp Outdated Show resolved Hide resolved
soh/soh/Enhancements/randomizer/3drando/shops.cpp Outdated Show resolved Hide resolved
soh/soh/Enhancements/randomizer/hook_handlers.cpp Outdated Show resolved Hide resolved
soh/src/overlays/actors/ovl_En_Ds/z_en_ds.c Outdated Show resolved Hide resolved
soh/src/overlays/actors/ovl_En_Ds/z_en_ds.c Show resolved Hide resolved
Comment on lines +150 to 158
if (!GameInteractor_Should(VB_GIVE_ITEM_FROM_CARPET_SALESMAN, false, this)) {
if (GameInteractor_Should(VB_GIVE_BOMBCHUS_FROM_CARPET_SALESMAN, true, this) || Actor_HasParent(&this->actor, play)){
Rupees_ChangeBy(-200);
En_Js_SetupAction(this, func_80A89160);
} else{
Message_ContinueTextbox(play, 0x6073);
func_80A89008(this);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is fairly confusing, what is this change for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In order to avoid a 2 part knot of logic where Bombchu Bag and Merchant Shuffle are both trying to affect the same vanilla function, I made it so that if the merchant is selling a randomised check, it completely skips the vanilla handling and processes the sale entirely in the hook. This also made handling the flag and post-sale custom text (Now I can get back to being an arms dealer) timing conflict much easier as I could swap the text IDs without making another hook and another flag for that hook.

soh/include/macros.h Outdated Show resolved Hide resolved
Pepper0ni and others added 2 commits September 5, 2024 12:28
Note to self, Don't code tired. *proceeds to ignore note*

Co-authored-by: Angelo Bulfone <[email protected]>
@Pepe20129 Pepe20129 added code cleanup rando v3 Issues specifically targeting develop-rando labels Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code cleanup rando v3 Issues specifically targeting develop-rando
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants