Skip to content

Commit

Permalink
Merge pull request #12 from DestinyItemManager/duplicate-glyphs
Browse files Browse the repository at this point in the history
Forbid duplicate glyphs
  • Loading branch information
delphiactual authored Jun 28, 2024
2 parents c72f671 + 6e4b464 commit b8d2645
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 111 deletions.
99 changes: 0 additions & 99 deletions output/symbol-name-sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1317,15 +1317,6 @@ export const symbolData: {
fromRichText: false,
},
},
{
codepoint: 57492,
glyph: '',
source: {
tableName: 'InventoryItem',
hash: 1602994568,
fromRichText: false,
},
},
{
codepoint: 983122,
glyph: '󰁒',
Expand Down Expand Up @@ -1794,51 +1785,6 @@ export const symbolData: {
fromRichText: false,
},
},
{
codepoint: 61186,
glyph: '',
source: {
tableName: 'InventoryItem',
hash: 1517917190,
fromRichText: false,
},
},
{
codepoint: 61187,
glyph: '',
source: {
tableName: 'InventoryItem',
hash: 3994381207,
fromRichText: false,
},
},
{
codepoint: 61188,
glyph: '',
source: {
tableName: 'InventoryItem',
hash: 1225978592,
fromRichText: false,
},
},
{
codepoint: 61191,
glyph: '',
source: {
tableName: 'InventoryItem',
hash: 1980796564,
fromRichText: false,
},
},
{
codepoint: 61194,
glyph: '',
source: {
tableName: 'InventoryItem',
hash: 988980152,
fromRichText: false,
},
},
{
codepoint: 61230,
glyph: '',
Expand All @@ -1848,24 +1794,6 @@ export const symbolData: {
fromRichText: false,
},
},
{
codepoint: 61190,
glyph: '',
source: {
tableName: 'InventoryItem',
hash: 1680616210,
fromRichText: false,
},
},
{
codepoint: 61193,
glyph: '',
source: {
tableName: 'InventoryItem',
hash: 4249729126,
fromRichText: false,
},
},
{
codepoint: 61229,
glyph: '',
Expand All @@ -1884,15 +1812,6 @@ export const symbolData: {
fromRichText: false,
},
},
{
codepoint: 61192,
glyph: '',
source: {
tableName: 'InventoryItem',
hash: 2307689415,
fromRichText: false,
},
},
{
codepoint: 61228,
glyph: '',
Expand All @@ -1902,15 +1821,6 @@ export const symbolData: {
fromRichText: false,
},
},
{
codepoint: 61183,
glyph: '',
source: {
tableName: 'Trait',
hash: 2724747993,
fromRichText: false,
},
},
{
codepoint: 983371,
glyph: '󰅋',
Expand All @@ -1920,15 +1830,6 @@ export const symbolData: {
fromRichText: false,
},
},
{
codepoint: 983368,
glyph: '󰅈',
source: {
tableName: 'Trait',
hash: 3173573497,
fromRichText: false,
},
},
{
codepoint: 57497,
glyph: '',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"scripts": {
"build": "tsc && resolve-tspaths",
"install": "git submodule update --init --recursive",
"watch": "tsc --watch --assumeChangesOnlyAffectDirectDependencies --preserveWatchOutput",
"fix:eslint": "pnpm lint:eslint --fix",
"fix:prettier": "prettier --write \"**/*.{js,ts,tsx,scss,html,json}\"",
Expand Down
23 changes: 11 additions & 12 deletions src/generate-symbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getAllDefs } from '@d2api/manifest-node';
import { FontGlyphs } from '../data/d2-font-glyphs.js';
import { DimCustomSymbols } from '../data/dim-custom-symbols.js';
import { writeFile } from './helpers.js';
import { warnLog } from './log.js';
import { errorLog, warnLog } from './log.js';

const TAG = 'SYMBOLS';

Expand Down Expand Up @@ -195,7 +195,6 @@ const data: [glyph: FontGlyphs | DimCustomSymbols, name?: string][] = [
[FontGlyphs.void_quickfall],
[DimCustomSymbols.vanishing_step, 'Vanishing Step'],
[DimCustomSymbols.bastion, 'Bastion'],
[FontGlyphs.balloom, 'Controlled Demolition'],
[DimCustomSymbols.offensive_bulwark, 'Offensive Bulwark'],
[DimCustomSymbols.chaos_accelerant, 'Chaos Accelerant'],
[FontGlyphs.void_soul, 'Child of the Old Gods'],
Expand Down Expand Up @@ -257,21 +256,11 @@ const data: [glyph: FontGlyphs | DimCustomSymbols, name?: string][] = [
[FontGlyphs.strand_infest, 'Sever'],
[DimCustomSymbols.suspend, 'Suspend'],
[FontGlyphs.strand_tangle, 'Tangle'],
[FontGlyphs.strand_suspend_grenade, 'Shackle Grenade'],
[FontGlyphs.strand_threadling_grenade, 'Threadling Grenade'],
[FontGlyphs.strand_grappling_hook, 'Grapple'],
[FontGlyphs.strand_severing_leap_melee, 'Frenzied Blade'],
[FontGlyphs.strand_titan_suspend_brace, "Drengr's Lash"],
[FontGlyphs.strand_titan_slide_melee, 'Flechette Storm'],
[FontGlyphs.strand_rope_dart_melee, 'Threaded Spike'],
[FontGlyphs.strand_hunter_quickfall, 'Ensnaring Slam'],
[FontGlyphs.strand_hunter_clone, 'Threaded Specter'],
[FontGlyphs.strand_hunter_buzzsaw, 'Whirling Maelstrom'],
[FontGlyphs.strand_seize_melee, 'Arcane Needle'],
[FontGlyphs.strand_warlock_suspend_tangle, 'The Wanderer'],
[FontGlyphs.strand_threadling, 'Threadling'],
[DimCustomSymbols.unravel, 'Unravel'],
[DimCustomSymbols.into_the_fray, 'Woven Mail'],

// Weapons
// Primary
Expand Down Expand Up @@ -490,7 +479,14 @@ const findSource: (name: string) => Source | undefined = (name: string) => {
}
};

const seenGlyphs = new Set<number>();
let hasDupes = false;
for (const [glyph, name] of data) {
if (seenGlyphs.has(glyph)) {
errorLog(TAG, `symbol names: duplicate glyph ${glyph} ${name}`);
hasDupes = true;
}
seenGlyphs.add(glyph);
if (name) {
const source = findSource(name);
output.push({ codepoint: glyph, glyph: String.fromCodePoint(glyph), source });
Expand All @@ -503,6 +499,9 @@ for (const [glyph, name] of data) {
translateManually.push(glyph);
}
}
if (hasDupes) {
throw new Error('Duplicate glyphs');
}

const outString =
"export const symbolData: {codepoint: number; glyph: string, source?: {tableName: 'Trait' | 'InventoryItem' | 'SandboxPerk' | 'ActivityMode' | 'Objective'| 'ItemCategory' | 'InventoryBucket' | 'Faction' | 'Stat' | 'DamageType', hash: number, fromRichText: boolean }}[] =" +
Expand Down

0 comments on commit b8d2645

Please sign in to comment.