Skip to content

Instantly share code, notes, and snippets.

@Javran
Last active September 30, 2017 03:14
Show Gist options
  • Save Javran/f7d68c3fd13ab15e1c7316c7a5e62895 to your computer and use it in GitHub Desktop.
Save Javran/f7d68c3fd13ab15e1c7316c7a5e62895 to your computer and use it in GitHub Desktop.
const fs = require('fs-extra')
const xs = fs.readJsonSync('raw.json')
const trBgm = id =>
id === 77 ? '艦娘音頭' :
id === 101 ? '月夜海' :
id === 102 ? '鎮守府秋刀魚祭り改二' :
`BGM_${id}`
console.log('[table]')
xs.map(rawLine => {
console.log('[tr]')
const mkLine = content => console.log(`[td]${String(content)}[/td]`)
const mapId = Number(rawLine.path[1])
const area = Math.floor(mapId / 10)
const num = mapId % 10
const preDesc = rawLine.path[2] === 'api_boss_bgm' ? "Boss" : "道中"
const dayOrNightDesc = rawLine.path[3] === 0 ? "昼" : "夜"
console.log(`[td]${area}-${num}[/td]`)
console.log(`[td]${preDesc} ${dayOrNightDesc}[/td]`)
console.log(`[td]${trBgm(rawLine.lhs)} → ${trBgm(rawLine.rhs)}[/td]`)
console.log('[/tr]')
})
console.log('[/table]')
[{"kind":"E","path":["api_mst_mapbgm","11","api_map_bgm",0],"lhs":1,"rhs":102},{"kind":"E","path":["api_mst_mapbgm","13","api_boss_bgm",0],"lhs":77,"rhs":2},{"kind":"E","path":["api_mst_mapbgm","13","api_boss_bgm",1],"lhs":77,"rhs":2},{"kind":"E","path":["api_mst_mapbgm","15","api_boss_bgm",0],"lhs":13,"rhs":77},{"kind":"E","path":["api_mst_mapbgm","15","api_boss_bgm",1],"lhs":13,"rhs":77},{"kind":"E","path":["api_mst_mapbgm","15","api_map_bgm",0],"lhs":7,"rhs":102},{"kind":"E","path":["api_mst_mapbgm","15","api_map_bgm",1],"lhs":2,"rhs":102},{"kind":"E","path":["api_mst_mapbgm","16","api_map_bgm",0],"lhs":37,"rhs":102},{"kind":"E","path":["api_mst_mapbgm","16","api_map_bgm",1],"lhs":37,"rhs":102},{"kind":"E","path":["api_mst_mapbgm","31","api_map_bgm",0],"lhs":29,"rhs":102},{"kind":"E","path":["api_mst_mapbgm","31","api_map_bgm",1],"lhs":2,"rhs":102},{"kind":"E","path":["api_mst_mapbgm","32","api_map_bgm",0],"lhs":29,"rhs":102},{"kind":"E","path":["api_mst_mapbgm","32","api_map_bgm",1],"lhs":2,"rhs":102},{"kind":"E","path":["api_mst_mapbgm","33","api_boss_bgm",0],"lhs":11,"rhs":77},{"kind":"E","path":["api_mst_mapbgm","33","api_boss_bgm",1],"lhs":11,"rhs":77},{"kind":"E","path":["api_mst_mapbgm","33","api_map_bgm",0],"lhs":8,"rhs":102},{"kind":"E","path":["api_mst_mapbgm","33","api_map_bgm",1],"lhs":2,"rhs":102},{"kind":"E","path":["api_mst_mapbgm","34","api_boss_bgm",0],"lhs":4,"rhs":77},{"kind":"E","path":["api_mst_mapbgm","34","api_boss_bgm",1],"lhs":5,"rhs":77},{"kind":"E","path":["api_mst_mapbgm","34","api_map_bgm",0],"lhs":19,"rhs":102},{"kind":"E","path":["api_mst_mapbgm","34","api_map_bgm",1],"lhs":4,"rhs":102},{"kind":"E","path":["api_mst_mapbgm","35","api_boss_bgm",0],"lhs":13,"rhs":101},{"kind":"E","path":["api_mst_mapbgm","35","api_boss_bgm",1],"lhs":13,"rhs":101},{"kind":"E","path":["api_mst_mapbgm","35","api_map_bgm",0],"lhs":19,"rhs":102},{"kind":"E","path":["api_mst_mapbgm","35","api_map_bgm",1],"lhs":19,"rhs":102},{"kind":"E","path":["api_mst_mapbgm","61","api_boss_bgm",0],"lhs":6,"rhs":77},{"kind":"E","path":["api_mst_mapbgm","61","api_boss_bgm",1],"lhs":6,"rhs":77},{"kind":"E","path":["api_mst_mapbgm","61","api_map_bgm",0],"lhs":20,"rhs":102},{"kind":"E","path":["api_mst_mapbgm","61","api_map_bgm",1],"lhs":20,"rhs":102},{"kind":"E","path":["api_mst_mapbgm","65","api_boss_bgm",0],"lhs":68,"rhs":101},{"kind":"E","path":["api_mst_mapbgm","65","api_boss_bgm",1],"lhs":68,"rhs":101},{"kind":"E","path":["api_mst_mapbgm","65","api_map_bgm",0],"lhs":75,"rhs":102},{"kind":"E","path":["api_mst_mapbgm","65","api_map_bgm",1],"lhs":75,"rhs":102}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment