|
@ -104,35 +104,35 @@ fn_workshop_download() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
fn_workshop_get_list() { |
|
|
fn_workshop_get_list() { |
|
|
workshoplist=($(echo $workshopmods | tr ";" "\n")) |
|
|
workshoplist=($(echo "${workshopmods}" | tr ";" "\n")) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
fn_workshop_get_latest_mod_version() { |
|
|
fn_workshop_get_latest_mod_version() { |
|
|
local modid="$1" |
|
|
local modid="$1" |
|
|
local serverresp="$(curl -s -d "itemcount=1&publishedfileids[0]=${modid}" "http://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1")" |
|
|
local serverresp="$(curl -s -d "itemcount=1&publishedfileids[0]=${modid}" "http://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1")" |
|
|
local remupd= |
|
|
local remupd= |
|
|
if [[ "$serverresp" =~ \"hcontent_file\":[[:space:]]*([^,]*) ]]; then |
|
|
if [[ "${serverresp}" =~ \"hcontent_file\":[[:space:]]*([^,]*) ]]; then |
|
|
remupd="${BASH_REMATCH[1]}" |
|
|
remupd="${BASH_REMATCH[1]}" |
|
|
fi |
|
|
fi |
|
|
echo "$remupd" | tr -d '"' |
|
|
echo "${remupd}" | tr -d '"' |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
fn_workshop_get_name_from_steam() { |
|
|
fn_workshop_get_name_from_steam() { |
|
|
local modid="$1" |
|
|
local modid="$1" |
|
|
local serverresp="$(curl -s -d "itemcount=1&publishedfileids[0]=${modid}" "http://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1")" |
|
|
local serverresp="$(curl -s -d "itemcount=1&publishedfileids[0]=${modid}" "http://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1")" |
|
|
local title= |
|
|
local title= |
|
|
if [[ "$serverresp" =~ \"title\":[[:space:]]*([^,]*) ]]; then |
|
|
if [[ "${serverresp}" =~ \"title\":[[:space:]]*([^,]*) ]]; then |
|
|
title="${BASH_REMATCH[1]}" |
|
|
title="${BASH_REMATCH[1]}" |
|
|
fi |
|
|
fi |
|
|
echo "$title" | tr -d '"' |
|
|
echo "${title}" | tr -d '"' |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
fn_workshop_check_mod_update() { |
|
|
fn_workshop_check_mod_update() { |
|
|
local modid="$1" |
|
|
local modid="$1" |
|
|
if [ ! -f "${workshopmodsdldir}/steamapps/workshop/appworkshop_${gameappid}.acf" ]; then return 0; fi |
|
|
if [ ! -f "${workshopmodsdldir}/steamapps/workshop/appworkshop_${gameappid}.acf" ]; then return 0; fi |
|
|
local instmft="$(sed -n '/^\t"WorkshopItemsInstalled"$/,/^\t[}]$/{/^\t\t"'"${modid}"'"$/,/^\t\t[}]$/{s|^\t\t\t"manifest"\t\t"\(.*\)"$|\1|p}}' <"${workshopmodsdldir}/steamapps/workshop/appworkshop_${gameappid}.acf")" |
|
|
local instmft="$(sed -n '/^\t"WorkshopItemsInstalled"$/,/^\t[}]$/{/^\t\t"'"${modid}"'"$/,/^\t\t[}]$/{s|^\t\t\t"manifest"\t\t"\(.*\)"$|\1|p}}' <"${workshopmodsdldir}/steamapps/workshop/appworkshop_${gameappid}.acf")" |
|
|
if [ -z "$instmft" ]; then return 0; fi |
|
|
if [ -z "${instmft}" ]; then return 0; fi |
|
|
local remmft="$(fn_workshop_get_latest_mod_version "$modid")" |
|
|
local remmft="$(fn_workshop_get_latest_mod_version "${modid}")" |
|
|
if [[ -n "${remmft}" && "${instmft}" != "${remmft}" ]]; then |
|
|
if [[ -n "${remmft}" && "${instmft}" != "${remmft}" ]]; then |
|
|
return 0 # true |
|
|
return 0 # true |
|
|
fi |
|
|
fi |
|
@ -144,8 +144,8 @@ fn_workshop_is_mod_copy_needed(){ |
|
|
local modsrc="${workshopmodsdldir}/steamapps/workshop/content/${gameappid}/${modid}" |
|
|
local modsrc="${workshopmodsdldir}/steamapps/workshop/content/${gameappid}/${modid}" |
|
|
if [ ! -f "${workshopmodsdir}/${modid}/meta.cpp" ]; then return 0; fi |
|
|
if [ ! -f "${workshopmodsdir}/${modid}/meta.cpp" ]; then return 0; fi |
|
|
local instmft="$(grep "timestamp" ${workshopmodsdir}/${modid}/meta.cpp)" |
|
|
local instmft="$(grep "timestamp" ${workshopmodsdir}/${modid}/meta.cpp)" |
|
|
if [ -z "$instmft" ]; then return 0; fi |
|
|
if [ -z "${instmft}" ]; then return 0; fi |
|
|
local remmft="$(grep "timestamp" $modsrc/meta.cpp)" |
|
|
local remmft="$(grep "timestamp" ${modsrc}/meta.cpp)" |
|
|
if [[ -n "${remmft}" && "${instmft}" != "${remmft}" ]]; then |
|
|
if [[ -n "${remmft}" && "${instmft}" != "${remmft}" ]]; then |
|
|
return 0 # true |
|
|
return 0 # true |
|
|
fi |
|
|
fi |
|
@ -225,31 +225,31 @@ fn_workshop_lowercase() { |
|
|
# # Copy the mod into serverfiles. |
|
|
# # Copy the mod into serverfiles. |
|
|
fn_workshop_copy_destination() { |
|
|
fn_workshop_copy_destination() { |
|
|
local modid="$1" |
|
|
local modid="$1" |
|
|
local modname="$(fn_workshop_get_mod_name $modid)" |
|
|
local modname="$(fn_workshop_get_mod_name ${modid})" |
|
|
if fn_workshop_is_mod_copy_needed $modid; then |
|
|
if fn_workshop_is_mod_copy_needed ${modid}; then |
|
|
echo "Copying mod ${modname} (${modid})" |
|
|
echo "Copying mod ${modname} (${modid})" |
|
|
# If workshop mod exists in installation folder, delete it for clean install |
|
|
# If workshop mod exists in installation folder, delete it for clean install |
|
|
if [ -d "${workshopmodsdir}/${modid}" ]; then |
|
|
if [ -d "${workshopmodsdir}/${modid}" ]; then |
|
|
rm -rf "${workshopmodsdir}/${modid}" |
|
|
rm -rf "${workshopmodsdir}/${modid}" |
|
|
fi |
|
|
fi |
|
|
modsrc="${workshopmodsdldir}/steamapps/workshop/content/${gameappid}/$modid" |
|
|
modsrc="${workshopmodsdldir}/steamapps/workshop/content/${gameappid}/${modid}" |
|
|
cp -fa ${modsrc} ${workshopmodsdir} |
|
|
cp -fa ${modsrc} ${workshopmodsdir} |
|
|
if [ "${engine}" == "realvirtuality" ]; then |
|
|
if [ "${engine}" == "realvirtuality" ]; then |
|
|
modkey="${workshopmodsdldir}/steamapps/workshop/content/${gameappid}/$modid/keys" |
|
|
modkey="${workshopmodsdldir}/steamapps/workshop/content/${gameappid}/${modid}/keys" |
|
|
if ! [ -d "${modkey}" ]; then |
|
|
if ! [ -d "${modkey}" ]; then |
|
|
modkey="$steamcmd/steamapps/workshop/content/${gameappid}/$modid/Keys" |
|
|
modkey="$steamcmd/steamapps/workshop/content/${gameappid}/${modid}/Keys" |
|
|
fi |
|
|
fi |
|
|
if ! [ -d "${modkey}" ]; then |
|
|
if ! [ -d "${modkey}" ]; then |
|
|
modkey="$steamcmd/steamapps/workshop/content/${gameappid}/$modid/key" |
|
|
modkey="$steamcmd/steamapps/workshop/content/${gameappid}/${modid}/key" |
|
|
fi |
|
|
fi |
|
|
if ! [ -d "${modkey}" ]; then |
|
|
if ! [ -d "${modkey}" ]; then |
|
|
modkey="$steamcmd/steamapps/workshop/content/${gameappid}/$modid/Key" |
|
|
modkey="$steamcmd/steamapps/workshop/content/${gameappid}/${modid}/Key" |
|
|
fi |
|
|
fi |
|
|
if ! [ -d "${modkey}" ]; then |
|
|
if ! [ -d "${modkey}" ]; then |
|
|
echo "Mod ${modname} seems to be missing key folder. Tring to copy key from the main folder." |
|
|
echo "Mod ${modname} seems to be missing key folder. Tring to copy key from the main folder." |
|
|
cp -fa "${workshopmodsdir}/${modid}/*.bikey" ${keysdir} |
|
|
cp -fa "${workshopmodsdir}/${modid}/*.bikey" ${keysdir} |
|
|
else |
|
|
else |
|
|
cp -fa $modkey/*.bikey ${keysdir} |
|
|
cp -fa ${modkey}/*.bikey ${keysdir} |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
else |
|
|
else |
|
@ -328,8 +328,9 @@ fn_workshop_check_installed() { |
|
|
# Builds list of installed Steam Workshop mods. |
|
|
# Builds list of installed Steam Workshop mods. |
|
|
fn_workshop_installed_list() { |
|
|
fn_workshop_installed_list() { |
|
|
fn_workshop_count_installed |
|
|
fn_workshop_count_installed |
|
|
for f in ${workshopmodsdir}/*; do |
|
|
for folder in ${workshopmodsdir}/*; do |
|
|
if [ -d "$f" ]; then |
|
|
# If it is a folder, then use it's name as Steam Workshop Mod Id |
|
|
|
|
|
if [ -d "${folder}" ]; then |
|
|
echo -e "$(fn_workshop_get_mod_name $(basename ${f})) ($(basename ${f}))" |
|
|
echo -e "$(fn_workshop_get_mod_name $(basename ${f})) ($(basename ${f}))" |
|
|
fi |
|
|
fi |
|
|
done |
|
|
done |
|
|