User:Pangaearocks

Notes for extracting data from XML files
Just some quick notes here for now about extracting data from the game's XML files. A tool called xmlstarlet goes through the monsters in, sorts them ascendingly, and turns it into a bullet-list, with drop chance in percentage at the end. The monster name is the game's ID, so the list needs some more work/text-replace, but it should be a good basis to work further with.



It will then look something like this:
 * _monster__Nekker (3%)
 * _monster__Nekker Warrior (5%)
 * _monster__Rotfiend (6%)
 * _monster__Siren (2%)
 * _monster__Succubus (3%)
 * _monster__Water Hag (1%)
 * _monster__Water Hag Greater (1%)
 * _monster__Werewolf (2%)
 * _monster__White bear (1%)
 * _monster__Wildhunt minion (6%)
 * _monster__Wyvern (3%)

Current WIP expansion:
declare -A ingredient

ingredient["Monstrous brain"]="Monster brain" ingredient["Phosphorus"]="Phosphorus" ingredient["Wraith essence"]="Wraith essence"

for c in "${!ingredient[@]}"; do	# printf "%s is in %s\n" "$c" "${continent[$c]}" echo ""${ingredient[$c]}"" "can drop from the following monsters:" > folder/"${ingredient[$c]}".txt xmlstarlet sel -t -m "//redxml/definitions/loot_definitions/loot/loot_entry[@name='Monstrous bone']" -s A:T:- "../@name" -v "concat('* ',../@name, ' (', @chance, '%)')" -nl def_loot_monsters.xml >> folder/"${ingredient[$c]}".txt sed -i 's/_monster__//g' folder/"${ingredient[$c]}".txt # echo "$c" "is also called" "${ingredient[$c]}" > folder/"${ingredient[$c]}".txt done