miijs 2.4.1 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npm-publish-github-packages.yml +36 -0
- package/README.md +2 -2
- package/index.js +4 -26
- package/mii.js +3346 -0
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Node.js Package
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
release:
|
|
8
|
+
types: [created]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-node@v4
|
|
16
|
+
with:
|
|
17
|
+
node-version: 20
|
|
18
|
+
- run: npm ci
|
|
19
|
+
- run: npm test
|
|
20
|
+
|
|
21
|
+
publish-gpr:
|
|
22
|
+
needs: build
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
permissions:
|
|
25
|
+
contents: read
|
|
26
|
+
packages: write
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v4
|
|
29
|
+
- uses: actions/setup-node@v4
|
|
30
|
+
with:
|
|
31
|
+
node-version: 20
|
|
32
|
+
registry-url: https://npm.pkg.github.com/
|
|
33
|
+
- run: npm ci
|
|
34
|
+
- run: npm publish
|
|
35
|
+
env:
|
|
36
|
+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ MiiJS is a complete and comprehensive Mii library for reading, converting, modif
|
|
|
47
47
|
- **`miiHeightToMeasurements(miiHeight)`** - Converts Mii height value (0-127) to real-world feet and inches. Returns `{feet, inches, totalInches, centimeters}`.
|
|
48
48
|
- **`inchesToMiiHeight(totalInches)`** - Converts real-world height in inches to Mii height value (0-127).
|
|
49
49
|
- **`centimetersToMiiHeight(totalCentimeters)`** - Converts real-world height in centimeters to Mii height value (0-127).
|
|
50
|
-
- **`
|
|
50
|
+
- **`miiHeightWeightToRealWeight(miiWeight)`** - Converts Mii weight value (0-127) to real-world weight values. Returns `{pounds, kilograms}`.
|
|
51
51
|
- **`imperialHeightWeightToMiiWeight(heightInches, weightLbs)`** - Converts real-world imperial measurements to Mii weight values.
|
|
52
52
|
- **`metricHeightWeightToMiiWeight(heightCentimeters, weightKilograms)`** - Converts real-world metric measurements to Mii weight values.
|
|
53
53
|
|
|
@@ -360,4 +360,4 @@ You can find FFLResHigh using a Wii U with an FTP program installed at `sys/titl
|
|
|
360
360
|
- **[kazuki-4ys' MiiInfoEditorCTR](https://github.com/kazuki-4ys/kazuki-4ys.github.io/tree/master/web_apps/MiiInfoEditorCTR)** - I repurposed how to decrypt and reencrypt the QR codes from here, including repurposing the asmCrypto.js file in its entirety with very small modifications (it has since been stripped down to only include the functions this library uses). I believe I also modified the code for rendering the Mii using Nintendo's Mii Studio from here as well, though I do not remember for certain.
|
|
361
361
|
- **[ariankordi's FFL.js](https://github.com/ariankordi/FFL.js/)** - Rendering Miis locally would not be possible without this library. Instructions for finding FFLResHigh are also learned from [ariankordi's FFL-Testing repository](https://github.com/ariankordi/FFL-Testing).
|
|
362
362
|
- **[Models Resource](https://models.spriters-resource.com/3ds/systembios/asset/306260/)** - For the bodies used in Mii rendering
|
|
363
|
-
- **[socram8888's Amiitools](https://github.com/socram8888/amiitool)** - I _think_, for the code reverse engineered to help with aspects of Amiibo dump processing. I went through so many iterations in research and coding, there may be other credits due as well but I _think_ this was the only repo actually used for the reverse engineering in the final working code.
|
|
363
|
+
- **[socram8888's Amiitools](https://github.com/socram8888/amiitool)** - I _think_, for the code reverse engineered to help with aspects of Amiibo dump processing. I went through so many iterations in research and coding, there may be other credits due as well but I _think_ this was the only repo actually used for the reverse engineering in the final working code.
|
package/index.js
CHANGED
|
@@ -12,7 +12,6 @@ const httpsLib = require('https');
|
|
|
12
12
|
const asmCrypto = require("./asmCrypto.js");
|
|
13
13
|
const path = require("path");
|
|
14
14
|
const createGL = require('gl');
|
|
15
|
-
const typeCheat = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3];
|
|
16
15
|
const {
|
|
17
16
|
createCharModel, initCharModelTextures,
|
|
18
17
|
initializeFFL, exitFFL, parseHexOrB64ToUint8Array,
|
|
@@ -20,6 +19,7 @@ const {
|
|
|
20
19
|
} = require("./fflWrapper.js");
|
|
21
20
|
const ModuleFFL = require("ffl.js/examples/ffl-emscripten-single-file.js");
|
|
22
21
|
const FFLShaderMaterial = require("ffl.js/FFLShaderMaterial.js");
|
|
22
|
+
const typeCheat = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3];
|
|
23
23
|
|
|
24
24
|
// Typedefs for intellisence
|
|
25
25
|
/** @typedef {import('./types').WiiMii} WiiMii */
|
|
@@ -1686,7 +1686,7 @@ function makeChild(parent0, parent1, options) {
|
|
|
1686
1686
|
delete child.stages[iStage].stages;//Because we're just cloning the baseline object repeatedly to make the stages a little bit cleaner, we need to clear this on subsequent clones
|
|
1687
1687
|
}
|
|
1688
1688
|
|
|
1689
|
-
//
|
|
1689
|
+
//Basically there's a random chance for a hairstyle to not advance throughout the years, so it's possible to end up with a hairstyle from a younger stage. This is slightly more likely for boys than girls.
|
|
1690
1690
|
let ageGroup = 0;
|
|
1691
1691
|
for (let iHairStage = 0; iHairStage < 4; iHairStage++) {
|
|
1692
1692
|
const subgroup = childGenTables.hairStyleGroups[hairGroupIndex][ageGroup];
|
|
@@ -1716,25 +1716,8 @@ function makeChild(parent0, parent1, options) {
|
|
|
1716
1716
|
child.stages[5].hair.type = hairType;
|
|
1717
1717
|
break;
|
|
1718
1718
|
}
|
|
1719
|
-
if (child.stages[0].general.gender === 0) {
|
|
1720
|
-
|
|
1721
|
-
ageGroup = Math.min(ageGroup + 1, 3);
|
|
1722
|
-
}
|
|
1723
|
-
else {
|
|
1724
|
-
if (Math.floor(Math.random() * 3) !== 0) {
|
|
1725
|
-
ageGroup = Math.min(ageGroup + 1, 3);
|
|
1726
|
-
}
|
|
1727
|
-
}
|
|
1728
|
-
}
|
|
1729
|
-
else {
|
|
1730
|
-
if (iHairStage === 0) {
|
|
1731
|
-
ageGroup = Math.min(ageGroup + 1, 3);
|
|
1732
|
-
}
|
|
1733
|
-
else {
|
|
1734
|
-
if (Math.floor(Math.random() * 4) !== 0) {
|
|
1735
|
-
ageGroup = Math.min(ageGroup + 1, 3);
|
|
1736
|
-
}
|
|
1737
|
-
}
|
|
1719
|
+
if (iHairStage === 0 || Math.floor(Math.random() * (child.stages[0].general.gender === 0 ? 3 : 4)) !== 0) {//For each stage of life there is a 33% chance for boys, and a 25% chance for girls, of staying on the same hairstyle as they had already. However, they are guaranteed to never have the same hairstyle stage as their newborn stage.
|
|
1720
|
+
ageGroup = Math.min(ageGroup + 1, 3);
|
|
1738
1721
|
}
|
|
1739
1722
|
}
|
|
1740
1723
|
return child.stages;
|
|
@@ -1898,7 +1881,6 @@ function miiWeightToRealWeight(heightInches, miiWeight) {
|
|
|
1898
1881
|
|
|
1899
1882
|
This is approximate, not guaranteed accurate nor intended to be taken that way. This is for entertainment value only.
|
|
1900
1883
|
*/
|
|
1901
|
-
if (!heightInches || heightInches < 0) throw new Error("heightInches must be >= 0");
|
|
1902
1884
|
const H = miiHeightToMeasurements(heightInches).totalInches;
|
|
1903
1885
|
const BMI = bmiFromWeightSlider(miiWeight);
|
|
1904
1886
|
return {
|
|
@@ -1907,8 +1889,6 @@ function miiWeightToRealWeight(heightInches, miiWeight) {
|
|
|
1907
1889
|
};
|
|
1908
1890
|
}
|
|
1909
1891
|
function imperialHeightWeightToMiiWeight(heightInches, weightLbs) {
|
|
1910
|
-
if (!heightInches || heightInches < 0) throw new Error("heightInches must be >= 0");
|
|
1911
|
-
|
|
1912
1892
|
const H = miiHeightToMeasurements(heightInches).totalInches;
|
|
1913
1893
|
const BMI = weightLbs * 703 / (H * H);
|
|
1914
1894
|
|
|
@@ -1922,8 +1902,6 @@ function imperialHeightWeightToMiiWeight(heightInches, weightLbs) {
|
|
|
1922
1902
|
function metricHeightWeightToMiiWeight(heightCentimeters, weightKilograms) {
|
|
1923
1903
|
const heightInches = Math.round(heightCentimeters / 2.54);
|
|
1924
1904
|
const weightLbs = Math.round(weightKilograms / 0.4535924);
|
|
1925
|
-
if (!heightInches || heightInches < 0) throw new Error("heightCentimeters must be >= 0");
|
|
1926
|
-
|
|
1927
1905
|
const H = miiHeightToMeasurements(heightInches).totalInches;
|
|
1928
1906
|
const BMI = weightLbs * 703 / (H * H);
|
|
1929
1907
|
|