SHARE
TWEET

Untitled

a guest Sep 18th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // RUN IN KC3 STRATEGY ROOM
  2. (function(){
  3.     const defSettings = {
  4.         exportMode: "standard",
  5.         output: 2, // new tab
  6.         exportName: false,
  7.         eventLocking: false,
  8.         groupShipsByClass: false,
  9.         exportIncludesUnlocked: false
  10.     };
  11.     let settings;
  12.     if (!localStorage.srShowcase) {
  13.         localStorage.srShowcase = JSON.stringify( defSettings );
  14.         settings = defSettings;
  15.     } else {
  16.         settings = JSON.parse( localStorage.srShowcase );
  17.     }
  18.     // Build the list of latest ships
  19.     KC3ShipManager.load();
  20.     shipsToExport = [];
  21.     for(const idx in KC3ShipManager.list) {
  22.         const ship = KC3ShipManager.list[idx];
  23.         // Skip ships not heart-locked
  24.         if(!settings.exportIncludesUnlocked && !ship.lock) continue;
  25.         const shipMst = ship.master();
  26.  
  27.         shipsToExport.push({
  28.             id: ship.rosterId,
  29.             masterId: ship.masterId,
  30.             lvl: ship.level,
  31.             sally: ship.sally,
  32.             extra_slot: ship.ex_item !== 0 ? 1 : 0,
  33.             fp: shipMst.api_houg[0] + ship.mod[0],
  34.             tp: shipMst.api_raig[0] + ship.mod[1],
  35.             aa: shipMst.api_tyku[0] + ship.mod[2],
  36.             ar: shipMst.api_souk[0] + ship.mod[3],
  37.             lk: shipMst.api_luck[0] + ship.mod[4],
  38.             hp: ship.maxHp() + ship.mod[5],
  39.             as: ship.nakedAsw()
  40.         });
  41.     }
  42.  
  43.     // Summarize improvement of all gears
  44.     KC3GearManager.load();
  45.     gearsToExport = [];
  46.     const gears = {};
  47.     for(const idx in KC3GearManager.list) {
  48.         const gear = KC3GearManager.list[idx];
  49.         // Skip unlocked gears
  50.         if(!settings.exportIncludesUnlocked && !gear.lock) continue;
  51.         const key = `g${gear.masterId}`;
  52.         if(gears[key] === undefined) {
  53.             gears[key] = {
  54.                 id: gear.masterId,
  55.                 mod: Array(11).fill(0)
  56.             };
  57.         }
  58.         gears[key].mod[gear.stars || 0]++;
  59.     }
  60.     // Convert to array
  61.     for(const key in gears) {
  62.         if(!gears[key].id) continue;
  63.         gearsToExport.push(gears[key]);
  64.     }
  65.     gearsToExport.sort((a, b) => a.id - b.id);
  66.  
  67.  
  68.     var element = document.createElement('a');
  69.     element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify({gears: gearsToExport ,ships:shipsToExport})));
  70.     element.setAttribute('download', 'kc3moe_data.json');
  71.  
  72.     element.style.display = 'none';
  73.     document.body.appendChild(element);
  74.  
  75.     element.click();
  76.  
  77.     document.body.removeChild(element);
  78.     console.log('done');
  79. })();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top