Phase 1: The Data Layer (Val Town) Goal: Create a single, reliable Val Town API endpoint that provides all the necessary instance data, properly formatted and cached.
Task 1.1: Research the XIVAPI /instancecontent endpoint.
Familiarize yourself with its structure. You will need to request specific columns to get the data required by the PRD.
Identify the fields for:
Name: The instance's name.
ContentType.Name: This will give you the "Type" (e.g., "Dungeon").
ContentFinderCondition.Name: This often contains the common name for the duty.
Unlock Quest: This can be tricky. Look for a field like QuestUnlock which might be an object containing the quest name. You may need to experiment to find the most reliable field.
Note on Pagination: XIVAPI results are paginated (e.g., 100 results per page). Your script must loop through all pages to collect every instance.
Task 1.2: Create the Val Town "Val" (Function).
Create a new val in your Val Town workspace (e.g., ffxivInstanceList).
Write JavaScript code inside this val to perform the following logic:
Initialize an empty array, e.g., allInstances = [].
Make an initial fetch call to https://xivapi.com/instancecontent?columns=ID,Name,ContentType.Name,....
Write a while or for loop that continues as long as the API response indicates there is a next page (Pagination.PageNext != null). In each loop, fetch the next page and add the results to your allInstances array.
Once all instances are collected, process the array: Group the instances by their expansion. You may need another API call to /expansion or hardcode the expansion order and level caps to achieve this grouping.
Return the final, grouped JSON object.