Skip to content

feat(ItemRestoration): restore vendored and disenchanted items - #223

Merged
Nyeriah merged 1 commit into
azerothcore:masterfrom
Nyeriah:feat/item-recovery-sources
Nov 4, 2026
Merged

Nyeriah merged 1 commit into
azerothcore:masterfrom
Nyeriah:feat/item-recovery-sources

Conversation

@Nyeriah

@Nyeriah Nyeriah commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

What and why

Since azerothcore/azerothcore-wotlk#28357 the core also keeps items players sold to a vendor or disenchanted, together with the copper or materials they got for them. The Item Restoration product can now sell those back too. On top of the points, the store takes that copper from the character's money and those materials from their bags or bank. It sits behind a new admin option in Tools, off by default, and needs the .support recovery commands from mod-enhanced-support.

Decisions worth knowing

  • The website never edits inventories. The cost check and the payment go through .support recovery check|redeem over SOAP, which handles the character online or fully logged out (no session on the account for at least a minute). The option is greyed out unless mod-enhanced-support is in the modules list, and saving it asks the worldserver for help support recovery (SettingsController.php).
  • The cost is checked when the item goes into the cart and again at checkout before the points are taken, since the bags can change in between (CartValidation.php, ItemRestoration::checkout_order_processed).
  • A restoration that fails after payment (a duplicate order, or the server refusing) now puts the order on hold with the server's reply as an order note, so it can be refunded. Before, a failed item restore left the order completed with no trace. This covers destroyed items too.
  • The free restoration page keeps offering destroyed items only, and getOwnedRestorableItemCharacterName is limited to Source = 0, so the free endpoint can't hand out a sold item without its cost.

Review guide

ItemRestoration.php holds the flow: checkRecoveryCost and the rewritten payment_complete. ToolsApi.php runs the commands and decides what counts as success. ACoreServices.php adds Source, Money and the materials to the list (one extra query) and the ownership lookup. Tools.php, Opts.php, ItemRestorationPage.php and the cost display JS are mechanical.

Known gaps

  • Success is matched against English reply text ("Recovery N: ... can redeem" / "redeemed for", and "Mail sent to" for item restore), because AcoreSoap::executeCommand() returns command errors as text. A non-English worldserver locale would see every restoration fail and every order go on hold.
  • The checkout-time check uses woocommerce_checkout_order_processed, which the block checkout doesn't fire. The cart check and the on-hold fallback still apply there.

The core now also records items sold to a vendor or disenchanted, with
the copper and materials the player got for them. The store offers those
rows behind a new admin option and charges that cost back from the
character's bags through mod-enhanced-support's .support recovery
check/redeem commands.

- The option is greyed out unless mod-enhanced-support is installed, and
  saving it checks that the worldserver knows the command.
- The cost is checked when the item is added to the cart and again at
  checkout, then redeemed on payment.
- A restoration that fails after payment puts the order on hold with the
  server's reply, instead of completing it silently.
- The free restoration page keeps offering destroyed items only.
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Walkthrough

The plugin adds an option for sold and disenchanted item recovery. It retrieves recovery-source costs and ownership data, filters item listings, validates recovery during checkout, and processes eligible recovery requests after payment.

Changes: Item restoration recovery

Layer / File(s) Summary
Recovery-source setting and data
src/acore-wp-plugin/src/Manager/Opts.php, src/acore-wp-plugin/src/Components/AdminPanel/Pages/Tools.php, src/acore-wp-plugin/src/Components/AdminPanel/SettingsController.php, src/acore-wp-plugin/src/Manager/ACoreServices.php
Adds the recovery-source option and admin control. Service queries now return recovery costs, loot, and ownership data.
Recovery API and item listing
src/acore-wp-plugin/src/Components/Tools/ToolsApi.php, src/acore-wp-plugin/src/Components/UserPanel/Pages/ItemRestorationPage.php
Adds recovery check and redeem methods. Item listings filter nonzero-source rows when recovery sources are disabled.
Checkout validation and restoration
src/acore-wp-plugin/src/Hooks/WooCommerce/CartValidation.php, src/acore-wp-plugin/src/Hooks/WooCommerce/ItemRestoration.php
Checks recovery eligibility during cart validation and order processing. Eligible items are redeemed or restored; failed restorations put the order on hold.
Recovery cost display
src/acore-wp-plugin/src/Hooks/WooCommerce/ItemRestoration.php
Displays sale proceeds or disenchant costs and recovery availability information in the item selection UI.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Customer
  participant CartValidation
  participant ItemRestoration
  participant ACoreServices
  participant ToolsApi
  participant Worldserver
  Customer->>CartValidation: Add restoration item
  CartValidation->>ItemRestoration: checkRecoveryCost
  ItemRestoration->>ACoreServices: Check item ownership and source
  ItemRestoration->>ToolsApi: RecoveryCheck
  ToolsApi->>Worldserver: Check recovery eligibility
  ItemRestoration->>ToolsApi: RecoveryRedeem
  ToolsApi->>Worldserver: Redeem recovery item
Loading

Suggested reviewers: thescrewedsoftware

Merge Risk: High · up to b30a9

Resolve these issues before merging: existing restoration pages can fail on older schemas, and customers can pay for restorations that remain unfulfilled or require manual intervention. Payment callbacks without a customer session also fail the new ownership check.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@Nyeriah
Nyeriah merged commit 28305bc into azerothcore:master Nov 4, 2026
1 of 2 checks passed
Nyeriah added a commit that referenced this pull request Nov 4, 2026
…224)

## What and why

mod-enhanced-support's `.support recovery check|redeem` now count
disenchant materials in the bank and bank bags too, online and offline.
They take from the bags first, then the bank. This updates the store
note, the admin tooltip and the `ToolsApi` docblock from #223, which
said bags only.

Text only, no behavior change on the website side.
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.

1 participant