diff --git a/src/Pixel.js b/src/Pixel.js index 3cbcd46..546fd3b 100644 --- a/src/Pixel.js +++ b/src/Pixel.js @@ -14,16 +14,22 @@ module.exports = class Pixel { this.hex = hex; this.matches = []; + const usedPalettes = []; + items.forEach((item) => { item.hexColours.forEach(({ value }, index) => { if (value.toLowerCase().includes(hex.toLowerCase())) { - this.matches.push({ - palette: { - name: item.name, - description: item.description, - }, - position: position(index), - }); + if (!usedPalettes.includes(item.name)) { + this.matches.push({ + palette: { + name: item.name, + description: item.description, + }, + position: position(index), + }); + + usedPalettes.push(item.name); + } } }); }); diff --git a/test/unit/warframe.spec.js b/test/unit/warframe.spec.js index e7e5c26..38103be 100644 --- a/test/unit/warframe.spec.js +++ b/test/unit/warframe.spec.js @@ -62,16 +62,9 @@ describe('Warframe', () => { xp: 153461190, polarized: 5, features: 5, - cosmetics: [ - { - uniqueName: '/Lotus/Upgrades/Skins/AntiMatter/NovaDeluxeIIHelmet', - name: 'Nova Atomica Helmet', - description: "Nova Atomica's signature helmet.", - type: 'Skin', - imageName: 'nova-atomica-helmet.png', - category: 'Skins', - }, - ], + cosmetics: [{ + uniqueName: '/Lotus/Upgrades/Skins/AntiMatter/NovaDeluxeIIHelmet', name: 'Nova Atomica Helmet', description: "Nova Atomica's signature helmet.", type: 'Skin', imageName: 'nova-atomica-helmet.png', category: 'Skins', + }], upgrades: { arcanes: [], mods: [] }, colors: { syandana: { @@ -81,7 +74,7 @@ describe('Warframe', () => { primary: { hex: 'FF588A', matches: [{ palette: { name: 'Valentine', description: 'Unlocks a collection of lovely colors.' }, position: { row: 2, col: 2 } }] }, secondary: { hex: 'FE1C50', matches: [{ palette: { name: 'Valentine', description: 'Unlocks a collection of lovely colors.' }, position: { row: 8, col: 2 } }] }, tertiary: { hex: 'FF0D43', matches: [{ palette: { name: 'Valentine', description: 'Unlocks a collection of lovely colors.' }, position: { row: 3, col: 2 } }] }, accents: { hex: 'FF5C9F', matches: [{ palette: { name: 'Valentine', description: 'Unlocks a collection of lovely colors.' }, position: { row: 7, col: 2 } }] }, emissive: [{ hex: 'FF70A9', matches: [{ palette: { name: 'Valentine', description: 'Unlocks a collection of lovely colors.' }, position: { row: 12, col: 2 } }] }, { hex: 'FF70A9', matches: [{ palette: { name: 'Valentine', description: 'Unlocks a collection of lovely colors.' }, position: { row: 12, col: 2 } }] }], energy: [{ hex: 'FF70A9', matches: [{ palette: { name: 'Valentine', description: 'Unlocks a collection of lovely colors.' }, position: { row: 12, col: 2 } }] }], }, sigil: { - primary: { hex: '3F9FB7', matches: [{ palette: { name: 'Classic', description: 'Unlocks additional color options for Warframe customization.' }, position: { row: 16, col: 2 } }] }, secondary: { hex: '808080', matches: [{ palette: { name: 'Tenno', description: 'Unlocks additional color options reflecting the default colors used on each standard Warframe.' }, position: { row: 10, col: 3 } }] }, tertiary: { hex: 'BABABA', matches: [{ palette: { name: 'Tenno', description: 'Unlocks additional color options reflecting the default colors used on each standard Warframe.' }, position: { row: 12, col: 1 } }, { palette: { name: 'Tenno', description: 'Unlocks additional color options reflecting the default colors used on each standard Warframe.' }, position: { row: 5, col: 4 } }] }, accents: { hex: '808080', matches: [{ palette: { name: 'Tenno', description: 'Unlocks additional color options reflecting the default colors used on each standard Warframe.' }, position: { row: 10, col: 3 } }] }, emissive: [], energy: [{ hex: 'FFBA80', matches: [] }], + primary: { hex: '3F9FB7', matches: [{ palette: { name: 'Classic', description: 'Unlocks additional color options for Warframe customization.' }, position: { row: 16, col: 2 } }] }, secondary: { hex: '808080', matches: [{ palette: { name: 'Tenno', description: 'Unlocks additional color options reflecting the default colors used on each standard Warframe.' }, position: { row: 10, col: 3 } }] }, tertiary: { hex: 'BABABA', matches: [{ palette: { name: 'Tenno', description: 'Unlocks additional color options reflecting the default colors used on each standard Warframe.' }, position: { row: 12, col: 1 } }] }, accents: { hex: '808080', matches: [{ palette: { name: 'Tenno', description: 'Unlocks additional color options reflecting the default colors used on each standard Warframe.' }, position: { row: 10, col: 3 } }] }, emissive: [], energy: [{ hex: 'FFBA80', matches: [] }], }, attachments: { primary: { hex: 'FF588A', matches: [{ palette: { name: 'Valentine', description: 'Unlocks a collection of lovely colors.' }, position: { row: 2, col: 2 } }] }, secondary: { hex: 'FE1C50', matches: [{ palette: { name: 'Valentine', description: 'Unlocks a collection of lovely colors.' }, position: { row: 8, col: 2 } }] }, tertiary: { hex: 'FF0D43', matches: [{ palette: { name: 'Valentine', description: 'Unlocks a collection of lovely colors.' }, position: { row: 3, col: 2 } }] }, accents: { hex: 'FF5C9F', matches: [{ palette: { name: 'Valentine', description: 'Unlocks a collection of lovely colors.' }, position: { row: 7, col: 2 } }] }, emissive: [], energy: [{ hex: 'FF70A9', matches: [{ palette: { name: 'Valentine', description: 'Unlocks a collection of lovely colors.' }, position: { row: 12, col: 2 } }] }],