wip
This commit is contained in:
1048
package-lock.json
generated
Normal file
1048
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
5
package.json
Normal file
5
package.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"canvas": "^2.11.2"
|
||||||
|
}
|
||||||
|
}
|
22
src/draw.ts
Normal file
22
src/draw.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import { DominionCard } from "./types"
|
||||||
|
import { createCanvas } from "canvas"
|
||||||
|
|
||||||
|
export const drawCard = (card: DominionCard): Promise<string> => {
|
||||||
|
if (card.orientation === "card") {
|
||||||
|
return drawStandardCard(card);
|
||||||
|
} else {
|
||||||
|
return drawLandscapeCard(card);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const drawStandardCard = async (card: DominionCard): Promise<string> => {
|
||||||
|
const canvas = createCanvas(1403, 2151);
|
||||||
|
const context = canvas.getContext("2d");
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
const drawLandscapeCard = async (card: DominionCard): Promise<string> => {
|
||||||
|
// TODO: everything
|
||||||
|
return "";
|
||||||
|
}
|
14
src/sampleData.ts
Normal file
14
src/sampleData.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { DominionCard, TYPE_ACTION } from "./types";
|
||||||
|
|
||||||
|
export const sampleCard: DominionCard = {
|
||||||
|
orientation: "card",
|
||||||
|
title: "Title",
|
||||||
|
description: "Hello, world.",
|
||||||
|
types: [TYPE_ACTION],
|
||||||
|
image: "",
|
||||||
|
artist: "",
|
||||||
|
author: "",
|
||||||
|
version: "",
|
||||||
|
price: "",
|
||||||
|
preview: "",
|
||||||
|
}
|
112
src/types.ts
112
src/types.ts
@ -1,41 +1,42 @@
|
|||||||
type DominionText = string;
|
export type DominionText = string;
|
||||||
|
|
||||||
type DominionColor = {
|
export type DominionColor = {
|
||||||
color: string;
|
value: string;
|
||||||
priority: number; // highest priority is "primary", second highest is "secondary".
|
priority: number; // highest priority is "primary", second highest is "secondary".
|
||||||
overridesAction: boolean;
|
overridesAction?: boolean;
|
||||||
|
onConflictDescriptionOnly?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type DominionBasicCardType = {
|
export type DominionBasicCardType = {
|
||||||
typeType: "basic";
|
typeType: "basic";
|
||||||
name: "Action" | "Treasure" | "Victory" | "Reaction" | "Duration" | "Reserve" | "Night" | "Attack" | "Command";
|
name: "Action" | "Treasure" | "Victory" | "Reaction" | "Duration" | "Reserve" | "Night" | "Attack" | "Command";
|
||||||
color: null | DominionColor;
|
color: null | DominionColor;
|
||||||
};
|
};
|
||||||
type DominionBasicLandscapeType = {
|
export type DominionBasicLandscapeType = {
|
||||||
typeType: "basic";
|
typeType: "basic";
|
||||||
name: "Event" | "Landmark" | "Project" | "Way" | "Trait";
|
name: "Event" | "Landmark" | "Project" | "Way" | "Trait";
|
||||||
color: null | DominionColor;
|
color: null | DominionColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
type DominionCardType = DominionBasicCardType | DominionCustomCardType;
|
export type DominionCardType = DominionBasicCardType | DominionCustomCardType;
|
||||||
type DominionLandscapeType = DominionBasicLandscapeType | DominionCustomLandscapeType;
|
export type DominionLandscapeType = DominionBasicLandscapeType | DominionCustomLandscapeType;
|
||||||
|
|
||||||
type DominionCard = {
|
export type DominionCard = {
|
||||||
orientation: "card";
|
orientation: "card";
|
||||||
title: string;
|
title: string;
|
||||||
description: DominionText;
|
description: DominionText;
|
||||||
type: Array<DominionCardType>;
|
types: Array<DominionCardType>;
|
||||||
image: string;
|
image: string;
|
||||||
artist: string;
|
artist: string;
|
||||||
author: string;
|
author: string;
|
||||||
version: string;
|
version: string;
|
||||||
price: DominionText;
|
price: DominionText;
|
||||||
preview: DominionText;
|
preview?: DominionText;
|
||||||
} | {
|
} | {
|
||||||
orientation: "landscape";
|
orientation: "landscape";
|
||||||
title: string;
|
title: string;
|
||||||
description: DominionText;
|
description: DominionText;
|
||||||
type: Array<DominionLandscapeType>;
|
types: Array<DominionLandscapeType>;
|
||||||
image: string;
|
image: string;
|
||||||
artist: string;
|
artist: string;
|
||||||
author: string;
|
author: string;
|
||||||
@ -43,25 +44,104 @@ type DominionCard = {
|
|||||||
price: DominionText;
|
price: DominionText;
|
||||||
};
|
};
|
||||||
|
|
||||||
type DominionCustomSymbol = {
|
export type DominionCustomSymbol = {
|
||||||
image: string;
|
image: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type DominionCustomCardType = {
|
export type DominionCustomCardType = {
|
||||||
typeType: "custom";
|
typeType: "custom";
|
||||||
name: string;
|
name: string;
|
||||||
color: DominionColor
|
color: DominionColor
|
||||||
};
|
};
|
||||||
type DominionCustomLandscapeType = {
|
export type DominionCustomLandscapeType = {
|
||||||
typeType: "custom";
|
typeType: "custom";
|
||||||
name: string;
|
name: string;
|
||||||
color: DominionColor
|
color: DominionColor
|
||||||
};
|
};
|
||||||
|
|
||||||
type DominionExpansion = {
|
export type DominionExpansion = {
|
||||||
cards: Array<DominionCard>;
|
cards: Array<DominionCard>;
|
||||||
icon: string;
|
icon: string;
|
||||||
customSymbols: Array<DominionCustomSymbol>;
|
customSymbols: Array<DominionCustomSymbol>;
|
||||||
customCardTypes: Array<DominionCustomCardType>;
|
customCardTypes: Array<DominionCustomCardType>;
|
||||||
customLandscapeTypes: Array<DominionCustomLandscapeType>;
|
customLandscapeTypes: Array<DominionCustomLandscapeType>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const TYPE_ACTION: DominionBasicCardType = {
|
||||||
|
typeType: "basic",
|
||||||
|
name: "Action",
|
||||||
|
color: {
|
||||||
|
value: "white",
|
||||||
|
priority: 6,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const TYPE_TREASURE: DominionBasicCardType = {
|
||||||
|
typeType: "basic",
|
||||||
|
name: "Treasure",
|
||||||
|
color: {
|
||||||
|
value: "yellow",
|
||||||
|
priority: 5,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const TYPE_VICTORY: DominionBasicCardType = {
|
||||||
|
typeType: "basic",
|
||||||
|
name: "Victory",
|
||||||
|
color: {
|
||||||
|
value: "green",
|
||||||
|
priority: 4,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const TYPE_REACTION: DominionBasicCardType = {
|
||||||
|
typeType: "basic",
|
||||||
|
name: "Reaction",
|
||||||
|
color: {
|
||||||
|
value: "blue",
|
||||||
|
priority: 1,
|
||||||
|
overridesAction: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const TYPE_DURATION: DominionBasicCardType = {
|
||||||
|
typeType: "basic",
|
||||||
|
name: "Duration",
|
||||||
|
color: {
|
||||||
|
value: "orange",
|
||||||
|
priority: 3,
|
||||||
|
overridesAction: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const TYPE_RESERVE: DominionBasicCardType = {
|
||||||
|
typeType: "basic",
|
||||||
|
name: "Duration",
|
||||||
|
color: {
|
||||||
|
value: "orange",
|
||||||
|
priority: 2, // unknown whether this should be above or below reaction/duration?
|
||||||
|
overridesAction: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const TYPE_NIGHT: DominionBasicCardType = {
|
||||||
|
typeType: "basic",
|
||||||
|
name: "Night",
|
||||||
|
color: {
|
||||||
|
value: "black",
|
||||||
|
priority: 6,
|
||||||
|
onConflictDescriptionOnly: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const TYPE_ATTACK: DominionBasicCardType = {
|
||||||
|
typeType: "basic",
|
||||||
|
name: "Attack",
|
||||||
|
color: null
|
||||||
|
}
|
||||||
|
|
||||||
|
export const TYPE_COMMAND: DominionBasicCardType = {
|
||||||
|
typeType: "basic",
|
||||||
|
name: "Command",
|
||||||
|
color: null
|
||||||
|
}
|
Reference in New Issue
Block a user