Compare commits

..

1 commit

Author SHA1 Message Date
RenovateBot 4b78509653 Update dependency @types/uuid to v9.0.4
Some checks failed
continuous-integration/drone/push Build is failing
2023-09-28 10:42:57 +00:00
2 changed files with 16 additions and 4 deletions

View file

@ -1,5 +1,6 @@
import { CardRarity } from "../constants/CardRarity"; import { CardRarity } from "../constants/CardRarity";
import Card from "../database/entities/card/Card"; import Card from "../database/entities/card/Card";
import Series from "../database/entities/card/Series";
export default class CardDropHelper { export default class CardDropHelper {
public static async GetRandomCard(): Promise<Card> { public static async GetRandomCard(): Promise<Card> {
@ -16,7 +17,18 @@ export default class CardDropHelper {
else if (randomRarity < goldChance) cardRarity = CardRarity.Gold; else if (randomRarity < goldChance) cardRarity = CardRarity.Gold;
else cardRarity = CardRarity.Legendary; else cardRarity = CardRarity.Legendary;
const randomCard = await this.GetRandomCardByRarity(cardRarity); const allSeries = await Series.FetchAll(Series, [ "Cards", "Cards.Series" ]);
const allSeriesWithCards = allSeries.filter(x => x.Cards.length > 0 && x.Cards.find(x => x.Rarity == cardRarity));
const randomSeriesIndex = Math.floor(Math.random() * allSeriesWithCards.length);
const randomSeries = allSeriesWithCards[randomSeriesIndex];
const allCards = randomSeries.Cards.filter(x => x.Rarity == cardRarity && x.Path && x.FileName);
const randomCardIndex = Math.floor(Math.random() * allCards.length);
const randomCard = allCards[randomCardIndex];
return randomCard; return randomCard;
} }

View file

@ -910,9 +910,9 @@
integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==
"@types/uuid@^9.0.0": "@types/uuid@^9.0.0":
version "9.0.5" version "9.0.4"
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.5.tgz#25a71eb73eba95ac0e559ff3dd018fc08294acf6" resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.4.tgz#e884a59338da907bda8d2ed03e01c5c49d036f1c"
integrity sha512-xfHdwa1FMJ082prjSJpoEI57GZITiQz10r3vEJCHa2khEFQjKy91aWKz6+zybzssCvXUwE1LQWgWVwZ4nYUvHQ== integrity sha512-zAuJWQflfx6dYJM62vna+Sn5aeSWhh3OB+wfUEACNcqUSc0AGc5JKl+ycL1vrH7frGTXhJchYjE1Hak8L819dA==
"@types/ws@^8.5.5": "@types/ws@^8.5.5":
version "8.5.6" version "8.5.6"