Skip to content

Commit 1c4b64b

Browse files
committed
2.0.0-beta.11
1 parent 2c7b4d2 commit 1c4b64b

File tree

2 files changed

+30
-15
lines changed

2 files changed

+30
-15
lines changed

gulpfile.babel.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ gulp.task('update:game', gulp.series(updateGameScript, updateGameAssets));
1212

1313
// Beta URL: https://earlyproxy.touch.dofus.com/
1414

15+
// DON'T EDIT THESE REGEX
16+
// Since the auto update feature, regex to patch the script.js are stored in the repo:
17+
// https://github.com/Clover-Lindo/lindo-game-base
1518
export function updateGameScript(cb) {
1619

1720
async.waterfall([

src/app/window/official-game-update/official-game-update.component.ts

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ export class OfficialGameUpdateComponent implements OnInit, OnDestroy {
3737
private remoteOrigin: string = "https://proxyconnection.touch.dofus.com/";
3838
private remoteManifestPath: string = "manifest.json";
3939
private remoteAssetMapPath: string = "assetMap.json";
40-
private remotelindoManifest: string = "https://raw.githubusercontent.com/Clover-Lindo/lindo-game-base/master/manifest.json";
40+
private remoteLindoManifest: string = "https://raw.githubusercontent.com/Clover-Lindo/lindo-game-base/master/manifest.json";
41+
private remoteLindoManifestAlt: string = "http://api.no-emu.co/manifest.json";
4142
private remoteKeymaster: string = "https://raw.githubusercontent.com/madrobby/keymaster/master/keymaster.js";
4243
private remoteITunesAppVersion: string = "http://itunes.apple.com/lookup?id=1041406978&t=" + (new Date().getTime());
4344

@@ -91,9 +92,11 @@ export class OfficialGameUpdateComponent implements OnInit, OnDestroy {
9192
let manifestDifferences = this.differences(this.currentManifest, this.manifest);
9293
let assetMapDifferences = this.differences(this.currentAssetMap, this.assetMap);
9394

94-
this.computeProgressTotal(manifestDifferences, assetMapDifferences);
95-
96-
this.progressMode = "determinate";
95+
// Redownload script & style if regex has changed
96+
if (lindoManifestDifferences['regex.json'] == 1) {
97+
for (let i in manifestDifferences)
98+
manifestDifferences[i] = 1;
99+
}
97100

98101
setTimeout(() => {
99102
this.translate.get('app.window.update-dofus.information.downloading').subscribe((res: string) => {
@@ -103,11 +106,9 @@ export class OfficialGameUpdateComponent implements OnInit, OnDestroy {
103106

104107
this.log("Updating required files");
105108

106-
// Redownload script & style if regex has changed
107-
if (lindoManifestDifferences['regex.json'] == 1) {
108-
for (let i in manifestDifferences)
109-
manifestDifferences[i] = 1;
110-
}
109+
this.computeProgressTotal(manifestDifferences, assetMapDifferences);
110+
111+
this.progressMode = "determinate";
111112

112113

113114
// Downloading & saving assets
@@ -258,12 +259,15 @@ export class OfficialGameUpdateComponent implements OnInit, OnDestroy {
258259
if (err) {
259260
reject(err);
260261
}
262+
else if (response.statusCode >= 300) {
263+
reject(response.statusCode);
264+
}
261265
else {
266+
this.addProgress(weight - currentProgress);
262267
if (json)
263268
resolve(JSON.parse(body));
264269
else
265270
resolve(body);
266-
this.addProgress(weight - currentProgress);
267271
}
268272
})).on("progress", (state) => {
269273
let progress = state.percent * weight;
@@ -274,7 +278,15 @@ export class OfficialGameUpdateComponent implements OnInit, OnDestroy {
274278
}
275279

276280
async downloadLindoManifest() {
277-
return this.lindoManifest = await this.download(this.remotelindoManifest, true);
281+
try {
282+
return this.lindoManifest = await this.download(this.remoteLindoManifest, true);
283+
} catch(e) {
284+
return await this.downloadLindoManifestAlt();
285+
}
286+
}
287+
288+
async downloadLindoManifestAlt() {
289+
return this.lindoManifest = await this.download(this.remoteLindoManifestAlt, true);
278290
}
279291

280292
async downloadManifest() {
@@ -371,7 +383,7 @@ export class OfficialGameUpdateComponent implements OnInit, OnDestroy {
371383
}
372384
}
373385
return files;
374-
} catch (e) { Logger.info(e.message); }
386+
} catch (e) { Logger.error(e.message); }
375387
}
376388

377389
applyRegex(regex, files) {
@@ -396,7 +408,7 @@ export class OfficialGameUpdateComponent implements OnInit, OnDestroy {
396408
for (var filename in files) {
397409
promises.push(this.saveOneFile(this.destinationPath + filename, files[filename]));
398410
}
399-
} catch (e) { Logger.info(e.message); }
411+
} catch (e) { Logger.error(e.message); }
400412
return await Promise.all(promises);
401413
}
402414

@@ -421,7 +433,7 @@ export class OfficialGameUpdateComponent implements OnInit, OnDestroy {
421433
this.destinationPath + manifest.files[i].filename));
422434
}
423435
}
424-
} catch (e) { Logger.info(e.message); }
436+
} catch (e) { Logger.error(e.message); }
425437
await Promise.all(promises);
426438
return;
427439
}
@@ -471,7 +483,7 @@ export class OfficialGameUpdateComponent implements OnInit, OnDestroy {
471483
resolve();
472484
})
473485
.pipe(fileStream);
474-
} catch (e) { Logger.info(e.message); }
486+
} catch (e) { Logger.error(e.message); }
475487
});
476488
}
477489

0 commit comments

Comments
 (0)