Skip to content

feat: add buy 100 helper for city shops#447

Merged
Manuito83 merged 1 commit into
Manuito83:developfrom
AlexTzib:fix/city-shops-buy-100
May 23, 2026
Merged

feat: add buy 100 helper for city shops#447
Manuito83 merged 1 commit into
Manuito83:developfrom
AlexTzib:fix/city-shops-buy-100

Conversation

@AlexTzib
Copy link
Copy Markdown
Contributor

@AlexTzib AlexTzib commented May 5, 2026

This is a focused attempt at #132.

What changed:

  • adds a small browser helper on Torn city shop pages: shops.php, bigalgunshop.php, and token_shop.php
  • injects a 100 button beside shop Buy controls
  • when tapped, it fills the purchase quantity with up to 100 while trying to respect visible stock, available money, and any max value exposed on the input
  • does not submit the purchase automatically, so the user still confirms by pressing the normal Buy flow

Why:
For common shop runs, setting the quantity manually is repetitive. This keeps the helper small and similar in spirit to the existing Torn PDA browser helpers that fill values on Torn pages.

Notes:
Torn shop pages are React/DOM driven and class names can change, so I kept the selectors defensive and limited the injection to shop URLs only.

Local verification:

  • Ran git diff --check.
  • Extracted the injected JavaScript from the Dart file and parsed it with Node: cityShopsBuy100JS syntax ok.

I could not run Flutter analyzer/build locally because flutter is not available on this PATH, so GitHub CI will be the compile check.

@AlexTzib
Copy link
Copy Markdown
Contributor Author

AlexTzib commented May 6, 2026

Hi @Manuito83, one thing I noticed while re-reviewing this PR.

The helper is intended to fill a quantity of up to 100 and not submit the purchase, which is exactly the right direction. The only risky part I see is the fallback path in fillBuy100: if no quantity input is found, it calls the original buy button with buyButton.click() and then tries to find the input after a short delay.

That is probably fine on shop pages where the first click only opens a quantity dialog, but if any targeted page/shop variant submits directly, tapping the new 100 button could accidentally buy instead of only filling the amount.

Would you prefer we remove that fallback and only fill when an input is already discoverable, or do you know these three pages always open a quantity step first? I think this is worth deciding before merge because it touches purchase behavior.

@AlexTzib AlexTzib force-pushed the fix/city-shops-buy-100 branch from a978d68 to 8b93d0d Compare May 10, 2026 07:13
@AlexTzib
Copy link
Copy Markdown
Contributor Author

Small update after comparing this with the existing foreign-stock buy max helper.

I kept the city-shop specific selectors because the Torn city shop DOM is different from the abroad stock DOM, so the foreign-stock helper cannot be reused as-is. But I aligned the behavior with the safer parts of that existing app helper:

  • only inject the helper when the page has Torn money visible, similar to the abroad safety check
  • keep the helper passive: pressing 100 now only fills the quantity input when one is available
  • removed the fallback that clicked the real Buy button, because that could be risky on shop variants where Buy submits immediately
  • moved the button styling into one injected style block instead of inline styles on every button
  • kept the quantity calculation capped by money, detected stock, and input max/data-money values

So this is still a city-shop implementation, but it now follows the same safer pattern as the existing abroad helper instead of trying to trigger the real buy flow.

@Manuito83
Copy link
Copy Markdown
Owner

Thanks!

@Manuito83 Manuito83 merged commit 0ff82e5 into Manuito83:develop May 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants