From a2374dba6eb71ba0620f2529d5b7a54c4328a1b5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 30 Mar 2026 21:13:27 +0000 Subject: [PATCH 1/2] Initial plan From 0745d2b98ac69bf971dcb945c8fa0b2843c1e712 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 30 Mar 2026 21:21:05 +0000 Subject: [PATCH 2/2] Fix cash shop lock after purchase failure 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> --- cashshop/handle_client.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/cashshop/handle_client.go b/cashshop/handle_client.go index 15425e36..36135c7b 100644 --- a/cashshop/handle_client.go +++ b/cashshop/handle_client.go @@ -173,12 +173,12 @@ func (server *Server) handleCashShopOperation(conn mnet.Client, reader mpacket.R commodity, ok := nx.GetCommodity(sn) if !ok || commodity.ItemID == 0 { // Unknown SN - plr.Send(packetCashShopUpdateAmounts(plrNX, plrMaplePoints)) + plr.Send(packetCashShopError(opcode.SendCashShopBuyFailed, constant.CashShopErrorOutOfStock)) return } if commodity.OnSale == 0 || commodity.Price <= 0 { - plr.Send(packetCashShopUpdateAmounts(plrNX, plrMaplePoints)) + plr.Send(packetCashShopError(opcode.SendCashShopBuyFailed, constant.CashShopErrorOutOfStock)) return } @@ -202,13 +202,13 @@ func (server *Server) handleCashShopOperation(conn mnet.Client, reader mpacket.R return } default: - plr.Send(packetCashShopUpdateAmounts(plrNX, plrMaplePoints)) + plr.Send(packetCashShopError(opcode.SendCashShopBuyFailed, constant.CashShopErrorUnknown)) return } newItem, e := channel.CreateItemFromID(commodity.ItemID, count) if e != nil { - plr.Send(packetCashShopUpdateAmounts(plrNX, plrMaplePoints)) + plr.Send(packetCashShopError(opcode.SendCashShopBuyFailed, constant.CashShopErrorUnknown)) return } @@ -244,6 +244,7 @@ func (server *Server) handleCashShopOperation(conn mnet.Client, reader mpacket.R plr.SetMaplePoints(plrMaplePoints) default: log.Println("Unknown currency type: ", currencySel) + plr.Send(packetCashShopError(opcode.SendCashShopBuyFailed, constant.CashShopErrorUnknown)) return } @@ -261,7 +262,7 @@ func (server *Server) handleCashShopOperation(conn mnet.Client, reader mpacket.R commodity, ok := nx.GetCommodity(pkgSN) if !ok || commodity.Price <= 0 { - plr.Send(packetCashShopUpdateAmounts(plrNX, plrMaplePoints)) + plr.Send(packetCashShopError(opcode.SendCashShopBuyFailed, constant.CashShopErrorOutOfStock)) return } @@ -277,7 +278,7 @@ func (server *Server) handleCashShopOperation(conn mnet.Client, reader mpacket.R } } if !ok || len(pkgItems) == 0 { - plr.Send(packetCashShopUpdateAmounts(plrNX, plrMaplePoints)) + plr.Send(packetCashShopError(opcode.SendCashShopBuyFailed, constant.CashShopErrorOutOfStock)) return } @@ -294,7 +295,7 @@ func (server *Server) handleCashShopOperation(conn mnet.Client, reader mpacket.R return } default: - plr.Send(packetCashShopUpdateAmounts(plrNX, plrMaplePoints)) + plr.Send(packetCashShopError(opcode.SendCashShopBuyFailed, constant.CashShopErrorUnknown)) return } @@ -319,13 +320,13 @@ func (server *Server) handleCashShopOperation(conn mnet.Client, reader mpacket.R } if itemID == 0 { - plr.Send(packetCashShopUpdateAmounts(plrNX, plrMaplePoints)) + plr.Send(packetCashShopError(opcode.SendCashShopBuyFailed, constant.CashShopErrorOutOfStock)) return } newItem, e := channel.CreateItemFromID(itemID, count) if e != nil { - plr.Send(packetCashShopUpdateAmounts(plrNX, plrMaplePoints)) + plr.Send(packetCashShopError(opcode.SendCashShopBuyFailed, constant.CashShopErrorUnknown)) return } itemsToGive = append(itemsToGive, newItem) @@ -338,7 +339,7 @@ func (server *Server) handleCashShopOperation(conn mnet.Client, reader mpacket.R for _, it := range itemsToGive { if _, err := plr.GiveItem(it); err != nil { - plr.Send(packetCashShopUpdateAmounts(plrNX, plrMaplePoints)) + plr.Send(packetCashShopError(opcode.SendCashShopBuyFailed, constant.CashShopErrorCheckFullInventory)) return } } @@ -387,6 +388,7 @@ func (server *Server) handleCashShopOperation(conn mnet.Client, reader mpacket.R plr.SetMaplePoints(plrMaplePoints) default: log.Println("Unknown currency type: ", currencySel) + plr.Send(packetCashShopError(opcode.SendCashShopIncSlotCountFailed, constant.CashShopErrorUnknown)) return }