Add optional purchase confirmation before buying a generator (#109) - #157
Merged
Conversation
Players could accidentally buy a generator with a single click. Add a buy-confirmation config option (default true) that asks the player to confirm in chat before the purchase is made. The three BUY click handlers in the player panels now delegate to a new shared CommonPanel.purchaseGenerator helper, which: - refreshes the panel and bails out if the generator cannot be purchased (the reason is already messaged by canPurchaseGenerator), - purchases directly when confirmation is disabled, - otherwise requests a chat confirmation and only purchases on confirm. Adds the buy-confirmation setting, a confirm-generator-purchase locale string, and tests for the helper and the setting default. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01D7NWPeGXmsUJnnX42X24Rd
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Closes #109
Problem
Players reported buying generators unwittingly — a single click on the BUY action purchases immediately.
Change
Adds a
buy-confirmationconfig option (default true). When enabled, buying a generator asks the player to confirm in chat before any money is taken.The three BUY click handlers (
GeneratorUserPanel×1,GeneratorViewPanel×2) previously duplicated the same purchase logic. They now delegate to a sharedCommonPanel.purchaseGenerator(island, data, tier)helper, which:canPurchaseGenerator),ConversationUtils.createConfirmationand only purchases on confirm.The chat-confirmation approach matches how this addon already confirms other actions (e.g. library data replacement).
Added
Settings.buyConfirmation(buy-confirmation, default true) + getter/setter.stone-generator.conversations.confirm-generator-purchaselocale string (en-US).CommonPanel.purchaseGeneratorshared helper.Tests
CommonPanelPurchaseTest:Full suite: 66 tests pass.
🤖 Generated with Claude Code