Skip to content

Commit

Permalink
Merge pull request #50 from WatWowMap/grab-latest-remote
Browse files Browse the repository at this point in the history
Grab Latest Remote
  • Loading branch information
TurtIeSocks committed Jan 6, 2022
2 parents d13231d + 0760d07 commit 6d58ffe
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pogo-data-generator",
"version": "1.3.5",
"version": "1.3.6",
"description": "Pokemon GO project data generator",
"author": "TurtIeSocks",
"license": "Apache-2.0",
Expand Down
4 changes: 2 additions & 2 deletions src/classes/Masterfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ export default class Masterfile {
return merged
}

async fetch(url: string): Promise<any> {
async fetch(url: string, text = false): Promise<any> {
try {
const data = await Fetch(url)
if (!data.ok) {
throw new Error(`${data.status} ${data.statusText} URL: ${url}`)
}
return data.json()
return text ? data.text() : data.json()
} catch (e) {
console.error(e, `Unable to fetch ${url}`)
}
Expand Down
31 changes: 30 additions & 1 deletion src/classes/Translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default class Translations extends Masterfile {
manualTranslations: { [key: string]: TranslationKeys }
parsedTranslations: { [key: string]: TranslationKeys }
codes: { [id: string]: string }
latestRemoteLocales: { [id: string]: string }
masterfile: FinalResult
generics: { [key: string]: { [key: string]: string } }
reference: TranslationKeys
Expand Down Expand Up @@ -39,6 +40,19 @@ export default class Translations extends Masterfile {
th: 'thai',
'zh-tw': 'chinesetraditional',
}
this.latestRemoteLocales = {
de: 'German',
en: 'English',
es: 'Spanish',
fr: 'French',
it: 'Italian',
ja: 'Japanese',
ko: 'Korean',
'pt-br': 'BrazilianPortuguese',
ru: 'Russian',
th: 'Thai',
'zh-tw': 'ChineseTraditional',
}
this.generics = {
de: {
none: 'Keiner',
Expand Down Expand Up @@ -148,6 +162,18 @@ export default class Translations extends Masterfile {
for (let i = 0; i < data.length; i += 2) {
this.rawTranslations[locale][data[i]] = data[i + 1]
}

const textFile = await this.fetch(
`https://raw.githubusercontent.com/PokeMiners/pogo_assets/master/Texts/Latest%20Remote/${this.latestRemoteLocales[locale] || 'English'}.txt`,
true
)
const splitText = textFile.split('\n')

splitText.forEach((line: string, i: number) => {
if (line?.startsWith('RESOURCE ID')) {
this.rawTranslations[locale][line.replace('RESOURCE ID: ', '')] = splitText[i + 1].replace('TEXT: ', '')
}
})
} catch (e) {
console.warn(e, '\n', `Unable to process ${locale} from GM`)
}
Expand Down Expand Up @@ -648,7 +674,10 @@ export default class Translations extends Masterfile {
.replace(/{/g, `${this.options.questVariables.prefix}amount_`)
.replace(/\}/g, this.options.questVariables.suffix)
if (
(key.startsWith('quest_') || key.startsWith('score') || key.startsWith('geotarget_quest') || key.startsWith('challenge')) &&
(key.startsWith('quest_') ||
key.startsWith('score') ||
key.startsWith('geotarget_quest') ||
key.startsWith('challenge')) &&
this.options.questTitleTermsToSkip.every(term => !key.includes(term)) &&
!value.includes('%PLAYERNAME%')
) {
Expand Down
14 changes: 3 additions & 11 deletions static/tempEvos.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,7 @@
]
},
"142": {
"tempEvolutions": [
{
"tempEvoId": 1,
"attack": 292,
"defense": 210,
"stamina": 190,
"unreleased": true
}
]
"tempEvolutions": []
},
"150": {
"tempEvolutions": [
Expand Down Expand Up @@ -659,14 +651,14 @@
"849": {
"tempEvolutions": [
{
"tempEvoId": "Amped Gmax",
"tempEvoId": "Low Key Gmax",
"attack": 224,
"defense": 140,
"stamina": 181,
"unreleased": true
},
{
"tempEvoId": "Low Key Gmax",
"tempEvoId": "Amped Gmax",
"attack": 224,
"defense": 140,
"stamina": 181,
Expand Down

0 comments on commit 6d58ffe

Please sign in to comment.