-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
68 lines (56 loc) · 1.79 KB
/
index.js
File metadata and controls
68 lines (56 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { writeFileSync } from 'fs';
import { basename } from 'path';
import got from 'got';
import { Version } from './modules/Version.js';
import { AssetRipper } from './modules/wrappers/AssetRipper.js';
// import { Spine } from './modules/wrappers/Spine.js';
import { writeError } from './modules/helper.js';
const version = new Version();
await version.versionCheck();
const fetchIndex = [
'spritesheets/heroes', // character sprites, portraits
'spritesheets/items', // icons, weapons, cards
'spritesheets/ui/main_s3', // UI icons
'ui/common' // stickers
];
console.log('\nGot: Downloading assets from the server ...');
const downloadDir = './data/version-data/' + version.current;
for (let i = 0; i < fetchIndex.length; i++) {
const fetchPath = fetchIndex[i];
console.log(`\t[${i+1}/${fetchIndex.length}]\t~/${fetchPath}`);
try {
const absFetchPath = version.link + '/AssetBundles/Android/' + fetchPath;
const absDLPath = downloadDir + '/' + basename(fetchPath);
const { rawBody: asset } = await got(absFetchPath);
writeFileSync(absDLPath, asset);
} catch (error) {
writeError(error);
}
}
console.log('\nLOG: Starting AssetRipper v0.3.4.0 ...');
const assetRipper = new AssetRipper();
const extractIndex = {
heroes: [
'characters.png',
'characters.atlas.txt',
'portraits.png',
'portraits.asset'
],
items: [
'items.png',
'items.atlas.txt'
],
main_s3: [
'MainUiS3.png',
'MainUiS3.json'
],
common: [
'ProfilecardStickers.png',
'ProfilecardStickers.prefab'
]
}
for (const [asset, data] of Object.entries(extractIndex)) {
assetRipper.scan(version.dir + '/' + asset);
assetRipper.export(data);
}
console.log(`\nDiffing all sprites from v${version.current} -> v${version.next} ...`);