Skip to content

Instantly share code, notes, and snippets.

@dorkster
Created October 11, 2016 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dorkster/2dd11e8b0d071d494c128be7df938045 to your computer and use it in GitHub Desktop.
Save dorkster/2dd11e8b0d071d494c128be7df938045 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Usage: run this script in the root of a Flare mod to update all keys pertaining to primary stats.
TITLE_STATS_IN=("physment" "physoff" "physdef" "mentoff" "mentdef" "offdef")
TITLE_STATS_OUT=("physical,mental" "physical,offense" "physical,defense" "mental,offense" "mental,defense" "offense,defense")
if [ -e "engine/titles.txt" ]; then
for i in "${!TITLE_STATS_IN[@]}"; do
sed -i -e "s/${TITLE_STATS_IN[i]}/${TITLE_STATS_OUT[i]}/g" "engine/titles.txt"
done
fi
PRIMARY_STATS=("physical" "mental" "offense" "defense")
FILENAMES=("engine/classes.txt" "engine/stats.txt" "menus/character.txt")
for i in "powers/trees/"*; do
FILENAMES+=("$i")
done
for filename in "${FILENAMES[@]}"; do
for i in "${PRIMARY_STATS[@]}"; do
if [ -e "$filename" ]; then
sed -i -e "s/${i}=/primary=${i},/g" "$filename"
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment