Public
Edited
Oct 2, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
allItems = [...d3.group(shops.flatMap(it=>[...it.receive, ...it.cost]), d=>d.id).keys()]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof currentShopOnly = Inputs.toggle({label: '仅当前商店'})
Insert cell
<textarea readonly>
${JSON.stringify(Object.fromEntries(midresult4.map(it => [it.receive[0].id, it.cost[0].count/it.receive[0].count])), null, 2)}
</textarea>
Insert cell
midresult4 = (currentShopOnly ? selectedShop : midresult).filter(row=>{
const id = row.receive[0].id
return midresult3[id] !== undefined
})
Insert cell
// 过滤不可交易物品
midresult3 = Object.fromEntries(midresult2.filter(it=>{
if (!filterUntradeable) {
return !!it.name // 不过滤不可交易时仅过滤无名称物品
} else {
return it.untradable === 'False' && !!it.name
}
}).map(it=>[it.id, it.untradable !== 'False']))
Insert cell
midresult2 = {
const db = serverType === 'zh' ? itemdb_cn : itemdb
const list = [...d3.group(midresult.flatMap(it=>[...it.receive]), d=>d.id).keys()]
return (await db.query(`select items."key: #" as id, "9: Name" as name, items."22: IsUntradable" as untradable from items where list_contains([${list.join(',')}], id)`))
}
Insert cell
debug2 = shops.filter(it=> it.cost.length > 1 )
Insert cell
debug1 = shops.filter(it=> it.receive.length > 1 )
Insert cell
midresult = {
return shops.filter(it=> it.receive.length === 1 )
}
Insert cell
shops = debugShop || getShopsByCost(currencyID)
Insert cell
gainShops = getShopsByGain('36218')
Insert cell
Insert cell
Insert cell
Insert cell
specialShopCSV = {
// 'https://docs.google.com/spreadsheets/d/e/2PACX-1vSw2F2SwSSYTbsROX7MgF2sOZ_XfpDsd84BBw5zuodPDyvoYjGTaZNqhf-MX3DY1fJbXUeDJYW4YtQj/pub?gid=843459945&single=true&output=csv'
const en = 'https://raw.githubusercontent.com/xivapi/ffxiv-datamining/master/csv/SpecialShop.csv'
const zh = 'https://raw.githubusercontent.com/thewakingsands/ffxiv-datamining-cn/master/SpecialShop.csv'
const target = serverType === 'zh' ? zh : en
return parseCSV(await (await fetch(target)).text())
}
Insert cell
Insert cell
achievementCSV = {
const en = 'https://raw.githubusercontent.com/xivapi/ffxiv-datamining/master/csv/Achievement.csv'
const zh = 'https://raw.githubusercontent.com/thewakingsands/ffxiv-datamining-cn/master/Achievement.csv'
const target = serverType === 'zh' ? zh : en
return parseCSV(await (await fetch(target)).text())
}
Insert cell
import { itemdb, itemdb_cn } from '1ef1dad66b92c723'
Insert cell
function parseCSV(text) {
const lineend0 = text.indexOf('\n') // key,0,1 ...
const lineend1 = text.indexOf('\n', lineend0 + 1) // #, Name, ...
const lineend2 = text.indexOf('\n', lineend1 + 1) // int,str, ...
// const lineend3 = text.indexOf('\n', lineend2 + 1) // 0, '', ... , some files don't start with 0
const idxes = text.slice(0, lineend0).split(',')
const labels = text.slice(lineend0 + 1, lineend1).split(',')
return d3.csvParseRows(text.slice(lineend2 + 1))
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more