-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update all Static-Storage sources to mapdata (#114)
I'm really proud/happy for this change. Finally, it's coming all together. These files were 1-1 ported from their old representation to mapdata. Still, they have more useful information to the map system, like levels. Labels have unique, but readable feature ids as well, while services continue to have numbered unique ids. Combat locations were built from the ground up, with a new script, replacing the old, hand-made data. This is done by extracting data from the content book dumps. For backwards-compatibility, I'm adding Grind Spots and Uth Shrines from the old data (these are still mostly relevant locations in-game). Changes for combat locations: - Include levels for every location (except the Grind Spots and Uth Shrines) - Include corrupted dungeons (missing previously) - Include lootrun camps! These were added almost a year ago, but we still have not had a location on the map. This changes now. - Merge caves with combat locations. We used to have a separate data source for them, but there is no reason to keep them separate. --------- Co-authored-by: kristofbolyai <[email protected]>
- Loading branch information
1 parent
dcd848f
commit 4521950
Showing
8 changed files
with
12,275 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash | ||
|
||
# Get the base directory | ||
BASE_DIR="$(cd $(dirname "$0")/.. 2>/dev/null && pwd)" | ||
|
||
# Set the content and output directories | ||
CONTENT_DIR=$BASE_DIR/Data-Storage | ||
OUTPUT_DIR=$BASE_DIR/Reference | ||
|
||
# Create the output directory if it does not exist | ||
mkdir -p $OUTPUT_DIR | ||
|
||
# Function to map and transform data | ||
transform_data() { | ||
jq 'def map_category(type; name): | ||
if type == "bossAltar" then "boss-altar" | ||
elif type == "lootrunCamp" then "lootrun-camp" | ||
elif type == "dungeon" then | ||
if (name | startswith("Corrupted ")) then "dungeon:corrupted" | ||
else "dungeon" | ||
end | ||
elif type == "raid" then "raid" | ||
elif type == "cave" then "cave" | ||
elif type == "Rune Shrines" then "shrine" | ||
elif type == "Grind Spots" then "grind-spots" | ||
else type | ||
end; | ||
map({ | ||
featureId: (map_category(.type; "") + "-" + (.name | gsub(" "; "-") | gsub("[^a-zA-Z0-9\\-]+"; "") | ascii_downcase)), | ||
categoryId: ("wynntils:content:" + map_category(.type; .name)), | ||
attributes: (if .requirements.level then { | ||
label: .name, | ||
level: .requirements.level | ||
} else { | ||
label: .name | ||
} end), | ||
location: (.location // .coordinates) | ||
})' | ||
} | ||
|
||
# Read, transform, and write the JSON data from the primary source | ||
primary_data=$(cat $CONTENT_DIR/raw/content/content_book_dump.json | jq '[ | ||
.dungeon[], .raid[], .bossAltar[], .lootrunCamp[], .cave[] | ||
]' | transform_data) | ||
|
||
# Read, transform, and write the JSON data from the secondary source, filtering for 'Rune Shrines' and 'Grind Spots' | ||
secondary_data=$(cat "$CONTENT_DIR/combat_locations.json" | jq '[ | ||
.[] | select(.type == "Rune Shrines" or .type == "Grind Spots") | | ||
{type, locations} | (.locations[] | | ||
{ | ||
name: .name, | ||
coordinates: .coordinates, | ||
type: .type | ||
}) + { type: .type } | ||
]' | transform_data) | ||
|
||
# Combine primary and secondary data | ||
combined_data=$(echo "$primary_data" "$secondary_data" | jq -s add) | ||
|
||
# Write the combined data to the output file | ||
echo "$combined_data" > $OUTPUT_DIR/combat_locations_mapdata.json | ||
|
||
# Calculate md5sum of the new cave data | ||
MD5=$(md5sum $OUTPUT_DIR/combat_locations_mapdata.json | cut -d' ' -f1) | ||
|
||
# Update urls.json with the new md5sum for dataStaticMapdataCombatLocations | ||
jq '. = [.[] | if (.id == "dataStaticMapdataCombatLocations") then (.md5 = "'$MD5'") else . end]' < $BASE_DIR/Data-Storage/urls.json > $BASE_DIR/Data-Storage/urls.json.tmp | ||
mv $BASE_DIR/Data-Storage/urls.json.tmp $BASE_DIR/Data-Storage/urls.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.