Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // RUN IN KC3 STRATEGY ROOM
- (function(){
- const defSettings = {
- exportMode: "standard",
- output: 2, // new tab
- exportName: false,
- eventLocking: false,
- groupShipsByClass: false,
- exportIncludesUnlocked: false
- };
- let settings;
- if (!localStorage.srShowcase) {
- localStorage.srShowcase = JSON.stringify( defSettings );
- settings = defSettings;
- } else {
- settings = JSON.parse( localStorage.srShowcase );
- }
- // Build the list of latest ships
- KC3ShipManager.load();
- shipsToExport = [];
- for(const idx in KC3ShipManager.list) {
- const ship = KC3ShipManager.list[idx];
- // Skip ships not heart-locked
- if(!settings.exportIncludesUnlocked && !ship.lock) continue;
- const shipMst = ship.master();
- shipsToExport.push({
- id: ship.rosterId,
- masterId: ship.masterId,
- lvl: ship.level,
- sally: ship.sally,
- extra_slot: ship.ex_item !== 0 ? 1 : 0,
- fp: shipMst.api_houg[0] + ship.mod[0],
- tp: shipMst.api_raig[0] + ship.mod[1],
- aa: shipMst.api_tyku[0] + ship.mod[2],
- ar: shipMst.api_souk[0] + ship.mod[3],
- lk: shipMst.api_luck[0] + ship.mod[4],
- hp: ship.maxHp() + ship.mod[5],
- as: ship.nakedAsw()
- });
- }
- // Summarize improvement of all gears
- KC3GearManager.load();
- gearsToExport = [];
- const gears = {};
- for(const idx in KC3GearManager.list) {
- const gear = KC3GearManager.list[idx];
- // Skip unlocked gears
- if(!settings.exportIncludesUnlocked && !gear.lock) continue;
- const key = `g${gear.masterId}`;
- if(gears[key] === undefined) {
- gears[key] = {
- id: gear.masterId,
- mod: Array(11).fill(0)
- };
- }
- gears[key].mod[gear.stars || 0]++;
- }
- // Convert to array
- for(const key in gears) {
- if(!gears[key].id) continue;
- gearsToExport.push(gears[key]);
- }
- gearsToExport.sort((a, b) => a.id - b.id);
- var element = document.createElement('a');
- element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify({gears: gearsToExport ,ships:shipsToExport})));
- element.setAttribute('download', 'kc3moe_data.json');
- element.style.display = 'none';
- document.body.appendChild(element);
- element.click();
- document.body.removeChild(element);
- console.log('done');
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement