Compare commits

..

No commits in common. "f812467f5e6e27dd2322fe9b213c7367ecffc43a" and "65a55895e75ac548bba6516c179ca2ef2fe309ed" have entirely different histories.

4 changed files with 8 additions and 12 deletions

View file

@ -7,7 +7,7 @@
# any secret values.
BOT_TOKEN=
BOT_VER=0.8.2
BOT_VER=0.8.1
BOT_AUTHOR=Vylpes
BOT_OWNERID=147392775707426816
BOT_CLIENTID=682942374040961060

View file

@ -1,6 +1,6 @@
{
"name": "card-drop",
"version": "0.8.2",
"version": "0.8.1",
"main": "./dist/bot.js",
"typings": "./dist",
"scripts": {

View file

@ -72,8 +72,8 @@ export default class Trade extends ButtonEvent {
return;
}
user1UserInventory1.RemoveQuantity(1);
user2UserInventory1.RemoveQuantity(1);
user1UserInventory1.SetQuantity(user1UserInventory1.Quantity - 1);
user2UserInventory1.SetQuantity(user2UserInventory1.Quantity - 1);
await user1UserInventory1.Save(Inventory, user1UserInventory1);
await user2UserInventory1.Save(Inventory, user2UserInventory1);
@ -82,15 +82,15 @@ export default class Trade extends ButtonEvent {
let user2UserInventory2 = await Inventory.FetchOneByCardNumberAndUserId(user2UserId, user1CardNumber);
if (!user1UserInventory2) {
user1UserInventory2 = new Inventory(user1UserId, user2CardNumber, 1);
user1UserInventory2 = new Inventory(user1UserId, user1CardNumber, 1);
} else {
user1UserInventory2.AddQuantity(1);
user1UserInventory2.SetQuantity(user1UserInventory2.Quantity + 1);
}
if (!user2UserInventory2) {
user2UserInventory2 = new Inventory(user2UserId, user1CardNumber, 1);
user2UserInventory2 = new Inventory(user2UserId, user2CardNumber, 1);
} else {
user2UserInventory2.AddQuantity(1);
user2UserInventory2.SetQuantity(user2UserInventory2.Quantity + 1);
}
await user1UserInventory2.Save(Inventory, user1UserInventory2);

View file

@ -29,10 +29,6 @@ export default class Inventory extends AppBaseEntity {
this.Quantity = quantity;
}
public AddQuantity(amount: number) {
this.Quantity += amount;
}
public RemoveQuantity(amount: number) {
if (this.Quantity < amount) return;