function cleanHeroData(json) {
  for (const [key, char] of Object.entries(json)) {
    delete char['moonlight']

    if (char.ex_equip && char.ex_equip.length) {
      char.ex_equip = [
        {
          stat: char.ex_equip[0].stat
        }
      ]
    } else {
      char.ex_equip = []
    }
  }

  console.log(JSON.stringify(json, null, 1))
}

cleanHeroData(herodata)


##############


function cleanArtifactData(json) {
  for (const [key, artifact] of Object.entries(json)) {
    delete artifact['assets']
  }

  console.log(JSON.stringify(json, null, 1))
}

cleanArtifactData(artifactData)







CREATE TABLE item_info_1 AS
SELECT
    *
FROM text_en
INNER JOIN equip_item ON equip_item.name = text_en.id


### Importing gear automatically from the game:
NOT RELEASED YET
##### First time  setup for the automatic importer on Windows:
1. Install [Python 3.9+](https://www.python.org/downloads/release/python-392/) using the Windows installer (64-bit) option. Click for [direct download link](https://www.python.org/ftp/python/3.9.2/python-3.9.2-amd64.exe). Use default settings
2. Install [Npcap 1.10](https://nmap.org/npcap/#download). Click for [direct download link](https://nmap.org/npcap/dist/npcap-1.10.exe). Use default settings
3. Restart your computer

##### First time  setup for the automatic importer on Mac:
1. Install [Python 3.9+](https://www.python.org/downloads/release/python-392/)
2. Install [Wireshark](https://www.wireshark.org/download.html)

##### Using the automatic importer:
1. Open your emulator
2. Close Epic 7 if it's open
3. On the *Importer* tab, click *Start scanning*
4. Open Epic 7
5. Load into the lobby and click to open your equipment inventory
6. On the *Importer* tab, click *Stop scanning*
7. Wait about 3-5 minutes for the gear to be processed
8. Once it is done, click Export, and save the *gear.txt* file.
9. Under the *Importing gear data* section, click on Append/Replace/Merge data, and select your *gear.txt* file.
10. Now you should see your imported gears under the Gears tab.
11. Use the Level = 0 filter to find level 0 items (most likely recent event items). Manually edit those items to fix their info.


Object.values(a).forEach(x => {
    delete x._id;
    delete x.description;
    delete x.identifier;
    delete x.limited;
    delete x.skill;
})


  "ReplaceNameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee": {
    "assets": {
      "icon": "https://assets.epicsevendb.com/_source/item_arti/icon_art0105.png",
      "image": "https://assets.epicsevendb.com/_source/item_arti/art0105_fu.png",
      "thumbnail": "https://assets.epicsevendb.com/_source/item_arti/art0105_l.jpg"
    },
    "name": "ReplaceNameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
    "rarity": 5,
    "role": "warrior",
    "stats": {
      "attack": 21,
      "health": 32
    }
  },


const ordered = Object.keys(h).sort().reduce(
  (obj, key) => {
    obj[key] = h[key];
    return obj;
  },
  {}
);


Object.values(ordered).forEach(x => {
    delete x.id;
    delete x.base_id;
    delete x.specialty_id;
    delete x.description;
    delete x.story;
    delete x.get_line;
    delete x.stats;
    delete x.relationships;
    delete x.specialty;
    delete x.camping;
    delete x.zodiac_tree;
    delete x.buffs;
    delete x.debuffs;
    delete x.common;
    delete x.skills;
})

d = -- log.txt --

m = []question_circle.png

for (var x of d) {
    if (x.ipFlags == "") {
        //continue;
    }
    if (x.tcpAck in m) {
        m[x.tcpAck].push(x)
    } else {
        m[x.tcpAck] = [x]
    }
}
n = Object.values(m)
duplicates = {}

function combine(index) {
    arr = n[index]
    Utils.sortByAttribute(arr, 'tcpSeq')

    data = ""
    for (var packet of arr) {
        if (!Object.keys(duplicates).includes(packet.tcpSeq)) {
            data += packet.data
        }
        duplicates[packet.tcpSeq] = true;
    }

    return data;
}

finishedReading([combine(0)])

x=""; for (var i= 0; i < 107; i++) {if(i!=13)x+=n[12][i].data} finishedReading([x])
00\xabpersonality\xaapet_pers_8\xaaadditional\x80\xa3tip\x85\xa4type\xa5gacha\xa2tm\xce`>\xd9\xf9\xa7user_id\xce\x00\xedYm\xa4name\xacepic7#vhldwg\xa4info\x82\xa4type\xa5equip\xa4code\xa5efh07'

00\xabpersonality\xaapet_pers_2\xaaadditional\x80\xa3tip\x85\xa4type\xa5gacha\xa2tm\xce`>\xce\xc8\xa7user_id\xce\x00&\x05\'\xa4name\xaaMaxedcrew7\xa4info\x82\xa4type\xa4unit\xa4code\xa5c2002'

4
4343 to alarms 3607
4263 to archers 3171
4079 to spears 3919
4358 to mages 2734

7
4079 to grey 3984
4615 to white 3654

var count = 10;
var win = 0;
for (var j = 0; j < count; j++) {
    var spirit = 50
    for (var i = 0; i < 6; i++) {
        if (Math.random() < 0.85) spirit += 10
    }
    for (var i = 0; i < 3; i++) {
        if (Math.random() < 0.85) spirit += 5
    }
    if (spirit >= 100) win += 1
}

console.log(win + " / " + count + " = " + (win/count))

    "assets": {
      "icon": "https://raw.githubusercontent.com/fribbels/Fribbels-Epic-7-Optimizer/main/data/cachedimages/question_circle.png",
      "image": "https://raw.githubusercontent.com/fribbels/Fribbels-Epic-7-Optimizer/main/data/cachedimages/question_circle.png",
      "thumbnail": "https://raw.githubusercontent.com/fribbels/Fribbels-Epic-7-Optimizer/main/data/cachedimages/question_circle.png"
    },



  "Camilla": {
    "_id": "camilla",
    "name": "Camilla",
    "moonlight": false,
    "rarity": 3,
    "attribute": "light",
    "role": "warrior",
    "zodiac": "maiden",
    "self_devotion": {
      "type": "cri",
      "grades": {
        "D": 0.028,
        "C": 0.042,
        "B": 0.056,
        "A": 0.07,
        "S": 0.084,
        "SS": 0.098,
        "SSS": 0.112
      }
    },
    "devotion": {
      "type": "max_hp_rate",
      "grades": {
        "C": 0.024,
        "B": 0.036,
        "A": 0.048,
        "S": 0.06,
        "SS": 0.072,
        "SSS": 0.084
      },
      "slots": {
        "1": true,
        "2": true,
        "3": true,
        "4": true
      }
    },
    "specialty_change": {},
    "assets": {
      "icon": "https://raw.githubusercontent.com/fribbels/Fribbels-Epic-7-Optimizer/main/data/cachedimages/question_circle.png",
      "image": "https://raw.githubusercontent.com/fribbels/Fribbels-Epic-7-Optimizer/main/data/cachedimages/question_circle.png",
      "thumbnail": "https://raw.githubusercontent.com/fribbels/Fribbels-Epic-7-Optimizer/main/data/cachedimages/question_circle.png"
    },
    "ex_equip": [],
    "calculatedStatus": {
      "lv50FiveStarNoAwaken": {
        "cp": 10990,
        "atk": 647,
        "hp": 3688,
        "spd": 108,
        "def": 477,
        "chc": 0.15,
        "chd": 1.5,
        "dac": 0.05,
        "eff": 0,
        "efr": 0
      },
      "lv50FiveStarFullyAwakened": {
        "cp": 12701,
        "atk": 767,
        "hp": 4028,
        "spd": 112,
        "def": 477,
        "chc": 0.19,
        "chd": 1.5,
        "dac": 0.05,
        "eff": 0.18,
        "efr": 0
      },
      "lv60SixStarNoAwaken": {
        "cp": 13717,
        "atk": 807,
        "hp": 4637,
        "spd": 108,
        "def": 592,
        "chc": 0.15,
        "chd": 1.5,
        "dac": 0.05,
        "eff": 0,
        "efr": 0
      },
      "lv60SixStarFullyAwakened": {
        "cp": 16298,
        "atk": 957,
        "hp": 5057,
        "spd": 112,
        "def": 592,
        "chc": 0.27,
        "chd": 1.5,
        "dac": 0.05,
        "eff": 0.18,
        "efr": 0
      }
    }
  },
