Fix claim of bought items

This commit is contained in:
bri cassa 2022-07-10 19:40:52 +02:00
parent 969571f559
commit 868213081f
1 changed files with 9 additions and 11 deletions

View File

@ -1066,13 +1066,13 @@ function ex_methods.sell(self, p_name, ex_name, item_name, wear, amount, rate)
local red_del_stmt
if row_sold < row_amount and not out_of_funds then
if row_sold < row_amount then
red_stmt:bind_names({
id = row.Id,
delta = row_sold,
})
red_del_stmt = red_stmt
else -- row_sold == row_amount or out_of_funds
else
del_stmt:bind_values(row.Id)
red_del_stmt = del_stmt
end
@ -1088,16 +1088,14 @@ function ex_methods.sell(self, p_name, ex_name, item_name, wear, amount, rate)
sql_error(db:errmsg())
end
if not out_of_funds then
local in_succ, in_err =
self:put_in_inbox(poster, item_name, wear, row_sold)
if not in_succ then
search_stmt:reset()
db:exec("ROLLBACK;")
return false, in_err
end
local in_succ, in_err =
self:put_in_inbox(poster, item_name, wear, row_sold)
if not in_succ then
search_stmt:reset()
db:exec("ROLLBACK;")
return false, in_err
end
if poster ~= p_name then
local revenue = row_sold * row_rate