Compare commits
4 commits
d3f20e2bba
...
a294d408c1
Author | SHA1 | Date | |
---|---|---|---|
a294d408c1 | |||
0aad5cad23 | |||
8683c1e58a | |||
ea0ca17044 |
3 changed files with 59 additions and 20 deletions
|
@ -31,7 +31,7 @@ export default class Trade extends ButtonEvent {
|
||||||
const user1Quantity = Number(interaction.customId.split(" ")[8]) ?? 1;
|
const user1Quantity = Number(interaction.customId.split(" ")[8]) ?? 1;
|
||||||
const user2Quantity = Number(interaction.customId.split(" ")[9]) ?? 1;
|
const user2Quantity = Number(interaction.customId.split(" ")[9]) ?? 1;
|
||||||
|
|
||||||
AppLogger.LogSilly("Button/Trade/AcceptTrade", `Parameters: user1UserId=${user1UserId}, user2UserId=${user2UserId}, user1CardNumber=${user1CardNumber}, user2CardNumber=${user2CardNumber}, expiry=${expiry}, timeoutId=${timeoutId}`);
|
AppLogger.LogSilly("Button/Trade/AcceptTrade", `Parameters: user1UserId=${user1UserId}, user2UserId=${user2UserId}, user1CardNumber=${user1CardNumber}, user2CardNumber=${user2CardNumber}, expiry=${expiry}, timeoutId=${timeoutId} user1Quantity=${user1Quantity} user2Quantity=${user2Quantity}`);
|
||||||
|
|
||||||
const expiryDate = new Date(expiry);
|
const expiryDate = new Date(expiry);
|
||||||
|
|
||||||
|
@ -74,8 +74,8 @@ export default class Trade extends ButtonEvent {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
user1UserInventory1.SetQuantity(user1UserInventory1.Quantity - user1Quantity);
|
user1UserInventory1.RemoveQuantity(user1Quantity);
|
||||||
user2UserInventory1.SetQuantity(user2UserInventory1.Quantity - user2Quantity);
|
user2UserInventory1.RemoveQuantity(user2Quantity);
|
||||||
|
|
||||||
await user1UserInventory1.Save(Inventory, user1UserInventory1);
|
await user1UserInventory1.Save(Inventory, user1UserInventory1);
|
||||||
await user2UserInventory1.Save(Inventory, user2UserInventory1);
|
await user2UserInventory1.Save(Inventory, user2UserInventory1);
|
||||||
|
@ -84,15 +84,15 @@ export default class Trade extends ButtonEvent {
|
||||||
let user2UserInventory2 = await Inventory.FetchOneByCardNumberAndUserId(user2UserId, user1CardNumber);
|
let user2UserInventory2 = await Inventory.FetchOneByCardNumberAndUserId(user2UserId, user1CardNumber);
|
||||||
|
|
||||||
if (!user1UserInventory2) {
|
if (!user1UserInventory2) {
|
||||||
user1UserInventory2 = new Inventory(user1UserId, user1CardNumber, user2Quantity);
|
user1UserInventory2 = new Inventory(user1UserId, user2CardNumber, user2Quantity);
|
||||||
} else {
|
} else {
|
||||||
user1UserInventory2.SetQuantity(user1UserInventory2.Quantity + user2Quantity);
|
user1UserInventory2.AddQuantity(user2Quantity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!user2UserInventory2) {
|
if (!user2UserInventory2) {
|
||||||
user2UserInventory2 = new Inventory(user2UserId, user2CardNumber, user1Quantity);
|
user2UserInventory2 = new Inventory(user2UserId, user1CardNumber, user1Quantity);
|
||||||
} else {
|
} else {
|
||||||
user2UserInventory2.SetQuantity(user2UserInventory2.Quantity + user2Quantity);
|
user2UserInventory2.AddQuantity(user1Quantity);
|
||||||
}
|
}
|
||||||
|
|
||||||
await user1UserInventory2.Save(Inventory, user1UserInventory2);
|
await user1UserInventory2.Save(Inventory, user1UserInventory2);
|
||||||
|
|
|
@ -35,6 +35,10 @@ export default class Inventory extends AppBaseEntity {
|
||||||
this.Quantity -= amount;
|
this.Quantity -= amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AddQuantity(amount: number) {
|
||||||
|
this.Quantity += amount;
|
||||||
|
}
|
||||||
|
|
||||||
public AddClaim(claim: Claim) {
|
public AddClaim(claim: Claim) {
|
||||||
this.Claims.push(claim);
|
this.Claims.push(claim);
|
||||||
}
|
}
|
||||||
|
|
61
yarn.lock
61
yarn.lock
|
@ -343,6 +343,11 @@
|
||||||
resolved "https://registry.yarnpkg.com/@discordjs/collection/-/collection-2.1.0.tgz#f327d944ab2dcf9a1f674470a481f78a120a5e3b"
|
resolved "https://registry.yarnpkg.com/@discordjs/collection/-/collection-2.1.0.tgz#f327d944ab2dcf9a1f674470a481f78a120a5e3b"
|
||||||
integrity sha512-mLcTACtXUuVgutoznkh6hS3UFqYirDYAg5Dc1m8xn6OvPjetnUlf/xjtqnnc47OwWdaoCQnHmHh9KofhD6uRqw==
|
integrity sha512-mLcTACtXUuVgutoznkh6hS3UFqYirDYAg5Dc1m8xn6OvPjetnUlf/xjtqnnc47OwWdaoCQnHmHh9KofhD6uRqw==
|
||||||
|
|
||||||
|
"@discordjs/collection@^2.1.1":
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@discordjs/collection/-/collection-2.1.1.tgz#901917bc538c12b9c3613036d317847baee08cae"
|
||||||
|
integrity sha512-LiSusze9Tc7qF03sLCujF5iZp7K+vRNEDBZ86FT9aQAv3vxMLihUvKvpsCWiQ2DJq1tVckopKm1rxomgNUc9hg==
|
||||||
|
|
||||||
"@discordjs/formatters@^0.4.0":
|
"@discordjs/formatters@^0.4.0":
|
||||||
version "0.4.0"
|
version "0.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/@discordjs/formatters/-/formatters-0.4.0.tgz#066a2c2163b26ac066e6f621f17445be9690c6a9"
|
resolved "https://registry.yarnpkg.com/@discordjs/formatters/-/formatters-0.4.0.tgz#066a2c2163b26ac066e6f621f17445be9690c6a9"
|
||||||
|
@ -351,25 +356,30 @@
|
||||||
discord-api-types "0.37.83"
|
discord-api-types "0.37.83"
|
||||||
|
|
||||||
"@discordjs/rest@^2.0.0", "@discordjs/rest@^2.3.0":
|
"@discordjs/rest@^2.0.0", "@discordjs/rest@^2.3.0":
|
||||||
version "2.3.0"
|
version "2.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/@discordjs/rest/-/rest-2.3.0.tgz#06d37c7fb54a9be61134b5bbb201abd760343472"
|
resolved "https://registry.yarnpkg.com/@discordjs/rest/-/rest-2.4.0.tgz#63bfc816af58af844914e3589d7eae609cd199b5"
|
||||||
integrity sha512-C1kAJK8aSYRv3ZwMG8cvrrW4GN0g5eMdP8AuN8ODH5DyOCbHgJspze1my3xHOAgwLJdKUbWNVyAeJ9cEdduqIg==
|
integrity sha512-Xb2irDqNcq+O8F0/k/NaDp7+t091p+acb51iA4bCKfIn+WFWd6HrNvcsSbMMxIR9NjcMZS6NReTKygqiQN+ntw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@discordjs/collection" "^2.1.0"
|
"@discordjs/collection" "^2.1.1"
|
||||||
"@discordjs/util" "^1.1.0"
|
"@discordjs/util" "^1.1.1"
|
||||||
"@sapphire/async-queue" "^1.5.2"
|
"@sapphire/async-queue" "^1.5.3"
|
||||||
"@sapphire/snowflake" "^3.5.3"
|
"@sapphire/snowflake" "^3.5.3"
|
||||||
"@vladfrangu/async_event_emitter" "^2.2.4"
|
"@vladfrangu/async_event_emitter" "^2.4.6"
|
||||||
discord-api-types "0.37.83"
|
discord-api-types "0.37.97"
|
||||||
magic-bytes.js "^1.10.0"
|
magic-bytes.js "^1.10.0"
|
||||||
tslib "^2.6.2"
|
tslib "^2.6.3"
|
||||||
undici "6.13.0"
|
undici "6.19.8"
|
||||||
|
|
||||||
"@discordjs/util@^1.1.0":
|
"@discordjs/util@^1.1.0":
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/@discordjs/util/-/util-1.1.0.tgz#dcffd2b61aab8eadd66bea67811bc34fc769bb2a"
|
resolved "https://registry.yarnpkg.com/@discordjs/util/-/util-1.1.0.tgz#dcffd2b61aab8eadd66bea67811bc34fc769bb2a"
|
||||||
integrity sha512-IndcI5hzlNZ7GS96RV3Xw1R2kaDuXEp7tRIy/KlhidpN/BQ1qh1NZt3377dMLTa44xDUNKT7hnXkA/oUAzD/lg==
|
integrity sha512-IndcI5hzlNZ7GS96RV3Xw1R2kaDuXEp7tRIy/KlhidpN/BQ1qh1NZt3377dMLTa44xDUNKT7hnXkA/oUAzD/lg==
|
||||||
|
|
||||||
|
"@discordjs/util@^1.1.1":
|
||||||
|
version "1.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@discordjs/util/-/util-1.1.1.tgz#bafcde0faa116c834da1258d78ec237080bbab29"
|
||||||
|
integrity sha512-eddz6UnOBEB1oITPinyrB2Pttej49M9FZQY8NxgEvc3tq6ZICZ19m70RsmzRdDHk80O9NoYN/25AqJl8vPVf/g==
|
||||||
|
|
||||||
"@discordjs/ws@^1.1.1":
|
"@discordjs/ws@^1.1.1":
|
||||||
version "1.1.1"
|
version "1.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/@discordjs/ws/-/ws-1.1.1.tgz#bffbfd46838258ab09054ed98ddef1a36f6507a3"
|
resolved "https://registry.yarnpkg.com/@discordjs/ws/-/ws-1.1.1.tgz#bffbfd46838258ab09054ed98ddef1a36f6507a3"
|
||||||
|
@ -1036,6 +1046,11 @@
|
||||||
resolved "https://registry.yarnpkg.com/@sapphire/async-queue/-/async-queue-1.5.2.tgz#2982dce16e5b8b1ea792604d20c23c0585877b97"
|
resolved "https://registry.yarnpkg.com/@sapphire/async-queue/-/async-queue-1.5.2.tgz#2982dce16e5b8b1ea792604d20c23c0585877b97"
|
||||||
integrity sha512-7X7FFAA4DngXUl95+hYbUF19bp1LGiffjJtu7ygrZrbdCSsdDDBaSjB7Akw0ZbOu6k0xpXyljnJ6/RZUvLfRdg==
|
integrity sha512-7X7FFAA4DngXUl95+hYbUF19bp1LGiffjJtu7ygrZrbdCSsdDDBaSjB7Akw0ZbOu6k0xpXyljnJ6/RZUvLfRdg==
|
||||||
|
|
||||||
|
"@sapphire/async-queue@^1.5.3":
|
||||||
|
version "1.5.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@sapphire/async-queue/-/async-queue-1.5.3.tgz#03cd2a2f3665068f314736bdc56eee2025352422"
|
||||||
|
integrity sha512-x7zadcfJGxFka1Q3f8gCts1F0xMwCKbZweM85xECGI0hBTeIZJGGCrHgLggihBoprlQ/hBmDR5LKfIPqnmHM3w==
|
||||||
|
|
||||||
"@sapphire/shapeshift@^3.9.7":
|
"@sapphire/shapeshift@^3.9.7":
|
||||||
version "3.9.7"
|
version "3.9.7"
|
||||||
resolved "https://registry.yarnpkg.com/@sapphire/shapeshift/-/shapeshift-3.9.7.tgz#43e23243cac8a0c046bf1e73baf3dbf407d33a0c"
|
resolved "https://registry.yarnpkg.com/@sapphire/shapeshift/-/shapeshift-3.9.7.tgz#43e23243cac8a0c046bf1e73baf3dbf407d33a0c"
|
||||||
|
@ -1259,9 +1274,9 @@
|
||||||
integrity sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==
|
integrity sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==
|
||||||
|
|
||||||
"@types/node@^20.0.0":
|
"@types/node@^20.0.0":
|
||||||
version "20.16.3"
|
version "20.16.5"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.16.3.tgz#7b4f9a37091cf03a0c2561bf76a9a55f03f4f523"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.16.5.tgz#d43c7f973b32ffdf9aa7bd4f80e1072310fd7a53"
|
||||||
integrity sha512-/wdGiWRkMOm53gAsSyFMXFZHbVg7C6CbkrzHNpaHoYfsUWPg7m6ZRKtvQjgvQ9i8WT540a3ydRlRQbxjY30XxQ==
|
integrity sha512-VwYCweNo3ERajwy0IUlqqcyZ8/A7Zwa9ZP3MnENWcB11AejO+tLy3pu850goUW2FC/IJMdZUfKpX/yxL1gymCA==
|
||||||
dependencies:
|
dependencies:
|
||||||
undici-types "~6.19.2"
|
undici-types "~6.19.2"
|
||||||
|
|
||||||
|
@ -1464,6 +1479,11 @@
|
||||||
resolved "https://registry.yarnpkg.com/@vladfrangu/async_event_emitter/-/async_event_emitter-2.2.4.tgz#d3537432c6db6444680a596271dff8ea407343b3"
|
resolved "https://registry.yarnpkg.com/@vladfrangu/async_event_emitter/-/async_event_emitter-2.2.4.tgz#d3537432c6db6444680a596271dff8ea407343b3"
|
||||||
integrity sha512-ButUPz9E9cXMLgvAW8aLAKKJJsPu1dY1/l/E8xzLFuysowXygs6GBcyunK9rnGC4zTsnIc2mQo71rGw9U+Ykug==
|
integrity sha512-ButUPz9E9cXMLgvAW8aLAKKJJsPu1dY1/l/E8xzLFuysowXygs6GBcyunK9rnGC4zTsnIc2mQo71rGw9U+Ykug==
|
||||||
|
|
||||||
|
"@vladfrangu/async_event_emitter@^2.4.6":
|
||||||
|
version "2.4.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/@vladfrangu/async_event_emitter/-/async_event_emitter-2.4.6.tgz#508b6c45b03f917112a9008180b308ba0e4d1805"
|
||||||
|
integrity sha512-RaI5qZo6D2CVS6sTHFKg1v5Ohq/+Bo2LZ5gzUEwZ/WkHhwtGTCB/sVLw8ijOkAUxasZ+WshN/Rzj4ywsABJ5ZA==
|
||||||
|
|
||||||
abbrev@1:
|
abbrev@1:
|
||||||
version "1.1.1"
|
version "1.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
|
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
|
||||||
|
@ -2542,6 +2562,11 @@ discord-api-types@0.37.83:
|
||||||
resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.37.83.tgz#a22a799729ceded8176ea747157837ddf4708b1f"
|
resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.37.83.tgz#a22a799729ceded8176ea747157837ddf4708b1f"
|
||||||
integrity sha512-urGGYeWtWNYMKnYlZnOnDHm8fVRffQs3U0SpE8RHeiuLKb/u92APS8HoQnPTFbnXmY1vVnXjXO4dOxcAn3J+DA==
|
integrity sha512-urGGYeWtWNYMKnYlZnOnDHm8fVRffQs3U0SpE8RHeiuLKb/u92APS8HoQnPTFbnXmY1vVnXjXO4dOxcAn3J+DA==
|
||||||
|
|
||||||
|
discord-api-types@0.37.97:
|
||||||
|
version "0.37.97"
|
||||||
|
resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.37.97.tgz#d658573f726ad179261d538dbad4e7e8eca48d11"
|
||||||
|
integrity sha512-No1BXPcVkyVD4ZVmbNgDKaBoqgeQ+FJpzZ8wqHkfmBnTZig1FcH3iPPersiK1TUIAzgClh2IvOuVUYfcWLQAOA==
|
||||||
|
|
||||||
discord.js@^14.15.3:
|
discord.js@^14.15.3:
|
||||||
version "14.15.3"
|
version "14.15.3"
|
||||||
resolved "https://registry.yarnpkg.com/discord.js/-/discord.js-14.15.3.tgz#b2a67a1a4ef192be498fb8b6784224a42906f1be"
|
resolved "https://registry.yarnpkg.com/discord.js/-/discord.js-14.15.3.tgz#b2a67a1a4ef192be498fb8b6784224a42906f1be"
|
||||||
|
@ -6526,6 +6551,11 @@ tslib@^1.9.0:
|
||||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
|
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
|
||||||
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
|
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
|
||||||
|
|
||||||
|
tslib@^2.6.3:
|
||||||
|
version "2.7.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01"
|
||||||
|
integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==
|
||||||
|
|
||||||
type-check@^0.4.0, type-check@~0.4.0:
|
type-check@^0.4.0, type-check@~0.4.0:
|
||||||
version "0.4.0"
|
version "0.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1"
|
resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1"
|
||||||
|
@ -6639,6 +6669,11 @@ undici@6.13.0:
|
||||||
resolved "https://registry.yarnpkg.com/undici/-/undici-6.13.0.tgz#7edbf4b7f3aac5f8a681d515151bf55cb3589d72"
|
resolved "https://registry.yarnpkg.com/undici/-/undici-6.13.0.tgz#7edbf4b7f3aac5f8a681d515151bf55cb3589d72"
|
||||||
integrity sha512-Q2rtqmZWrbP8nePMq7mOJIN98M0fYvSgV89vwl/BQRT4mDOeY2GXZngfGpcBBhtky3woM7G24wZV3Q304Bv6cw==
|
integrity sha512-Q2rtqmZWrbP8nePMq7mOJIN98M0fYvSgV89vwl/BQRT4mDOeY2GXZngfGpcBBhtky3woM7G24wZV3Q304Bv6cw==
|
||||||
|
|
||||||
|
undici@6.19.8:
|
||||||
|
version "6.19.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/undici/-/undici-6.19.8.tgz#002d7c8a28f8cc3a44ff33c3d4be4d85e15d40e1"
|
||||||
|
integrity sha512-U8uCCl2x9TK3WANvmBavymRzxbfFYG+tAu+fgx3zxQy3qdagQqBLwJVrdyO1TBfUXvfKveMKJZhpvUYoOjM+4g==
|
||||||
|
|
||||||
unicorn-magic@^0.1.0:
|
unicorn-magic@^0.1.0:
|
||||||
version "0.1.0"
|
version "0.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/unicorn-magic/-/unicorn-magic-0.1.0.tgz#1bb9a51c823aaf9d73a8bfcd3d1a23dde94b0ce4"
|
resolved "https://registry.yarnpkg.com/unicorn-magic/-/unicorn-magic-0.1.0.tgz#1bb9a51c823aaf9d73a8bfcd3d1a23dde94b0ce4"
|
||||||
|
|
Loading…
Reference in a new issue