Skip to content

Commit efcd0b1

Browse files
authored
Merge pull request #34 from TeamLumi/Extend-Move-Dex
Extend move dex
2 parents 9c6348a + 849eff2 commit efcd0b1

File tree

19 files changed

+547
-268
lines changed

19 files changed

+547
-268
lines changed

__gamedata/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ const GAMEDATAV = "vanilla";
152152
const GAMEDATA2 = "2.0";
153153
const GAMEDATA3 = "3.0";
154154

155+
const GAME_MODE_STRINGS = {
156+
[GAMEDATAV]: "Vanilla BDSP",
157+
[GAMEDATA2]: "Luminescent 2.2F",
158+
[GAMEDATA3]: "Re:Illuminated",
159+
}
160+
155161
// romfs/Data/StreamingAssets/AssetAssistant/Message/english
156162
const AreaNames = { // english_dp_fld_areaname.json
157163
[GAMEDATAV]: areaNamesVanilla,
@@ -355,6 +361,7 @@ module.exports = {
355361
GAMEDATA2,
356362
GAMEDATA3,
357363
GAMEDATAV,
364+
GAME_MODE_STRINGS,
358365
AreaNames,
359366
DisplayNames,
360367
ItemNames,

docusaurus.config.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,16 @@ const config = {
156156
},
157157
{ to: '/rom-hacking', label: 'ROM Hacking', position: 'left' },
158158
{ to: '/blog', label: 'Blog', position: 'left' },
159-
...(isDexEnabled ? [{ to: '/dex', label: 'Pokédex', position: 'left' }] : []),
160-
...(isPokedexEnabled ? [{ to: POKEDEX_BASE_PATH, label: 'Pokédex', position: 'left' }] : []),
161-
{ to: '/mapper', label: "Mapper (Beta)", position: "left" },
159+
{
160+
type: 'dropdown',
161+
label: 'Pokemon Data',
162+
position: 'left',
163+
items: [
164+
...(isPokedexEnabled ? [{ to: POKEDEX_BASE_PATH, label: 'Pokédex' }] : []),
165+
{ to: '/mapper', label: "Mapper (Beta)" },
166+
{ to: '/moves', label: "Moves" },
167+
],
168+
},
162169
{
163170
label: 'Discord',
164171
href: 'https://discord.gg/luminescent',

plugins/move-data-plugin/index.js

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const { GAMEDATA2, GAMEDATA3, GAMEDATAV, MovesTable } = require('../../__gamedat
55
const { getMoveProperties } = require('../pokedex-data-plugin/dex/moves');
66
const { normalizePokemonName } = require('../pokedex-data-plugin/dex/name');
77
const { getTypeName } = require('../pokedex-data-plugin/dex/types');
8+
const { Z_MOVES } = require('../pokedex-data-plugin/dex/moveConstants');
89

910
/**
1011
* @param {{path: string, routeBasePath: string, moveComponent: string, moveListComponent: string, wrapperComponent: string}} options
@@ -27,13 +28,27 @@ function moveDexDataPlugin(context, options) {
2728
const moves3 = MovesTable[GAMEDATA3].Waza.slice(1).map(
2829
(move) => getMoveProperties(move.wazaNo, GAMEDATA3, true)
2930
);
30-
const movesList3 = moves3.map((m) => ({
31-
...m,
32-
id: m.moveId,
33-
name: m.name,
34-
type: m.type,
35-
typeName: getTypeName(m.type),
36-
}));
31+
32+
const firstZMoveMap = Object.fromEntries(Z_MOVES.map(z => [z, 0]));
33+
34+
const movesList3 = moves3
35+
.filter(m => {
36+
if (!Z_MOVES.includes(m.movePath)) return true;
37+
38+
if (firstZMoveMap[m.movePath] === 0) {
39+
firstZMoveMap[m.movePath] = 1;
40+
return true; // keep first
41+
}
42+
43+
return false; // skip duplicates
44+
})
45+
.map(m => ({
46+
...m,
47+
id: m.moveId,
48+
name: m.name,
49+
type: m.type,
50+
typeName: getTypeName(m.type),
51+
}));
3752

3853
return {
3954
movesV,
@@ -57,23 +72,32 @@ function moveDexDataPlugin(context, options) {
5772
};
5873

5974
const moveRoutes = [];
75+
const zMoveMap = {};
76+
for (const item of Z_MOVES) {
77+
zMoveMap[item] = 0;
78+
}
6079
await Promise.all(
6180
content.moves3.map(async (move3) => {
62-
const moveName = normalizePokemonName(move3.name, GAMEDATA3);
63-
const movePath = `${moveDexPath}/${moveName}`;
81+
if (Z_MOVES.includes(move3.movePath)) {
82+
if (zMoveMap[move3.movePath] === 1) {
83+
return
84+
}
85+
zMoveMap[move3.movePath] += 1
86+
}
87+
const movePath = `${moveDexPath}/${move3.movePath}`;
6488

65-
const moveJson3 = await actions.createData(`3.0lumi${moveName}.json`, JSON.stringify(move3));
89+
const moveJson3 = await actions.createData(`3.0lumi-${move3.movePath}.json`, JSON.stringify(move3));
6690
let moveJson2 = null;
6791
let moveJsonV = null;
6892

6993
const move2 = content.moves2.find((m2) => m2.name === move3.name);
7094
if (move2) {
71-
moveJson2 = await actions.createData(`2.0lumi${moveName}.json`, JSON.stringify(move2));
95+
moveJson2 = await actions.createData(`2.0lumi-${move3.movePath}.json`, JSON.stringify(move2));
7296
}
7397

7498
const moveV = content.movesV.find((mV) => mV.name === move3.name);
7599
if (moveV) {
76-
moveJsonV = await actions.createData(`VanilaBDSP${moveName}.json`, JSON.stringify(moveV));
100+
moveJsonV = await actions.createData(`VanilaBDSP-${move3.movePath}.json`, JSON.stringify(moveV));
77101
}
78102

79103
moveRoutes.push({

0 commit comments

Comments
 (0)