questData = {
const map = new Map()
questCSV.forEach(row=>{
const questID = row[0]
const locations = []
const todoStart = 1222
const todoLength = 24
const todoArraySize = 8
for (let i = 0; i < todoLength; i++) {
const array = []
for (let j = 0; j < todoArraySize; j++) {
const locID = row[todoStart + j*24 + i]
if (locID !== '0') {
const location = levelData.get(locID)
let npcName = ''
if (location.object !== '0') npcName = npcData.get(location.object)?.name
array.push({
...location,
npcName,
})
}
}
locations.push(array)
}
const issuer = row[40]
const issuerLocation = row[41]
const target = row[43]
const scriptArgStart = 100
const scriptArgLength = 50
const scriptedNpcs = new Set()
for (let i = 0; i < scriptArgLength; i++) {
const id = row[scriptArgStart + i]
if (id === '0') continue
if (npcData.has(id) && npcData.get(id).name !== '') {
scriptedNpcs.add(id)
}
}
const listeners = new Set()
const listenerStart = 278
const listenerLength = 64
for (let i = 0; i < listenerLength; i++) {
const id = row[listenerStart + i]
if (id === '0') continue
if (npcData.has(id)) {
listeners.add(id)
}
}
map.set(questID, {
id: questID,
name: row[1],
issuer,
issuerLocation,
target,
locations,
scriptedNpcs,
listeners,
raw: row,
})
})
return map
}