-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
977 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,18 @@ | ||
import '../lib/data/itemAliases'; | ||
|
||
import { Stopwatch } from '@sapphire/stopwatch'; | ||
import { existsSync, writeFileSync } from 'fs'; | ||
import { writeFileSync } from 'fs'; | ||
import { Bank } from 'oldschooljs'; | ||
import { table } from 'table'; | ||
|
||
import Createables from '../lib/data/createables'; | ||
import { md5sum } from '../lib/util'; | ||
import { makeTable } from '../lib/util/smallUtils'; | ||
|
||
export function main() { | ||
const data = [ | ||
['Item name', 'Input Items', 'Output Items', 'GP Cost'], | ||
...Createables.map(i => { | ||
return [i.name, `${new Bank(i.inputItems)}`, `${new Bank(i.outputItems)}`, `${i.GPCost ?? 0}`]; | ||
}) | ||
]; | ||
const hash = md5sum(JSON.stringify(data)).slice(0, 5); | ||
const fileName = `./src/lib/data/creatablesTable_${hash}.txt`; | ||
const headers = ['Item name', 'Input Items', 'Output Items', 'GP Cost']; | ||
const rows = Createables.map(i => { | ||
return [i.name, `${new Bank(i.inputItems)}`, `${new Bank(i.outputItems)}`, `${i.GPCost ?? 0}`]; | ||
}); | ||
|
||
const exists = existsSync(fileName); | ||
if (exists) { | ||
console.log('No changes to creatables'); | ||
return; | ||
} | ||
|
||
const stopwatch = new Stopwatch(); | ||
stopwatch.start(); | ||
const creatableTable = table(data); | ||
stopwatch.stop(); | ||
console.log(`Rendered creatables table in ${stopwatch.toString()}`); | ||
|
||
writeFileSync(fileName, creatableTable); | ||
writeFileSync('./src/lib/data/creatablesTable.txt', makeTable(headers, rows)); | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters