Using KanColle's main.js
in Node.js.
yarn add @kancolle/main
const main = require('@kancolle/main')
console.log(main.fn('SuffixUtil').create(156, 'ship_card'))
// 6982
See dist/api
for more functions (many will not work).
To start PIXI
rendering:
main.init()
PIXI
globals are available.
To get scene instance:
const hook = (throttle, fn) => {
if (hook._initialized) {
return
}
hook._initialized = true
const render = PIXI.CanvasRenderer.prototype.render
let time = new Date()
PIXI.CanvasRenderer.prototype.render = function(...args) {
const newTime = new Date()
if (newTime - time > throttle) {
time = newTime
hook._last = args
if (fn) {
fn(...args)
}
}
return render.apply(this, args)
}
}
hook(1000, scene => {
// ...
})
To build files in dist
:
yarn
yarn build
# or
GADGET_PROXY=http://... yarn build
dist/main.js
is the final patched file.
- After
main.init()
a request toversion.json
will be performed withaxios
, that won't work due to browser security related issues, more browser simulation is required. Similarly, many functions won't work withoutapi_start2
response. For example,main.fn('ShipLoader').getPath
need versions fromapi_start2
.