diff --git a/package.json b/package.json index d017abd2..cda5416f 100644 --- a/package.json +++ b/package.json @@ -12,12 +12,12 @@ "build": "turbo run build" }, "devDependencies": { - "@types/node": "^20.9.1", + "@types/node": "^20.9.2", "@typescript-eslint/eslint-plugin": "^6.11.0", "@typescript-eslint/parser": "^6.11.0", "discord-api-types": "0.37.63", "eslint": "^8.54.0", - "tsup": "^7.3.0", + "tsup": "^8.0.0", "turbo": "^1.10.16", "typescript": "^5.2.2" }, diff --git a/packages/runtime-worker/images/backgrounds/commands/slot.png b/packages/runtime-worker/images/backgrounds/commands/slot.png index afae8be4..545dd3ec 100644 Binary files a/packages/runtime-worker/images/backgrounds/commands/slot.png and b/packages/runtime-worker/images/backgrounds/commands/slot.png differ diff --git a/packages/runtime-worker/images/emojis/apple-warped.png b/packages/runtime-worker/images/emojis/apple-warped.png new file mode 100644 index 00000000..2cdbf0df Binary files /dev/null and b/packages/runtime-worker/images/emojis/apple-warped.png differ diff --git a/packages/runtime-worker/images/emojis/cherries-warped.png b/packages/runtime-worker/images/emojis/cherries-warped.png new file mode 100644 index 00000000..cabbf515 Binary files /dev/null and b/packages/runtime-worker/images/emojis/cherries-warped.png differ diff --git a/packages/runtime-worker/images/emojis/heart-warped.png b/packages/runtime-worker/images/emojis/heart-warped.png new file mode 100644 index 00000000..01418789 Binary files /dev/null and b/packages/runtime-worker/images/emojis/heart-warped.png differ diff --git a/packages/runtime-worker/images/emojis/pear-warped.png b/packages/runtime-worker/images/emojis/pear-warped.png new file mode 100644 index 00000000..a1c06e46 Binary files /dev/null and b/packages/runtime-worker/images/emojis/pear-warped.png differ diff --git a/packages/runtime-worker/images/emojis/strawberry-warped.png b/packages/runtime-worker/images/emojis/strawberry-warped.png new file mode 100644 index 00000000..ba6a4219 Binary files /dev/null and b/packages/runtime-worker/images/emojis/strawberry-warped.png differ diff --git a/packages/runtime-worker/images/emojis/watermelon-warped.png b/packages/runtime-worker/images/emojis/watermelon-warped.png new file mode 100644 index 00000000..c765b54e Binary files /dev/null and b/packages/runtime-worker/images/emojis/watermelon-warped.png differ diff --git a/packages/runtime-worker/images/overlays/JACKPOT.png b/packages/runtime-worker/images/overlays/JACKPOT.png new file mode 100644 index 00000000..869e657b Binary files /dev/null and b/packages/runtime-worker/images/overlays/JACKPOT.png differ diff --git a/packages/runtime-worker/images/overlays/YOULOST.png b/packages/runtime-worker/images/overlays/YOULOST.png new file mode 100644 index 00000000..e5175138 Binary files /dev/null and b/packages/runtime-worker/images/overlays/YOULOST.png differ diff --git a/packages/runtime-worker/images/overlays/YOUWIN.png b/packages/runtime-worker/images/overlays/YOUWIN.png new file mode 100644 index 00000000..9c070156 Binary files /dev/null and b/packages/runtime-worker/images/overlays/YOUWIN.png differ diff --git a/packages/runtime-worker/src/ImageCache.ts b/packages/runtime-worker/src/ImageCache.ts index 4306b2cd..3af11e13 100644 --- a/packages/runtime-worker/src/ImageCache.ts +++ b/packages/runtime-worker/src/ImageCache.ts @@ -20,16 +20,16 @@ const images = { "badge-giver3": "badges/GivingHandTier3_50x50.png", "badge-giver4": "badges/GivingHandTier4_50x50.png", - "apple": "emojis/apple.png", - "cherries": "emojis/cherries.png", + "apple": "emojis/apple-warped.png", + "cherries": "emojis/cherries-warped.png", "discoin": "emojis/discoin.png", - "heart": "emojis/heart.png", + "heart": "emojis/heart-warped.png", "heart-broken": "emojis/pixel_heart_broken.png", "heart-full": "emojis/pixel_heart.png", - "pear": "emojis/pear.png", - "strawberry": "emojis/strawberry.png", + "pear": "emojis/pear-warped.png", + "strawberry": "emojis/strawberry-warped.png", "triangle": "emojis/triangle.png", - "watermelon": "emojis/watermelon.png", + "watermelon": "emojis/watermelon-warped.png", "add-circle": "icons/add_circle.png", "neko": "icons/NEKO.png", @@ -42,7 +42,10 @@ const images = { "profile-light": "overlays/profile_light.png", "old-profile-light": "overlays/profile_old_light.png", "old-profile": "overlays/profile_old.png", - "profile": "overlays/profile.png" + "profile": "overlays/profile.png", + "slot-jackpot": "overlays/JACKPOT.png", + "slot-win": "overlays/YOUWIN.png", + "slot-lost": "overlays/YOULOST.png" } import type { UnpackArray } from "@amanda/shared-types" diff --git a/packages/runtime-worker/src/commands/money.ts b/packages/runtime-worker/src/commands/money.ts index ca913785..bd049853 100644 --- a/packages/runtime-worker/src/commands/money.ts +++ b/packages/runtime-worker/src/commands/money.ts @@ -399,27 +399,14 @@ commands.assign([ const fruits = ["apple" as const, "cherries" as const, "watermelon" as const, "pear" as const, "strawberry" as const] // plus heart, which is chosen seperately const isPremium = await sql.orm.get("premium", { user_id: cmd.author.id }) - let cooldownInfo: { max: number, min: number, step: number, regen: { amount: number, time: number, } } // avg % assumes 5 fruits + heart, heart payouts [0, 1.25, 4, 20], triple fruit payout 5 - if (isPremium?.state) { - cooldownInfo = { - max: 190, // avg +6.2% per roll - min: 172, // avg -4.8% per roll - step: 6, // 4 rolls to hit the bottom - regen: { - amount: 1, - time: 20 * 1000 // 2 minutes to recover by 1 roll - } - } - } else { - cooldownInfo = { - max: 186, // avg +3.6% per roll - min: 164, // avg -9.4% per roll - step: 7, // 4.6 rolls to hit the bottom - regen: { - amount: 1, - time: 30 * 1000 // 3.5 minutes to recover by 1 roll - } + const cooldownInfo = { + max: isPremium?.state ? 190 : 186, + min: isPremium?.state ? 172 : 164, + step: isPremium?.state ? 6 : 7, + regen: { + amount: 1, + time: (isPremium?.state ? 20 : 30) * 1000 } } @@ -433,7 +420,10 @@ commands.assign([ "heart", "pear", "strawberry", - "watermelon" + "watermelon", + "slot-jackpot", + "slot-win", + "slot-lost" ]) ]) @@ -443,16 +433,24 @@ commands.assign([ else slots[i] = sharedUtils.arrayRandom(fruits) } - const canvas = Canvas.createCanvas(600, 800).getContext("2d") + const canvas = Canvas.createCanvas(1200, 1600).getContext("2d") const bg = images.get("slot-background")! canvas.drawImage(bg, 0, 0) const pieces: Array = [] slots.forEach(i => pieces.push(images.get(i)!/* .resize(85, 85)*/)) - canvas.drawImage(pieces[0], 100, 560, 85, 85) - canvas.drawImage(pieces[1], 258, 560, 85, 85) - canvas.drawImage(pieces[2], 412, 560, 85, 85) + canvas.drawImage(pieces[0], 200, 814, 100, 100) + canvas.drawImage(pieces[1], 400, 785, 110, 110) + canvas.drawImage(pieces[2], 632, 753, 120, 120) + + const text = slots.every(s => s === "heart") + ? images.get("slot-jackpot")! + : slots.includes("heart") || slots.slice(1).every(s => s === slots[0]) + ? images.get("slot-win")! + : images.get("slot-lost")! + + canvas.drawImage(text, 283, 1108) const amount = cmd.data.options.get("amount")?.asNumber() @@ -474,16 +472,16 @@ commands.assign([ let result = "" let winning = BigInt(0) - if (slots.every(s => s == "heart")) { + if (slots.every(s => s === "heart")) { winning = bet * BigInt(20) result = lang.GLOBAL.THREE_HEARTS - } else if (slots.filter(s => s == "heart").length == 2) { + } else if (slots.filter(s => s === "heart").length === 2) { winning = bet * BigInt(4) result = lang.GLOBAL.TWO_HEARTS - } else if (slots.filter(s => s == "heart").length == 1) { + } else if (slots.filter(s => s === "heart").length === 1) { winning = bet + (bet / BigInt(3)) result = lang.GLOBAL.ONE_HEART - } else if (slots.slice(1).every(s => s == slots[0])) { + } else if (slots.slice(1).every(s => s === slots[0])) { winning = bet * BigInt(5) result = lang.GLOBAL.TRIPLE_PIECES } else { diff --git a/yarn.lock b/yarn.lock index a0187b57..b71452d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -950,12 +950,12 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^20.9.1": - version: 20.9.1 - resolution: "@types/node@npm:20.9.1" +"@types/node@npm:^20.9.2": + version: 20.9.2 + resolution: "@types/node@npm:20.9.2" dependencies: undici-types: ~5.26.4 - checksum: bb893c6790733dac32818c1ca170fa466622dec39a0ade4639463e1358cb811771e242accbd065e7a1bfe59adc989c0ee59be65e462d3a0ab49043426f0b7637 + checksum: 5bbb8fb2248fc5c5c4071d9809fb9af85997677c07124d65665202b53283a3b7bdff26fb844e9ee407e3847dfce6399c2b01e3329ea44a4b720647b1b987c678 languageName: node linkType: hard @@ -1244,7 +1244,7 @@ __metadata: version: 0.0.0-use.local resolution: "amanda@workspace:." dependencies: - "@types/node": ^20.9.1 + "@types/node": ^20.9.2 "@typescript-eslint/eslint-plugin": ^6.11.0 "@typescript-eslint/parser": ^6.11.0 cloudstorm: ^0.9.5 @@ -1252,7 +1252,7 @@ __metadata: eslint: ^8.54.0 heatsync: ^2.4.2 snowtransfer: ^0.9.0 - tsup: ^7.3.0 + tsup: ^8.0.0 turbo: ^1.10.16 typescript: ^5.2.2 languageName: unknown @@ -5014,9 +5014,9 @@ __metadata: languageName: node linkType: hard -"tsup@npm:^7.3.0": - version: 7.3.0 - resolution: "tsup@npm:7.3.0" +"tsup@npm:^8.0.0": + version: 8.0.0 + resolution: "tsup@npm:8.0.0" dependencies: bundle-require: ^4.0.0 cac: ^6.7.12 @@ -5033,10 +5033,13 @@ __metadata: sucrase: ^3.20.3 tree-kill: ^1.2.2 peerDependencies: + "@microsoft/api-extractor": ^7.36.0 "@swc/core": ^1 postcss: ^8.4.12 typescript: ">=4.5.0" peerDependenciesMeta: + "@microsoft/api-extractor": + optional: true "@swc/core": optional: true postcss: @@ -5046,7 +5049,7 @@ __metadata: bin: tsup: dist/cli-default.js tsup-node: dist/cli-node.js - checksum: 9d66196cffc1a54bce6002c2a89caad9337a88d9bf01882f8abf5eb28ccbf845a777da558dc625df1bc4844362db14557e1578a06cf7e5d2fe1ff1b06bd1941a + checksum: c39d7f484e1745ab14f38672b925cf1d713bec9f94d50c31aaf8c828a8500efa1f219e6518cdf9e06d74a146872be4591d98ef9aead103909b89d2b07a2f961a languageName: node linkType: hard