fix part 3

This commit is contained in:
DaInfLoop 2024-08-13 15:00:01 +01:00
parent fcd0787454
commit 7e50cb802e
4 changed files with 20 additions and 6 deletions

1
assets/communityvs/None.png Symbolic link
View file

@ -0,0 +1 @@
assets/battlebgs/None.png

View file

Before

Width:  |  Height:  |  Size: 241 KiB

After

Width:  |  Height:  |  Size: 241 KiB

View file

@ -144,7 +144,14 @@ const opponents = {
text: "Master OG",
colour: ["#FF0000", "#FFFFFF"]
},
[Opponents.Stik]: {
}
const communityOpponents = {
[Opponents.None]: {
text: "",
colour: ["#FFFFFF", "#FFFFFF"]
},
[CommunityOpponents.Stik]: {
text: "Stik",
colour: ["#FF0000", "#000000"]
}
@ -277,7 +284,7 @@ const server = createServer(async (req, res) => {
const canvas = createCanvas(1920, 1080);
const context = canvas.getContext("2d");
if (!validOpponents.includes(opts.opponent)) opts.opponent = CommunityOpponents.None
if (!validOpponents.includes(opts.opponent)) opts.opponent = Opponents.None
const SquadBackground = await loadImage(
`./assets/communityvs/${opts.opponent}.png`,
@ -291,9 +298,11 @@ const server = createServer(async (req, res) => {
context.textAlign = "center"
context.font = applyText(canvas, opponents[opts.opponent].text, 875)
drawText([1450, 1000], opponents[opts.opponent].text, opponents[opts.opponent].colour[1], { colour: opponents[opts.opponent].colour[0], width: 20 }, context);
// @ts-ignore shut up
context.font = applyText(canvas, communityOpponents[opts.opponent].text, 875)
// @ts-ignore shut up
drawText([1450, 1000], communityOpponents[opts.opponent].text, communityOpponents[opts.opponent].colour[1], { colour: communityOpponents[opts.opponent].colour[0], width: 20 }, context);
context.font = applyText(canvas, opts.username, 675)
@ -334,7 +343,7 @@ const server = createServer(async (req, res) => {
);
}
console.log(`Generating ${opts.action} for ${opts.username}`)
console.log(`Generating ${opts.action}`)
// Image dimensions
const canvas = createCanvas(1920, 1080);

View file

@ -127,6 +127,10 @@ export enum Opponents {
Dicey2024 = "Dicey2024",
CakeDay = "CakeDay",
MasterOG = "MasterOG",
}
export enum CommunityOpponents {
None = "None",
Stik = "Stik",
}