diff --git a/src/json/miieditor.json b/src/json/miieditor.json new file mode 100644 index 0000000..5d8cf5a --- /dev/null +++ b/src/json/miieditor.json @@ -0,0 +1,39 @@ +{ + "face": [0, 1, 8, 2, 3, 9, 4, 5, 10, 6, 7, 11], + "hairs": [ + [33, 47, 40, 37, 32, 107, 48, 51, 55, 70, 44, 66], + [52, 50, 38, 49, 43, 31, 56, 68, 62, 115, 76, 119], + [64, 81, 116, 121, 22, 58, 60, 87, 125, 117, 73, 75], + [42, 89, 57, 54, 80, 34, 23, 86, 88, 118, 39, 36], + [45, 67, 59, 65, 41, 30, 12, 16, 10, 82, 128, 129], + [14, 95, 105, 100, 6, 20, 93, 102, 27, 4, 17, 110], + [123, 8, 106, 72, 3, 21, 0, 98, 63, 90, 11, 120], + [5, 74, 108, 94, 124, 25, 99, 69, 35, 13, 122, 113], + [53, 24, 85, 83, 71, 131, 96, 101, 29, 7, 15, 112], + [79, 1, 109, 127, 91, 26, 61, 103, 2, 77, 18, 92], + [84, 9, 19, 130, 97, 104, 46, 78, 28, 114, 126, 111] + ], + "eyebrows": [ + [6, 0, 12, 1, 9, 19, 7, 21, 8, 17, 5, 4], + [11, 10, 2, 3, 14, 20, 15, 13, 22, 18, 16, 23] + ], + "eyes": [ + [2, 4, 0, 8, 39, 17, 1, 26, 16, 15, 27, 20], + [33, 11, 19, 32, 9, 12, 23, 34, 21, 25, 40, 35], + [5, 41, 13, 36, 37, 6, 24, 30, 31, 18, 28, 46], + [7, 44, 38, 42, 45, 29, 3, 43, 22, 10, 14, 47], + [48, 49, 50, 53, 59, 56, 54, 58, 57, 55, 51, 52] + ], + "nose": [ + [1, 10, 2, 3, 6, 0, 5, 4, 8, 9, 7, 11], + [13, 14, 12, 17, 16, 15] + ], + "mouth": [ + [23, 1, 19, 21, 22, 5, 0, 8, 10, 16, 6, 13], + [7, 9, 2, 17, 3, 4, 15, 11, 20, 18, 14, 12], + [27, 30, 24, 25, 29, 28, 26, 35, 31, 34, 33, 32] + ], + "arrayOf6": [0, 1, 2, 3, 4, 5], + "arrayOf9": [0, 1, 2, 3, 4, 5, 6, 7, 8], + "arrayOf12": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] +} diff --git a/src/routes/account.js b/src/routes/account.js index f8ac2b3..1162331 100644 --- a/src/routes/account.js +++ b/src/routes/account.js @@ -12,6 +12,7 @@ const cache = require('../cache'); const util = require('../util'); const logger = require('../logger'); const config = require('../../config.json'); +const editorJSON = require('../json/miieditor.json'); const { Router } = express; @@ -217,59 +218,9 @@ router.post('/online-files', requireLoginMiddleware, async (request, response) = router.get('/miieditor', requireLoginMiddleware, async (request, response) => { const { account } = request; - // Adapted from https://www.3dbrew.org/wiki/Mii#Mapped_Editor_.3C-.3E_Hex_values - - const editorToHex = { - 'face': [ - 0x00,0x01,0x08,0x02,0x03,0x09,0x04,0x05,0x0a,0x06,0x07,0x0b - ], - 'hairs': [ - [0x21,0x2f,0x28,0x25,0x20,0x6b,0x30,0x33,0x37,0x46,0x2c,0x42], - [0x34,0x32,0x26,0x31,0x2b,0x1f,0x38,0x44,0x3e,0x73,0x4c,0x77], - [0x40,0x51,0x74,0x79,0x16,0x3a,0x3c,0x57,0x7d,0x75,0x49,0x4b], - [0x2a,0x59,0x39,0x36,0x50,0x22,0x17,0x56,0x58,0x76,0x27,0x24], - [0x2d,0x43,0x3b,0x41,0x29,0x1e,0x0c,0x10,0x0a,0x52,0x80,0x81], - [0x0e,0x5f,0x69,0x64,0x06,0x14,0x5d,0x66,0x1b,0x04,0x11,0x6e], - [0x7b,0x08,0x6a,0x48,0x03,0x15,0x00,0x62,0x3f,0x5a,0x0b,0x78], - [0x05,0x4a,0x6c,0x5e,0x7c,0x19,0x63,0x45,0x23,0x0d,0x7a,0x71], - [0x35,0x18,0x55,0x53,0x47,0x83,0x60,0x65,0x1d,0x07,0x0f,0x70], - [0x4f,0x01,0x6d,0x7f,0x5b,0x1a,0x3d,0x67,0x02,0x4d,0x12,0x5c], - [0x54,0x09,0x13,0x82,0x61,0x68,0x2e,0x4e,0x1c,0x72,0x7e,0x6f] - ], - 'eyebrows': [ - [0x06,0x00,0x0c,0x01,0x09,0x13,0x07,0x15,0x08,0x11,0x05,0x04], - [0x0b,0x0a,0x02,0x03,0x0e,0x14,0x0f,0x0d,0x16,0x12,0x10,0x17] - ], - 'eyes': [ - [0x02,0x04,0x00,0x08,0x27,0x11,0x01,0x1a,0x10,0x0f,0x1b,0x14], - [0x21,0x0b,0x13,0x20,0x09,0x0c,0x17,0x22,0x15,0x19,0x28,0x23], - [0x05,0x29,0x0d,0x24,0x25,0x06,0x18,0x1e,0x1f,0x12,0x1c,0x2e], - [0x07,0x2c,0x26,0x2a,0x2d,0x1d,0x03,0x2b,0x16,0x0a,0x0e,0x2f], - [0x30,0x31,0x32,0x35,0x3b,0x38,0x36,0x3a,0x39,0x37,0x33,0x34] - ], - 'nose': [ - [0x01,0x0a,0x02,0x03,0x06,0x00, 0x05,0x04,0x08,0x09,0x07,0x0B], - [0x0d,0x0e,0x0c,0x11,0x10,0x0f] - ], - 'mouth': [ - [0x17,0x01,0x13,0x15,0x16,0x05,0x00,0x08,0x0a,0x10,0x06,0x0d], - [0x07,0x09,0x02,0x11,0x03,0x04,0x0f,0x0b,0x14,0x12,0x0e,0x0c], - [0x1b,0x1e,0x18,0x19,0x1d,0x1c,0x1a,0x23,0x1f,0x22,0x21,0x20] - ], - 'arrayOf6': [ - 0,1,2,3,4,5 - ], - 'arrayOf9': [ - 0,1,2,3,4,5,6,7,8 - ], - 'arrayOf12': [ - 0,1,2,3,4,5,6,7,8,9,10,11 - ] - }; - response.render('account/miieditor', { encodedUserMiiData: account.mii.data, - editorToHex + editorJSON }); }); diff --git a/views/account/miieditor.handlebars b/views/account/miieditor.handlebars index 372820a..a617b17 100644 --- a/views/account/miieditor.handlebars +++ b/views/account/miieditor.handlebars @@ -52,7 +52,7 @@
- {{#each editorToHex.face}} + {{#each editorJSON.face}} {{/each}} @@ -74,14 +74,14 @@
- {{#each editorToHex.arrayOf12}} + {{#each editorJSON.arrayOf12}} {{/each}}
- {{#each editorToHex.arrayOf12}} + {{#each editorJSON.arrayOf12}} {{/each}} @@ -95,7 +95,7 @@
- {{#each editorToHex.hairs}} + {{#each editorJSON.hairs}}
{{#each this}} @@ -149,7 +149,7 @@
- {{#each editorToHex.eyebrows}} + {{#each editorJSON.eyebrows}}
{{#each this}} @@ -212,7 +212,7 @@
- {{#each editorToHex.eyes}} + {{#each editorJSON.eyes}}
{{#each this}} @@ -270,7 +270,7 @@
- {{#each editorToHex.nose}} + {{#each editorJSON.nose}}
{{#each this}} @@ -309,7 +309,7 @@
- {{#each editorToHex.mouth}} + {{#each editorJSON.mouth}}
{{#each this}} @@ -362,7 +362,7 @@
- {{#each editorToHex.arrayOf9}} + {{#each editorJSON.arrayOf9}} {{/each}} @@ -400,7 +400,7 @@
- {{#each editorToHex.arrayOf6}} + {{#each editorJSON.arrayOf6}} {{/each}} @@ -426,7 +426,7 @@
- {{#each editorToHex.arrayOf6}} + {{#each editorJSON.arrayOf6}} {{/each}}