diff --git a/AquaNet/public/assets/fonts/GothicA1.woff2 b/AquaNet/public/assets/fonts/GothicA1.woff2 new file mode 100644 index 00000000..d288a385 Binary files /dev/null and b/AquaNet/public/assets/fonts/GothicA1.woff2 differ diff --git a/AquaNet/src/components/settings/userbox/ChuniUserplate.svelte b/AquaNet/src/components/settings/userbox/ChuniUserplate.svelte index 610044cc..d70711c7 100644 --- a/AquaNet/src/components/settings/userbox/ChuniUserplate.svelte +++ b/AquaNet/src/components/settings/userbox/ChuniUserplate.svelte @@ -1,5 +1,5 @@ {#await DDSreader?.getFile(`nameplate:${chuniNameplate.toString().padStart(8, "0")}`, `nameplate:00000001`) then nameplateURL} @@ -41,11 +61,25 @@ {chuniName} -
- RATING - - {ratingToString(chuniRating)} - +
+ + {#await DDSreader?.getFileFromSheet("surfboard:CHU_UI_Common_01_v11.dds", 485, 5 + (28 * ratingColorData.offset), 62, 15, undefined, ratingColorData.color) then url} + {#if url} + Rating + + {#each ratingToString(chuniRating).split("") as digit} + {#await DDSreader?.getFileFromSheet("surfboard:CHU_UI_Common_01_v11.dds", 552 + (24 * (ratingDigitOrder.indexOf(digit) ?? 0)), 1 + (28 * ratingColorData.offset), 16, 20, undefined, ratingColorData.color) then url} + Rating Digit + {/await} + {/each} + + {:else} + RATING + + {ratingToString(chuniRating)} + + {/if} + {/await}
@@ -54,8 +88,8 @@ @use "../../../vars" @font-face - font-family: "Zen Maru Gothic" - src: url("/assets/fonts/ZenMaru.woff2") + font-family: "Gothic A1" + src: url("/assets/fonts/GothicA1.woff2") .chuni-nameplate width: 576px @@ -83,7 +117,7 @@ top: 40px font-size: 1.15em - font-family: "Zen Maru Gothic", sans-serif + font-family: "Gothic A1", sans-serif font-weight: bold overflow-x: hidden @@ -128,7 +162,7 @@ display: flex align-items: center color: black - font-family: "Zen Maru Gothic", sans-serif + font-family: "Gothic A1", sans-serif font-weight: bold .chuni-user-name @@ -149,7 +183,7 @@ flex: 1 0 35% font-size: 0.875em text-shadow: #333 1px 1px, #333 1px -1px, #333 -1px 1px, #333 -1px -1px - color: #ddf + color: #fff .chuni-user-rating-number font-size: 1.5em diff --git a/AquaNet/src/libs/userbox/dds.ts b/AquaNet/src/libs/userbox/dds.ts index c2917aa6..2efd836a 100644 --- a/AquaNet/src/libs/userbox/dds.ts +++ b/AquaNet/src/libs/userbox/dds.ts @@ -56,6 +56,12 @@ void main() { gl_FragColor = texture2D(uTexture, vTextureCoord); }` +export interface RGB { + r: number, + g: number, + b: number +} + export class DDS { constructor(db: IDBDatabase | undefined) { this.cache = new DDSCache(db); @@ -241,13 +247,27 @@ export class DDS { * @param s Scale factor * @returns An object URL which correlates to a Blob */ - async getFileFromSheet(path: string, x: number, y: number, w: number, h: number, s?: number): Promise { + async getFileFromSheet(path: string, x: number, y: number, w: number, h: number, s?: number, color?: RGB): Promise { if (!await this.loadFile(path)) return ""; this.canvas2D.width = w * (s ?? 1); this.canvas2D.height = h * (s ?? 1); this.ctx.drawImage(this.canvasGL, x, y, w, h, 0, 0, w * (s ?? 1), h * (s ?? 1)); + if (color) { + let colorData = this.ctx.getImageData(0, 0, this.canvas2D.width, this.canvas2D.height); + for (let i = 0; colorData.data.length > i; i++) + switch (i % 4) { + case 0: + colorData.data[i] *= (color.r / 255); break; + case 1: + colorData.data[i] *= (color.g / 255); break; + case 2: + colorData.data[i] *= (color.b / 255); break; + } + this.ctx.putImageData(colorData, 0, 0); + } + /* We don't want to cache this, it's a spritesheet piece. */ return URL.createObjectURL(await this.get2DBlob("image/png") ?? new Blob([])); }; diff --git a/AquaNet/src/libs/userbox/userbox.ts b/AquaNet/src/libs/userbox/userbox.ts index 67539089..2d2a11ad 100644 --- a/AquaNet/src/libs/userbox/userbox.ts +++ b/AquaNet/src/libs/userbox/userbox.ts @@ -85,6 +85,8 @@ const DIRECTORY_PATHS = ([ ([ "CHU_UI_Common_Avatar_body_00.dds", "CHU_UI_Common_Avatar_face_00.dds", + "CHU_UI_Common_01_v11.dds", + "CHU_UI_TeamEmblem_01_v14.dds", "CHU_UI_title_rank_00_v10.dds" ]).includes(name), id: (name: string) => name