Skip to content

Commit

Permalink
Fixed an issue where weapon equip will fail and unequip your weapon
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherBThai committed Oct 9, 2023
1 parent a933879 commit 3420160
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/commands/commandList/battle/util/weaponUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -770,9 +770,16 @@ exports.equip = async function (p, uwid, pet) {

let sql = `UPDATE user_weapon SET pid = NULL WHERE pid = ${pid} AND uid = ${uid};`;
sql += `UPDATE user_weapon SET pid = ${pid} WHERE uid = ${uid} AND uwid = ${uwid};`;
const result = await p.query(sql);

if (result[1].changedRows <= 0 && result[1].affectedRows <= 0) {
const con = await p.startTransaction();
try {
const result = await con.query(sql);
if (result[1].changedRows <= 0 && result[1].affectedRows <= 0) {
await con.rollback();
return;
}
await con.commit();
} catch (err) {
con.rollback();
return;
}

Expand Down

0 comments on commit 3420160

Please sign in to comment.