From 513a4db716d5ef21d73ec88076b9f0a8eeffb111 Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Fri, 13 Jan 2023 15:09:14 +0100 Subject: [PATCH] Fixes a critical issue with pointshop (#7549) Fixes #7548 Thanks to @mazvi --- src/map/npc.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/map/npc.cpp b/src/map/npc.cpp index 1e5dd21eef..24d69476a7 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -2458,7 +2458,11 @@ static enum e_CASHSHOP_ACK npc_cashshop_process_payment(struct npc_data *nd, int clif_messagecolor(&sd->bl, color_table[COLOR_RED], output, false, SELF); return ERROR_TYPE_PURCHASE_FAIL; } - pc_setreg2(sd, nd->u.shop.pointshop_str, cost[0] - (price - points)); + + if( !set_reg_num( nullptr, sd, add_str( nd->u.shop.pointshop_str ), nd->u.shop.pointshop_str, cost[0] - ( price - points ), nullptr ) ){ + return ERROR_TYPE_PURCHASE_FAIL; + } + sprintf(output, msg_txt(sd, 716), nd->u.shop.pointshop_str, cost[0] - (price - points)); // Your '%s' is now: %d clif_messagecolor(&sd->bl, color_table[COLOR_LIGHT_GREEN], output, false, SELF); }