mirror of
https://github.com/DaInfLoop/Battler-Generator.git
synced 2024-12-03 13:12:02 +00:00
fix part 3
This commit is contained in:
parent
fcd0787454
commit
7e50cb802e
1
assets/communityvs/None.png
Symbolic link
1
assets/communityvs/None.png
Symbolic link
|
@ -0,0 +1 @@
|
|||
assets/battlebgs/None.png
|
Before Width: | Height: | Size: 241 KiB After Width: | Height: | Size: 241 KiB |
21
index.ts
21
index.ts
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue