-
- ${isDefaultPattern
- ? translateText("territory_patterns.pattern.default")
- : translateCosmetic(
- "territory_patterns.pattern",
- this.pattern!.name,
- )}
-
- ${this.colorPalette !== null
- ? html`
-
- ${translateCosmetic(
- "territory_patterns.color_palette",
- this.colorPalette!.name,
- )}
-
- `
- : html`
`}
-
+
+
+ ${this.rarity !== "common"
+ ? html`
+
+
+
+ ${Array.from(
+ { length: 40 },
+ (_, i) =>
+ html``,
+ )}`
+ : null}
`;
diff --git a/src/core/CosmeticSchemas.ts b/src/core/CosmeticSchemas.ts
index 586a44055..bd808cdcc 100644
--- a/src/core/CosmeticSchemas.ts
+++ b/src/core/CosmeticSchemas.ts
@@ -51,8 +51,17 @@ export const ColorPaletteSchema = z.object({
secondaryColor: z.string(),
});
-export const PatternSchema = z.object({
+const CosmeticSchema = z.object({
name: CosmeticNameSchema,
+ affiliateCode: z.string().nullable(),
+ product: ProductSchema.nullable(),
+ artist: z.string().optional(),
+ rarity: z
+ .enum(["common", "uncommon", "rare", "epic", "legendary"])
+ .or(z.string()),
+});
+
+export const PatternSchema = CosmeticSchema.extend({
pattern: PatternDataSchema,
colorPalettes: z
.object({
@@ -61,17 +70,10 @@ export const PatternSchema = z.object({
})
.array()
.optional(),
- affiliateCode: z.string().nullable(),
- product: ProductSchema.nullable(),
- artist: z.string().optional(),
});
-export const FlagSchema = z.object({
- name: CosmeticNameSchema,
+export const FlagSchema = CosmeticSchema.extend({
url: z.string(),
- affiliateCode: z.string().nullable(),
- product: ProductSchema.nullable(),
- artist: z.string().optional(),
});
// Schema for resources/cosmetics/cosmetics.json
diff --git a/tests/Privilege.test.ts b/tests/Privilege.test.ts
index 3d70bcf5a..dbf471871 100644
--- a/tests/Privilege.test.ts
+++ b/tests/Privilege.test.ts
@@ -43,6 +43,7 @@ const flagCosmetics = {
url: "https://example.com/cool.png",
affiliateCode: null,
product: { productId: "prod_1", priceId: "price_1", price: "$4.99" },
+ rarity: "common",
},
},
};