Skip to content

Commit

Permalink
Merge pull request #157 from WatWowMap/pogo-data-generator
Browse files Browse the repository at this point in the history
Update Generators
  • Loading branch information
TurtIeSocks authored Aug 20, 2021
2 parents 675ad23 + dbe219f commit cd2747a
Show file tree
Hide file tree
Showing 79 changed files with 260 additions and 368 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Pokemon GO Map frontend built with React. Currently in beta testing!
**The dev yarn scripts do not generate the masterfile and locales like the production scripts do, you must generate them manually using these:**

- `yarn generate` if you want to experiment with the masterfile generator
- `yarn create-locales` if you want to generate locales manually
- `yarn build` to only build and not run the server
- `yarn server` to only start the server without recompiling webpack
- `yarn console` repl server for running code/playing with the ORM
Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"license": "MIT",
"private": true,
"scripts": {
"start": "yarn upgrade pogo-translations && node server/createLocales.js && webpack --env prod && node server/generateMasterfile.js && node server/src/index.js",
"server": "node server/generateMasterfile.js && node server/src/index.js",
"start": "yarn create-locales && webpack --env prod && yarn generate && yarn server",
"server": "yarn generate && node server/src/index.js",
"dev": "nodemon server/src/index.js --watch server",
"build": "yarn upgrade pogo-translations && node server/createLocales.js && webpack --env prod",
"build": "yarn create-locales && webpack --env prod",
"watch": "webpack --watch --env dev",
"generate": "node server/generateMasterfile.js",
"create-locales": "yarn upgrade pogo-translations && node server/createLocales.js",
"generate": "node -e 'require(\"./server/src/services/generateMasterfile\").generate()'",
"create-locales": "node -e 'require(\"./server/src/services/createLocales\").locales()'",
"console": "node --experimental-repl-await ./server/src/console.js",
"migrate:make": "knex --knexfile server/knexfile.cjs migrate:make",
"migrate:latest": "knex --knexfile server/knexfile.cjs migrate:latest",
Expand Down Expand Up @@ -89,7 +89,6 @@
"ohbem": "^1.1.0",
"passport": "^0.4.1",
"passport-discord": "https://github.com/tonestrike/passport-discord.git",
"pogo-translations": "git+https://github.com/bschultz/pogo-translations.git",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-i18next": "^11.9.0",
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions public/base-locales/ko.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions public/base-locales/pt-br.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions public/base-locales/ru.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions public/base-locales/th.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions public/base-locales/zh-tw.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Binary file removed public/images/nest/nest-bug.png
Binary file not shown.
Binary file removed public/images/nest/nest-dark.png
Binary file not shown.
Binary file removed public/images/nest/nest-dragon.png
Binary file not shown.
Binary file removed public/images/nest/nest-electric.png
Binary file not shown.
Binary file removed public/images/nest/nest-empty.png
Binary file not shown.
Binary file removed public/images/nest/nest-fairy.png
Binary file not shown.
Binary file removed public/images/nest/nest-fighting.png
Binary file not shown.
Binary file removed public/images/nest/nest-fire.png
Binary file not shown.
Binary file removed public/images/nest/nest-flying.png
Binary file not shown.
Binary file removed public/images/nest/nest-ghost.png
Binary file not shown.
Binary file removed public/images/nest/nest-grass.png
Binary file not shown.
Binary file removed public/images/nest/nest-ground.png
Binary file not shown.
Binary file removed public/images/nest/nest-ice.png
Binary file not shown.
Binary file removed public/images/nest/nest-normal.png
Binary file not shown.
Binary file removed public/images/nest/nest-poison.png
Binary file not shown.
Binary file removed public/images/nest/nest-psychic.png
Binary file not shown.
Binary file removed public/images/nest/nest-rock.png
Binary file not shown.
Binary file removed public/images/nest/nest-steel.png
Binary file not shown.
Binary file removed public/images/nest/nest-water.png
Binary file not shown.
Binary file removed public/images/type/bug.png
Binary file not shown.
Binary file removed public/images/type/dark.png
Binary file not shown.
Binary file removed public/images/type/dragon.png
Binary file not shown.
Binary file removed public/images/type/electric.png
Binary file not shown.
Binary file removed public/images/type/fairy.png
Binary file not shown.
Binary file removed public/images/type/fighting.png
Binary file not shown.
Binary file removed public/images/type/fire.png
Diff not rendered.
Binary file removed public/images/type/flying.png
Diff not rendered.
Binary file removed public/images/type/ghost.png
Diff not rendered.
Binary file removed public/images/type/grass.png
Diff not rendered.
Binary file removed public/images/type/ground.png
Diff not rendered.
Binary file removed public/images/type/ice.png
Diff not rendered.
Binary file removed public/images/type/normal.png
Diff not rendered.
Binary file removed public/images/type/poison.png
Diff not rendered.
Binary file removed public/images/type/psychic.png
Diff not rendered.
Binary file removed public/images/type/rock.png
Diff not rendered.
Binary file removed public/images/type/steel.png
Diff not rendered.
Binary file removed public/images/type/water.png
Diff not rendered.
60 changes: 0 additions & 60 deletions server/createLocales.js

This file was deleted.

141 changes: 0 additions & 141 deletions server/generateMasterfile.js

This file was deleted.

34 changes: 0 additions & 34 deletions server/src/data/weatherTypes.json

This file was deleted.

13 changes: 9 additions & 4 deletions server/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ const i18next = require('i18next')
const Backend = require('i18next-fs-backend')
require('./db/initialization')

const { sessionStore } = require('./services/session-store.js')
const rootRouter = require('./routes/rootRouter.js')
const config = require('./services/config.js')
const { Pokemon } = require('./models/index')
const { sessionStore } = require('./services/session-store')
const rootRouter = require('./routes/rootRouter')
const config = require('./services/config')

const app = express()

Expand Down Expand Up @@ -68,7 +69,7 @@ if (config.discord.enabled) {
i18next.use(Backend).init({
lng: 'en',
fallbackLng: 'en',
preload: ['en', 'de', 'es', 'fr', 'pl'],
preload: config.localeSelection,
ns: ['translation'],
defaultNS: 'translation',
backend: { loadPath: 'public/locales/{{lng}}/{{ns}}.json' },
Expand All @@ -79,6 +80,10 @@ i18next.use(Backend).init({

app.use(rootRouter, requestRateLimiter)

if (config.database.settings.reactMapHandlesPvp) {
Pokemon.initOhbem()
}

app.listen(config.port, config.interface, () => {
// eslint-disable-next-line no-console
console.log(`Server is now listening at http://${config.interface}:${config.port}`)
Expand Down
11 changes: 1 addition & 10 deletions server/src/models/Gym.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,10 @@ class Gym extends Model {

for (let i = 0; i < length; i += 1) {
const gym = queryResults[i]
if (gym.raid_pokemon_form === 0 && gym.raid_pokemon_id > 0) {
const formId = masterfile[gym.raid_pokemon_id].default_form_id
if (formId) gym.raid_pokemon_form = formId
}
if (!gyms) {
gym.team_id = 0
}
if (!gym.raid_pokemon_id
&& args.filters[`e${gym.raid_level}`]) {
if (!gym.raid_pokemon_id && args.filters[`e${gym.raid_level}`]) {
filteredResults.push(gym)
} else if (args.filters[`${gym.raid_pokemon_id}-${gym.raid_pokemon_form}`]) {
filteredResults.push(gym)
Expand Down Expand Up @@ -217,10 +212,6 @@ class Gym extends Model {
if (pokemon.raid_pokemon_id === 0) {
return `e${pokemon.raid_level}`
}
if (pokemon.raid_pokemon_form === 0) {
const formId = masterfile[pokemon.raid_pokemon_id].default_form_id
if (formId) pokemon.raid_pokemon_form = formId
}
return `${pokemon.raid_pokemon_id}-${pokemon.raid_pokemon_form}`
})
}
Expand Down
4 changes: 2 additions & 2 deletions server/src/models/Nest.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Nest extends Model {
const returnedResults = []
queryResults.forEach(pkmn => {
if (pkmn.pokemon_form == 0 || pkmn.pokemon_form === null) {
const formId = masterfile[pkmn.pokemon_id].default_form_id
const formId = masterfile[pkmn.pokemon_id].defaultFormId
if (formId) pkmn.pokemon_form = formId
}
if (args.filters[`${pkmn.pokemon_id}-${pkmn.pokemon_form}`]) {
Expand All @@ -55,7 +55,7 @@ class Nest extends Model {

return results.map(pokemon => {
if (pokemon.pokemon_form == 0 || pokemon.pokemon_form === null) {
return `${pokemon.pokemon_id}-${masterfile[pokemon.pokemon_id].default_form_id || 0}`
return `${pokemon.pokemon_id}-${masterfile[pokemon.pokemon_id].defaultFormId || 0}`
}
return `${pokemon.pokemon_id}-${pokemon.pokemon_form || 0}`
})
Expand Down
Loading

0 comments on commit cd2747a

Please sign in to comment.