diff --git a/package.json b/package.json index 047ec4a6f..db33f3d0c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "reactmap", - "version": "1.3.2", + "version": "1.3.3", "description": "React based frontend map.", "main": "ReactMap.mjs", "author": "TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com>", diff --git a/server/src/configs/default.json b/server/src/configs/default.json index 13be60930..5d477b61d 100644 --- a/server/src/configs/default.json +++ b/server/src/configs/default.json @@ -84,7 +84,7 @@ "hideOldPokestops": false, "fetchTimeoutMs": 3000, "pogoApiEndpoints": { - "invasions": "https://raw.githubusercontent.com/WatWowMap/Masterfile-Generator/master/custom-invasions.json", + "invasions": "https://raw.githubusercontent.com/WatWowMap/event-info/main/grunts/formatted.json", "masterfile": "https://raw.githubusercontent.com/WatWowMap/Masterfile-Generator/master/master-latest-react-map.json", "translations": "https://raw.githubusercontent.com/WatWowMap/pogo-translations/master" } diff --git a/server/src/services/EventManager.js b/server/src/services/EventManager.js index 125ac31bb..f0bffa1d1 100644 --- a/server/src/services/EventManager.js +++ b/server/src/services/EventManager.js @@ -128,33 +128,10 @@ module.exports = class EventManager { if (endpoint) { console.log('[EVENT] Fetching Latest Invasions') try { - this.invasions = await fetchJson(endpoint).then((response) => - response - ? Object.fromEntries( - Object.entries(this.invasions).map(([type, info]) => { - const latest = response[type] - const newInvasion = this.invasions[type] - if (info.encounters) { - Object.keys(info.encounters).forEach((position, i) => { - if (latest?.active) { - newInvasion.encounters[position] = latest.lineup.team[ - i - ].map((pkmn, j) => - pkmn.template === 'UNSET' && - info.encounters[position][j] - ? info.encounters[position][j] - : { id: pkmn.id, form: pkmn.form }, - ) - newInvasion.second_reward = - latest.lineup.rewards.length > 1 - } - }) - } - return [type, newInvasion] - }), - ) - : this.invasions, - ) + const newInvasions = await fetchJson(endpoint) + if (newInvasions) { + this.invasions = newInvasions + } } catch (e) { console.warn('[WARN] Unable to generate latest invasions:\n', e.message) } diff --git a/src/components/popups/Pokestop.jsx b/src/components/popups/Pokestop.jsx index e1a762278..86e702a79 100644 --- a/src/components/popups/Pokestop.jsx +++ b/src/components/popups/Pokestop.jsx @@ -633,16 +633,19 @@ const Invasion = ({ pokestop, Icons, t }) => { ) const getRewardPercent = (grunt) => { - if (grunt.type === 'Giovanni') { - return { third: '100%' } - } if (grunt.type.startsWith('NPC')) { return {} } - if (grunt.second_reward) { + if (grunt.secondReward) { return { first: '85%', second: '15%' } } - return { first: '100%' } + if (grunt.thirdReward) { + return { third: '100%' } + } + if (grunt.firstReward) { + return { first: '100%' } + } + return {} } return invasions.map((invasion) => (