| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 | 
							- #!/bin/bash
 
- #
 
- # mh command for simplified operations
 
- #
 
- # mh save
 
- # mh restore
 
- # mh kill
 
- #
 
- # can utilize save/restore to save-scum decoration farming
 
- # can utilize kill to stop processes when failed to cease
 
- #
 
- # save includes timestamps to avoid potential
 
- #
 
- # current implementation uses hard-coded user id; not portable
 
- # future implementations should either save/restore for all ids, or ask/compute
 
- export steam_game_id="582010"
 
- export save_path="${HOME}/games/mhworld/saves"
 
- export steam_user_id="48081292"
 
- export full_path="${HOME}/.local/share/Steam/userdata/${steam_user_id}/${steam_game_id}/remote/SAVEDATA1000"
 
- mhsave() {
 
- 	mkdir -p "$save_path"
 
- 	local save_file="${save_path}/$(date +%Y%m%d%H%M%S)"
 
- 	cp "$full_path" "$save_file"
 
- 	ln -sf "$save_file" "${save_path}/latest"
 
- }
 
- mhrestore() {
 
- 	[ ! -f "${save_path}/latest" ] && return
 
- 	cp -L "${save_path}/latest" "$full_path"
 
- }
 
- case "$1" in
 
- 	run)
 
- 		steam "steam://rungameid/${steam_game_id}" &> /dev/null &
 
- 		;;
 
- 	save)
 
- 		mhsave
 
- 		;;
 
- 	restore)
 
- 		mhrestore
 
- 		;;
 
- 	kill)
 
- 		ps aux | grep -i monster | awk '{print $2}' | xargs kill -9 &> /dev/null
 
- 		;;
 
- 	*)
 
- 		echo "unable to process command..."
 
- 		;;
 
- esac
 
 
  |