From 1ae01ee342afeadd8724b0c72094f2251134e66b Mon Sep 17 00:00:00 2001 From: Znote Date: Sat, 18 Jul 2020 23:51:26 +0200 Subject: [PATCH] Character auction: Fixed points transfer to seller. --- auctionChar.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/auctionChar.php b/auctionChar.php index e20307a..b6213aa 100644 --- a/auctionChar.php +++ b/auctionChar.php @@ -71,7 +71,10 @@ if ($auction['characterAuction']) { // Passive check to see if bid period has expired and someone won a deal $time = time(); $expired_auctions = mysql_select_multi(" - SELECT `id` + SELECT + `id`, + `original_account_id`, + (`bid`+`deposit`) as `points` FROM `znote_auction_player` WHERE `sold` = 0 AND `time_end` < {$time} @@ -90,6 +93,14 @@ if ($auction['characterAuction']) { WHERE `id` IN(".implode(',', $soldIds).") LIMIT ".COUNT($soldIds)."; "); + // Transfer points to seller account + foreach ($expired_auctions as $a) { + mysql_update(" + UPDATE `znote_accounts` + SET `points` = (`points`+{$a['points']}) + WHERE `account_id` = {$a['original_account_id']}; + "); + } } } // end passive check @@ -179,12 +190,12 @@ if ($auction['characterAuction']) { WHERE `id` = {$character['zaid']} LIMIT 1; "); - // If character is sold, return deposit back to sellers account + // If character is sold, give points to seller if (time() >= $character['time_end']) { mysql_update(" UPDATE `znote_accounts` - SET `points` = `points`+{$character['deposit']} - WHERE `account_id` = {$account['id']} + SET `points` = (`points`+{$character['deposit']}+{$price}) + WHERE `account_id` = {$character['original_account_id']} LIMIT 1; "); } else {