Skip to content

Fix cash shop lock after purchase failure - #269

Merged
ErwinsExpertise merged 2 commits into
masterfrom
copilot/fix-cash-shop-lock
Mar 31, 2026
Merged

ErwinsExpertise merged 2 commits into
masterfrom
copilot/fix-cash-shop-lock

Conversation

Copilot AI commented Mar 30, 2026 •

Copy link
Copy Markdown
Contributor

Failed cash shop operations (buy item, buy package, increase slots) left the client UI locked. The client waits for a SendChannelCSAction response to complete the operation flow, but several error paths only sent SendChannelCSUpdateAmounts, which updates the NX/MP display without signaling operation completion.

Changes

  • BuyItem: Replace packetCashShopUpdateAmounts with packetCashShopError for unknown SN, not-on-sale, invalid currency, and item creation failure paths. Add missing error response for unreachable currency branch at charge time.
  • BuyPackage: Same treatment for unknown SN, empty package, invalid currency, zero itemID, item creation failure, and GiveItem failure paths.
  • IncreaseSlots: Add missing error response for unknown currency type (previously a bare return).

Before:

if !ok || commodity.ItemID == 0 {
    plr.Send(packetCashShopUpdateAmounts(plrNX, plrMaplePoints)) // client stays locked
    return
}

After:

if !ok || commodity.ItemID == 0 {
    plr.Send(packetCashShopError(opcode.SendCashShopBuyFailed, constant.CashShopErrorOutOfStock))
    return
}

Replace packetCashShopUpdateAmounts with packetCashShopError in all
failure paths that were missing the CSAction error response. The client
expects a SendChannelCSAction packet to complete the operation flow;
only sending SendChannelCSUpdateAmounts left the UI locked.

Affected operations:
- BuyItem: unknown SN, not on sale, invalid currency, item creation
  failure, and unknown currency at charge time
- BuyPackage: unknown SN, no package items, invalid currency, zero
  itemID, item creation failure, and GiveItem failure
- IncreaseSlots: unknown currency type

Agent-Logs-Url: https://github.com/Hucaru/Valhalla/sessions/2157034a-85bb-4704-bbc9-c72f3b5006b3

Co-authored-by: ErwinsExpertise <44278151+ErwinsExpertise@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix cash shop lock after purchase failure Fix cash shop lock after purchase failure Mar 30, 2026
Copilot AI requested a review from ErwinsExpertise March 30, 2026 21:22
@ErwinsExpertise
ErwinsExpertise marked this pull request as ready for review March 31, 2026 15:03
@ErwinsExpertise
ErwinsExpertise merged commit ae5fd67 into master Mar 31, 2026
3 checks passed
@ErwinsExpertise
ErwinsExpertise deleted the copilot/fix-cash-shop-lock branch March 31, 2026 15:03
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.

Cash shop lock after failure in purchase

3 participants